/* LOOCKR mobile webapp — black/white + signal-orange brand system */
:root {
  --ivory: #F7F5F2; --ink: #0A0A0A; --terracotta: #FF4A1F; --gold: #FFB800;
  --clay: #E8E4DE; --line: rgba(10,10,10,.14); --line-iv: rgba(247,245,242,.18);
  --serif: "Space Grotesk", "Inter", sans-serif; --ui: "Space Grotesk", "Inter", sans-serif;
  --body: "Inter", system-ui, sans-serif; --radius: 18px; --pill: 999px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--ivory); color: var(--ink);
  font-family: var(--body); font-size: 16px; overscroll-behavior-y: none; }
.hidden { display: none !important; }
.serif { font-family: var(--serif); font-weight: 700; letter-spacing: -0.4px; }
.big { font-size: 2.15rem; line-height: 1.08; letter-spacing: -1px; }
h2 { font-family: var(--serif); font-size: 1.7rem; margin: 4px 0 2px; letter-spacing: -0.5px; }
h3 { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 8px; letter-spacing: -0.3px; }

/* Screens */
.screen { min-height: 100dvh; padding: 0 20px calc(92px + var(--safe-b)); }
.screen:not(.hidden) { display: block; }
.screen.hidden { display: none; }

/* Auth */
.auth-wrap { padding-top: 11vh; max-width: 420px; margin: 0 auto; }
.brand-badge { display: inline-block; border: 1.5px solid var(--ink); border-radius: var(--pill);
  padding: 6px 16px; font-family: var(--ui); font-weight: 700; letter-spacing: 2.5px; font-size: .8rem; }
.auth-wrap .big em { color: var(--terracotta); font-style: italic; }
.sub { color: #555; margin: 14px 0 26px; line-height: 1.5; }
.auth-card { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 10px 30px rgba(18,18,18,.06); }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; padding: 10px; border: 1.5px solid var(--line); background: transparent;
  border-radius: var(--pill); font-family: var(--ui); font-weight: 500; cursor: pointer; }
.tab.on { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.legal { text-align: center; font-size: .75rem; color: #888; margin-top: 16px; }

/* Inputs / buttons */
.input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 1rem; background: #fff; margin-bottom: 10px; font-family: var(--body); }
.input:focus { outline: none; border-color: var(--terracotta); }
.btn { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); padding: 12px 18px;
  border-radius: var(--pill); font-family: var(--ui); font-weight: 700; font-size: .95rem; cursor: pointer; }
.btn.primary { background: var(--ink); color: var(--ivory); }
.btn.ghost { border-color: var(--line); color: #444; }
.btn.sm { padding: 7px 12px; font-size: .8rem; }
.btn.big { width: 100%; padding: 15px; font-size: 1.05rem; margin-top: 6px; }
.msg { min-height: 18px; font-size: .85rem; color: var(--terracotta); text-align: center; margin: 8px 0 0; }

/* Top bar + tab dock */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between;
  align-items: center; padding: 14px 4px 10px; background: var(--ivory); }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo.auth { height: 34px; margin-bottom: 14px; }
.nav-btn { border: none; background: none; font-size: 1.25rem; cursor: pointer; padding: 4px 8px; color: var(--ink); }
/* floating dock — unique bottom nav */
.tabbar { position: fixed; bottom: calc(12px + var(--safe-b)); left: 50%; transform: translateX(-50%);
  z-index: 30; display: flex; width: calc(100% - 32px); max-width: 420px;
  background: rgba(10,10,10,.94); backdrop-filter: blur(14px); border-radius: 24px;
  padding: 6px; box-shadow: 0 14px 40px rgba(10,10,10,.35); border: 1px solid rgba(255,255,255,.08); }
.tabbar-btn { flex: 1; border: none; background: transparent; font-family: var(--ui); font-size: .62rem;
  font-weight: 600; color: rgba(247,245,242,.55); cursor: pointer; padding: 7px 0 6px;
  border-radius: 18px; transition: color .25s, background .25s, transform .2s; }
.tabbar-btn span { display: block; font-size: 1.15rem; margin-bottom: 2px; line-height: 1; }
.tabbar-btn.on { background: var(--terracotta); color: #0A0A0A; box-shadow: 0 6px 18px rgba(255,74,31,.45); }
.tabbar-btn:active { transform: scale(.94); }
@keyframes slideIn { from { transform: translateX(26px); opacity: .35; } to { transform: none; opacity: 1; } }
.view.slide-in { animation: slideIn .3s cubic-bezier(.22,.61,.36,1); }

/* Closet grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.piece { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background: var(--clay); border: 1.5px solid var(--line); }
.piece img { width: 100%; height: 100%; object-fit: cover; display: block; }
.piece .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(18,18,18,.72); color: var(--ivory);
  font-size: .6rem; font-family: var(--ui); font-weight: 600; padding: 3px 8px; border-radius: var(--pill);
  max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piece .wears { position: absolute; top: 6px; right: 6px; background: var(--gold); color: var(--ink);
  font-size: .6rem; font-weight: 700; padding: 2px 7px; border-radius: var(--pill); }
.piece .menu { position: absolute; top: 6px; left: 6px; background: rgba(18,18,18,.6); color: #fff;
  border: none; border-radius: 50%; width: 22px; height: 22px; font-size: .8rem; cursor: pointer; }
.piece.empty-tile { display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
  color: #aaa; cursor: pointer; border-style: dashed; }
.fab { position: fixed; right: 22px; bottom: calc(96px + var(--safe-b)); width: 58px; height: 58px;
  border-radius: 50%; background: var(--terracotta); color: #fff; border: none; font-size: 1.7rem;
  box-shadow: 0 8px 24px rgba(194,107,58,.4); cursor: pointer; z-index: 25; }

/* Generate */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: var(--pill);
  padding: 9px 14px; font-family: var(--ui); font-size: .82rem; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.lbl { display: block; font-family: var(--ui); font-size: .72rem; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: #666; margin: 10px 0 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.temp-row { display: flex; gap: 8px; align-items: center; }
.temp-row .input { margin-bottom: 0; }
input[type="range"] { width: 100%; accent-color: var(--terracotta); margin-top: 12px; }
.deck { margin-top: 16px; }
.outfit-card { background: #fff; border: 1.5px solid var(--line); border-radius: 22px;
  padding: 18px 14px; box-shadow: 0 14px 40px rgba(18,18,18,.08); animation: pop .25s ease; }
@keyframes pop { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.outfit-card h3 { margin: 0 0 2px; }
.occ-line { font-family: var(--ui); font-size: .7rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--terracotta); font-weight: 700; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.slot { background: var(--clay); border-radius: 12px; padding: 8px; text-align: center; }
.slot img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #fff; }
.slot .noimg { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1;
  background: #fff; border-radius: 8px; font-size: 1.6rem; color: #bbb; }
.slot .sname { font-size: .62rem; font-weight: 600; margin-top: 5px; color: #444; text-transform: capitalize; }
.slot .srole { font-size: .56rem; color: #999; text-transform: uppercase; letter-spacing: .5px; }
.deck-meta { text-align: center; font-family: var(--ui); font-size: .72rem; color: #888; margin: 10px 0; }
.actions { display: flex; justify-content: center; gap: 14px; margin-top: 16px; }
.act { width: 56px; height: 56px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  font-size: 1.35rem; cursor: pointer; }
.act.good { color: var(--terracotta); border-color: var(--terracotta); }
.act.bad { color: #999; }
.act.gold { color: var(--gold); border-color: var(--gold); }
.done { text-align: center; padding-top: 30px; }
.done .btn { margin: 8px; }

/* History */
.run-card { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; }
.run-head { display: flex; justify-content: space-between; font-family: var(--ui); font-size: .78rem;
  font-weight: 600; margin-bottom: 10px; }
.run-items { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.run-items img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: var(--clay); }

/* Profile */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.stat { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px;
  text-align: center; }
.stat b { display: block; font-family: var(--ui); font-size: 1.5rem; }
.stat span { font-size: .7rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }
.card-plain { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(18,18,18,.5);
  display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--ivory); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(26px + var(--safe-b)); max-height: 88dvh; overflow-y: auto; }
.head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#modal-body .input { background: #fff; }
.photo-preview { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px;
  background: var(--clay); border: 1.5px dashed var(--line); margin-bottom: 12px; }
.photo-upload { width: 100%; padding: 26px 10px; border: 1.5px dashed var(--line); border-radius: 14px;
  text-align: center; background: #fff; cursor: pointer; font-family: var(--ui); font-weight: 600; }
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select.input { appearance: none; }
.spinner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px 0;
  font-family: var(--ui); font-weight: 600; color: #666; }
.spinner::before { content: ""; width: 18px; height: 18px; border: 2.5px solid var(--clay);
  border-top-color: var(--terracotta); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--ivory); padding: 12px 20px; border-radius: var(--pill);
  font-family: var(--ui); font-size: .85rem; font-weight: 600; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ---------- v2: daily swipe + closet filters + history archive ---------- */

/* filter bar + closet sections */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.filter-bar .chips { margin: 0; flex: 1; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.filter-bar .chip { white-space: nowrap; }
.closet-sec { margin-top: 18px; }
.closet-sec h3 { font-size: .8rem; font-family: var(--ui); font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: #999; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.closet-sec h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.count-note { font-family: var(--ui); font-size: .72rem; color: #999; margin-top: 6px; }

/* swipe deck */
.swipe-hint { display: flex; justify-content: space-between; font-family: var(--ui);
  font-size: .68rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: #aaa; margin: 4px 6px 8px; }
.swipe-hint span:first-child { color: #bbb; }
.swipe-hint span:last-child { color: var(--terracotta); }
.outfit-card { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
  transition: transform .18s ease, opacity .18s ease; }
.outfit-card.dragging { transition: none; cursor: grabbing; }
.outfit-card.fly { transition: transform .22s ease-in, opacity .22s ease-in; }
.outfit-card .edge-tag { position: absolute; top: 14px; padding: 6px 14px; border-radius: var(--pill);
  font-family: var(--ui); font-weight: 700; font-size: .8rem; letter-spacing: 1.5px;
  border: 2.5px solid; background: rgba(250,246,239,.85); opacity: 0; pointer-events: none; }
.outfit-card .edge-tag.like { right: 14px; color: var(--terracotta); border-color: var(--terracotta); }
.outfit-card .edge-tag.pass { left: 14px; color: #999; border-color: #999; }
.outfit-card.show-like .edge-tag.like { opacity: 1; }
.outfit-card.show-pass .edge-tag.pass { opacity: 1; }

/* history: chosen outfit cards */
.run-head { display: flex; justify-content: space-between; align-items: baseline; }
.outfit-row { display: flex; gap: 10px; align-items: stretch; padding: 10px 0; border-top: 1px solid var(--line); }
.outfit-row:first-of-type { border-top: none; }
.outfit-row .thumbs { display: flex; gap: 6px; flex: 1; }
.outfit-row .thumbs .t { width: 52px; height: 52px; border-radius: 10px; background: var(--clay);
  overflow: hidden; position: relative; flex-shrink: 0; }
.outfit-row .thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.outfit-row .thumbs .t .noimg { width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-family: var(--ui); font-weight: 700; color: #bbb; }
.outfit-row .choice { display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 44px; }
.choice-badge { font-size: 1.05rem; }
.choice-label { font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #888; }
.choice-badge.liked { color: var(--terracotta); }
.choice-badge.wore { color: var(--gold); }
.empty-note { color: #999; font-size: .9rem; padding: 20px 0; text-align: center; }
