@font-face { font-family: 'Creepster'; src: url('/fonts/creepster.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/fonts/bricolage-grotesque.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/dm-sans.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }

:root {
  --bg: #0D0A12;
  --bg-deep: #07050A;
  --surface: #15111C;
  --card: #1A1522;
  --raised: #221B2C;
  --line: #2E2638;
  --line-2: #3A3046;
  --text: #F4EFE6;
  --muted: #A89FB4;
  --faint: #7A7088;
  --acc: #FF7A1A;
  --acc-ink: #1A0E00;
  --good: #7FD6A4;
  --bad: #FF8F8F;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: #FFB070; }
a:hover { color: #FFD2A8; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.good { color: var(--good); }
.acc-text { color: var(--acc); }

:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }

/* ---------- shell: one screen, never a second page ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  gap: 14px;
  overflow: hidden;
}

.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; flex-shrink: 0; }
.logo { font-family: 'Creepster', cursive; font-size: 30px; letter-spacing: 1px; color: var(--acc); text-decoration: none; line-height: 1; }
.logo:hover { color: var(--acc); }
.top-right { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; gap: 2px; background: var(--card); border-radius: 999px; padding: 4px; }
.lang button { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; border-radius: 999px; min-width: 40px; height: 32px; }
.lang button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.photo-chip { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 4px 12px 4px 4px; }
.photo-chip img { width: 36px; height: 36px; border-radius: 999px; object-fit: cover; background: var(--line-2); }
.link-btn { border: 0; background: none; font-weight: 700; font-size: 13px; min-height: 36px; padding: 0; }
.ready-tag { font-size: 13px; font-weight: 700; color: var(--good); }

.screen { display: none; flex: 1; min-height: 0; flex-direction: column; gap: 16px; overflow-y: auto; overscroll-behavior: contain; }
.app[data-screen="photo"] .screen[data-screen="photo"],
.app[data-screen="template"] .screen[data-screen="template"],
.app[data-screen="brewing"] .screen[data-screen="brewing"],
.app[data-screen="done"] .screen[data-screen="done"],
.app[data-screen="message"] .screen[data-screen="message"] { display: flex; }

h1, h2 { font-family: var(--display); font-weight: 800; margin: 0; }
h1 { font-size: clamp(30px, 9.6vw, 38px); line-height: 1.02; letter-spacing: -0.5px; }
h2 { font-size: 26px; letter-spacing: -0.3px; }
.intro { display: flex; flex-direction: column; gap: 8px; }
.sub { margin: 0; font-size: 16px; line-height: 1.4; color: var(--muted); }
.sub strong { color: var(--text); }

.banner { background: #12261B; color: var(--good); border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 15px; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.steps li { font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 4px; white-space: nowrap; }
.steps li.on { color: var(--bg); background: var(--acc); border-radius: 999px; padding: 6px 12px; }
.steps li.ok { color: var(--good); }
.steps li.line { flex: 1; height: 1px; background: var(--line); padding: 0; }

/* photo drop zone */
.drop {
  flex: 1; min-height: 300px;
  border: 2px dashed var(--line-2); border-radius: 24px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px;
  position: relative;
}
.drop-icon { color: var(--muted); }
.drop-icon .acc { stroke: var(--acc); }
.drop-preview { width: 132px; height: 132px; border-radius: 24px; object-fit: cover; }
.drop-text { text-align: center; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.drop-title { font-family: var(--display); font-weight: 600; font-size: 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.btn {
  height: 56px; border-radius: 16px; border: 0; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--acc); color: var(--acc-ink); }
.btn.primary:hover { color: var(--acc-ink); filter: brightness(1.06); }
.btn.ghost { background: var(--card); border: 1px solid var(--line-2); color: var(--text); }
.btn.light { background: var(--text); color: var(--bg); height: 52px; border-radius: 14px; font-size: 16px; }
.btn:active, .cta:active, .tile:active { transform: scale(0.98); }

.trust { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: var(--muted); margin: 0; flex-shrink: 0; }
.trust svg { flex-shrink: 0; margin-top: 1px; }
.error { color: var(--bad); font-size: 14px; margin: 0; text-align: center; }

/* template picker */
.chips { display: flex; gap: 8px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }

.screen[data-screen="template"] { overflow: hidden; }
.grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; padding-bottom: 4px; }
.card-tpl { border-radius: 18px; padding: 6px; text-align: left; background: var(--surface); border: 2px solid transparent; display: flex; flex-direction: column; }
.card-tpl[aria-pressed="true"] { background: var(--card); border-color: var(--acc); }
.card-tpl:disabled { opacity: 0.55; cursor: not-allowed; }
.thumb { position: relative; width: 100%; aspect-ratio: 3 / 4; flex-shrink: 0; border-radius: 14px; background: var(--raised); overflow: hidden; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pill { position: absolute; background: rgba(13, 10, 18, 0.8); color: var(--text); font-size: 11px; padding: 4px 8px; border-radius: 999px; }
.pill.tag { left: 8px; top: 8px; font-weight: 700; }
.pill.len { right: 8px; bottom: 8px; }
.tpl-name { font-weight: 700; font-size: 14px; padding: 8px 2px 2px; line-height: 1.25; }

.cta-wrap { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.cta {
  height: 58px; border: 0; border-radius: 16px; background: var(--acc); color: var(--acc-ink);
  font-family: var(--display); font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; text-decoration: none; flex-shrink: 0;
}
.cta:hover { color: var(--acc-ink); }
.cta:disabled { opacity: 0.45; cursor: not-allowed; }
.center-cta { justify-content: center; gap: 10px; }
.cta-price { background: var(--acc-ink); color: var(--acc); border-radius: 10px; padding: 6px 10px; font-family: var(--body); font-weight: 700; font-size: 15px; }
.fine { text-align: center; font-size: 12px; line-height: 1.5; color: var(--muted); margin: 0; }
.fine.bottom { margin-top: auto; font-size: 13px; }

/* sheet */
.backdrop { position: fixed; inset: 0; background: rgba(4, 3, 6, 0.72); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet {
  width: 100%; max-width: 480px; background: var(--card); border-radius: 28px 28px 0 0;
  padding: 12px 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px;
  max-height: 92dvh; overflow-y: auto; animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grabber { width: 44px; height: 5px; border-radius: 999px; background: var(--line-2); align-self: center; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 24px; }
.round { width: 44px; height: 44px; border-radius: 999px; border: 0; background: #2A2234; color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.summary { display: flex; gap: 12px; align-items: center; background: var(--raised); border-radius: 16px; padding: 10px; }
.summary img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--line-2); flex-shrink: 0; }
.summary img.tall { width: 42px; border-radius: 10px; }
.sum-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sum-title { font-weight: 700; font-size: 15px; }
.sum-price { font-family: var(--display); font-weight: 800; font-size: 20px; white-space: nowrap; }
.consents { display: flex; flex-direction: column; gap: 12px; }
.consents label { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; cursor: pointer; }
.consents input { width: 22px; height: 22px; margin: 0; accent-color: var(--acc); flex-shrink: 0; }
.sheet input[type="email"], .email-card input {
  height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 16px; padding: 0 16px; width: 100%;
}

/* brewing */
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 4px; }
.ring { position: relative; width: 168px; height: 168px; }
#ringBar { stroke: var(--acc); transition: stroke-dashoffset 0.8s ease; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pct { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; }
.status-list { list-style: none; margin: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border-radius: 18px; font-size: 14px; }
.status-list li { display: flex; justify-content: space-between; gap: 12px; }
.status-list li.muted b { color: var(--muted); font-weight: 400; }
.status-list li.done-row { color: var(--text); }
.status-list li.done-row b { color: var(--good); font-weight: 700; }
.card { display: flex; flex-direction: column; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; font-size: 14px; line-height: 1.4; }
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.email-saved { color: var(--good); font-weight: 700; }

/* done */
.player { position: relative; flex: 1; min-height: 240px; border-radius: 22px; background: var(--raised); overflow: hidden; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .round { position: absolute; right: 12px; bottom: 12px; background: rgba(13, 10, 18, 0.8); }
.ai-tag { position: absolute; left: 12px; top: 12px; background: rgba(13, 10, 18, 0.8); font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex-shrink: 0; }
.tile { height: 64px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--card); color: var(--text); font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.done-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.done-foot a { font-weight: 700; white-space: nowrap; }

/* message */
.message { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 24px 8px; }
.message p { margin: 0; font-size: 15px; line-height: 1.5; }
.message .btn { padding: 0 28px; margin-top: 8px; }
.spinner { width: 48px; height: 48px; border-radius: 999px; border: 4px solid var(--line); border-top-color: var(--acc); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 14px; padding: 12px 18px; border-radius: 999px; z-index: 20;
  max-width: calc(100% - 32px); text-align: center;
}

@media (max-height: 700px) {
  h1 { font-size: 28px; }
  .sub { font-size: 14px; }
  .drop { min-height: 260px; gap: 12px; }
  .drop-icon { width: 64px; height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
