/* =========================================================
   Jala Wrapped 2026 — look & feel prototype
   ========================================================= */

:root {
  --ink: #161412;
  --ink-2: #201E1C;           /* Jala logo colour */
  --paper: #F4EFE6;
  --paper-dim: rgba(244, 239, 230, .62);
  --line: rgba(244, 239, 230, .14);
  --glass: rgba(244, 239, 230, .07);
  --accent: #B79CFF;
  --good: #C6F432;
  --bad: #FF4F1F;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  --radius: 22px;
  --pad: 22px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  display: grid;
  place-items: center;
}

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Ambient background ---------- */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.blob {
  position: absolute;
  width: 80vmax; height: 80vmax;
  border-radius: 50%;
  color: var(--accent);
  background: radial-gradient(closest-side, currentColor, transparent);
  opacity: .32;
  transition: color 1.2s ease;
  will-change: transform;
}
.b1 { top: -35vmax; left: -30vmax; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { bottom: -40vmax; right: -30vmax; opacity: .26; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { top: 30%; left: 40%; width: 50vmax; height: 50vmax; opacity: .14; color: #FF8FD8; animation: drift3 30s ease-in-out infinite alternate; }

@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, -10vmax) scale(.9); } }
@keyframes drift3 { to { transform: translate(-30vmax, -20vmax) scale(1.3); } }

.grain {
  position: fixed; inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-2%, -1%); }
}

/* ---------- Stage (phone on mobile, framed card on desktop) ---------- */
.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  container-type: size;
  container-name: stage;
}
#app { position: absolute; inset: 0; }

@media (min-width: 720px) and (min-height: 600px) {
  .stage {
    height: min(880px, calc(100vh - 48px));
    height: min(880px, calc(100dvh - 48px));
    border-radius: 36px;
    background: rgba(22, 20, 18, .5);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    backdrop-filter: blur(24px) saturate(140%);
    box-shadow: 0 50px 140px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .09);
  }
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(18px, env(safe-area-inset-top)) var(--pad) max(20px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.solid { background: var(--accent); color: var(--ink); }

/* ---------- Type ---------- */
.display {
  margin: 0;
  font-weight: 900;
  font-stretch: 100%;
  font-size: 56px;
  font-size: clamp(40px, 14cqi, 70px);
  line-height: .9;
  letter-spacing: -.025em;
}
.display-2 {
  margin: 0;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 34px;
  font-size: clamp(28px, 8.6cqi, 42px);
  line-height: .98;
  letter-spacing: -.02em;
}
.sub { margin: 14px 0 0; font-size: 16px; line-height: 1.4; color: var(--paper-dim); max-width: 34ch; }
.sub strong { color: var(--paper); font-weight: 700; }
.fine { margin: 12px 0 0; font-size: 13px; color: var(--paper-dim); text-align: center; }
.fine strong { color: var(--paper); }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* Kinetic words */
.kinetic .w {
  display: inline-block;
  animation: wordIn .9s var(--spring) both;
  animation-delay: calc(var(--d, 0ms) + var(--i) * 70ms);
  transform-origin: 50% 100%;
}
@keyframes wordIn {
  0%   { opacity: 0; transform: translateY(55%) scaleY(1.5); font-stretch: 62%; }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; font-stretch: 100%; }
}
.display-2.kinetic .w { animation-name: wordIn2; }
@keyframes wordIn2 {
  0%   { opacity: 0; transform: translateY(55%) scaleY(1.4); font-stretch: 62%; }
  100% { opacity: 1; transform: none; font-stretch: 85%; }
}

