:root {
  --bg: #f7f3ee;
  --card: #ffffff;
  --ink: #1f1b2e;
  --muted: #6b6478;
  --line: #e6dfd6;
  --brand: #e2475b;       /* zhuzh coral-red */
  --brand-ink: #ffffff;
  --accent: #2f6fd6;
  --safe: #3f8f6b;
  --step: #2f6fd6;
  --bold: #c2378f;
  --chip: #efe8df;
  --shadow: 0 1px 2px rgba(31,27,46,.06), 0 6px 20px rgba(31,27,46,.07);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15121f; --card: #211d2e; --ink: #f3eef8; --muted: #a49cb3; --line: #342e45;
    --brand: #ff5f73; --accent: #6e9cff; --safe: #5fc196; --step: #6e9cff; --bold: #f06cc3;
    --chip: #2c2640; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; margin: 0; letter-spacing: -.01em; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 10px; }
.logo { display: flex; align-items: baseline; gap: 8px; }
.logo b { font-family: Fraunces, serif; font-weight: 800; font-size: 28px; color: var(--brand); letter-spacing: -.02em; }
.logo span { color: var(--muted); font-size: 13px; }
.sub { color: var(--muted); font-size: 14px; margin: 2px 0 14px; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.tabs .in { display: flex; width: 100%; max-width: 720px; }
nav.tabs button { flex: 1; background: none; border: 0; padding: 10px 4px 12px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
nav.tabs button svg { width: 24px; height: 24px; }
nav.tabs button.on { color: var(--brand); }
nav.tabs button.add span.plus { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow); }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; background: var(--chip); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; cursor: pointer; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 0; padding: 0; text-align: left; cursor: pointer; }
.tile .ph { aspect-ratio: 1; background: var(--chip); object-fit: cover; width: 100%; }
.tile .meta { padding: 8px 10px 10px; }
.tile .nm { font-weight: 600; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .when { color: var(--muted); font-size: 12px; margin-top: 3px; }
.sw { display: flex; gap: 4px; margin-top: 6px; }
.sw i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 22px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.login { max-width: 400px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 16px 40px; }
.login .logo b { font-size: 48px; }
.login .tag { color: var(--muted); margin: 4px 0 28px; }
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input.in, select.in, textarea.in { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
textarea.in { min-height: 84px; resize: vertical; }
.err { color: var(--brand); font-size: 14px; min-height: 20px; margin-top: 8px; }

/* shirt view */
.hero { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; margin-bottom: 14px; }
.hero img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; background: var(--chip); }
.hero h2 { font-size: 22px; line-height: 1.15; }
.back { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 6px 0; cursor: pointer; }
.zhuzh { width: 100%; border: 0; border-radius: 18px; padding: 18px; font: 800 24px Fraunces, serif; letter-spacing: .01em; color: #fff; cursor: pointer;
  background: linear-gradient(110deg, #e2475b, #c2378f 45%, #6e5bd6 75%, #2f6fd6); background-size: 200% 100%; box-shadow: var(--shadow); transition: background-position .6s; }
.zhuzh:hover { background-position: 100% 0; }
.zhuzh.busy { animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { 0% { background-position: 0 0; } 100% { background-position: 200% 0; } }

.look { margin-top: 14px; }
.look .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; color: #fff; }
.badge.safe { background: var(--safe); } .badge.step { background: var(--step); } .badge.bold { background: var(--bold); }
.look h3 { font-size: 19px; }
.pieces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.piece { flex: none; width: 84px; }
.piece img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--chip); }
.piece small { display: block; font-size: 11px; line-height: 1.2; color: var(--muted); margin-top: 4px; }
.why { margin: 10px 0 12px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.acts .btn { padding: 9px 12px; font-size: 14px; }
.acts .btn.on { background: var(--ink); color: var(--bg); }
.worn { color: var(--safe); font-weight: 600; font-size: 14px; }

/* add flow */
.shot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shot label { display: block; aspect-ratio: 3/4; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; overflow: hidden; position: relative; }
.shot label .cap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px; color: var(--muted); font-size: 14px; }
.shot label .cap b { color: var(--ink); font-size: 15px; }
.shot label img { width: 100%; height: 100%; object-fit: cover; }
.shot input { display: none; }
.tips { font-size: 14px; color: var(--muted); margin: 14px 0; }
.tips li { margin: 3px 0; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15,12,25,.45); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.sheet-x { position: absolute; right: 12px; top: 10px; background: var(--chip); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
.colors-edit .row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.colors-edit input[type=color] { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--card); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-photo { width: 100%; max-height: 340px; object-fit: contain; border-radius: 14px; background: var(--chip); }

.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }
