:root {
  --bg: #fff6ec;
  --bg-dot: #f3e4d3;
  --surface: #ffffff;
  --ink: #2a1f3d;
  --ink-2: #5c5170;
  --muted: #8a809b;
  --line: #efe4d8;
  --violet: #6c4cff;
  --violet-soft: #efeaff;
  --coral: #ff6f91;
  --sun: #ffc93c;
  --mint: #3ccf91;
  --shadow-sm: 0 1px 2px rgba(42,31,61,.06), 0 4px 12px rgba(42,31,61,.06);
  --shadow: 0 2px 4px rgba(42,31,61,.05), 0 14px 34px rgba(42,31,61,.10);
  --radius: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45;
  background-color: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 110% -10%, rgba(255,111,145,.13), transparent 60%),
    radial-gradient(50rem 36rem at -20% 20%, rgba(108,76,255,.10), transparent 60%),
    radial-gradient(var(--bg-dot) 1.2px, transparent 1.3px);
  background-size: auto, auto, 22px 22px;
  background-attachment: fixed;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.1; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- buttons ---------- */
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  color: #fff; background: var(--violet); border: 0; border-radius: 16px; padding: 14px 22px;
  font-weight: 800; cursor: pointer; box-shadow: 0 6px 0 #4b2fd6, 0 12px 22px rgba(108,76,255,.25);
  transition: transform .12s, box-shadow .12s, opacity .15s;
}
.primary:hover:not(:disabled) { transform: translateY(-1px); }
.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #4b2fd6, 0 6px 12px rgba(108,76,255,.2); }
.primary:disabled { opacity: .4; cursor: default; }
.primary.wide { width: 100%; }
.primary.light { color: var(--violet); background: #fff; box-shadow: 0 6px 0 rgba(42,31,61,.18), 0 14px 26px rgba(42,31,61,.18); }
.primary.light:active:not(:disabled) { box-shadow: 0 2px 0 rgba(42,31,61,.18), 0 6px 12px rgba(42,31,61,.14); }
.secondary, .back-btn {
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 18px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm);
}
.back-btn { padding: 9px 14px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink-2); background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
.icon-btn:hover { background: var(--violet-soft); color: var(--violet); }
.icon-btn svg, .input-shell svg, .lock-badge svg, .add-tile svg, .account svg, .card-status svg, .shelf-text svg, .stages svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg { width: 21px; }

/* ---------- thumbnails: grey until collected ---------- */
.thumb { position: relative; display: block; overflow: hidden; aspect-ratio: 1; background: #ece8f2; }
.thumb > svg, .thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .9s ease; }
.thumb.grey > svg, .thumb.grey > img { filter: grayscale(1) contrast(.88) brightness(1.06); }
.thumb.colour > svg, .thumb.colour > img { filter: none; }
.thumb.pop { animation: pop .7s cubic-bezier(.2,1.6,.4,1); }
.runs-badge {
  position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; padding: 0 7px; display: grid; place-items: center;
  color: #fff; background: var(--coral); border: 2px solid #fff; border-radius: 99px; font-size: 13px; font-weight: 900; box-shadow: var(--shadow-sm);
}
.lock-badge, .tick-badge { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }
.lock-badge { color: #fff; background: rgba(42,31,61,.72); }
.lock-badge svg { width: 16px; }
.tick-badge { color: #fff; background: var(--mint); border: 2px solid #fff; font-weight: 900; font-size: 14px; }

/* ---------- sign in ---------- */
.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); }
.auth-layout { width: 100%; max-width: 1080px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(28px, 6vw, 80px); align-items: center; }
.auth-hero { display: grid; place-items: center; }
.hero-stage { position: relative; width: min(100%, 480px); aspect-ratio: 1; }
.hero-stage::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle, rgba(255,201,60,.35), rgba(255,111,145,.18) 55%, transparent 72%); }
.sticker { position: absolute; width: 23%; border-radius: 22px; border: 5px solid #fff; box-shadow: var(--shadow); animation: float 6s ease-in-out infinite; }
.sticker.s1 { left: 2%; top: 6%; --r: -10deg; animation-delay: -1s; }
.sticker.s2 { right: 4%; top: 2%; --r: 8deg; animation-delay: -3s; }
.sticker.s3 { left: -2%; top: 46%; --r: 6deg; width: 20%; animation-delay: -2s; }
.sticker.s4 { right: -1%; top: 42%; --r: -7deg; animation-delay: -4s; }
.sticker.s5 { left: 10%; bottom: 0; --r: -4deg; width: 20%; animation-delay: -5s; }
.sticker.s6 { right: 12%; bottom: 2%; --r: 11deg; width: 21%; animation-delay: -2.5s; }
.demo-card {
  position: absolute; left: 50%; top: 50%; width: 48%; padding: 10px 10px 14px; background: #fff; border-radius: 26px;
  box-shadow: 0 4px 10px rgba(42,31,61,.08), 0 30px 60px rgba(42,31,61,.20); transform: translate(-50%, -50%) rotate(-3deg);
}
.demo-card .thumb { border-radius: 18px; }
.demo-meta { display: block; padding: 10px 4px 0; }
.demo-meta b { display: block; font-size: 17px; font-weight: 900; }
.demo-meta .pips i.on { background: var(--violet); }
.demo-card.done .pips i.on { background: var(--sun); }
.demo-badge {
  position: absolute; top: -14px; right: -18px; padding: 8px 14px; border-radius: 99px; background: var(--coral); color: #fff;
  font-weight: 900; font-size: 15px; box-shadow: var(--shadow); transform: scale(0) rotate(12deg); transition: transform .35s cubic-bezier(.2,1.6,.4,1);
}
.demo-card.done .demo-badge { transform: scale(1) rotate(12deg); }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; margin-bottom: 22px; }
.app-mark { width: 42px; height: 42px; border-radius: 13px; box-shadow: var(--shadow-sm); }
.auth-panel { min-width: 0; }
.auth-panel h1 { font-size: clamp(36px, 5vw, 54px); font-weight: 900; letter-spacing: -.035em; line-height: 1; }
.auth-panel h1 span { background: linear-gradient(90deg, var(--violet), #c04cff 55%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--ink-2); margin: 16px 0 24px; font-size: 17px; max-width: 440px; }
.how { list-style: none; display: grid; gap: 10px; margin: 20px 0 0; padding: 0; }
.how li { display: flex; align-items: center; gap: 12px; }
.how-num { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; background: var(--violet-soft); color: var(--violet); font-weight: 900; }
.how li:nth-child(2) .how-num { background: #ffe6ec; color: #e0436b; }
.how li:nth-child(3) .how-num { background: #fff1c9; color: #b7790b; }
.how b { display: block; font-size: 15px; }
.how small { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.auth-card { padding: 8px 20px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.field-label { display: block; margin: 0 0 8px 2px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.input-shell { display: flex; align-items: center; gap: 10px; background: #fbf8f4; border: 2px solid var(--line); border-radius: 16px; padding: 0 14px; margin-bottom: 14px; transition: border-color .15s, box-shadow .15s; }
.input-shell:focus-within { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(108,76,255,.14); background: #fff; }
.input-shell svg { width: 20px; flex: none; color: var(--muted); }
.input-shell input { min-width: 0; width: 100%; padding: 14px 0; background: transparent; border: 0; outline: 0; font-size: 16px; }
.auth-card { padding: 22px 20px 16px; }
.auth-card h2 { font-size: 22px; font-weight: 900; margin-bottom: 8px; }
.code-shell input { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: .45em; padding-left: .45em; font-variant-numeric: tabular-nums; }
.code-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; }
.link-btn { border: 0; background: none; padding: 6px 2px; color: var(--violet); font-weight: 800; font-size: 14px; cursor: pointer; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.error-msg { color: #d6335a; min-height: 18px; margin: 10px 0 0; font-size: 13px; text-align: center; }

/* ---------- profile ---------- */
.profile-panel { width: 100%; max-width: 560px; text-align: center; }
.setup-meta { max-width: 360px; margin: 0 auto 16px; color: var(--muted); font-size: 13px; font-weight: 700; }
.setup-track { height: 6px; background: #efe6dc; border-radius: 99px; margin-top: 8px; overflow: hidden; }
.setup-track i { display: block; width: 50%; height: 100%; background: linear-gradient(90deg, var(--violet), var(--coral)); border-radius: inherit; transition: width .3s ease; }
.profile-card { padding: 30px 22px 24px; }
.profile-card h1 { font-size: clamp(28px, 6vw, 36px); font-weight: 900; }
.profile-card .tagline { margin: 8px auto 22px; font-size: 15px; }
.choice-grid { display: grid; gap: 12px; }
.choice-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.choice-grid.sex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; margin-inline: auto; }
.choice-card {
  min-width: 0; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: #fbf8f4; border: 2px solid var(--line); border-radius: 20px; padding: 16px 8px; cursor: pointer; font-weight: 800;
  transition: transform .15s, border-color .15s, background .15s;
}
.choice-card:hover { transform: translateY(-2px); border-color: #d9ccff; }
.choice-card.selected { border-color: var(--violet); background: var(--violet-soft); }
.choice-icon { width: 68px; height: 68px; display: grid; place-items: center; color: #fff; border-radius: 22px; background: var(--violet); }
.choice-card:nth-child(2) .choice-icon { background: var(--coral); }
.choice-card:nth-child(3) .choice-icon { background: #ff9f43; }
.choice-icon svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.choice-label { font-size: 16px; }
.choice-caption { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: -4px; }
.btn-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); background: rgba(255,247,238,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(239,228,216,.8); }
.topbar-inner { max-width: 1080px; min-height: 64px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 17px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; border-radius: 11px; }
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.settings-btn { border: 1px solid var(--line); border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); }
.settings-btn svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account { position: relative; }
.account-btn { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; box-shadow: var(--shadow-sm); }
.account-btn svg { width: 18px; color: var(--muted); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--coral)); color: #fff; font-weight: 900; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); animation: fade .15s ease; }
.account-email { margin: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.account-profile { margin: 2px 0 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: #faf6f1; font-weight: 800; cursor: pointer; }
.menu-item:hover { background: var(--violet-soft); color: var(--violet); }
.menu-item svg { width: 18px; }

/* ---------- up next ---------- */
.next-up {
  max-width: 1048px; width: calc(100% - 32px); margin: 20px auto 0; padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px;
  color: #fff; border-radius: 30px; background: radial-gradient(120% 140% at 0% 0%, #8a6bff 0%, #6c4cff 45%, #b04cf0 80%, #ff6f91 120%);
  box-shadow: 0 20px 50px rgba(108,76,255,.28);
}
.next-main { display: flex; align-items: center; gap: 24px; min-width: 0; }
.next-thumb { flex: none; width: 168px; border-radius: 24px; border: 5px solid rgba(255,255,255,.9); box-shadow: 0 14px 30px rgba(42,31,61,.25); transform: rotate(-3deg); }
.next-thumb.all-done { display: grid; place-items: center; aspect-ratio: 1; background: rgba(255,255,255,.18); font-size: 64px; color: var(--sun); }
.next-copy { min-width: 0; }
.next-copy .eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.next-copy h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 900; letter-spacing: -.03em; }
.next-lead { margin: 6px 0 14px; font-size: 16px; color: rgba(255,255,255,.9); max-width: 420px; }
.next-progress { display: flex; align-items: center; gap: 10px; max-width: 340px; margin-bottom: 18px; }
.next-progress small { font-weight: 900; color: rgba(255,255,255,.85); }
.pips.big { flex: 1; margin: 0; gap: 4px; }
.pips.big i { height: 9px; background: rgba(255,255,255,.28); }
.pips.big i.on { background: var(--sun); }
.next-side { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 22px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); }
.ring { --p: 0; align-self: center; width: 116px; height: 116px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #7a54f7 calc(100% - 12px), transparent calc(100% - 11px)), conic-gradient(var(--sun) calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.ring b { font-size: 34px; font-weight: 900; line-height: 1; }
.ring small { font-size: 11px; font-weight: 700; line-height: 1.2; color: rgba(255,255,255,.8); }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stages li { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; font-size: 14px; color: rgba(255,255,255,.7); }
.stages li > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 12px; font-weight: 900; }
.stages li.current { color: #fff; }
.stages li.current > span { background: #fff; color: var(--violet); }
.stages li.done > span { background: var(--mint); color: #fff; }
.stages small { font-weight: 800; }
.stages svg { width: 14px; vertical-align: -2px; }
.goal { margin: 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.2); font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }

/* ---------- chapters + cards ---------- */
.grid-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 8px 16px 72px; }
.chapter { margin-top: 32px; }
.chapter-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chapter-num { margin: 0 0 2px; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.chapter-head h2 { font-size: 24px; font-weight: 900; }
.chapter-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.refresh-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border: 1px solid #d9ccff; border-radius: 99px; background: var(--violet-soft); color: var(--violet); font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; }
.refresh-btn:hover:not(:disabled) { background: #e3dbff; }
.refresh-btn:disabled { opacity: .6; cursor: default; }
.refresh-btn svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.refresh-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chapter-count { padding: 5px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-weight: 900; font-size: 14px; color: var(--ink-2); }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.char-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; padding: 8px; text-align: left; cursor: pointer;
  background: #fff; border: 2px solid #fff; border-radius: 24px; box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.char-card:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: var(--shadow); }
.char-card .thumb { border-radius: 18px; }
.char-card.locked { cursor: default; }
.char-card.locked .thumb > svg, .char-card.locked .thumb > img { opacity: .45; }
.char-card.locked:hover { transform: none; box-shadow: var(--shadow-sm); }
.char-card.done { background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #ffd36b, #ff8fb1 50%, #9b8cff) border-box; border-color: transparent; box-shadow: 0 10px 26px rgba(255,143,177,.25); }
.char-card.next { box-shadow: 0 0 0 4px rgba(108,76,255,.22), var(--shadow); }
.next-tag { position: absolute; left: 8px; bottom: 8px; padding: 4px 10px; border-radius: 99px; background: var(--violet); color: #fff; font-size: 12px; font-weight: 900; box-shadow: var(--shadow-sm); }
.card-body { display: flex; flex-direction: column; gap: 1px; padding: 10px 6px 4px; min-width: 0; }
.cname { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cstudio { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-top: 8px; }
.pips i { height: 6px; border-radius: 99px; background: #ece5dd; }
.pips i.on { background: var(--violet); }
.card-progress { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.card-progress .pips { flex: 1; margin: 0; }
.card-progress small { font-size: 12px; font-weight: 900; color: var(--muted); }
.card-status { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 13px; font-weight: 900; color: var(--muted); }
.card-status svg { width: 14px; }
.card-status.done { color: #e0436b; }
.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 230px; padding: 16px;
  text-align: center; border: 2px dashed #cfc2ff; border-radius: 24px; background: rgba(239,234,255,.6); color: var(--violet); cursor: pointer;
  transition: background .15s, transform .15s;
}
button.add-tile:hover { background: var(--violet-soft); transform: translateY(-3px); }
.add-tile .plus { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--violet); color: #fff; font-size: 30px; font-weight: 700; box-shadow: 0 8px 18px rgba(108,76,255,.3); }
.add-tile small { color: var(--ink-2); font-weight: 600; }
.shelf { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-radius: 22px; background: rgba(255,255,255,.65); border: 2px dashed #e6dbcd; }
.shelf-thumbs { display: flex; flex: none; padding-left: 10px; }
.mini { width: 56px; height: 56px; margin-left: -10px; border-radius: 50%; border: 3px solid #fff; box-shadow: var(--shadow-sm); }
.mini > svg { opacity: .55; }
.mini.mystery { display: grid; place-items: center; background: #efe8df; color: #b3a796; font-weight: 900; font-size: 20px; }
.shelf-text { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-2); font-weight: 700; }
.shelf-text svg { flex: none; width: 20px; color: var(--muted); }

/* ---------- character page ---------- */
.char-wrap { max-width: 920px; margin: 0 auto; padding: 18px 16px 64px; display: grid; gap: 16px; }
.char-hero { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: center; padding: 16px; }
.hero-thumb { border-radius: 18px; }
.studio-chip { display: inline-block; margin: 0 0 8px; padding: 4px 10px; border-radius: 99px; background: var(--violet-soft); color: var(--violet); font-size: 12px; font-weight: 800; }
.hero-info h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 900; }
.hero-status { margin: 8px 0 12px; color: var(--ink-2); }
.meter { height: 10px; border-radius: 99px; background: #efe8df; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--coral)); transition: width .5s ease; }
.run-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.run-tabs:empty { display: none; }
.run-tab { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: #faf6f1; font-size: 13px; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.run-tab.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.photo-panel { padding: 18px; }
.photo-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.photo-head h2 { font-size: 19px; font-weight: 900; }
.photo-head span { color: var(--muted); font-weight: 800; }
.shot-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.shot { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; }
.shot.filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot.empty { display: grid; place-items: center; border: 2px dashed #e8ddd0; color: #cbbfb1; font-weight: 900; }
.shot.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--violet); background: var(--violet-soft); color: var(--violet); font-weight: 800; font-size: 13px; cursor: pointer; }
.shot.add .plus { font-size: 28px; line-height: 1; }
.shot.add:hover { background: #e4dcff; }
.del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(42,31,61,.7); color: #fff; font-size: 13px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.shot:hover .del, .shot:focus-within .del { opacity: 1; }
@media (hover: none) { .del { opacity: 1; } }
.upload-status { min-height: 20px; margin: 12px 0 0; color: var(--ink-2); font-size: 14px; text-align: center; }
.upload-status:empty { min-height: 0; margin: 0; }
.again { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 16px; border-radius: 18px; background: #fff4d6; }
.again b { font-size: 16px; }
.again p { margin: 2px 0 0; color: #7c6331; font-size: 14px; }
.again .primary { flex: none; }

/* ---------- add modal ---------- */
.settings-sheet { max-width: 520px; overflow-y: auto; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.settings-label { margin: 6px 0 10px; font-size: 13px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.settings-sheet .choice-grid { margin-bottom: 16px; }
.settings-sheet .sex-grid { max-width: none; }
.settings-note { margin: 0; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.settings-sheet .btn-row { margin-top: 18px; justify-content: flex-end; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(42,31,61,.45); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal-sheet { width: 100%; max-width: 760px; max-height: 88vh; display: flex; flex-direction: column; background: var(--bg); border-radius: 28px 28px 0 0; padding: 20px 16px 0; box-shadow: var(--shadow); animation: slideUp .28s cubic-bezier(.2,.9,.3,1); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { font-size: 24px; font-weight: 900; }
.modal-head p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.close-x { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 24px; cursor: pointer; }
.input-shell.search { background: var(--surface); margin-bottom: 4px; }
.studio-list { overflow-y: auto; padding: 4px 2px calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.studio-block { margin-top: 16px; }
.studio-block h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.lib-tile { display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 10px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s; }
.lib-tile:hover:not(:disabled) { transform: translateY(-2px); }
.lib-tile .thumb { border-radius: 13px; margin-bottom: 6px; }
.lib-tile b { font-size: 13px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tile small { font-size: 12px; padding: 0 2px; font-weight: 800; color: var(--violet); }
.lib-tile.added { cursor: default; opacity: .6; }
.lib-tile.added small { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---------- toasts + confetti ---------- */
#toastRoot { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: max-content; max-width: calc(100% - 32px); }
.toast { padding: 12px 18px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 600; text-align: center; box-shadow: var(--shadow); animation: toastIn .25s ease; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 10px; height: 14px; border-radius: 3px; background: var(--c); transform: rotate(var(--r)); animation: fall 2.2s cubic-bezier(.3,.6,.5,1) var(--d) forwards; }

@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.92); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes fall { to { transform: translateY(110vh) rotate(calc(var(--r) + 540deg)); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r)); } 50% { transform: translateY(-10px) rotate(var(--r)); } }
@keyframes colourIn { 0%, 30% { filter: grayscale(1) contrast(.88) brightness(1.06); } 45%, 80% { filter: none; } 100% { filter: grayscale(1) contrast(.88) brightness(1.06); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .auth-layout { grid-template-columns: 1fr; gap: 8px; max-width: 480px; }
  .auth-hero { order: -1; }
  .hero-stage { width: min(100%, 280px); margin-bottom: 4px; }
  .demo-card { width: 50%; border-radius: 20px; padding: 7px 7px 10px; }
  .demo-meta b { font-size: 14px; }
  .demo-badge { font-size: 12px; padding: 6px 10px; right: -12px; }
  .sticker { border-width: 3px; border-radius: 16px; }
  .next-up { grid-template-columns: 1fr; }
  .next-side { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 18px; }
  .ring { width: 96px; height: 96px; grid-row: span 2; }
  .ring b { font-size: 28px; }
  .goal { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .brand > span { display: none; }
  .auth-panel h1 { font-size: 34px; }
  .brand-lockup { margin-bottom: 14px; }
  .tagline { font-size: 15px; margin: 12px 0 18px; }
  .next-up { margin-top: 14px; padding: 16px; border-radius: 26px; gap: 16px; }
  .next-main { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; column-gap: 16px; row-gap: 2px; align-items: center; }
  .next-thumb { grid-row: 1 / span 2; width: 96px; border-width: 4px; border-radius: 18px; }
  .next-copy { display: contents; }
  .next-copy .eyebrow, .next-copy h1 { grid-column: 2; margin: 0; }
  .next-copy > .eyebrow { grid-row: 1; align-self: end; }
  .next-copy h1 { grid-row: 2; align-self: start; font-size: 30px; }
  .next-lead, .next-progress, .next-copy .primary { grid-column: 1 / -1; }
  .next-lead { margin: 14px 0 0; }
  .next-progress { margin: 10px 0 0; max-width: none; }
  .next-copy .primary { width: 100%; margin-top: 16px; }
  .next-side { padding: 14px; }
  .chapter-head h2 { font-size: 21px; }
  .char-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .add-tile { min-height: 210px; }
  .shelf { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .mini { width: 44px; height: 44px; }
  .char-hero { grid-template-columns: 112px 1fr; gap: 14px; padding: 12px; }
  .shot-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .again { flex-direction: column; align-items: stretch; text-align: center; }
  .choice-grid.cols-3 { gap: 8px; }
  .choice-card { min-height: 130px; padding: 12px 4px; }
  .choice-icon { width: 56px; height: 56px; border-radius: 18px; }
  .choice-icon svg { width: 38px; height: 38px; }
}
@media (min-width: 900px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet { border-radius: 28px; max-height: 84vh; }
}
.url-sharing { padding: 28px 16px 40px; text-align: center; }
