﻿/* Mottie â€” "editorial where you look, plain where you act". */
:root {
  --paper: #F4EFE6;
  --paper-2: #ECE5D8;
  --card: #FBF8F3;
  --ink: #1F1D1A;
  --ink-2: #57524A;
  --stone: #8C857B;
  --line: rgba(31, 29, 26, .12);
  --sage: #8E9B82;
  --blush: #D9AFA3;
  --camel: #B48A5E;
  --danger: #A2493D;
  --shadow: 0 1px 2px rgba(31,29,26,.06), 0 12px 32px -12px rgba(31,29,26,.22);
  --radius: 22px;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161513; --paper-2: #201E1B; --card: #24221F;
    --ink: #F1ECE3; --ink-2: #BDB5A8; --stone: #8F887D;
    --line: rgba(241, 236, 227, .12);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -16px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); }
body { min-height: 100dvh; overscroll-behavior-y: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
#app { max-width: 520px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 16px calc(var(--safe-b) + 96px); }

/* type */
.eyebrow { font: 600 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--stone); }
.display { font: 400 34px/1.08 var(--serif); letter-spacing: -.01em; margin: 6px 0 0; }
.h2 { font: 400 24px/1.15 var(--serif); margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }

/* buttons & chips */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 15px 22px; background: var(--ink); color: var(--paper);
  font-weight: 600; letter-spacing: .01em; width: 100%; cursor: pointer; transition: transform .15s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { width: auto; padding: 10px 16px; font-size: 14px; }
.link { background: none; border: 0; padding: 8px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; border-radius: 999px; padding: 9px 14px; background: var(--paper-2); color: var(--ink); font-size: 14px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line); transition: background .15s, color .15s; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }
.input { width: 100%; padding: 14px 16px; border-radius: 14px; border: 0; background: var(--card); color: var(--ink); font: inherit;
  box-shadow: inset 0 0 0 1px var(--line); }
.input:focus { outline: 2px solid var(--sage); }

/* header */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.wx { text-align: right; }
.wx .t { font: 400 30px/1 var(--serif); }
.wx .d { font-size: 12px; color: var(--stone); margin-top: 4px; }

/* Mottie */
.mottie { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; margin: 6px 0 16px; }
.mottie .frame { width: 96px; height: 96px; border-radius: 26px; overflow: hidden; background: #F4EFE6; box-shadow: var(--shadow); }
.mottie .frame img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); }
.bubble { position: relative; background: var(--card); border-radius: 18px; padding: 12px 14px; font: italic 400 16px/1.35 var(--serif);
  box-shadow: inset 0 0 0 1px var(--line); }
.bubble::before { content: ""; position: absolute; left: -6px; top: 22px; width: 12px; height: 12px; background: var(--card);
  transform: rotate(45deg); box-shadow: -1px 1px 0 0 var(--line); }
.mottie.big { grid-template-columns: 1fr; justify-items: center; text-align: center; }
.mottie.big .frame { width: 220px; height: 220px; border-radius: 48px; }
.mottie.big .bubble::before { display: none; }

/* mood */
.mood { margin: 0 0 14px; }
.mood .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.mood .chips::-webkit-scrollbar { display: none; }

/* deck */
.deck { position: relative; height: min(62dvh, 560px); margin: 4px 0 14px; touch-action: none; }
/* Today must fit one screen: header + Mottie + mood + deck + actions above the tab bar */
.deck.today { height: max(300px, min(560px, calc(100dvh - 392px - var(--safe-t) - var(--safe-b)))); margin-bottom: 12px; }
.today-head .display { font-size: 30px; }
.today-head + .mottie { grid-template-columns: 64px 1fr; margin: 4px 0 12px; }
.today-head + .mottie .frame { width: 64px; height: 64px; border-radius: 20px; }
.today-head + .mottie .bubble { font-size: 15px; padding: 10px 12px; }
.today-head + .mottie .bubble::before { top: 18px; }
.today-head { margin-bottom: 8px; }
.card { position: absolute; inset: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; will-change: transform; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
  user-select: none; -webkit-user-select: none; }
.card.dragging { transition: none; }
.card:nth-last-child(2) { transform: translateY(10px) scale(.965); }
.card:nth-last-child(3) { transform: translateY(20px) scale(.93); opacity: .7; }
.card:nth-last-child(n+4) { opacity: 0; }
.card .art { flex: 1; min-height: 0; position: relative; background: #F4EFE6; }
.card .art > img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card .meta { padding: 14px 18px 16px; }
.card .meta .h2 { font-size: 22px; }
.card .meta p { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.tag { position: absolute; top: 14px; left: 14px; background: rgba(251,248,243,.92); color: #1F1D1A; border-radius: 999px; padding: 6px 10px;
  font: 600 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; backdrop-filter: blur(6px); }
.stamp { position: absolute; top: 22px; padding: 6px 12px; border-radius: 10px; font: 700 15px/1 var(--sans); letter-spacing: .12em;
  text-transform: uppercase; opacity: 0; border: 2px solid; }
.stamp.like { left: 18px; color: var(--sage); transform: rotate(-12deg); }
.stamp.nope { right: 18px; color: var(--danger); transform: rotate(12deg); }
.stamp.wear { left: 50%; top: auto; bottom: 22px; transform: translateX(-50%); color: var(--camel); }

/* flat-lay of the user's own items */
.flatlay { position: absolute; inset: 0; display: grid; grid-template-rows: 46% 36% 18%; padding: 16px 14px 10px; gap: 4px; }
.flatlay .row { display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 0; }
.flatlay .row img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(31,29,26,.16)); }
.flatlay .row.single img { flex: 0 1 70%; }
.flatlay .row.shoes img { flex: 0 1 38%; }
.flatlay .missing { font: italic 13px var(--serif); color: var(--stone); }

/* own looks: "Pieces | Mannequin" toggle and the mannequin render */
.view-toggle { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; background: rgba(251,248,243,.92);
  border-radius: 999px; padding: 3px; backdrop-filter: blur(6px); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.view-toggle button { border: 0; background: transparent; color: #57524A; font: 600 11px/1 var(--sans); letter-spacing: .06em;
  text-transform: uppercase; padding: 7px 10px; border-radius: 999px; cursor: pointer; }
.view-toggle button[aria-pressed="true"] { background: #1F1D1A; color: #F4EFE6; }
.card .art > img.render { object-fit: cover; object-position: center 30%; }
.rendering { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center;
  font: italic 16px/1.4 var(--serif); color: #57524A; }
.rendering img { width: 120px; height: 120px; border-radius: 30px; object-fit: cover; animation: breathe 1.6s ease-in-out infinite; }
.actions { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 12px; align-items: center; }
.act { height: 58px; border-radius: 999px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 15px; cursor: pointer; }
.act.wear { background: var(--ink); color: var(--paper); font-weight: 600; }
.act:active { transform: scale(.96); }
.hint { text-align: center; font-size: 12px; color: var(--stone); margin: 8px 0 0; position: relative; top: -4px; }

/* reason sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(20,19,17,.28); z-index: 40; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--paper); border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(var(--safe-b) + 18px); box-shadow: 0 -10px 40px rgba(0,0,0,.18); max-width: 520px; margin: 0 auto;
  animation: up .28s cubic-bezier(.2,.8,.2,1); max-height: 88dvh; overflow: auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* done state */
.done { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; text-align: center; }
.done .art { height: 300px; position: relative; border-radius: 16px; overflow: hidden; background: #F4EFE6; margin: 14px 0; }
.done .art > img { width: 100%; height: 100%; object-fit: cover; }

/* closet */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { aspect-ratio: 3/4; background: var(--card); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); position: relative; overflow: hidden;
  border: 0; padding: 8px; cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: contain; }
.tile .dot { position: absolute; right: 8px; bottom: 8px; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.tile.pending { box-shadow: inset 0 0 0 2px var(--blush); }
.tile.busy { display: grid; place-items: center; }
.tile.busy img { width: 70%; height: auto; border-radius: 14px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.94); opacity: .7; } }
.section { margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.fab { position: fixed; right: max(16px, calc(50vw - 244px)); bottom: calc(var(--safe-b) + 84px); z-index: 20; width: auto; padding: 15px 20px; box-shadow: var(--shadow); }
.edit-img { height: 260px; background: #F4EFE6; border-radius: 18px; padding: 12px; margin-bottom: 14px; }
.edit-img img { width: 100%; height: 100%; object-fit: contain; }
.field { margin: 14px 0; }
.field > .eyebrow { display: block; margin-bottom: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--paper-2); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 9px 0; border-radius: 10px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

/* me */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.stat { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: inset 0 0 0 1px var(--line); }
.stat .n { font: 400 34px/1 var(--serif); }
.stat .l { font-size: 12px; color: var(--stone); margin-top: 6px; }
.list { background: var(--card); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.list > * { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }

/* onboarding */
.ob { min-height: calc(100dvh - 120px); display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.ob .body { padding-top: 10px; }
.progress { display: flex; gap: 6px; margin-bottom: 22px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.progress i.on { background: var(--ink); }
.results button { display: block; width: 100%; text-align: left; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; }
.words { display: grid; gap: 18px; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; gap: 6px;
  padding: 8px 12px calc(var(--safe-b) + 8px); background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line); }
.tabs[hidden] { display: none; }
.tabs a { flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--stone);
  text-decoration: none; font-size: 11px; letter-spacing: .04em; border-radius: 12px; }
.tabs a .ti { font-size: 18px; line-height: 1; }
.tabs a.on { color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 12px 18px; border-radius: 999px; font-size: 14px; z-index: 60; animation: fade .2s; max-width: 90vw; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