/* ---------- Top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.logo { height: 24px; width: auto; display: block; }
.tag {
  font-size: 11px; font-weight: 800; letter-spacing: .16em;
  padding: 7px 10px; border-radius: 99px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 0 28px; border-radius: 99px;
  font-weight: 800; font-size: 18px; letter-spacing: -.01em; font-stretch: 95%;
  text-decoration: none;
  transition: transform .45s var(--spring), background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.94); }
.btn:focus-visible, .ans:focus-visible, .chip:focus-visible, .field input:focus-visible, .linkbtn:focus-visible {
  outline: 3px solid var(--paper); outline-offset: 3px;
}
.btn.primary { background: var(--accent); color: var(--ink); box-shadow: 0 10px 40px -10px var(--accent); }
.btn.primary:hover { transform: translateY(-2px) scale(1.02); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.block { width: 100%; }
.btn .arrow { transition: transform .4s var(--spring); }
.btn:hover .arrow { transform: translateX(4px); }

.chip {
  appearance: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 0 16px; border-radius: 99px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; font-weight: 700; color: var(--paper-dim);
  display: inline-flex; align-items: center; gap: 8px;
}
.chip[aria-pressed="true"] { color: var(--ink); background: var(--paper); }

.linkbtn {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--paper-dim); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
  padding: 10px; margin: 6px auto 0; display: block;
}

/* ---------- Intro ---------- */
.intro-art {
  position: relative;
  flex: 1 1 auto;
  min-height: 180px;
  display: grid;
  place-items: center;
  margin: 8px 0 4px;
}
.hero-flower {
  width: min(84cqi, 46cqh);
  height: min(84cqi, 46cqh);
  max-width: 400px; max-height: 400px;
  overflow: visible;
  animation: heroIn 1.4s var(--spring) both;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .35));
}
@keyframes heroIn { from { transform: scale(0) rotate(-120deg); } to { transform: none; } }
.year {
  position: absolute;
  font-weight: 900;
  font-size: 26cqi;
  font-size: calc(min(84cqi, 46cqh) * .3);
  line-height: 1;
  color: var(--ink);
  letter-spacing: -.04em;
  animation: yearIn 1.2s .35s var(--spring) both, breathe 4s 1.6s ease-in-out infinite alternate;
}
@keyframes yearIn { from { opacity: 0; transform: scale(.4); font-stretch: 125%; } to { opacity: 1; transform: none; font-stretch: 68%; } }
@keyframes breathe { from { font-stretch: 68%; } to { font-stretch: 92%; } }
.intro-copy { flex: 0 0 auto; }
.intro-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.intro-actions .btn { flex: 1; }

/* ---------- Question ---------- */
.qhead { display: flex; flex-direction: column; gap: 14px; }
.progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 6px; align-items: center; }
.seg { height: 26px; display: grid; place-items: center; }
.seg::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(244, 239, 230, .22);
}
.seg.now::before { width: 12px; height: 12px; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.seg.done::before { display: none; }
.seg.fresh svg { animation: segPop .8s var(--spring) both; }
@keyframes pulse { 50% { transform: scale(1.45); opacity: .6; } }
@keyframes segPop { from { transform: scale(0) rotate(-180deg); } to { transform: none; } }

.meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.meta .qnum { color: var(--paper-dim); letter-spacing: .06em; }
.meta .right { display: flex; gap: 8px; align-items: center; }
.pill { padding: 6px 11px; border-radius: 99px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; }
.pill.hot { background: var(--bad); color: var(--ink); box-shadow: none; animation: segPop .6s var(--spring) both; }
.pill.x2 { background: var(--good); color: var(--ink); box-shadow: none; }

.qbody { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 10px 0 16px; min-height: 0; }

.timer {
  position: relative;
  width: 124px; height: 124px;
  width: clamp(92px, 32cqi, 140px); height: clamp(92px, 32cqi, 140px);
  align-self: center;
  display: grid; place-items: center;
  animation: heroIn .9s var(--spring) both;
}
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.t-track { fill: none; stroke: var(--line); stroke-width: 3; }
.t-ring { fill: none; stroke: var(--paper); stroke-width: 3.5; stroke-linecap: round; }
.t-shape { fill: var(--accent); transition: fill .3s; }
.t-num {
  position: relative;
  font-weight: 900; font-stretch: 80%;
  font-size: 40px; font-size: clamp(30px, 11cqi, 48px);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.timer.urgent .t-shape { fill: var(--bad); }
.timer.urgent svg { animation: shudder .25s linear infinite; }
.timer.done { animation: timerOut .5s var(--out) forwards; }
@keyframes shudder {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(1px, -1px) rotate(-1.5deg); }
  75% { transform: translate(-1px, 1px) rotate(1.5deg); }
}
@keyframes timerOut { to { transform: scale(.85); opacity: .5; } }

.cat { margin: 0; text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.question {
  margin: 0; text-align: center;
  font-weight: 800; font-stretch: 88%;
  font-size: 28px; font-size: clamp(23px, 7.4cqi, 36px);
  line-height: 1.04; letter-spacing: -.02em;
  text-wrap: balance;
}

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 0 0 auto; }
.ans {
  appearance: none; border: 0; cursor: pointer;
  position: relative;
  min-height: 92px; min-height: clamp(78px, 13cqh, 108px);
  padding: 12px 14px 14px;
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--paper);
  text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  font-weight: 800; font-stretch: 90%;
  font-size: 19px; font-size: clamp(16px, 5cqi, 22px);
  line-height: 1.05; letter-spacing: -.01em;
  animation: ansIn .7s var(--spring) both;
  animation-delay: calc(250ms + var(--i) * 70ms);
  transition: transform .4s var(--spring), background .2s, color .2s, box-shadow .2s, opacity .3s;
  overflow-wrap: anywhere;
}
@keyframes ansIn { from { opacity: 0; transform: translateY(30px) scale(.9); } to { opacity: 1; transform: none; } }
@media (hover: hover) { .ans:hover:not(:disabled) { background: rgba(244, 239, 230, .13); transform: translateY(-2px); } }
.ans:active:not(:disabled) { transform: scale(.95); }
.ans:disabled { cursor: default; }
.ans .key {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; font-stretch: 100%;
  background: var(--accent); color: var(--ink);
}
.ans.picked { transform: scale(1.03); }
.ans.correct { background: var(--good); color: var(--ink); box-shadow: 0 16px 50px -12px var(--good); transform: scale(1.04); }
.ans.correct .key, .ans.wrong .key { background: var(--ink); color: var(--paper); }
.ans.wrong { background: var(--bad); color: var(--ink); animation: shake .5s both; }
.ans.was-correct { box-shadow: inset 0 0 0 3px var(--good); }
.ans.dim { opacity: .3; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}

