:root {
  --bg: #0F0F0F;
  --surface: #1A1A1A;
  --line: #2A2A2A;
  --coral: #FF4D2E;
  --coral-hover: #FF6B4A;
  --coral-soft: #FF7A5C;
  --lime: #B8FF3C;
  --muted: #8A8A8A;
  --text: #FFFFFF;
  --on-coral: #0F0F0F;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
p { margin: 0; }

.app {
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- header */
.top { display: flex; justify-content: space-between; align-items: center; }
.wordmark { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.top-right { display: flex; gap: 10px; align-items: center; }
.meta { font-size: 13px; font-weight: 500; color: var(--muted); }
.meta b { color: var(--text); font-weight: 600; }
.streak {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--coral);
}

/* ---------- layout */
.screen { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.center-screen { align-items: center; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-xs { display: flex; flex-direction: column; gap: 8px; }
.push-down { margin-top: auto; }
.center { text-align: center; }
.muted { font-size: 14px; color: var(--muted); line-height: 1.5; }
.muted-lg { font-size: 16px; color: var(--muted); line-height: 1.5; }
.white { color: var(--text); }
.eyebrow { font-size: 13px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px 20px; }

/* ---------- play */
.prompt-card { display: flex; flex-direction: column; gap: 14px; padding: 24px 22px; }
.prompt-text { font-size: 31px; font-weight: 700; line-height: 1.12; letter-spacing: -0.025em; }
.meta-line { font-size: 14px; color: var(--muted); }
.meta-line b { color: var(--text); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 10px; }
.field input, .field textarea, .inline-form input {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
  transition: border-color .15s ease;
}
.field textarea { min-height: 132px; resize: none; }
.field input::placeholder, .field textarea::placeholder, .inline-form input::placeholder { color: var(--muted); }
.field input:focus, .field textarea:focus, .inline-form input:focus { outline: none; border-color: var(--coral); }
.field-foot { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--muted); }
.field-foot .over { color: var(--coral); }

.judge { display: flex; flex-direction: column; gap: 8px; }
.judge-list { font-size: 17px; font-weight: 600; }

/* ---------- buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 0 18px;
  border-radius: 16px; border: 1.5px solid transparent;
  font-size: 17px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--coral); color: var(--on-coral); font-weight: 700; }
.btn.primary:hover { background: var(--coral-hover); }
.btn.secondary { background: transparent; border-color: var(--line); color: var(--text); }
.btn.secondary:hover { border-color: var(--coral); }
.btn.small { width: auto; min-height: 48px; font-size: 15px; padding: 0 16px; border-radius: 14px; flex: none; }
.btn:disabled { opacity: .7; cursor: wait; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .link-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; cursor: pointer; }
.link-btn:hover { color: var(--text); }

.error { color: var(--coral); font-size: 14px; font-weight: 600; }

/* ---------- verdict */
.your-line { font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; margin: 0; overflow-wrap: anywhere; }
.your-line::before { content: "\201C"; }
.your-line::after { content: "\201D"; }
.flag-note { background: var(--surface); border: 1px solid var(--coral); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.verdict-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 12px; }
.verdict-head .eyebrow { white-space: nowrap; }
.reaction { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--line); color: var(--lime); }

.bar-row { display: flex; flex-direction: column; gap: 8px; }
.bar-head { display: flex; justify-content: space-between; font-size: 16px; }
.bar-head b { font-weight: 700; }
.bar-head b.high { color: var(--lime); }
.bar { height: 8px; border-radius: 4px; background: var(--line); }
.bar i {
  display: block; height: 100%; max-width: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--coral), var(--coral-soft));
}

.score-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.big-score { position: relative; transform-origin: left bottom; font-size: 56px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.big-score small { font-size: 22px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.rank-tag { font-size: 15px; font-weight: 700; color: var(--lime); padding-bottom: 6px; text-align: right; }

.burst { position: absolute; left: 36px; top: 26px; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 6px; height: 6px; border-radius: 50%; opacity: 0; }
.burst.go i { animation: pop .7s ease-out forwards; }
@keyframes pop {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); }
}

/* ---------- board */
.subhead { display: flex; align-items: center; gap: 8px; }
.subhead h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.icon-btn { width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--text); cursor: pointer; border-radius: 12px; }

