:root {
  --emoji: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Noto Emoji", sans-serif;
  --ink: #2e2119;
  --cream: #fff6e9;
  --crust: #c98b52;
  --amber: #e0894a;
  --good: #59b866;
  --bad: #c0392b;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: #241a14 radial-gradient(circle at 50% 0%, #3a2a20 0%, #1c1410 70%);
  color: var(--cream);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}

#game-wrap {
  position: relative;
  width: min(96vw, 960px);
  max-height: 88vh;
  aspect-ratio: 960 / 640;
  border-radius: 18px;
  overflow: hidden;
  background: #1c1410;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

canvas { display: block; width: 100%; height: 100%; background: #f6e4cd; touch-action: none; }

#game-dom {
  position: absolute;
  inset: 0;
  overflow: auto;
  background: linear-gradient(#2b1f18, #1c1410);
}

#help { font-size: 14px; opacity: 0.65; }

body.touch { gap: 0; }
body.touch #help { display: none; }
body.touch #game-wrap {
  width: 100vw; height: 100vh; max-height: none;
  aspect-ratio: auto; border-radius: 0; box-shadow: none;
}
body.touch canvas { object-fit: contain; }

/* ---------- overlays ---------- */

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28, 20, 16, 0.86);
  backdrop-filter: blur(6px);
  z-index: 5; padding: 16px;
}
.overlay.hidden { display: none; }

