:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --line: #2a2a2f;
  --text: #ffffff;
  --muted: #a8a8b3;
  --gold: #caa356;
  --gold-2: #e3c27a;
  --gold-dim: rgba(202, 163, 86, 0.14);
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.45; min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
h1, h2, h3, .bebas { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; letter-spacing: 0.04em; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
.brand { display: flex; align-items: center; gap: 10px; line-height: 1; }
.brand .logo { height: 52px; width: auto; display: block; }
.brand b { font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 26px; letter-spacing: 0.08em; color: var(--gold); }
.brand span { font-family: "Bebas Neue", sans-serif; font-size: 24px; letter-spacing: 0.06em; color: var(--gold); line-height: 0.95; max-width: 110px; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; }

/* screens */
[data-screen] { display: none; animation: fade 0.25s ease; }
[data-screen].on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.gold { color: var(--gold); }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { height: 16px; }

/* buttons */
.btn {
  min-height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 0 20px; font-weight: 600; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.btn.gold { background: var(--gold); border-color: var(--gold); color: #111; }
.btn.gold:active { background: var(--gold-2); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; }
.linkish { background: none; border: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; min-height: 44px; font-size: 15px; }

.start {
  width: 100%; height: 200px; border-radius: 28px; border: 0; margin-top: 18px;
  background: radial-gradient(120% 140% at 50% 0%, #e7c983 0%, var(--gold) 45%, #9c7a37 100%);
  color: #111; font-family: "Bebas Neue", sans-serif; font-size: 72px; letter-spacing: 0.08em;
  box-shadow: 0 18px 50px -18px rgba(202, 163, 86, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s ease;
}
.start:active { transform: scale(0.98); }
.start small { display: block; font-family: "Inter", sans-serif; font-size: 15px; letter-spacing: 0.02em; font-weight: 600; opacity: 0.75; margin-top: -6px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
.chip.gold { border-color: rgba(202, 163, 86, 0.5); background: var(--gold-dim); color: var(--gold-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* profile */
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); border: 2px solid var(--gold); display: grid; place-items: center; font-weight: 700; color: var(--gold); font-size: 18px; overflow: hidden; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; border-width: 1.5px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: "Bebas Neue", sans-serif; font-weight: 400; font-size: 30px; color: var(--gold); line-height: 1; }
.stat span { font-size: 12px; color: var(--muted); }

/* round */
.round-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 12px; }
.seller { position: relative; padding: 22px 18px; }
.seller .who { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.seller .quote { font-size: 23px; line-height: 1.35; font-weight: 600; margin-top: 10px; }
.seller .quote.hidden-text { color: var(--muted); font-weight: 500; font-size: 18px; }
.wave { display: inline-flex; gap: 3px; height: 14px; align-items: flex-end; }
.wave i { width: 3px; background: var(--gold); border-radius: 2px; animation: wv 0.9s infinite ease-in-out; }
.wave i:nth-child(2) { animation-delay: 0.15s; } .wave i:nth-child(3) { animation-delay: 0.3s; } .wave i:nth-child(4) { animation-delay: 0.45s; }
@keyframes wv { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.wave.off i { animation: none; height: 4px; opacity: 0.4; }

.mic-zone { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 26px; }
.mic {
  width: 132px; height: 132px; border-radius: 50%; border: 0; background: var(--gold); color: #111; display: grid; place-items: center;
  box-shadow: 0 0 0 0 rgba(202, 163, 86, 0.5); transition: transform 0.12s;
}
.mic svg { width: 54px; height: 54px; }
.mic.rec { background: #ef4444; color: #fff; animation: pulse 1.4s infinite; }
.mic:active { transform: scale(0.96); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); } 100% { box-shadow: 0 0 0 26px rgba(239, 68, 68, 0); } }
.timer { font-family: "Bebas Neue", sans-serif; font-size: 40px; letter-spacing: 0.06em; line-height: 1; }
.meter { width: 100%; max-width: 320px; height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--good)); transition: width 0.06s linear; }
.hint { color: var(--muted); font-size: 15px; text-align: center; min-height: 22px; }

/* grading */
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; margin: 40px auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* result */
.score-hero { text-align: center; padding: 22px 18px 18px; }
.score-hero .big { font-family: "Bebas Neue", sans-serif; font-size: 108px; line-height: 0.9; color: var(--gold); }
.score-hero .big small { font-size: 40px; color: var(--muted); }
.heard { font-size: 16px; line-height: 1.5; color: #e5e5ea; font-style: italic; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 15px; }
.bar-row .track { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.bar-row .track i.low { background: var(--bad); } .bar-row .track i.mid { background: var(--warn); } .bar-row .track i.full { background: var(--good); }
.tone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.tone-grid span b { color: var(--text); font-weight: 600; }
.tip h3 { font-size: 26px; color: var(--gold); margin-bottom: 8px; }
.tip p { margin: 8px 0; }
.tip .label { font-weight: 700; color: var(--gold-2); }
.tip ul { margin: 6px 0; padding-left: 20px; }
.tip li { margin: 6px 0; }
.tip .say { background: var(--surface-2); border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 8px; margin: 6px 0; }
.praise { margin: 0 0 10px; font-weight: 600; color: var(--good); }
.ways { margin: 4px 0 8px; padding-left: 18px; font-size: 15px; } .ways li { margin: 4px 0; }
.upgrade { border-color: rgba(202, 163, 86, 0.6); background: linear-gradient(180deg, var(--gold-dim), transparent); }
.sticky-next { position: sticky; bottom: 12px; margin-top: 16px; z-index: 5; }

/* leaderboard */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.tab.on { background: var(--gold); color: #111; border-color: var(--gold); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin: 12px 0; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lb li { display: grid; grid-template-columns: 34px auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.lb li.me { border-color: var(--gold); background: linear-gradient(90deg, var(--gold-dim), var(--surface)); }
.lb .rk { font-family: "Bebas Neue", sans-serif; font-size: 26px; color: var(--muted); text-align: center; }
.lb li:nth-child(1) .rk { color: var(--gold); }
.lb .nm { min-width: 0; }
.lb .nm b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb .badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.lb .badge { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--gold-dim); color: var(--gold-2); white-space: nowrap; }
.lb .val { font-family: "Bebas Neue", sans-serif; font-size: 30px; color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: none; z-index: 40; }
.sheet-bg.on { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform 0.25s ease;
  max-width: 600px; margin: 0 auto;
}
.sheet.on { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { font-size: 32px; margin-bottom: 10px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: var(--surface-2); }
.opt input { accent-color: var(--gold); width: 22px; height: 22px; }
.field { width: 100%; min-height: 56px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 14px; font: inherit; }
.field:focus { outline: 2px solid var(--gold); border-color: transparent; }
textarea.field { min-height: 130px; resize: vertical; }
select.field { appearance: none; }
.err { color: var(--bad); font-size: 15px; min-height: 22px; margin: 8px 0; }

/* feedback */
.fb-fab {
  min-height: 40px; padding: 0 11px; border-radius: 12px; font-size: 13px !important; border: 1px solid rgba(202, 163, 86, 0.6);
  background: var(--gold-dim); color: var(--gold-2); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.fb-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.fb-kind button { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.fb-kind button.on { border-color: var(--gold); background: var(--gold-dim); color: var(--gold-2); }
.fb-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.fb-item .st { font-size: 12px; font-weight: 700; }
.fb-item .reply { margin-top: 6px; color: var(--gold-2); }

.toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--gold); padding: 12px 18px; border-radius: 14px; z-index: 60; font-weight: 600; display: none; max-width: calc(100% - 32px); text-align: center; }
.toast.on { display: block; animation: fade 0.2s; }

@media (min-width: 700px) {
  .wrap { padding-top: 12px; }
  .start { height: 220px; }
}
@media (max-width: 400px) {
  .hide-sm { display: none; }
  .brand .logo { height: 44px; }
  .brand span { font-size: 20px; max-width: 90px; }
}

/* conversation */
.chat { display: grid; gap: 8px; margin-top: 12px; }
.bubble { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.4; }
.bubble b { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 2px; opacity: 0.75; }
.bubble.seller { background: var(--surface-2); border: 1px solid var(--line); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.agent { background: var(--gold-dim); border: 1px solid rgba(202, 163, 86, 0.45); justify-self: end; border-bottom-right-radius: 4px; }
.mic:disabled { opacity: 0.5; }
details.full { margin-top: 10px; font-size: 15px; }
details.full summary { color: var(--gold); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.mic-label { font-weight: 800; letter-spacing: 0.12em; font-size: 15px; color: var(--muted); margin-top: -4px; }
.mic-label.on { color: #ef4444; }
.quote-card { margin: 16px 0 0; padding: 16px 18px; border-left: 3px solid var(--gold); background: linear-gradient(90deg, var(--gold-dim), transparent); border-radius: 0 14px 14px 0; }
.quote-card blockquote { margin: 0; font-size: 17px; line-height: 1.45; font-style: italic; color: #f1f1f4; }
.quote-card figcaption { margin-top: 8px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.quote-card figcaption::before { content: "— "; }

/* is this you? */
.retry-title { font-family: Inter, system-ui, sans-serif !important; font-weight: 700; font-size: 22px !important; letter-spacing: 0; margin: 8px 0 4px; }
.who-card { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; padding: 14px; margin-top: 12px; border-radius: 18px; border: 1px solid var(--gold); background: linear-gradient(90deg, var(--gold-dim), var(--surface)); }
.who-card img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex: none; }
.who-card b { display: block; font-size: 21px; }
.who-card small { color: var(--gold-2); font-size: 15px; font-weight: 600; }

/* START: smaller, styled like a gold banknote ($ engraving, inner border, corner medallions) */
.start {
  position: relative; overflow: hidden; height: 140px; font-size: 58px; border-radius: 22px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Ctext x='6' y='26' font-family='Georgia,serif' font-size='20' font-weight='700' fill='%23000' fill-opacity='0.08'%3E%24%3C/text%3E%3Ctext x='38' y='58' font-family='Georgia,serif' font-size='20' font-weight='700' fill='%23000' fill-opacity='0.08'%3E%24%3C/text%3E%3Cpath d='M0 32 Q16 22 32 32 T64 32' stroke='%23000' stroke-opacity='0.05' fill='none'/%3E%3C/svg%3E"),
    radial-gradient(120% 140% at 50% 0%, #ecd18f 0%, var(--gold) 45%, #94722f 100%);
}
.start::before { content: ""; position: absolute; inset: 7px; border: 1.5px solid rgba(0, 0, 0, 0.22); border-radius: 16px; pointer-events: none; }
.start::after {
  content: "$"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.25); display: grid; place-items: center;
  font-family: Georgia, serif; font-size: 26px; font-weight: 700; color: rgba(0, 0, 0, 0.35); letter-spacing: 0;
}
.start .medal-r {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.25); display: grid; place-items: center; font-family: Georgia, serif; font-size: 26px; font-weight: 700; color: rgba(0, 0, 0, 0.35); letter-spacing: 0;
}
.start small { margin-top: -2px; }
@media (min-width: 700px) { .start { height: 150px; } }

/* ---- one type scale: 14 small / 17 body / 20 emphasis / Bebas for headings ---- */
:root { --fs-sm: 14px; --fs-md: 17px; --fs-lg: 20px; }
body { font-size: var(--fs-md); }
.small, .muted.small, .chip, .tab, .tone-grid, .fb-item, .stat span, .linkish, .hint, details.full { font-size: var(--fs-sm); }
.btn, .tip p, .say, .bubble, .quote-card blockquote, .ways, .field, .opt { font-size: var(--fs-md); }
.seller .quote { font-size: var(--fs-lg); }
.seller .quote.hidden-text { font-size: var(--fs-md); }
.who-card b, .lb .nm b { font-size: var(--fs-md); }
h1 { font-size: 44px !important; } h2 { font-size: 32px !important; }
.tip h3 { display: none; }
.label { font-size: var(--fs-md); }

/* ---- result: level, step rows, tone chips ---- */
.score-hero { text-align: center; }
.tier-emoji { font-size: 56px; line-height: 1.1; margin-top: 4px; }
.tier { font-family: "Bebas Neue", sans-serif; font-size: 56px; line-height: 1; color: var(--gold); letter-spacing: 0.04em; }
.score-line { font-size: var(--fs-md); color: var(--text); margin-top: 6px; font-weight: 600; }
.tier-line { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-top: 4px; }
.steps { display: grid; gap: 8px; }
.step { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.step-ico { font-size: 20px; text-align: center; }
.step-name { font-weight: 600; font-size: var(--fs-md); }
.step-name small { display: block; font-weight: 500; color: var(--muted); font-size: var(--fs-sm); }
.step-mark { font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; }
.step.good { border-color: rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.08); } .step.good .step-mark { color: var(--good); }
.step.ok { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); } .step.ok .step-mark { color: var(--warn); }
.step.warn { border-color: rgba(251, 146, 60, 0.45); background: rgba(251, 146, 60, 0.08); } .step.warn .step-mark { color: #fb923c; }
.step.bad { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); } .step.bad .step-mark { color: var(--bad); }
.tone-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tchip { font-size: var(--fs-sm); font-weight: 600; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.tchip small { font-weight: 500; opacity: 0.8; }
.tchip.good { color: var(--good); border-color: rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.08); }
.tchip.ok { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.07); }
.tchip.bad { color: var(--bad); border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.08); }
.tip .label { margin: 12px 0 4px; }

/* score out of 10 first, level word under it; steps show points + bar */
.score-hero .big { font-family: "Bebas Neue", sans-serif; font-size: 96px; line-height: 0.9; color: var(--gold); margin-top: 6px; }
.score-hero .big small { font-size: 36px; color: var(--muted); }
.tier-line-big { font-family: "Bebas Neue", sans-serif; font-size: 30px; letter-spacing: 0.04em; color: var(--text); margin-top: 2px; }
.score-line { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; margin-top: 4px; }
.step { grid-template-columns: 32px 1fr auto; row-gap: 6px; }
.step-pts { font-weight: 700; font-size: var(--fs-md); white-space: nowrap; }
.step-pts small { font-weight: 500; color: var(--muted); font-size: var(--fs-sm); }
.step-bar { grid-column: 2 / -1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.step-bar i { display: block; height: 100%; border-radius: 99px; background: currentColor; }
.step.good .step-bar i { background: var(--good); } .step.ok .step-bar i { background: var(--warn); }
.step.warn .step-bar i { background: #fb923c; } .step.bad .step-bar i { background: var(--bad); }
.step.good .step-pts { color: var(--good); } .step.ok .step-pts { color: var(--warn); } .step.warn .step-pts { color: #fb923c; } .step.bad .step-pts { color: var(--bad); }
