:root {
  --night-900: #0F0D1F; --night-800: #1A1733; --tile: #FFF3DF; --tile-edge: #E3CFAE; --ink: #1A1430;
  --tangerine: #FF7A45; --gold: #FFC94D; --correct: #4BE3A2; --wrong: #FF5D6C;
  --dim: rgba(255,255,255,.62); --faint: rgba(255,255,255,.4);
  --glass: rgba(255,255,255,.07); --stroke: rgba(255,255,255,.14);
  --display: "Bricolage Grotesque", system-ui, sans-serif; --ui: "Figtree", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
html { background: var(--night-900); }
/* The glow sits on its own fixed layer: iOS Safari repaints `background-attachment: fixed`
   badly after the keyboard closes and left pieces of the previous screen on the page. */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255,122,69,.28), transparent 60%), linear-gradient(var(--night-800), var(--night-900)); }
body {
  background: transparent; position: relative; overflow-x: hidden;
  color: #fff; font: 600 17px/1.4 var(--ui); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 460px; margin: 0 auto; min-height: 100%; padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); display: flex; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.screen[hidden] { display: none; }
.center { align-items: center; justify-content: center; text-align: center; gap: 14px; }
h1 { font: 800 32px/1.1 var(--display); letter-spacing: -.5px; }
.big { font: 800 44px/1 var(--display); }
.huge { font: 800 72px/1 var(--display); }
.gold { color: var(--gold); }
.dim { color: var(--dim); font-weight: 500; }
.small { font-size: 14px; }
.strong { font-weight: 700; font-size: 20px; }
.eyebrow { font: 700 12px var(--ui); letter-spacing: 1.6px; text-transform: uppercase; color: var(--dim); margin-top: 8px; }
.eyebrow.accent { color: var(--gold); }
.error { color: var(--wrong); min-height: 20px; font-size: 15px; }

.logo { display: flex; gap: 4px; align-items: center; margin: 8px 0 18px; }
.logo b { font: 800 26px var(--display); color: var(--tangerine); margin-left: 8px; }
.t { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--tile); color: var(--ink);
  font: 800 19px var(--display); box-shadow: 0 2px 0 var(--tile-edge), 0 4px 10px rgba(0,0,0,.3); }
.logo .t:nth-child(odd) { transform: rotate(-4deg); } .logo .t:nth-child(even) { transform: rotate(3deg); }
.t.sm { width: 38px; height: 38px; flex: none; }

input { font: inherit; color: inherit; outline: none; }
.field { width: 100%; height: 58px; padding: 0 18px; border-radius: 16px; background: var(--glass); border: 1.5px solid var(--stroke); font-size: 20px; }
.field:focus, .code:focus { border-color: var(--tile); }
.code { width: 100%; height: 76px; border-radius: 16px; text-align: center; background: var(--glass); border: 1.5px solid var(--stroke);
  font: 800 44px var(--display); letter-spacing: 22px; padding-left: 22px; text-transform: uppercase; }
.colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.colors button { aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; font: 800 16px var(--display); color: var(--ink); cursor: pointer; }
.colors button[aria-checked="true"] { border-color: #fff; transform: scale(1.1); }
.colors button:disabled { opacity: .25; }

.btn { height: 60px; border-radius: 30px; border: 0; font: 700 19px var(--ui); cursor: pointer; width: 100%; margin-top: 8px; }
.btn.primary { background: var(--tile); color: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--dim); font: 600 15px var(--ui); text-decoration: underline; margin-top: 10px; cursor: pointer; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: var(--ink); font: 800 18px var(--display); width: 40px; height: 40px; flex: none; }
.avatar.xl { width: 110px; height: 110px; font-size: 48px; }
.stack { display: flex; justify-content: center; margin-top: 10px; }
.stack .avatar { margin-left: -10px; border: 3px solid var(--night-900); }