.stamp {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%) rotate(-8deg);
  background: var(--bad); color: var(--ink);
  font-weight: 900; font-stretch: 70%; font-size: 15cqi; line-height: .9; text-transform: uppercase;
  padding: 10px 18px 6px; border-radius: 14px;
  animation: stampIn .6s var(--spring) both;
  z-index: 5;
  white-space: nowrap;
}
@keyframes stampIn { from { transform: translate(-50%, -50%) rotate(-30deg) scale(2.4); opacity: 0; } }

/* ---------- Reveal sheet ---------- */
.sheet {
  position: absolute; left: 10px; right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  max-height: calc(100% - 20px);
  overflow-y: auto;
  border-radius: 30px;
  background: var(--accent);
  color: var(--ink);
  padding: 20px 20px 18px;
  z-index: 10;
  box-shadow: 0 -20px 80px rgba(0, 0, 0, .45);
  animation: sheetUp .75s var(--spring) both;
}
@keyframes sheetUp { from { transform: translateY(105%); } to { transform: none; } }
.sheet-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.verdict { font-weight: 900; font-stretch: 80%; font-size: 22px; text-transform: uppercase; letter-spacing: -.01em; }
.gain { font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; }
.bonus { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bonus span { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 99px; background: rgba(22, 20, 18, .12); }
.big {
  margin: 10px 0 0;
  font-weight: 900; font-stretch: 75%;
  font-size: 96px; font-size: clamp(64px, 25cqi, 132px);
  line-height: .82; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  animation: bigIn .9s var(--spring) both;
  transform-origin: 0 100%;
  overflow-wrap: anywhere;
}
.big.text { font-size: clamp(36px, 11.5cqi, 64px); line-height: .92; overflow-wrap: normal; word-break: normal; text-wrap: balance; }
@keyframes bigIn { from { transform: scaleY(.3) scaleX(1.3); opacity: 0; font-stretch: 125%; } to { transform: none; opacity: 1; font-stretch: 75%; } }
.big-label { margin: 6px 0 0; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; }
.punch { margin: 10px 0 0; font-size: 17px; line-height: 1.3; font-weight: 600; max-width: 32ch; }

.rankline {
  margin-top: 16px; padding: 14px 16px; border-radius: 20px;
  background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rank-lbl { display: block; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--paper-dim); }
.rank-num { font-weight: 900; font-stretch: 80%; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.rank-of { font-size: 15px; font-weight: 700; color: var(--paper-dim); margin-left: 4px; }
.move { font-weight: 900; font-size: 15px; padding: 7px 11px; border-radius: 99px; white-space: nowrap; animation: segPop .7s .6s var(--spring) both; }
.move.up { background: var(--good); color: var(--ink); }
.move.down { background: var(--bad); color: var(--ink); }
.move.same, .move.new { background: rgba(244, 239, 230, .14); color: var(--paper); }
.chase { margin: 10px 2px 0; font-size: 14px; font-weight: 700; }
.sheet .btn { margin-top: 14px; }

/* ---------- Interstitials ---------- */
.inter { justify-content: center; text-align: left; }
.mega {
  margin: 0;
  font-weight: 900;
  font-size: 30cqi;
  line-height: .78;
  letter-spacing: -.05em;
  text-transform: uppercase;
}
.mega .w { animation-name: megaIn; animation-duration: 1s; }
@keyframes megaIn {
  0% { opacity: 0; transform: translateX(-30%) scaleX(2); font-stretch: 125%; }
  100% { opacity: 1; transform: none; font-stretch: 62%; }
}
.mega.x2 { font-size: 62cqi; line-height: .8; font-stretch: 62%; animation: x2 1.1s .5s var(--spring) both; }
@keyframes x2 { from { transform: scale(0) rotate(-25deg); } to { transform: none; } }
.inter .sub { color: inherit; opacity: .8; font-size: 18px; }
.inter-actions { margin-top: 28px; }
.inter-flower { position: absolute; right: -20cqi; top: -14cqi; width: 70cqi; height: 70cqi; opacity: .25; animation: spin 18s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Results ---------- */
.results { text-align: center; align-items: stretch; }
.results .bar { margin-bottom: 8px; }
.res-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; min-height: 0; }
.score-big {
  font-weight: 900; font-stretch: 70%;
  font-size: 30cqi; line-height: .85; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  animation: bigIn 1s .2s var(--spring) both;
  transform-origin: 50% 100%;
}
.pts-lbl { font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: 13px; color: var(--paper-dim); }
.badge {
  margin: 18px 0 6px;
  display: inline-block;
  padding: 12px 22px 10px;
  border-radius: 18px;
  background: var(--accent); color: var(--ink);
  font-weight: 900; font-stretch: 80%; font-size: 30px; text-transform: uppercase; letter-spacing: -.01em;
  transform: rotate(-4deg);
  animation: stampIn2 .8s 1.1s var(--spring) both;
}
@keyframes stampIn2 { from { transform: rotate(-30deg) scale(2.2); opacity: 0; } to { transform: rotate(-4deg); opacity: 1; } }
.shape-row { display: flex; justify-content: center; gap: 6px; margin: 16px 0 4px; flex-wrap: wrap; }
.shape-row svg { animation: segPop .7s var(--spring) both; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 18px; }
.stat { padding: 12px 8px; border-radius: 18px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); }
.stat b { display: block; font-weight: 900; font-stretch: 80%; font-size: 26px; line-height: 1; }
.stat span { display: block; margin-top: 4px; font-size: 12px; color: var(--paper-dim); font-weight: 600; }

/* ---------- Name capture ---------- */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--paper-dim); letter-spacing: .04em; }
.field input {
  appearance: none; border: 0;
  min-height: 58px; padding: 0 18px; border-radius: 18px;
  background: var(--glass); box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 18px; font-weight: 700;
}
.field input:focus { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.preview {
  margin-top: 6px; padding: 16px; border-radius: 20px;
  background: var(--glass); box-shadow: inset 0 0 0 1px var(--line);
  display: flex; align-items: center; gap: 12px;
}
.preview .pv-name { font-weight: 900; font-stretch: 85%; font-size: 22px; }
.preview .pv-note { font-size: 13px; color: var(--paper-dim); }
.name-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Leaderboard ---------- */
.board { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px;
  min-height: 50px; padding: 0 14px; border-radius: 16px;
  background: var(--glass);
  animation: rowIn .6s var(--spring) both;
  animation-delay: calc(var(--i) * 55ms + 200ms);
  font-variant-numeric: tabular-nums;
}
@keyframes rowIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.row .r { font-weight: 900; font-stretch: 80%; font-size: 20px; }
.row .n { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-weight: 800; font-size: 15px; color: var(--paper-dim); }
.row.top1 .r, .row.top2 .r, .row.top3 .r { color: var(--accent); }
.row.me { background: var(--accent); color: var(--ink); transform-origin: center; animation-name: meIn; }
.row.me .s, .row.me .r { color: var(--ink); }
.row.me .you { font-size: 11px; font-weight: 900; letter-spacing: .1em; padding: 3px 7px; border-radius: 99px; background: var(--ink); color: var(--paper); margin-left: 6px; vertical-align: 2px; }
@keyframes meIn { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }
.gap { text-align: center; color: var(--paper-dim); font-weight: 900; letter-spacing: .3em; padding: 2px 0; }
.board-meta { margin: 8px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.board-actions { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- FX layer ---------- */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.bit { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; }
.bit svg { display: block; width: 100%; height: 100%; }
.wipe { position: absolute; left: 50%; top: 50%; width: 100px; height: 100px; margin: -50px 0 0 -50px; overflow: visible; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 220%);
  visibility: hidden;
  background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 14px;
  padding: 12px 18px; border-radius: 99px;
  transition: transform .5s var(--spring);
  white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }

/* ---------- Short screens ---------- */
@media (max-height: 640px) {
  .timer { width: 84px; height: 84px; }
  .t-num { font-size: 28px; }
  .qbody { gap: 8px; }
  .ans { min-height: 70px; }
  .big { font-size: 64px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .grain { animation: none; }
}

/* Interstitial text on solid accent */
.inter .sub strong { color: inherit; font-weight: 900; }

/* ---------- Persistent Jala logo (always visible, recolours per screen) ---------- */
.brand {
  position: absolute;
  z-index: 70;
  top: max(18px, env(safe-area-inset-top));
  left: var(--pad);
  width: 58px; height: 32px;
  pointer-events: none;
  background-color: var(--paper);
  -webkit-mask: url(assets/jala-logo-white.svg) no-repeat left center / contain;
  mask: url(assets/jala-logo-white.svg) no-repeat left center / contain;
  transition: background-color .5s ease;
}
.stage[data-tone="light"] .brand { background-color: var(--ink); }
.brand-space { display: block; width: 58px; height: 32px; flex: 0 0 auto; }
.meta { min-height: 32px; }

/* ---------- Challenge email preview ---------- */
.mail {
  margin-top: 4px; padding: 14px 16px; border-radius: 20px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  transform: rotate(-1.2deg);
  animation: mailIn .8s .3s var(--spring) both;
}
@keyframes mailIn { from { opacity: 0; transform: translateY(20px) rotate(4deg); } to { opacity: 1; transform: rotate(-1.2deg); } }
.mail-top { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: rgba(22, 20, 18, .55); letter-spacing: .04em; }
.mail-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.mail-subj { margin-top: 8px; font-weight: 900; font-stretch: 88%; font-size: 17px; line-height: 1.15; }
.mail-body { margin-top: 6px; font-size: 14px; line-height: 1.4; color: rgba(22, 20, 18, .78); }
.btn:disabled { opacity: .7; cursor: progress; }

/* Leaderboard: fit without scrolling */
.board { gap: 5px; margin-top: 14px; }
.row { min-height: 46px; }
.board-actions { padding-top: 14px; gap: 8px; }
.board-actions .btn { min-height: 54px; }
@media (max-height: 700px) {
  .row { min-height: 40px; }
  .board-actions .btn { min-height: 48px; }
}

/* ---------- Thanks: vibe chips, message, dropdown ---------- */
.field .lbl { font-size: 13px; font-weight: 700; color: var(--paper-dim); letter-spacing: .04em; }
.vibes { display: flex; flex-wrap: wrap; gap: 8px; }
.vibe {
  appearance: none; border: 0; cursor: pointer;
  min-height: 42px; padding: 0 14px; border-radius: 99px;
  background: var(--glass); box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 800; font-size: 14px; font-stretch: 92%;
  animation: ansIn .6s var(--spring) both; animation-delay: calc(200ms + var(--i) * 60ms);
  transition: background .2s, color .2s, box-shadow .2s;
}
.vibe[aria-pressed="true"] { background: var(--accent); color: var(--ink); box-shadow: none; }
.vibe:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.field textarea {
  appearance: none; border: 0; resize: none;
  padding: 14px 18px; border-radius: 18px;
  background: var(--glass); box-shadow: inset 0 0 0 1.5px var(--line);
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--paper);
}
.field textarea:focus { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.select { position: relative; }
.select::after {
  content: ''; position: absolute; right: 20px; top: 50%;
  width: 10px; height: 10px; margin-top: -7px;
  border-right: 2.5px solid var(--paper); border-bottom: 2.5px solid var(--paper);
  transform: rotate(45deg); pointer-events: none;
}
.select select {
  appearance: none; -webkit-appearance: none; border: 0; width: 100%;
  min-height: 58px; padding: 0 48px 0 18px; border-radius: 18px;
  background: var(--glass); box-shadow: inset 0 0 0 1.5px var(--line);
  font: inherit; font-size: 16px; font-weight: 700; color: var(--paper); cursor: pointer;
}
.select select:focus { box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.select select:invalid { color: var(--paper-dim); }
.select option { color: #161412; background: #F4EFE6; }