.panel {
  width: min(92%, 440px);
  max-height: 94%;
  overflow-y: auto;
  background: linear-gradient(#fffaf1, #ffeed9);
  color: var(--ink);
  border-radius: 20px;
  padding: 26px 28px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.panel.wide { width: min(96%, 760px); }

.logo-row { display: flex; justify-content: center; margin-bottom: 6px; }
.logo-row svg, .logo-row img { border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.logo { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.panel h2 { margin: 4px 0 10px; font-size: 24px; }
.tagline { margin: 8px 0 18px; font-size: 15px; line-height: 1.5; opacity: 0.72; }
.tagline.small { font-size: 13px; margin: 10px 0 0; }

label {
  display: block; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; opacity: 0.6; margin-bottom: 8px;
}

input {
  width: 100%; padding: 13px 16px; font-size: 17px; font-family: inherit;
  border: 2px solid #e5cdae; border-radius: 12px; background: #fff;
  color: var(--ink); text-align: center; outline: none;
}
input:focus { border-color: var(--crust); }

button {
  width: 100%; margin-top: 12px; padding: 14px;
  font-size: 16px; font-weight: 700; font-family: inherit;
  color: #fff; background: linear-gradient(#e0894a, #c9702f);
  border: none; border-radius: 12px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
button:hover { filter: brightness(1.07); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }

button.ghost { background: none; color: #a86b38; border: 2px solid #e0c7a6; }
button.ghost:hover { background: rgba(224,137,74,.1); }

.or { position: relative; margin: 20px 0 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .5; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #e0c7a6; }
.or span { position: relative; background: #fff5e6; padding: 0 12px; }

input.code { text-transform: uppercase; letter-spacing: 6px; font-weight: 800; font-size: 22px; }
.err { margin: 12px 0 0; font-size: 14px; color: var(--bad); font-weight: 600; }

.share { padding: 16px; margin-bottom: 6px; background: #fff; border-radius: 14px; }
.code-big { font-size: 40px; font-weight: 800; letter-spacing: 10px; text-indent: 10px; color: #a86b38; margin-bottom: 12px; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; padding: 11px 12px; font-size: 13px; text-align: left; border-radius: 10px; }
button.copy { width: auto; margin: 0; padding: 0 18px; flex: none; border-radius: 10px; }
button.copy.done { background: linear-gradient(#59b866, #45a052); }
#share-btn { margin-top: 10px; }
.you-are { font-size: 15px; margin-top: 14px; }

.spinner {
  width: 38px; height: 38px; margin: 4px auto 16px;
  border: 4px solid #eed9bd; border-top-color: var(--crust);
  border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- lobby ---------- */

.lobby-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; text-align: left; }
.lobby-head h2 { margin: 0; }
.lobby-head .tagline { margin: 4px 0 0; }
.party-code { text-align: right; flex: none; }
.party-code span { display: block; font-size: 10px; letter-spacing: 2px; opacity: .5; }
.party-code b { font-size: 22px; letter-spacing: 4px; color: #a86b38; }

.board { margin: 16px 0; background: #fff; border-radius: 14px; padding: 12px 14px; text-align: left; }
.board-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .55; margin-bottom: 8px; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; font-size: 15px; }
.board-row.lead { background: #fff5e0; box-shadow: 0 0 0 2px #f0b429 inset; }
.b-name { font-weight: 600; flex: none; }
.b-chips { flex: 1; display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 12px; background: #f3e6d2; border-radius: 20px; padding: 2px 8px; }
.b-total { font-weight: 800; font-size: 19px; color: #a86b38; }

.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 620px) { .game-grid { grid-template-columns: 1fr; } }

.game-card {
  width: 100%; margin: 0; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #fff; color: var(--ink);
  border: 2px solid #f0e0c8; border-radius: 14px;
}
.game-card:hover { border-color: var(--amber); filter: none; }
.game-card.mine { border-color: var(--amber); background: #fff6e8; }
.game-card.random { background: linear-gradient(#f6ecff, #efe2ff); border-color: #d9c6f0; }
.gc-emoji { font-size: 28px; flex: none; }
.gc-body { flex: 1; min-width: 0; }
.gc-name { display: block; font-weight: 700; font-size: 15px; }
.gc-tag { display: block; font-size: 12px; opacity: .65; line-height: 1.35; font-weight: 400; }
.gc-votes { display: flex; gap: 4px; flex: none; }
.gc-votes .dot { width: 14px; height: 14px; box-shadow: 0 0 0 2px #fff; }
.vote-status { margin: 14px 0 0; font-size: 14px; font-weight: 600; opacity: .7; }

/* ---------- chosen ---------- */

.chosen-emoji { font-size: 70px; }
.pickedby { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--amber); margin: 2px 0 10px; }
.count { font-size: 74px; font-weight: 800; color: #a86b38; }

/* ---------- results ---------- */

.result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 10px;
  background: #fff; border-radius: 12px; font-size: 17px; text-align: left;
}
.result-row .who { flex: 1; font-weight: 600; }
.result-row .cakes { font-variant-numeric: tabular-nums; opacity: .75; font-size: 14px; }
.result-row.win { box-shadow: 0 0 0 3px #f0b429 inset; }
.result-row.win::after { content: "🏆"; }

/* ---------- countdown ---------- */

#countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 140px; font-weight: 800; color: #fff;
  text-shadow: 0 8px 30px rgba(0,0,0,.5); pointer-events: none; z-index: 6;
}

/* ---------- touch controls ---------- */

#touch-ui { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
#stick {
  position: absolute; width: 128px; height: 128px; margin: -64px 0 0 -64px;
  border-radius: 50%; background: rgba(255,246,233,.16);
  border: 2px solid rgba(255,246,233,.35); opacity: 0; transition: opacity .12s ease;
}
#stick.active { opacity: 1; }
#stick-knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(255,246,233,.85); box-shadow: 0 3px 12px rgba(0,0,0,.35);
}
#use-btn {
  position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom));
  width: 108px; height: 108px; margin: 0; padding: 0; border-radius: 50%;
  font-size: 19px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(rgba(224,137,74,.92), rgba(201,112,47,.92));
  border: 3px solid rgba(255,246,233,.5); box-shadow: 0 6px 20px rgba(0,0,0,.4);
  pointer-events: auto; -webkit-tap-highlight-color: transparent; user-select: none;
}
#use-btn:active { transform: scale(.93); }

/* ---------- floating controls ---------- */

#end-game-btn, #mute-btn {
  position: absolute; z-index: 7; width: auto; margin: 0;
  padding: 8px 14px; font-size: 12px; font-weight: 700; border-radius: 20px;
  background: rgba(20,14,10,.72); border: 1px solid rgba(255,246,233,.25);
  color: var(--cream); backdrop-filter: blur(4px);
}
/* Both live along the bottom: every game puts scores in the top corners. */
#end-game-btn { left: 12px; bottom: 12px; }
#end-game-btn.armed { background: rgba(192,57,43,.95); border-color: #ff9c8f; }
#mute-btn { right: 12px; bottom: 12px; padding: 8px 11px; font-size: 15px; }

/* Lift them clear of the thumbstick and USE button on walking games. */
body.has-stick #mute-btn { bottom: 148px; }
body.touch.has-stick #mute-btn { bottom: calc(148px + env(safe-area-inset-bottom)); }
body.touch.has-stick #end-game-btn { bottom: calc(12px + env(safe-area-inset-bottom)); }

/* ---------- Uno: shout + stack ---------- */

.uno-shout { display: flex; gap: 10px; justify-content: center; min-height: 0; }
.uno-call, .uno-catch {
  width: auto; margin: 0; padding: 10px 26px; border-radius: 24px;
  font-size: 16px; font-weight: 800; letter-spacing: 1px;
}
.uno-call { background: linear-gradient(#e8b021, #bd8a10); color: #2b2118; }
.uno-call.urgent { animation: shout .7s ease-in-out infinite; }
@keyframes shout { 50% { transform: scale(1.09); filter: brightness(1.2); } }
.uno-catch { background: linear-gradient(#d7362f, #a82820); }
.uno-stack {
  font-size: 15px; font-weight: 700; color: #ffd166;
  padding-bottom: 6px;
}
.uno-stack b { font-size: 20px; }

#rotate-hint {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center;
  background: #241a14; padding: 24px;
}
#rotate-hint h2 { margin: 8px 0 0; font-size: 22px; }
#rotate-hint p { margin: 0; opacity: .6; font-size: 15px; }
.rotate-icon { font-size: 62px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%,45% { transform: rotate(0); } 70%,100% { transform: rotate(90deg); } }

/* ==========================================================================
   Per-game DOM styling
   ========================================================================== */

.q-sc { display: inline-flex; align-items: center; gap: 5px; margin-left: 12px; font-size: 13px; }
.q-sc .dot { width: 10px; height: 10px; }

/* ---------- Uno ---------- */

.uno-wrap { min-height: 100%; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; color: var(--cream); }
.uno-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.uno-opp { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.uno-opp-name { font-weight: 700; }
.uno-opp-cards { display: inline-flex; align-items: center; gap: 2px; }
.uno-opp-cards b { margin-left: 6px; opacity: .7; }
.uno-back { display: inline-flex; align-items: center; justify-content: center;
  background: #1b2330; border: 2px solid #37455c; border-radius: 6px; padding: 3px; }
.uno-back.mini { width: 20px; height: 27px; padding: 1px; border-width: 1px; }
.uno-turn { font-size: 14px; font-weight: 700; padding: 6px 14px; border-radius: 20px; background: rgba(255,255,255,.09); }
.uno-turn.active { background: var(--good); color: #08210d; }

.uno-table { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 10px 0; }
.uno-deck { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.uno-deck b { font-size: 12px; opacity: .6; }
.uno-deck .uno-back { padding: 8px; border-radius: 10px; }
.uno-colour { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.uc-swatch { width: 22px; height: 22px; border-radius: 6px; display: inline-block; box-shadow: 0 0 0 2px rgba(255,255,255,.3); }

.uno-card {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 62px; height: 92px; border-radius: 10px; background: var(--c);
  box-shadow: 0 4px 12px rgba(0,0,0,.4), inset 0 0 0 4px rgba(255,255,255,.85);
  color: #fff; font-weight: 800; overflow: hidden;
}
.uno-card.small { width: 44px; height: 66px; }
/* The white oval and Billie watermark every card carries. */
.uc-oval {
  position: absolute; width: 78%; height: 62%; border-radius: 50%;
  background: rgba(255,255,255,.9); transform: rotate(-22deg);
}
.uc-billie { position: absolute; opacity: .5; display: flex; }
.uc-mid { position: relative; font-size: 28px; color: var(--c); -webkit-text-stroke: 1.5px rgba(255,255,255,.9); }

/* Opponent's hand: real cards, face down and fanned. */
.uno-opp { flex-direction: column; align-items: flex-start; gap: 4px; }
.uno-opp-cards { display: inline-flex; align-items: flex-end; padding-top: 4px; min-height: 66px; }
.uno-flipped {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 64px; border-radius: 8px; flex: none;
  background: linear-gradient(#2a3852, #141c2b);
  border: 2px solid #56698f;
  box-shadow: 0 4px 10px rgba(0,0,0,.5), inset 0 0 0 3px rgba(255,255,255,.12);
  margin-left: -18px;
  transform: rotate(calc((var(--i) - 6) * 2.4deg)) translateY(calc(var(--i) * -0.4px));
  transition: transform .2s ease;
}
.uno-flipped:first-child { margin-left: 0; }
.uno-flipped svg { opacity: .95; }
.uc-corner { position: absolute; font-size: 12px; }
.uc-corner.tl { top: 7px; left: 8px; }
.uc-corner.br { bottom: 7px; right: 8px; transform: rotate(180deg); }
.uc-wild4 { font-size: 26px; }
.uc-wildwheel {
  width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(#d7362f 0 25%, #e8b021 0 50%, #3fa34d 0 75%, #2f7fd7 0);
  box-shadow: inset 0 0 0 3px #fff;
}

.uno-actions { text-align: center; min-height: 42px; }
.uno-msg { font-size: 14px; opacity: .8; padding-top: 10px; }
.uno-msg.dim { opacity: .45; }
.uno-btn { width: auto; padding: 10px 22px; margin: 0; border-radius: 20px; font-size: 14px; }

.uno-hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 4px; }
.uno-slot { width: auto; margin: 0; padding: 0; background: none; border: none; opacity: .45; filter: grayscale(.6); transition: transform .12s ease; }
.uno-slot.playable { opacity: 1; filter: none; cursor: pointer; }
.uno-slot.playable:hover { transform: translateY(-8px); }

.uno-picker {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(20,14,10,.88); z-index: 3;
}
.up-title { font-size: 20px; font-weight: 700; }
.up-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.up-swatch { width: 104px; margin: 0; padding: 22px 0; border-radius: 14px; font-size: 14px; }

/* ---------- Memory ---------- */

.mem-wrap { min-height: 100%; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; color: var(--cream); }
.mem-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.mem-score { display: inline-flex; align-items: center; gap: 6px; }
.mem-score b { font-size: 18px; color: #ffd9a0; }
.mem-clock {
  font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 2px 16px; border-radius: 20px; background: rgba(0,0,0,.35);
}
.mem-clock.urgent { background: rgba(226,72,60,.9); animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.mem-turn { font-weight: 700; padding: 6px 14px; border-radius: 20px; background: rgba(255,255,255,.09); font-size: 13px; align-self: center; }
.mem-turn.active { background: var(--good); color: #08210d; }

/* Cards are capped by BOTH a pixel size and a share of the viewport height, so
   the 5x4 grid always fits without scrolling. --cols is set from JS. */
.mem-grid {
  flex: 1;
  display: grid;
  gap: 7px;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, min(78px, 10.5vh)));
  min-height: 0;
}
.mem-card {
  width: 100%; margin: 0; padding: 0; aspect-ratio: 3/4;
  background: none; border: none; perspective: 600px; cursor: pointer;
}
.mc-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem-card.up .mc-inner { transform: rotateY(180deg); }
.mc-back, .mc-front {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; backface-visibility: hidden;
}
.mc-back { background: linear-gradient(#3b4a63, #26314a); border: 2px solid #4d5f7d; }
.mc-front { background: #fffaf1; border: 2px solid #e0c7a6; transform: rotateY(180deg); font-size: 30px; }
.mem-card.matched .mc-front { border-color: var(--owner, var(--good)); box-shadow: 0 0 0 3px var(--owner, var(--good)) inset; }
.mem-card.matched { opacity: .85; cursor: default; }

/* ---------- Quiz ---------- */

.quiz-wrap { min-height: 100%; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--cream); text-align: center; }
.quiz-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .85; }
.quiz-billie img, .quiz-billie svg { border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.quiz-role .tag { font-size: 13px; opacity: .75; }
.quiz-role .tag.you { color: #ffd9a0; opacity: 1; }
.quiz-role .ok { color: #7ee08c; font-weight: 700; font-size: 17px; }
.quiz-role .no { color: #ff9c8f; font-weight: 700; font-size: 17px; }
.quiz-q { font-size: 21px; font-weight: 700; line-height: 1.35; max-width: 620px; margin: 4px 0 6px; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 620px); }
@media (max-width: 560px) { .quiz-options { grid-template-columns: 1fr; } }
.quiz-opt {
  margin: 0; padding: 15px 12px; font-size: 15px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.16); color: var(--cream);
}
.quiz-opt:hover:not(:disabled) { border-color: var(--amber); }
.quiz-opt.picked { background: var(--amber); border-color: var(--amber); color: #fff; }
.quiz-opt:disabled { opacity: .55; }
.rev-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,.07); border-radius: 12px; font-size: 15px; }
.rev-row span { opacity: .7; }
.quiz-foot { font-size: 13px; opacity: .6; margin-top: auto; padding-top: 8px; }

/* ---------- Duel ---------- */

.duel-wrap { min-height: 100%; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--cream); text-align: center; }
.duel-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .85; }
.duel-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.d-big { font-size: 62px; }
.d-msg { font-size: 20px; font-weight: 700; }
.d-why { font-size: 14px; opacity: .65; }
.d-wait img, .d-wait svg { border-radius: 50%; }
.d-wait.crouch img, .d-wait.crouch svg { animation: crouch 1.1s ease-in-out infinite; }
@keyframes crouch { 0%,100% { transform: scale(1); } 50% { transform: scale(.9) translateY(6px); } }
.d-go { animation: flash .35s ease-in-out infinite alternate; }
@keyframes flash { from { opacity: .75; } to { opacity: 1; } }

.duel-tap {
  width: min(88%, 340px); margin: 0; padding: 30px 0;
  font-size: 26px; font-weight: 800; letter-spacing: 3px; border-radius: 20px;
  background: rgba(255,255,255,.12); border: 3px solid rgba(255,255,255,.2);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.duel-tap.go { background: linear-gradient(#3fa34d, #2d7d38); border-color: #7ee08c; }
.duel-tap.idle { opacity: .55; }
.duel-foot { font-size: 13px; opacity: .65; }

.yarn-track {
  position: relative; width: min(94%, 640px); height: 74px;
  background: rgba(255,255,255,.08); border-radius: 37px; border: 2px solid rgba(255,255,255,.16);
}
.yarn-goal { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; }
.yarn-goal.you { left: 14px; }
.yarn-goal.them { right: 14px; }
.yarn-ball { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 40px; transition: left .08s linear; }

/* ---------- Hangman ---------- */

.hm-wrap { min-height: 100%; padding: 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--cream); text-align: center; }
.hm-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; flex-wrap: wrap; gap: 8px; }
.hm-life { font-size: 15px; }
.hm-life.gone { filter: grayscale(1); opacity: .25; }
.hm-hint { font-size: 14px; opacity: .7; font-style: italic; }
.hm-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0; }
.hm-tile {
  width: 34px; height: 44px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; border-radius: 7px;
  background: rgba(255,255,255,.08); border-bottom: 3px solid rgba(255,255,255,.3);
}
.hm-tile.filled { background: rgba(255,255,255,.92); color: #2b2118; border-bottom-color: var(--amber); }
.hm-space { width: 18px; }
.hm-turn { font-size: 15px; font-weight: 700; min-height: 22px; }
.hm-turn .active { color: #ffd9a0; }
.hm-turn .ok { color: #7ee08c; }
.hm-turn .no { color: #ff9c8f; }
.hm-keys { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 640px; }
.hm-key {
  width: 40px; margin: 0; padding: 10px 0; font-size: 15px; font-weight: 700; border-radius: 8px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: var(--cream);
}
.hm-key:disabled { opacity: .3; }
.hm-key.hit { background: var(--good); border-color: #7ee08c; opacity: 1; }
.hm-key.miss { background: rgba(192,57,43,.85); opacity: .75; }
.hm-solve { display: flex; gap: 8px; width: min(100%, 420px); margin-top: auto; padding-top: 8px; }
.hm-input { flex: 1; min-width: 0; padding: 11px 14px; font-size: 15px; text-align: left; border-radius: 10px; }
.hm-go { width: auto; margin: 0; padding: 0 20px; border-radius: 10px; }

/* ---------- Draw & guess ---------- */

.dr-wrap { min-height: 100%; padding: 12px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--cream); }
.dr-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.dr-word b { color: #ffd9a0; font-size: 16px; letter-spacing: .5px; }
.dr-clock { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.dr-stage { position: relative; width: min(100%, 800px); }
.dr-canvas {
  width: 100%; height: auto; aspect-ratio: 800/520; display: block;
  background: #fffaf1; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  touch-action: none; cursor: default;
}
.dr-canvas.drawable { cursor: crosshair; }
.dr-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20,14,10,.86); border-radius: 12px;
}
.dr-rev { text-align: center; }
.dr-rev-big { font-size: 56px; }
.dr-rev-msg { font-size: 21px; font-weight: 700; }
.dr-rev-word { font-size: 15px; opacity: .75; margin-top: 4px; }
.dr-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.dr-colours, .dr-sizes { display: flex; gap: 5px; }
.dr-colour { width: 28px; height: 28px; margin: 0; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); }
.dr-colour.on { border-color: #fff; transform: scale(1.15); }
.dr-size { width: 34px; margin: 0; padding: 6px 0; border-radius: 8px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); }
.dr-size.on { background: var(--amber); }
.dr-btn { width: auto; margin: 0; padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.dr-guessbar { display: flex; gap: 8px; width: min(100%, 520px); }
.dr-input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 15px; text-align: left; border-radius: 10px; }
.dr-send { width: auto; margin: 0; padding: 0 22px; border-radius: 10px; }
.dr-feed { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 13px; }
.dr-guess { background: rgba(255,255,255,.1); border-radius: 14px; padding: 3px 10px; opacity: .8; }
.dr-guess.right { background: var(--good); opacity: 1; font-weight: 700; }

/* ---------- Riga Rush ---------- */

.rg-wrap { min-height: 100%; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; color: var(--cream); }
.rg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.rg-title { font-weight: 800; font-size: 16px; }
.rg-clock { font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.rg-body { flex: 1; display: flex; gap: 10px; align-items: flex-start; }
@media (max-width: 780px) { .rg-body { flex-direction: column; } }
.rg-mapbox { flex: 1; min-width: 0; }
.rg-canvas { width: 100%; height: auto; aspect-ratio: 960/520; display: block; border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.rg-side { width: 268px; flex: none; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 780px) { .rg-side { width: 100%; } }
.rg-here { background: rgba(255,255,255,.1); border-radius: 10px; padding: 8px 12px; }
.rg-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .55; }
.rg-here b { font-size: 15px; }
.rg-missions { display: flex; flex-direction: column; gap: 5px; }
.rg-mission { display: flex; gap: 8px; align-items: flex-start; background: rgba(255,255,255,.07); border-radius: 9px; padding: 7px 10px; font-size: 12.5px; }
.rg-mission.here { background: rgba(232,176,33,.25); box-shadow: 0 0 0 2px #e8b021 inset; }
.rg-m-emoji { font-size: 17px; }
.rg-m-text i { display: block; font-style: normal; opacity: .6; font-size: 11px; margin-top: 1px; }
.rg-complete { margin: 0; padding: 12px; font-size: 15px; border-radius: 10px; background: linear-gradient(#3fa34d, #2d7d38); }
.rg-conns-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .55; margin-top: 2px; }
.rg-conns { display: flex; flex-direction: column; gap: 5px; max-height: 260px; overflow-y: auto; }
.rg-conn {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0;
  padding: 8px 10px; border-radius: 9px; font-size: 13px; text-align: left;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14); color: var(--cream);
}
.rg-conn.target { border-color: #e8b021; background: rgba(232,176,33,.18); }
.rg-badge { flex: none; font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 6px; color: #fff; }
.rg-to { flex: 1; min-width: 0; }
.rg-time { flex: none; opacity: .6; font-size: 11px; }
.rg-riding { font-size: 13px; opacity: .6; padding: 10px; text-align: center; }

/* Hide & seek: the hider's taunt button */
#meow-btn {
  position: absolute; z-index: 7;
  left: 50%; transform: translateX(-50%);
  bottom: 12px; width: auto; margin: 0;
  padding: 12px 26px; font-size: 16px; font-weight: 800; letter-spacing: 1px;
  border-radius: 26px;
  background: linear-gradient(#e8963f, #c9702f);
  border: 2px solid rgba(255,246,233,.5);
  box-shadow: 0 5px 16px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
#meow-btn:disabled { opacity: .45; }
body.touch #meow-btn { bottom: calc(12px + env(safe-area-inset-bottom)); }

/* ---------- join: avatar + colour ---------- */

.looks { display: flex; align-items: center; gap: 12px; }
.avatar-pick {
  width: 62px; height: 62px; flex: none; margin: 0; padding: 0;
  border-radius: 50%; overflow: hidden;
  background: #fff; border: 3px dashed #e0c7a6; color: #c98b52;
  font-size: 24px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.avatar-pick.has-img { border-style: solid; border-color: var(--amber); }
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; }
.colour-row { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.colour-swatch {
  width: 100%; aspect-ratio: 1; margin: 0; padding: 0; border-radius: 50%;
  border: 3px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.colour-swatch.on { border-color: var(--ink); transform: scale(1.1); }
.hint-small { font-size: 11.5px; opacity: .55; margin: 8px 0 0; }

/* avatars shown around the app */
.pavatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  flex: none; box-shadow: 0 0 0 2px #fff;
}

/* emoji avatar choices */
.emoji-row {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 10px;
}
.emoji-pick {
  width: 100%; aspect-ratio: 1; margin: 0; padding: 0;
  font-size: 19px; line-height: 1; border-radius: 10px;
  background: #fff; border: 2px solid #f0e0c8; color: inherit;
}
.emoji-pick.on { border-color: var(--amber); background: #fff6e8; transform: scale(1.08); }
.avatar-pick .emoji-face { font-size: 30px; }
.pavatar-emoji {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-size: 14px; flex: none;
  background: #fff; box-shadow: 0 0 0 2px #fff;
}

/* ---------- Swedish lesson ---------- */

.sv-wrap { min-height: 100%; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--cream); text-align: center; }
.sv-head { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .85; flex-wrap: wrap; gap: 6px; }
.q-sc em { font-style: normal; color: #ffb37a; }
.sv-card {
  margin-top: 6px; padding: 18px 34px; border-radius: 18px;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.15);
  min-width: min(90%, 420px);
}
.sv-flag { font-size: 26px; }
.sv-prompt { font-size: 34px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 2px; }
.sv-cat { font-size: 12px; opacity: .5; }
.sv-ask { font-size: 14px; opacity: .7; }
.sv-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 620px); }
@media (max-width: 560px) { .sv-options { grid-template-columns: 1fr; } }
.sv-opt {
  margin: 0; padding: 15px 12px; font-size: 16px; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.16); color: var(--cream);
}
.sv-opt:hover:not(:disabled) { border-color: var(--amber); }
.sv-opt.picked { background: var(--amber); border-color: var(--amber); }
.sv-opt.right { background: var(--good); border-color: #7ee08c; opacity: 1; }
.sv-opt.wrong { background: rgba(192,57,43,.85); border-color: #ff9c8f; opacity: 1; }
.sv-opt:disabled { opacity: .6; }
.sv-foot { font-size: 14px; opacity: .8; margin-top: auto; padding-top: 10px; }
.sv-foot .ok { color: #7ee08c; }
.sv-foot .no { color: #ff9c8f; }

/* Emoji-heavy UI uses the webfont so Windows stops drawing empty boxes. */
.gc-emoji, .chosen-emoji, .emoji-pick, .avatar-pick .emoji-face, .pavatar-emoji,
.hm-life, .sv-flag, .mc-front, .rg-m-emoji, .rg-badge, .d-big, .yarn-ball,
.rotate-icon, .result-row.win::after, .uc-wild4 {
  font-family: var(--emoji);
}