.chip { display: inline-block; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.1); border: 1.5px solid var(--stroke); font: 700 12px var(--ui); letter-spacing: 1px; text-transform: uppercase; }
.bar { display: flex; justify-content: space-between; align-items: center; font-size: 17px; }
.worth { color: var(--gold); font: 800 20px var(--display); }
.timer { font: 800 22px var(--display); min-width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 4px solid var(--tangerine); }
.timer.low { border-color: var(--wrong); }
.tiles { display: flex; justify-content: center; gap: 6px; margin: 22px 0 6px; flex-wrap: nowrap; }
.tiles .t { width: var(--s, 40px); height: var(--s, 40px); font-size: calc(var(--s, 40px) * .52); border-radius: calc(var(--s, 40px) * .18); }
.tiles .gap { width: calc(var(--s, 40px) * .4); flex: none; }
.tiles .t.empty { background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px var(--stroke); color: transparent; }
.clue { text-align: center; font-size: 19px; font-weight: 600; margin-bottom: 8px; }
#guessForm { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.guess { text-transform: uppercase; font: 800 24px var(--display); letter-spacing: 2px; height: 64px; }
.feedback { min-height: 22px; text-align: center; color: var(--wrong); font-size: 15px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.opts { display: grid; gap: 14px; margin-top: 8px; }
.opt { display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 0 18px; border: 0; border-radius: 24px;
  background: var(--c); color: var(--ink); font: 800 21px/1.15 var(--display); text-align: left; cursor: pointer;
  transition: transform .15s, opacity .2s; }
.opt i { font-style: normal; width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: rgba(26,20,48,.22); font: 800 22px var(--display); }
.opt:active { transform: scale(.98); }
.opts.locked .opt { opacity: .28; filter: saturate(.5); pointer-events: none; }
.opts.locked .opt.mine { opacity: 1; filter: none; transform: scale(1.03); box-shadow: 0 0 0 4px var(--tile), 0 10px 30px rgba(0,0,0,.4); }
.timebar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.timebar div { height: 100%; background: var(--gold); border-radius: 4px; transition: width .25s linear; }
.center-text { text-align: center; }
.check.miss { background: var(--wrong); }
.check { width: 110px; height: 110px; border-radius: 50%; background: var(--correct); color: var(--ink); display: grid; place-items: center; font: 800 60px var(--display); animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.card { width: 100%; padding: 18px; border-radius: 20px; background: var(--glass); border: 1.5px solid var(--stroke); text-align: left; }
.card .eyebrow { margin: 0 0 6px; }
.app { display: flex; gap: 14px; align-items: center; text-align: left; margin-top: 18px; padding: 14px 16px; border-radius: 18px; background: var(--glass); border: 1.5px solid var(--stroke); color: #fff; text-decoration: none; width: 100%; }

/* Team Battle */
.teampick { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.team { width: 100%; text-align: left; padding: 18px 20px; border-radius: 22px; cursor: pointer; color: #fff;
  background: color-mix(in srgb, var(--c) 10%, transparent); border: 2px solid color-mix(in srgb, var(--c) 50%, transparent); font: inherit; }
.team b { display: block; font: 800 28px/1.1 var(--display); margin: 4px 0; }
.team small { display: block; font: 700 12px var(--ui); letter-spacing: 1.4px; text-transform: uppercase; color: var(--c); }
.team span { font: 600 13px var(--ui); opacity: .75; }
.team.on { background: var(--c); color: var(--ink); border-color: transparent; box-shadow: 0 0 28px color-mix(in srgb, var(--c) 50%, transparent); }
.team.on small { color: var(--ink); }
.team:disabled { cursor: default; }
.teamstrip { position: relative; height: 34px; border-radius: 17px; overflow: hidden; background: var(--b); display: flex; justify-content: space-between; align-items: center;
  padding: 0 14px; font: 700 13px var(--ui); letter-spacing: .8px; text-transform: uppercase; color: var(--ink); margin-top: 10px; }
.teamstrip[hidden] { display: none; }
#aTeamFill { position: absolute; inset: 0 auto 0 0; background: var(--a); transition: width .6s; }
.teamstrip span { position: relative; }
body.teamgame #app { outline: 4px solid var(--team); outline-offset: -4px; border-radius: 28px; }

/* Emoji reactions while waiting (rooms -> reactions/{code}/{uid}) */
.react-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--night-900) 30%); text-align: center; }
.react-bar[hidden] { display: none; }
.react-bar .eyebrow { margin: 0 0 8px; color: var(--faint); }
.react-row { max-width: 460px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.react-row button { height: 56px; border: 0; border-radius: 16px; background: var(--glass); font-size: 30px; line-height: 1; cursor: pointer;
  transition: transform .12s ease-out; }
.react-row button:active, .react-row button.pop { transform: scale(1.25); }
body.reacting #app { padding-bottom: 130px; }

/* After a round: "You are 2nd · 340 pts" under the points. */
.standing { color: var(--text, #fff); font-weight: 700; font-size: 18px; margin-top: 14px; }