.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow-x: auto; }
.tab { flex: 1; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: var(--text); font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); font-weight: 700; }

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.entry { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.entry.me { border: 1.5px solid var(--coral); }
.entry .pos { font-size: 20px; font-weight: 800; min-width: 22px; }
.entry.first .pos { color: var(--lime); }
.entry .body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.entry .line { font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.entry .who { font-size: 13px; color: var(--muted); }
.entry.me .who { color: var(--lime); font-weight: 600; }
.entry .pts { font-size: 16px; font-weight: 800; }
.locked { text-align: center; padding: 32px 16px; border: 1px dashed var(--line); border-radius: 18px; display: flex; flex-direction: column; gap: 6px; }
.locked b { font-size: 17px; }

.league-box { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 20px; background: var(--surface); border: 1px dashed var(--coral); margin-top: auto; }
.league-title { font-size: 17px; font-weight: 700; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { padding: 12px 14px; font-size: 15px; min-width: 0; background: var(--bg); }
.invite { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.invite code { font-family: var(--mono); font-size: 13px; background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }

/* ---------- share */
.share-card { display: flex; flex-direction: column; gap: 18px; padding: 24px 22px; }
.share-top, .share-bottom { display: flex; justify-content: space-between; align-items: baseline; }
.share-top b { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.share-top span { font-size: 13px; font-weight: 600; color: var(--coral); }
.share-prompt { font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.share-bars { font-family: var(--mono); font-size: 15px; line-height: 2; margin: 0; white-space: pre; overflow-x: auto; }
.share-bars .on { color: var(--coral); }
.share-bars .off { color: var(--line); }
.share-bottom { border-top: 1px solid var(--line); padding-top: 16px; }
.share-bottom b { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.share-bottom b small { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.share-bottom span { font-size: 15px; font-weight: 700; color: var(--lime); }
.toast { min-height: 20px; text-align: center; font-size: 14px; color: var(--lime); }

/* ---------- viral hooks */
.challenge-banner { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--coral); color: var(--coral); }
.challenge-who { font-size: 16px; font-weight: 700; color: var(--text); }
.challenge-who .lime { color: var(--lime); }
.proof { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); flex: none; }
.unlock-card { display: flex; flex-direction: column; gap: 12px; border: 1.5px solid var(--line); transition: border-color .5s ease; }
.unlock-card.won { border-color: var(--lime); }
.unlock-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.uc-lock { color: var(--coral); flex: none; transition: color .3s ease, opacity .3s ease .5s; }
.uc-lock .shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .3s cubic-bezier(.2,.9,.3,1.4); }
.uc-lock.shake { animation: shake .24s ease-in-out; }
.uc-lock.open { color: var(--lime); opacity: 0; }
.uc-lock.open .shackle { transform: translateY(-3px) rotate(-32deg); }
.unlock-body { position: relative; min-height: 52px; }
.redact { font-size: 20px; line-height: 1.3; color: #3A3A3A; user-select: none; transition: opacity .35s ease, filter .35s ease; }
.redact.gone { opacity: 0; filter: blur(10px); }
.unlock-body .unlock-line { position: absolute; inset: 0; opacity: 0; filter: blur(8px); transition: opacity .7s ease, filter .7s ease; }
.unlock-body .unlock-line.in { opacity: 1; filter: none; }
.unlock-who { font-size: 14px; font-weight: 600; color: var(--muted); }
.unlock-line { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.unlock-line::before { content: "\201C"; }
.unlock-line::after { content: "\201D"; }
.versus { font-size: 15px; font-weight: 700; color: var(--lime); }

/* ---------- install card */
.install-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 44px 14px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.install-card img { border-radius: 10px; flex: none; }
.install-text { flex: 1; min-width: 0; gap: 2px; }
.install-title { font-size: 15px; font-weight: 700; }
.install-card .muted { font-size: 13px; }
.install-close { position: absolute; top: 2px; right: 2px; margin: 0; color: var(--muted); }

/* ---------- motion: lock it */
.answer-wrap { position: relative; }
#submit-btn:disabled { opacity: 1; cursor: default; } /* locked, not broken: keep full coral */
.seal-lock { position: absolute; top: 14px; right: 14px; color: var(--coral); animation: lockpop .34s cubic-bezier(.2,.9,.3,1.4) both; }
.field textarea.sealed { border-color: var(--coral); color: #D9D9D9; padding-right: 48px; animation: stamp .32s ease-out; }
.prompt-card { transition: opacity .35s ease; }
.prompt-card.dim { opacity: .45; }
.judging { display: flex; flex-direction: column; gap: 14px; animation: fadeup .35s ease-out both; }
.sweep-row { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.sweep-track { position: relative; overflow: hidden; height: 8px; border-radius: 4px; background: var(--line); }
.sweep-track i { position: absolute; top: 0; left: 0; height: 100%; width: 34%; border-radius: 4px; background: linear-gradient(90deg, var(--coral), var(--coral-soft)); animation: sweep 1.1s ease-in-out infinite; }
.sweep-row:nth-child(3) i { animation-delay: .15s; }
.sweep-row:nth-child(4) i { animation-delay: .3s; }
.cook-dots span { display: inline-block; animation: blink 1s infinite; }
.cook-dots span:nth-child(2) { animation-delay: .2s; }
.cook-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes stamp { 0% { transform: scale(1); } 40% { transform: scale(.98); } 100% { transform: scale(1); } }
@keyframes lockpop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeup { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ---------- motion: score reveal (classes added by motion.js) */
.rv { opacity: 0; transform: translateY(10px); }
.rv.in { opacity: 1; transform: none; transition: opacity .35s ease, transform .35s cubic-bezier(.2,.9,.3,1.3); }
.slide { opacity: 0; transform: translateX(24px); }
.slide.in { opacity: 1; transform: none; transition: opacity .3s ease, transform .35s cubic-bezier(.2,.9,.3,1.2); }
.pill { opacity: 0; transform: scale(.6); }
.pill.in { animation: pillpop .42s cubic-bezier(.2,.9,.3,1.5) both; }
.scorepop { animation: scorepop .38s cubic-bezier(.2,.9,.3,1.6); }
@keyframes pillpop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes scorepop { 0% { transform: scale(1); } 45% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* ---------- motion extras */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes flick { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) translateY(-1px); } }
@keyframes flash { 0% { opacity: .18; } 100% { opacity: 0; } }
.streak.pulse { animation: pulse 1.4s ease-in-out 2; }
.flame { animation: flick .9s ease-in-out infinite; transform-origin: 50% 90%; }
.flash { position: fixed; inset: 0; background: var(--coral); pointer-events: none; animation: flash .45s ease-out forwards; }

@media (prefers-reduced-motion: reduce) {
  .burst.go i, .streak.pulse, .flame, .flash, .seal-lock, .field textarea.sealed, .judging,
  .sweep-track i, .cook-dots span, .pill.in, .scorepop, .uc-lock.shake { animation: none; }
  .rv, .slide, .pill { opacity: 1; transform: none; }
  .prompt-card, .uc-lock, .uc-lock .shackle, .redact, .unlock-body .unlock-line, .unlock-card, .rv.in, .slide.in { transition: none; }
  .flash { display: none; }
  .btn:active { transform: none; }
}

/* ---------- games hub */
.hub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hub-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.hero-card, .tile {
  display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text); cursor: pointer;
  font: inherit; transition: transform .12s ease, border-color .15s ease; -webkit-tap-highlight-color: transparent;
}
.hero-card { padding: 20px; border-radius: 20px; }
.hero-card:hover, .tile:hover { border-color: var(--coral); }
.hero-card:active, .tile:active { transform: scale(.98); }
.hero-card:focus-visible, .tile:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero-kicker { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--coral); }
.hero-prompt { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--coral); }
.status.done { color: var(--lime); }
.status.soon { color: var(--muted); }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 16px; border-radius: 18px; border-width: 1px; min-height: 172px; }
.tile svg.game-icon { color: var(--coral); }
.tile .tile-name { font-size: 16px; font-weight: 700; }
.tile .tile-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tile .status { margin-top: auto; }
.tile[aria-disabled="true"] { cursor: default; opacity: .6; }
.tile[aria-disabled="true"]:hover { border-color: var(--line); }
.tile[aria-disabled="true"]:active { transform: none; }
.progress-box { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: 18px; border: 1px dashed var(--line); }
.progress-box.done { border: 1.5px solid var(--lime); }
.progress-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.progress-title { font-size: 15px; font-weight: 700; }
.progress-box.done .progress-title { color: var(--lime); }
.progress-dots { display: flex; gap: 6px; }
.progress-dots span { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.progress-dots span.on { background: var(--lime); }

/* ---------- per-game play screen */
.game-bar h2 { flex: 1; }
.prompt-image { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; background: var(--bg); }
.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.side {
  min-height: 56px; border-radius: 16px; border: 1.5px solid var(--line); background: transparent; color: var(--text);
  font-size: 17px; font-weight: 700; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.side:active { transform: scale(.97); }
.side[aria-checked="true"] { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.side:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.side:disabled { cursor: default; }
.answer-wrap.finish { display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); transition: border-color .15s ease; }
.answer-wrap.finish:focus-within { border-color: var(--coral); }
.finish-opener { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.answer-wrap.finish textarea { min-height: 88px; padding: 0; border: 0; background: transparent; color: var(--coral-hover); font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.answer-wrap.finish textarea:focus { border: 0; }
.answer-wrap.finish textarea.sealed { animation: none; padding-right: 36px; color: #FF8A70; }
.two-words { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two-words input {
  height: 72px; padding: 0 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 22px; font-weight: 700; text-align: center; min-width: 0; transition: border-color .15s ease;
}
.two-words input::placeholder { color: var(--muted); font-weight: 400; font-size: 16px; }
.two-words input:focus { outline: none; border-color: var(--coral); }
.two-words input.sealed { border-color: var(--coral); color: #D9D9D9; animation: stamp .32s ease-out; }
.side-pill { display: inline-block; align-self: flex-start; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--coral); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) { .hero-card, .tile, .side, .two-words input { transition: none; } .two-words input.sealed { animation: none; } }

/* ---------- Jev, the space cat judge (jev.js). Timings: "Jev the space cat" row on the canvas */
.jev svg { display: block; width: 100%; height: auto; overflow: visible; }
.jev [data-e], .jev [data-m] { display: none; }
.jev[data-mood="neutral"] [data-e="normal"], .jev[data-mood="neutral"] [data-m="w"],
.jev[data-mood="cooked"] [data-e="sparkle"], .jev[data-mood="cooked"] [data-m="open"],
.jev[data-mood="mid"] [data-e="content"], .jev[data-mood="mid"] [data-m="smirk"],
.jev[data-mood="low"] [data-e="flat"], .jev[data-mood="low"] [data-m="flat"],
.jev[data-mood="stern"] [data-e="stern"], .jev[data-mood="stern"] [data-m="frown"] { display: inline; }
.jev { --la: var(--coral); --lb: var(--lime); }
.jev[data-mood="cooked"] { --la: var(--lime); --lb: var(--lime); }
.jev[data-mood="low"] { --lb: #3A3A3A; }
.jev[data-mood="stern"] { --lb: var(--coral); }
.jev .jev-la { fill: var(--la); }
.jev .jev-lb { fill: var(--lb); }
.jev .jev-whisker { stroke: #FFFFFF; stroke-width: 1.2; opacity: .7; stroke-linecap: round; }
.jev-blink { animation: jev-blink 1.2s steps(1) infinite; }
.jev-blink2 { animation: jev-blink 1.2s steps(1) .6s infinite; }
@keyframes jev-blink { 0% { opacity: 1; } 50% { opacity: .25; } }
.jev-float { animation: jev-float 3s ease-in-out infinite; }
@keyframes jev-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.jev-stage { position: relative; height: 210px; flex: none; }
.jev-stage.small { height: 150px; }
.jev-stars { position: absolute; inset: 0; pointer-events: none; }
.jev-stars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #FFFFFF; opacity: .35; }
.jev-ufo { position: absolute; left: 50%; top: 4px; width: 180px; margin-left: -90px; }
.jev-stage.small .jev-ufo { width: 130px; margin-left: -65px; }
.jev-beam {
  position: absolute; left: 50%; top: 122px; width: 200px; margin-left: -100px; height: 220px; pointer-events: none;
  background: linear-gradient(180deg, rgba(184, 255, 60, .42), rgba(184, 255, 60, 0));
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0; transform: scaleY(0); opacity: 0; transition: transform .35s ease, opacity .35s ease;
}
.jev-beam.on { transform: scaleY(1); opacity: 1; }
.jev-stage.small .jev-beam { top: 92px; width: 150px; margin-left: -75px; height: 110px; }
.jev-beam.sweep { animation: jev-sweep 2.4s ease-in-out infinite; }
@keyframes jev-sweep { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }
#judging .jev-pupils { animation: jev-look 2.4s ease-in-out infinite; }
@keyframes jev-look { 0%, 100% { transform: translateX(-2.4px); } 50% { transform: translateX(2.4px); } }
.jev-status { text-align: center; font-size: 16px; font-weight: 700; min-height: 24px; }

.jev-bubble {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: max-content; max-width: 100%;
  padding: 10px 16px; border-radius: 16px; background: var(--surface); border: 1px solid #4A4A4A;
  font-size: 15px; font-weight: 700; text-align: center;
}
.jev-bubble::before {
  content: ""; position: absolute; left: 50%; top: -7px; width: 12px; height: 12px; margin-left: -6px;
  background: var(--surface); border-left: 1px solid; border-top: 1px solid; border-color: inherit; transform: rotate(45deg);
}
.jev-bubble[data-mood="cooked"] { color: var(--lime); border-color: var(--lime); }
.jev-bubble[data-mood="low"], .jev-bubble[data-mood="stern"] { color: var(--coral-soft); border-color: var(--coral); }

/* Entry and reactions (classes set by jev.js) */
.jev-pre { opacity: 0; }
.jev-enter { animation: jev-enter .8s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes jev-enter { 0% { opacity: 0; transform: translate(170px, -200px) rotate(24deg) scale(.6); } 100% { opacity: 1; transform: none; } }
.jev-loop { animation: jev-loop .95s cubic-bezier(.45,0,.3,1) both; transform-origin: 50% 190%; }
@keyframes jev-loop { 0% { transform: rotate(0); } 100% { transform: rotate(-360deg); } }
.jev-nod { animation: jev-nod 1.1s ease-in-out both; transform-origin: 50% 80%; }
@keyframes jev-nod { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(7deg); } 55% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
.jev-sputter { animation: jev-sputter 1.2s ease-in-out both; transform-origin: 50% 60%; }
@keyframes jev-sputter {
  0% { transform: none; } 15% { transform: translate(-5px, 2px) rotate(-6deg); } 30% { transform: translate(5px, 6px) rotate(7deg); }
  45% { transform: translate(-4px, 14px) rotate(-5deg); } 65% { transform: translate(3px, 26px) rotate(10deg); } 100% { transform: translate(0, 18px) rotate(9deg); }
}
.jev-limp { transform: translate(0, 18px) rotate(9deg); transform-origin: 50% 60%; }
.jev-confetti { position: absolute; left: 50%; top: 100px; width: 0; height: 0; pointer-events: none; }
.jev-confetti i { position: absolute; width: 7px; height: 7px; border-radius: 50%; opacity: 0; }
.jev-confetti.go i { animation: jev-burst .8s ease-out forwards; }
@keyframes jev-burst { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); } }
.jev-smoke { position: absolute; left: calc(50% + 70px); top: 100px; width: 0; height: 0; pointer-events: none; }
.jev-smoke i { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #4A4A4A; opacity: 0; }
.jev-smoke.go i { animation: jev-puff 1.4s ease-out forwards; }
@keyframes jev-puff { 0% { opacity: .8; transform: translate(0, 0) scale(.5); } 100% { opacity: 0; transform: translate(var(--dx), -50px) scale(1.8); } }
#your-line { position: relative; z-index: 2; }
.jev-abduct { animation: jev-abduct 1.3s cubic-bezier(.5,0,.8,.4) forwards; }
@keyframes jev-abduct { 0% { transform: none; opacity: 1; } 15% { transform: translateY(6px) rotate(-2deg); } 100% { transform: translateY(-250px) rotate(8deg) scale(.12); opacity: 0; } }
.your-line.beamed { color: var(--muted); font-style: italic; font-size: 18px; animation: fadeup .35s ease-out both; }

.hub-head h2 { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.hub-head .meta { white-space: nowrap; }
.jev-mini { display: inline-block; width: 34px; height: 34px; flex: none; }
.jev-mini svg { overflow: hidden; animation: jev-float 3s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .jev-blink, .jev-blink2, .jev-float, .jev-beam.sweep, #judging .jev-pupils, .jev-enter, .jev-loop, .jev-nod,
  .jev-sputter, .jev-abduct, .jev-confetti.go i, .jev-smoke.go i, .jev-mini svg, .your-line.beamed { animation: none; }
  .jev-beam { transition: none; }
  .jev-pre { opacity: 1; }
}

/* ---------- credits, retries, profile */
.coin circle { fill: var(--surface); stroke: var(--lime); stroke-width: 2; }
.coin path { fill: var(--lime); }
.credits-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--lime); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.credits-pill:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.retry-badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--coral-soft);
  color: var(--coral-soft); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.r-eyebrow { display: flex; align-items: center; gap: 10px; }
.retry-compare { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); font-size: 14px; }
.retry-compare span { color: var(--muted); }
#retry-btn { gap: 8px; }
.btn.lime { background: var(--lime); color: var(--bg); font-weight: 700; gap: 8px; }
.btn.lime:hover { background: #C8FF63; }
.btn:disabled { opacity: .5; cursor: default; }

.profile-id { display: flex; align-items: center; gap: 14px; }
.jev-avatar { display: inline-block; width: 56px; height: 56px; flex: none; border-radius: 50%; background: #16232C; overflow: hidden; }
.jev-avatar svg { overflow: hidden; }
.profile-handle { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.stat b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.coral { color: var(--coral); }
.lime { color: var(--lime); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.credits-card { border: 1.5px solid var(--lime); }
.credit-balance { position: relative; display: flex; align-items: center; gap: 10px; }
.credit-balance b { font-size: 44px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.plus-one { font-size: 18px; font-weight: 800; color: var(--lime); opacity: 0; }
.plus-one.go { animation: plusone 1s ease-out both; }
@keyframes plusone { 0% { opacity: 0; transform: translateY(8px); } 30% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-14px); } }
#pf-toast { text-align: left; min-height: 0; }
.shop-row { display: flex; align-items: center; gap: 14px; }
.shop-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--bg); color: var(--coral); display: flex; align-items: center; justify-content: center; }
.shop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-name { font-size: 16px; font-weight: 700; }
.price-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 14px; flex: none;
  border: 1.5px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.price-btn:hover { border-color: var(--lime); }
.price-btn:disabled { opacity: .45; cursor: default; }
.price-btn:disabled:hover { border-color: var(--line); }
.price-btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.shop-row.soon { opacity: .6; }
.soon-tag { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 6px; }

/* Bottom sheets (native <dialog>: focus stays inside, Esc closes) */
dialog.sheet {
  width: min(440px, 100%); max-width: 100%; margin: auto auto 0; padding: 20px 20px calc(28px + env(safe-area-inset-bottom));
  border: 0; border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text);
  flex-direction: column; gap: 16px;
}
dialog.sheet[open] { display: flex; animation: sheetup .35s cubic-bezier(.2,.9,.3,1) both; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .6); }
@keyframes sheetup { 0% { transform: translateY(100%); } 100% { transform: none; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-head .jev-avatar { width: 52px; height: 52px; }
.sheet-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.check-list li { position: relative; padding-left: 28px; font-size: 15px; color: #CFCFCF; line-height: 1.4; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 3px; width: 12px; height: 7px; border-left: 3px solid var(--lime); border-bottom: 3px solid var(--lime); transform: rotate(-45deg); }
.check-list b { color: var(--text); }
.credit-math { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-size: 15px; }
.credit-math > span:last-child { display: inline-flex; align-items: center; gap: 6px; }

/* Stand-in ad (local testing only) */
.demo-ad { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; gap: 16px; padding: calc(20px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom)); background: #000; }
.demo-ad[hidden] { display: none; }
.ad-label { padding: 4px 8px; border-radius: 6px; background: #FFFFFF; color: #000000; font-size: 12px; font-weight: 800; }
.skip-btn { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid #4A4A4A; background: transparent; color: #CFCFCF; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.demo-ad-body { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; border-radius: 16px; border: 1.5px dashed #4A4A4A; color: var(--muted); font-size: 15px; line-height: 1.5; }
.demo-ad-left { font-size: 15px; font-weight: 700; }
.demo-track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.demo-track i { display: block; height: 100%; width: 0; background: var(--lime); transition: width 1s linear; }

@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open], .plus-one.go { animation: none; }
  .demo-track i { transition: none; }
}
.rank-tag.down { color: var(--muted); }
.retry-badge.small { padding: 1px 7px; font-size: 10px; border-width: 1px; vertical-align: 1px; }
