/* Warm playroom: cream backdrop, cream-and-rose board with a tan rim, cream vs plum pieces. */
:root {
  --bg-top: #fbf6ef;
  --bg-bottom: #f2e4d9;
  --ink: #4f3c46;
  --muted: #9c8791;
  --panel: rgba(120, 80, 95, .06);
  --panel-strong: rgba(120, 80, 95, .1);
  --panel-line: rgba(120, 80, 95, .14);
  --panel-solid: #f5ece4;
  --surface: #fffaf4;
  --gold: #e3b95c;
  --gold-deep: #c4933a;
  --gold-ink: #4a3310;
  --cream: #fdf8ee;
  --cream-rim: #e6c882;
  --plum: #9c7282;
  --plum-deep: #7a5263;
  --sq-light: #f6ecdc;
  --sq-dark: #c39ca5;
  --sq-picked: #ad828d;
  --board-rim: #c9a66f;
  --good: #3f8a5c;
  --danger: #c0546a;
  --radius: 24px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
  background-color: var(--bg-bottom);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* faint stars */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sky i { position: absolute; font-size: 0; border-radius: 50%; background: #eadcd0; opacity: .7; animation: twinkle 8s ease-in-out infinite; }
.sky i:nth-child(1) { top: 20%; left: 10%; width: 90px; height: 90px; }
.sky i:nth-child(2) { top: 22%; left: 34%; width: 50px; height: 50px; animation-delay: -2s; }
.sky i:nth-child(3) { top: 14%; right: 12%; width: 110px; height: 110px; background: #f5e6bf; animation-delay: -4s; }
.sky i:nth-child(4) { top: 20%; right: 22%; width: 70px; height: 70px; background: #f5e6bf; animation-delay: -1s; }
.sky i:nth-child(5) { bottom: 16%; right: 10%; width: 80px; height: 80px; animation-delay: -3s; }
.sky i:nth-child(6) { bottom: 30%; left: 6%; width: 60px; height: 60px; animation-delay: -5s; }
.sky i:nth-child(7) { top: 48%; right: 4%; width: 40px; height: 40px; }
@keyframes twinkle { 50% { opacity: .35; } }

#app { position: relative; z-index: 1; min-height: 100dvh; }
.screen {
  display: none;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.screen.active { display: block; animation: fade .25s ease-out; }

/* ------------------------------------------------ buttons & bits */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 58px; padding: 12px 26px; border-radius: 999px;
  background: var(--surface); font-size: 21px; font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--panel-line);
  transition: transform .08s;
}
.btn:active, .friend:active, .profile:active, .round-btn:active, .bar-btn:active { transform: scale(.96); }
.btn.go, .btn.play {
  background: linear-gradient(180deg, #f3d792, var(--gold) 55%, var(--gold-deep));
  color: var(--gold-ink); box-shadow: 0 5px 0 #a87a2c, 0 8px 20px rgba(196, 147, 58, .25);
}
.btn.play { font-size: 32px; min-height: 84px; padding: 14px 60px; }
.btn.soft { background: var(--panel); }
.btn.danger { background: rgba(192, 84, 106, .1); color: var(--danger); }
.btn.small { min-height: 46px; font-size: 17px; padding: 8px 18px; }
.row { display: flex; gap: 14px; justify-content: center; align-items: center; margin-top: 18px; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); font-weight: 600; }
.center { text-align: center; }

.p {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; flex: none;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.p.w { background: radial-gradient(circle at 40% 35%, #fff, var(--cream) 60%, #efe3c8); border: 2px solid var(--cream-rim); }
.p.b { background: radial-gradient(circle at 40% 35%, #c8a3b1, var(--plum) 60%, var(--plum-deep)); border: 2px solid var(--plum-deep); }

.chip { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 16px; font-weight: 900; }
.chip.easy { background: rgba(63, 138, 92, .12); color: var(--good); }
.chip.right { background: rgba(46, 111, 181, .14); color: #2e6fb5; }
.chip.tricky { background: rgba(214, 125, 60, .14); color: #a9561b; }
.chip.hard { background: rgba(192, 84, 106, .12); color: var(--danger); }
.chip.super { background: rgba(122, 82, 99, .14); color: var(--plum-deep); }

.kid-emoji {
  display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; flex: none;
  background: var(--surface); font-size: 28px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--panel-line);
}
.kid-emoji.big { width: 104px; height: 104px; font-size: 58px; }
.kid-emoji.huge { width: 160px; height: 160px; font-size: 92px; box-shadow: 0 0 0 4px var(--panel-line); }

.avatar { display: block; }
.avatar.mini { width: 52px; height: 52px; }
.avatar.tiny { width: 38px; height: 38px; }
.avatar.small { width: 62px; height: 62px; }
.avatar.portrait { width: 104px; height: 104px; }
.avatar.huge { width: 160px; height: 160px; }
.avatar.bob { animation: bob 2.6s ease-in-out infinite; }
.avatar.spin { animation: hop .6s ease-in-out 3; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
@keyframes hop { 50% { transform: translateY(-22px) scale(1.06); } }
@keyframes fade { from { opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.04); } }

/* ------------------------------------------------ top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1100px; margin: 0 auto 18px; }
.bar h2 { margin: 0; font-size: 28px; text-align: center; flex: 1; font-weight: 900; }
.bar-btn {
  display: flex; flex-direction: column; align-items: center; min-width: 72px; padding: 4px 6px;
  font-size: 15px; font-weight: 800; color: var(--ink);
}
.bar-btn span { font-size: 30px; line-height: 1; }
.bar-space { width: 72px; }
.me { display: flex; align-items: center; gap: 12px; font-size: 22px; background: var(--panel); padding: 6px 18px 6px 6px; border-radius: 999px; }
.me-link {
  background: var(--surface); padding-right: 8px;
  box-shadow: inset 0 0 0 2px var(--panel-line), 0 4px 0 rgba(120, 80, 95, .12);
  transition: transform .08s;
}
.me-link:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--panel-line); }
.me-go {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 8px 14px; border-radius: 999px;
  background: var(--gold); color: var(--gold-ink); font-size: 16px; font-weight: 900; white-space: nowrap;
}
.me-go i { font-style: normal; font-size: 22px; line-height: 1; }
.rating { font-weight: 900; font-size: 20px; color: #93661b; white-space: nowrap; }
.rating em { font-style: normal; font-size: 15px; margin-left: 6px; }
em.up, .up em { color: var(--good); }
em.down, .down em { color: var(--danger); }

/* ------------------------------------------------ home */
.title { text-align: center; margin-top: 4vh; }
.title h1 { font-size: clamp(42px, 8vw, 80px); margin: 8px 0 14px; font-weight: 900; letter-spacing: .5px; color: var(--plum-deep); }
.title-pieces .p { width: 44px; height: 44px; margin: 0 6px; }
.parade { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.parade .avatar { animation: bob 2.6s ease-in-out infinite; }
.parade .avatar:nth-child(odd) { animation-delay: -1.3s; }
.ask { text-align: center; font-size: 30px; margin: 4vh 0 18px; font-weight: 900; }
.profiles { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; max-width: 1000px; margin: 0 auto; }
.profile {
  width: 180px; padding: 20px 12px; border-radius: var(--radius); background: var(--panel-solid);
  box-shadow: inset 0 0 0 1px var(--panel-line);
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 22px;
}
.profile small { font-size: 17px; color: #93661b; }
.add-small { color: var(--muted); }
.add-small span { font-size: 22px; line-height: 1; }
.profile.add { box-shadow: inset 0 0 0 2px var(--panel-line); background: transparent; }

/* ------------------------------------------------ hub */
.hub { max-width: 900px; margin: 0 auto; text-align: center; min-height: calc(100dvh - 140px); display: flex; flex-direction: column; justify-content: center; }
.hub > .row, .hub > .color-pick { align-self: center; }
.versus { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 4vw, 48px); margin-top: 2vh; }
.versus { align-items: flex-start; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 26px; width: 220px; }
.vs-side .btn { margin-top: 6px; }
.vs-face { border-radius: 50%; }
.vs-face:active { transform: scale(.96); }
.vs { font-size: 50px; font-weight: 900; color: var(--plum); transform: rotate(-8deg); align-self: center; margin-top: -90px; }
.motto { font-size: 22px; margin: 22px 0; }
.motto span { font-weight: 600; color: var(--muted); font-size: 19px; }
.motto small { color: var(--muted); font-size: 17px; }
.play-row { margin-top: 36px; display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.color-pick {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; padding: 6px;
  background: var(--panel); border-radius: 999px; font-size: 19px;
}
.color-pick > span { padding: 0 8px 0 14px; color: var(--muted); }
.seg { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 18px; border-radius: 999px; }
.seg small { font-weight: 600; color: var(--muted); font-size: 14px; }
.seg.on { background: var(--surface); box-shadow: inset 0 0 0 2px var(--gold); }

/* ------------------------------------------------ pick a friend */
.friends { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.friend {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 10px 14px; background: var(--surface); border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--panel-line); overflow: hidden;
}
.friend.on { box-shadow: inset 0 0 0 3px var(--gold), 0 8px 20px rgba(196, 147, 58, .18); }
.friend .face { position: relative; display: block; }
.friend.locked { cursor: default; }
.friend.locked .avatar { filter: grayscale(1) brightness(.75); }
.friend.locked b, .friend.locked small { color: var(--muted); }
.friend.locked .chip { background: rgba(122, 82, 99, .08); color: var(--muted); }
.lock { position: absolute; right: -4px; bottom: -4px; width: 38%; height: 38%; fill: #fff; stroke: #fff; background: var(--plum); border-radius: 50%; padding: 6%; }
.tag { position: absolute; top: 8px; left: 8px; z-index: 1; font-size: 13px; font-weight: 900; padding: 3px 10px; border-radius: 999px; }
.tag.new { left: auto; right: 8px; background: #8fd1a6; color: #173f27; animation: breathe 1.2s ease-in-out infinite; }
.friends.compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin: 16px 0 4px; }
.friends.compact .friend { padding: 12px 6px 10px; gap: 2px; border-radius: 18px; }
.friends.compact .avatar.portrait { width: 64px; height: 64px; }
.friends.compact b { font-size: 16px; }
.friends.compact small { font-size: 13px; }
.friends.compact .tag { top: 4px; left: 4px; font-size: 11px; padding: 2px 7px; }
.friends.compact .tag.new { left: auto; right: 4px; }
.friend b { font-size: 24px; }
.friend small { font-size: 15px; color: var(--muted); font-weight: 700; }


/* ------------------------------------------------ progress & settings */
.who-me { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.who-me b { display: block; font-size: 28px; }
.avatar-edit { position: relative; border-radius: 50%; }
.avatar-edit:active { transform: scale(.96); }
.pencil {
  position: absolute; right: -2px; bottom: -2px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--gold); color: var(--gold-ink); font-size: 18px;
  box-shadow: 0 0 0 3px var(--panel-solid);
}
.big-pick { justify-content: center; }
.big-pick .emo { width: 72px; height: 72px; font-size: 40px; }
.progress, .settings { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel-solid); border-radius: var(--radius); padding: 20px 22px; box-shadow: inset 0 0 0 1px var(--panel-line); }
.panel h3 { margin: 0 0 12px; font-size: 22px; display: flex; align-items: center; gap: 10px; font-weight: 900; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats div { background: var(--panel-solid); border-radius: 20px; padding: 14px; text-align: center; box-shadow: inset 0 0 0 1px var(--panel-line); }
.stats b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stats small { color: var(--muted); font-size: 15px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--panel-line); stroke-width: 2; stroke-dasharray: 6 6; }
.chart .axis { font: 700 12px var(--font); fill: var(--muted); text-anchor: end; }
.chart .area { fill: rgba(227, 185, 92, .18); }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--surface); stroke: var(--gold); stroke-width: 3; }
.chart .dot.last { fill: var(--gold); }
.chart .val { font: 900 18px var(--font); fill: var(--ink); text-anchor: middle; }
.beaten { display: flex; flex-wrap: wrap; gap: 8px; }
.beaten span { filter: grayscale(1); opacity: .3; }
.beaten span.yes { filter: none; opacity: 1; }
.games { list-style: none; margin: 0; padding: 0; }
.games li { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--panel-line); font-size: 19px; }
.games li:last-child { border: 0; }
.g-name { flex: 1; }
.res { padding: 3px 12px; border-radius: 999px; font-size: 15px; }
.res.won { background: rgba(63, 138, 92, .12); color: var(--good); }
.res.lost { background: rgba(192, 84, 106, .12); color: var(--danger); }
.res.draw { background: rgba(227, 185, 92, .2); color: #93661b; }
.delta { width: 80px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.games small { color: var(--muted); width: 230px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 19px; }
.toggle small { display: block; color: var(--muted); font-size: 15px; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; }
.toggle i { flex: none; width: 66px; height: 38px; border-radius: 999px; background: #dccbc9; position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + i { background: var(--gold-deep); }
.toggle input:checked + i::after { transform: translateX(28px); }
.toggle input:focus-visible + i { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(79, 60, 70, .35); animation: fade .2s; }
.modal[hidden] { display: none; }
.card {
  width: min(600px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border-radius: 30px;
  padding: 28px; box-shadow: 0 0 0 1px var(--panel-line), 0 20px 60px rgba(79, 60, 70, .25); text-align: center;
  animation: pop .3s cubic-bezier(.2, 1.4, .5, 1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.card.wide { width: min(820px, 100%); }
.card h2 { font-size: 30px; margin: 6px 0 16px; font-weight: 900; }
.field { display: block; text-align: left; font-size: 19px; margin: 14px 0; }
.field small { color: var(--muted); font-weight: 600; }
.field input {
  display: block; width: 100%; margin-top: 8px; font: inherit; font-size: 24px; padding: 12px 18px; color: var(--ink);
  background: #fff; border: 2px solid var(--panel-line); border-radius: 18px; outline: none;
  -webkit-user-select: text; user-select: text;
}
.field input::placeholder { color: var(--muted); }
.field input:focus { border-color: var(--gold); }
.emojis, .ages { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.emo { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; background: var(--panel); }
.age { min-width: 56px; height: 56px; font-size: 21px; border-radius: 16px; background: var(--panel); }
.emo.on, .age.on { background: rgba(227, 185, 92, .2); box-shadow: inset 0 0 0 3px var(--gold); }

.result .avatar { margin: 0 auto; }
.result p { font-size: 20px; color: var(--muted); margin: 6px 0; }
.result .badge { color: #93661b; background: rgba(227, 185, 92, .2); display: inline-block; padding: 6px 16px; border-radius: 999px; }
.elo-change { font-size: 24px; margin: 14px auto 4px; padding: 10px 20px; border-radius: 20px; background: var(--panel); display: inline-block; font-variant-numeric: tabular-nums; }
.elo-change em { font-style: normal; margin-left: 6px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* ------------------------------------------------ game */
#s-game.active { display: flex; flex-direction: column; align-items: center; }
.game-bar { width: 100%; margin-bottom: 4px; }
.game-title { display: flex; align-items: center; gap: 6px; font-size: 24px; font-weight: 900; padding: 6px 14px; border-radius: 999px; }
.game-title .caret { font-size: 16px; color: var(--muted); }
.game-title:active { background: var(--panel); }

.table {
  --board: min(calc(100vw - 32px), calc(100dvh - 300px), 760px);
  display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; justify-content: center;
}
.tray {
  width: var(--board); min-height: calc(var(--board) / 16 + 4px); display: flex; flex-wrap: wrap; gap: 4px;
  padding-right: 32%; /* keeps the top tray clear of the peeking friend */
}
.tray .p { width: calc(var(--board) / 16); height: calc(var(--board) / 16); }
#kid-tray { padding-right: 0; }

.board-wrap { position: relative; }
.peek {
  position: absolute; z-index: 0; right: 4%; top: 0; width: 25%; transform: translateY(-61%);
  transition: transform .3s;
}
.peek .avatar { width: 100%; height: auto; }
.peek .avatar > circle { display: none; } /* just the face peeking over the edge */
.peek.think { animation: peek-think 1.2s ease-in-out infinite; }
.peek.happy { animation: peek-hop .45s ease-in-out 2; }
.peek.sad { animation: peek-sad .6s ease-in-out 1 forwards; }
@keyframes peek-think { 50% { transform: translateY(-62%) rotate(-5deg); } }
@keyframes peek-hop { 50% { transform: translateY(-78%); } }
@keyframes peek-sad { 50% { transform: translateY(-38%); } }

.board {
  position: relative; z-index: 1; width: var(--board); height: var(--board); border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 6px var(--board-rim), 0 0 0 8px rgba(255, 255, 255, .5), 0 14px 34px rgba(120, 80, 95, .28);
  touch-action: none;
}
.cells { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.cell.light { background: var(--sq-light); }
.cell.dark { background: var(--sq-dark); position: relative; }
.cell.picked { background: var(--sq-picked); }
.cell.target::after {
  content: ""; position: absolute; inset: 39%; border-radius: 50%; background: rgba(255, 255, 255, .6);
}
.pieces { position: absolute; inset: 0; pointer-events: none; }
.piece { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; display: grid; place-items: center; will-change: transform; }
.piece .disc {
  width: 78%; height: 78%; border-radius: 50%; position: relative; display: grid; place-items: center;
  transition: transform .15s, box-shadow .15s;
}
.piece .disc::before { content: ""; position: absolute; inset: 18%; border-radius: 50%; }
.piece.w .disc {
  background: radial-gradient(circle at 38% 32%, #fff 0 20%, var(--cream) 60%, #efe2c6);
  box-shadow: inset 0 0 0 3px var(--cream-rim), inset 0 -4px 0 rgba(170, 130, 60, .25), 0 4px 6px rgba(100, 60, 70, .3);
}
.piece.w .disc::before { box-shadow: inset 0 0 0 2px rgba(214, 180, 110, .6), 0 0 0 1px rgba(255, 255, 255, .7); }
.piece.b .disc {
  background: radial-gradient(circle at 38% 32%, #c9a7b4 0 18%, var(--plum) 58%, var(--plum-deep));
  box-shadow: inset 0 0 0 3px #b58e9c, inset 0 -4px 0 rgba(70, 30, 50, .35), 0 4px 6px rgba(100, 60, 70, .3);
}
.piece.b .disc::before { box-shadow: inset 0 0 0 2px rgba(90, 50, 70, .5), 0 0 0 1px rgba(220, 190, 200, .5); }
.piece.king .disc::before { display: none; }
.crown { width: 58%; height: 58%; position: relative; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3)); }
.piece.must .disc { animation: must 1.1s ease-in-out infinite; }
@keyframes must { 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 18px 6px rgba(227, 185, 92, .75); } }
.piece.nudge .disc { animation: nudge .3s ease-in-out 3; }
@keyframes nudge { 50% { transform: scale(1.18); } }
.piece.selected { z-index: 2; }
.piece.selected .disc { transform: scale(1.1) translateY(-6%); box-shadow: 0 0 0 4px var(--gold), 0 10px 14px rgba(100, 60, 70, .35); }
.piece.dragging { z-index: 5; }
.piece.dragging .disc { transform: scale(1.22); }
.piece.moving { z-index: 4; }
.piece.ghost .disc { opacity: .35; transform: scale(.85); transition: opacity .25s, transform .25s; }
.piece.taken .disc { animation: taken .35s ease-in forwards; }
@keyframes taken { to { transform: scale(0) rotate(90deg); opacity: 0; } }


.game-foot { width: 100%; max-width: 1100px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.kid-chip { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.kid-chip .kid-text { display: flex; flex-direction: column; line-height: 1.15; }
.kid-chip .kid-emoji { width: 64px; height: 64px; font-size: 38px; }
.kid-chip small { color: #93661b; font-size: 15px; }
.practice { font-size: 14px; color: #93661b; background: rgba(227, 185, 92, .2); padding: 4px 12px; border-radius: 999px; }
.round-btn {
  width: 72px; height: 72px; border-radius: 50%; background: #d9c4c8; box-shadow: none; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; color: #fff;
}
.round-btn span { font-size: 30px; line-height: 1; color: #fff; }

/* landscape: more room across, so the footer sits in the corners */
@media (orientation: landscape) and (min-height: 600px) {
  .table { --board: min(calc(100vw - 32px), calc(100dvh - 240px), 760px); }
  .game-foot { position: fixed; left: 0; right: 0; bottom: 0; max-width: none; padding: 0 max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); pointer-events: none; }
  .game-foot > * { pointer-events: auto; }
}

@media (max-width: 700px) {
  .btn.play { font-size: 26px; padding: 12px 40px; min-height: 70px; }
  .avatar.huge, .kid-emoji.huge { width: 116px; height: 116px; font-size: 66px; }
  .vs { font-size: 34px; margin-top: -70px; }
  .vs-side { width: 140px; font-size: 20px; }
  .games li { flex-wrap: wrap; row-gap: 2px; font-size: 17px; }
  .games .delta { width: auto; }
  .games small { width: 100%; text-align: left; padding-left: 52px; }
  .me-go { font-size: 0; padding: 6px 10px; }
  .me-go i { font-size: 22px; }
  .me b { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vs-side .btn { padding: 8px 14px; font-size: 15px; }
  .color-pick { flex-wrap: wrap; justify-content: center; border-radius: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .table { --board: min(calc(100vw - 32px), calc(100dvh - 290px)); }
  .game-title { font-size: 18px; }
}

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