/* The frame, in the look of the game art: chunky rounded parts with one dark ink outline, flat faces, one flat lip
   under everything you can press (it sinks when pressed) and bouncy springs. Calm graphite, warm ivory, one vermilion
   accent. Each game brings its own materials. */
[hidden] { display: none !important; }
@property --ring { syntax: '<length>'; inherits: false; initial-value: 0px; }
:root {
  --ground: #131315;
  --surface: #1C1C1F;
  --surface-2: #232327;
  --surface-3: #2C2C31;
  --line: #2A2A2E;
  --ink: #F3EFE7;
  --ink-2: #CFCAC1;
  --muted: #8E8C94;
  --faint: #5F5D65;
  --accent: #E8553F;
  --accent-press: #CC4430;
  --accent-ink: #FFFFFF;
  --good: #5DB585;
  --warn: #E3A33B;
  --paper: #F7F4EE;

  /* the cartoon parts */
  --outline: #09080C;      /* the ink outline around every part */
  --ow: 2px;               /* its one weight */
  --face: #2B2A30;         /* a quiet part's face */
  --face-lip: #1A191E;     /* and the lip it sits on */
  --face-hi: #34333A;
  --card: #1C1C1F;         /* a card that only holds things */
  --card-lip: #151518;
  --accent-lip: #A73A28;
  --cream: #F5E9CB;
  --cream-lip: #D5BC8F;
  --gold: #F5BE3C;
  --gold-lip: #CC8B20;
  --red-ink: #FF8F7D;

  --st: max(env(safe-area-inset-top, 0px), var(--cleo-inset-top, 0px));
  --sb: max(env(safe-area-inset-bottom, 0px), var(--cleo-inset-bottom, 0px));
  --sl: max(env(safe-area-inset-left, 0px), var(--cleo-inset-left, 0px));
  --sr: max(env(safe-area-inset-right, 0px), var(--cleo-inset-right, 0px));
  --pad: 20px;
  --r-card: 22px;
  --r-btn: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);     /* overshoots a little, then settles */
  --spring-soft: cubic-bezier(.22, 1.22, .36, 1);
  --font: 'Onest', ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--ink); }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.4; font-weight: 450;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
img { display: block; max-width: 100%; -webkit-user-drag: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.ic { width: 22px; height: 22px; flex: none; overflow: visible; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the stack of screens ---------- */
#app { position: fixed; inset: 0; overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--ground);
  padding: calc(var(--st) + 8px) calc(var(--sr) + var(--pad)) 0 calc(var(--sl) + var(--pad));
  will-change: transform, opacity;
}
.screen.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--sb) + 28px); }
.screen.scroll::-webkit-scrollbar { display: none; }
/* what scrolls fades out under the status bar instead of running into the clock and the island */
.screen.scroll:not(.gpage)::before {
  content: ''; display: block; flex: none; position: sticky; top: calc(-1 * (var(--st) + 8px)); z-index: 6; pointer-events: none;
  height: calc(var(--st) + 8px); margin: calc(-1 * (var(--st) + 8px)) calc(-1 * (var(--sr) + var(--pad))) 0 calc(-1 * (var(--sl) + var(--pad)));
  background: linear-gradient(var(--ground) calc(100% - 16px), rgba(19, 19, 21, 0));
}
.screen.enter { animation: screen-in .34s var(--ease-out) both; }
.screen.enter-back { animation: screen-back-in .28s var(--ease-out) both; }
.screen.leave { animation: screen-out .26s var(--ease) both; pointer-events: none; }
.screen.leave-back { animation: screen-back-out .26s var(--ease) both; pointer-events: none; z-index: 2; }
.screen.covered { visibility: hidden; }
@keyframes screen-in { from { transform: translateX(34px); opacity: 0; } 60% { transform: translateX(-3px); opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes screen-back-in { from { transform: translateX(-18px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes screen-out { to { transform: translateX(-18px); opacity: 0; } }
@keyframes screen-back-out { to { transform: translateX(32px); opacity: 0; } }
.screen.fade { animation: fade-in .3s var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* top bar of a screen */
.topbar { display: flex; align-items: center; gap: 8px; min-height: 56px; margin: 0 -4px 8px; flex: none; }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -.015em; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { width: 44px; flex: none; }

/* a square button with a drawn icon: a chunky key with a lip */
.icon-btn {
  position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex: none; padding-bottom: 3px;
  border-radius: 14px; color: var(--ink); background: var(--face);
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip);
  transition: transform .26s var(--spring), box-shadow .12s var(--ease);
}
.icon-btn .ic { width: 24px; height: 24px; }
.icon-btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -3px 0 var(--face-lip); transition-duration: .06s; }
.icon-btn.flat { background: none; box-shadow: none; padding: 0; }
.icon-btn.flat:active { transform: scale(.9); box-shadow: none; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 56px; padding: 0 22px 4px;
  border-radius: var(--r-btn); font-size: 17px; font-weight: 750; letter-spacing: -.008em; white-space: nowrap;
  background: var(--face); color: var(--ink);
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip);
  transition: transform .28s var(--spring), box-shadow .12s var(--ease), background .15s, color .15s;
}
.btn.wide { width: 100%; }
.btn .ic { width: 24px; height: 24px; margin-left: -2px; }
.btn > span { min-width: 0; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--accent-lip); text-shadow: 0 1.5px 0 rgba(120, 30, 18, .45); }
.btn.primary:active:not(:disabled) { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--accent-lip); }
/* the one flat highlight on the main action, like the gloss on the art */
.btn.primary::before { content: ''; position: absolute; left: 11px; top: 7px; width: 13px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .42); transform: rotate(-8deg); pointer-events: none; }
.btn.small.primary::before, .btn.tiny.primary::before { left: 8px; top: 5px; width: 9px; height: 4px; }
.btn.tonal { background: var(--face); color: var(--ink); }
.btn.danger { background: #3D211D; color: var(--red-ink); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 #2A1613; }
.btn.danger:active:not(:disabled) { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 #2A1613; }
.btn.light { background: var(--cream); color: #17151C; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--cream-lip); }
.btn.light:active:not(:disabled) { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--cream-lip); }
.btn.small { height: 44px; font-size: 15.5px; padding: 0 16px 3px; border-radius: 13px; gap: 8px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip); }
.btn.small .ic { width: 21px; height: 21px; }
.btn.tiny { height: 36px; font-size: 14px; padding: 0 13px 3px; border-radius: 11px; gap: 6px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip); }
.btn.tiny .ic { width: 19px; height: 19px; margin-left: -1px; }
.btn.small.primary, .btn.tiny.primary { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--accent-lip); }
.btn.small.light, .btn.tiny.light { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--cream-lip); }
.btn.small:active:not(:disabled), .btn.tiny:active:not(:disabled) { transform: translateY(1.5px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -3.5px 0 var(--face-lip); }
.btn.small.primary:active:not(:disabled), .btn.tiny.primary:active:not(:disabled) { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -3.5px 0 var(--accent-lip); }
.btn.only { padding-left: 0; padding-right: 0; }
.btn.only .ic { margin: 0; }
.btn:disabled { background: #222126; color: #66646C; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 #19181C; text-shadow: none; }
.btn:disabled::before { display: none; }
.btn:disabled .ic, .btn:disabled .avatar { opacity: .45; filter: grayscale(1); }
.btn.busy { pointer-events: none; }
.btn.busy span::after { content: ''; display: inline-block; width: 1.1em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
/* a button that is waiting for you (a rematch asked for) nods now and then */
.btn.nudge { animation: nudge 1.8s var(--ease) .6s infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-3px) scale(1.02); } 86% { transform: translateY(1px) scale(.995); } 93% { transform: translateY(-1px); } }
.btns { display: grid; gap: 10px; }
.btns.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.btns.two .btn { min-width: 0; padding: 0 12px 4px; font-size: 16px; gap: 8px; }
.btns.two .btn span { overflow: hidden; text-overflow: ellipsis; }
.text-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--ink-2); font-weight: 650; font-size: 15px; transition: transform .2s var(--spring); }
.text-link .ic { width: 18px; height: 18px; }
.text-link:active { transform: scale(.95); opacity: .75; }
.mark { display: inline-grid; place-items: center; width: 22px; height: 22px; }
.mark svg { width: 21px; height: 21px; }

/* ---------- avatars: a drawn face in a disc, outlined in ink ---------- */
.avatar {
  --s: 40px; position: relative; width: var(--s); height: var(--s); flex: none; border-radius: 50%;
  background: var(--c, #3A3A40); display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: calc(var(--s) * .38); letter-spacing: -.02em;
  outline: 2.5px solid var(--outline); outline-offset: 0;
}
.avatar.small { outline-width: 2px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar .i { line-height: 1; transform: translateY(.02em); }
.avatar.ring { box-shadow: 0 0 0 5px var(--accent), 0 0 0 7px var(--outline); }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: calc(var(--s) * .3); height: calc(var(--s) * .3); min-width: 11px; min-height: 11px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 2.5px var(--outline); }
.avatar .dot.on { background: #4FC07E; }
.avatar.bot { color: var(--ink-2); }
.avatar.bot .ic { width: 55%; height: 55%; }
.avatar.open { background: transparent; outline: 2.5px dashed #3A3940; color: var(--faint); }
.avatar.open .ic { width: 55%; height: 55%; }
.hop { animation: hop .42s var(--spring); }
@keyframes hop { 0% { transform: scale(1); } 35% { transform: scale(1.16, .9) translateY(-3px); } 65% { transform: scale(.96, 1.05); } 100% { transform: none; } }

/* ---------- chips, switches, rows ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 42px; padding: 0 16px 3px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  font-size: 15px; font-weight: 700; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip);
  transition: transform .26s var(--spring), background .15s, color .15s;
}
.chip:active { transform: translateY(1.5px); transition-duration: .06s; }
.chip.on { background: var(--cream); color: #17151C; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--cream-lip); animation: chip-on .34s var(--spring); }
@keyframes chip-on { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: none; } }
.switch {
  width: 56px; height: 34px; border-radius: 99px; background: #2B2A30; position: relative; flex: none;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 4px 0 #1A191E; transition: background .2s;
}
.switch i {
  position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: var(--cream);
  box-shadow: 0 0 0 var(--ow) var(--outline), inset -3px -3px 0 var(--cream-lip); transition: transform .34s var(--spring);
}
.switch:active i { transform: scale(1.1, .92); }
.switch.on { background: var(--accent); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 4px 0 var(--accent-lip); }
.switch.on i { transform: translateX(22px); }
.switch.on:active i { transform: translateX(22px) scale(1.1, .92); }
.row {
  display: flex; align-items: center; gap: 14px; min-height: 58px; width: 100%; padding: 8px 0; text-align: left;
  border-bottom: 2px solid #131315;
}
.row:last-child { border-bottom: 0; }
.row .k { flex: 1; display: flex; flex-direction: column; font-weight: 650; font-size: 16px; min-width: 0; }
.row .k small { color: var(--muted); font-size: 13.5px; font-weight: 520; margin-top: 1px; }
.row > .ic { width: 20px; height: 20px; }
.row .lead { display: grid; place-items: center; width: 28px; flex: none; margin-right: -2px; }
.row .lead .ic { width: 26px; height: 26px; }
button.row { transition: transform .22s var(--spring); }
button.row:active { transform: scale(.98); }
.group { background: var(--card); border-radius: 22px; padding: 0 16px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip); }
.group > .row:last-child { padding-bottom: 11px; }
.section-h { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin: 28px 0 8px; }
.section-h h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }

/* ---------- inputs ---------- */
.field { position: relative; display: block; }
.field input {
  width: 100%; height: 60px; border-radius: 18px; border: 0; background: #0E0E10; padding: 3px 18px 0;
  font-size: 19px; font-weight: 650; letter-spacing: -.01em; outline: none;
  box-shadow: inset 0 0 0 var(--ow) #2E2D33, inset 0 4px 0 #08080A;
  transition: box-shadow .15s;
}
.field input::placeholder { color: var(--faint); font-weight: 550; }
.field input:focus { box-shadow: inset 0 0 0 2.5px var(--ink-2), inset 0 4px 0 #08080A; }
.field .hint { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: 6px; pointer-events: none; }
.field .hint .ic { width: 20px; height: 20px; }
.field .hint.ok { color: var(--good); }
.field .hint.bad { color: var(--red-ink); }
.field-note { min-height: 22px; font-size: 14px; color: var(--muted); margin: 8px 4px 0; }
.field-note.bad { color: var(--red-ink); }

/* ---------- sheets, toasts ---------- */
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.sheet-wrap { position: absolute; inset: 0; pointer-events: auto; }
.scrim { position: absolute; inset: 0; background: rgba(8, 8, 10, .62); opacity: 0; transition: opacity .28s var(--ease); }
/* the result keeps the final board in its own colours: only a light shade behind its card */
.sheet-wrap:has(> .result-sheet) > .scrim { background: rgba(8, 8, 10, .18); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--st) - 24px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 30px 30px 0 0; padding: 0 calc(var(--pad) + var(--sr)) calc(var(--sb) + 18px) calc(var(--pad) + var(--sl));
  transform: translateY(104%); transition: transform .5s var(--spring-soft);
  box-shadow: 0 0 0 var(--ow) var(--outline), inset 0 2px 0 #26262A;
}
/* the sheet springs a little past its place: this keeps its colour under it while it does */
.sheet::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 60px; background: var(--surface); }
.sheet.drag { transition: none; }
.sheet.tall { height: calc(100% - var(--st) - 24px); }
.sheet-wrap.in .scrim { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.sheet-wrap.out .scrim { opacity: 0; }
.sheet-wrap.out .sheet { transform: translateY(104%); transition: transform .24s var(--ease); }
.grab { width: 44px; height: 6px; border-radius: 3px; background: #3A3940; margin: 9px auto 5px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; min-height: 52px; margin: 0 -2px 8px 0; flex: none; }
.sheet-head h2 { flex: 1; font-size: 22px; font-weight: 800; letter-spacing: -.02em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head > .ic { width: 30px; height: 30px; }
.sheet-head .icon-btn { width: 40px; height: 40px; border-radius: 13px; }
.sheet-head .icon-btn .ic { width: 22px; height: 22px; }
.sheet-body { overflow-y: auto; overflow-x: hidden; margin: 0 -6px; padding: 4px 6px 2px; }
.sheet-body::-webkit-scrollbar { display: none; }
.confirm { padding: 18px 0 4px; display: grid; gap: 8px; }
.confirm .pic { display: grid; place-items: center; margin: 4px 0 6px; }
.confirm .pic .ic { width: 64px; height: 64px; animation: pop-big .5s var(--spring) both; }
.confirm .pic + h2 { text-align: center; }
.confirm .pic ~ p { text-align: center; }
.confirm h2 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.confirm p { font-size: 15.5px; margin-bottom: 14px; }
.confirm .btns { margin-top: 12px; }
.toast {
  position: absolute; left: 50%; top: calc(var(--st) + 12px); transform: translate(-50%, -30px) scale(.86); opacity: 0;
  display: flex; align-items: center; gap: 10px; background: var(--cream); color: #17151C; padding: 11px 18px 15px; border-radius: 16px;
  font-weight: 700; font-size: 15.5px; line-height: 1.25; width: max-content; max-width: calc(100% - 40px); text-align: left;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--cream-lip), 0 10px 24px rgba(0, 0, 0, .35);
  transition: transform .44s var(--spring), opacity .18s;
}
.toast .ic { width: 24px; height: 24px; margin-left: -4px; }
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast.out { transform: translate(-50%, -20px) scale(.92); opacity: 0; transition: transform .26s var(--ease), opacity .2s; }

/* ---------- QR and the code pad ---------- */
.qr {
  background: #FBF6EA; border-radius: 26px; padding: 18px 18px 24px; aspect-ratio: 1 / 1.03; width: 100%; max-width: 300px; margin: 0 auto;
  box-shadow: inset 0 0 0 2.5px var(--outline), inset 0 -8px 0 #DCCBA6;
}
.qr svg { width: 100%; height: 100%; display: block; }
.codepad { display: grid; gap: 28px; justify-items: center; }
.code-boxes { display: flex; gap: 10px; }
.code-box {
  width: 58px; height: 72px; border-radius: 18px; background: #0E0E10; display: grid; place-items: center; padding-top: 3px;
  font-size: 36px; font-weight: 850; box-shadow: inset 0 0 0 var(--ow) #2E2D33, inset 0 4px 0 #08080A; transition: box-shadow .15s, transform .15s;
}
.code-box.on { background: var(--cream); color: #17151C; padding: 0 0 4px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--cream-lip); animation: pop-big .3s var(--spring); }
.code-box.cur { box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 4px 0 #08080A; }
.code-boxes.bad .code-box { box-shadow: inset 0 0 0 2.5px var(--red-ink); background: #2A1715; color: var(--red-ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 340px; }
.key {
  height: 64px; border-radius: 18px; background: var(--face); font-size: 28px; font-weight: 750; display: grid; place-items: center; padding-bottom: 5px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -7px 0 var(--face-lip); transition: transform .24s var(--spring), box-shadow .1s;
}
.key:active { transform: translateY(2.5px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4.5px 0 var(--face-lip); transition-duration: .05s; }
.key .ic { width: 30px; height: 30px; }

/* ---------- motion helpers ---------- */
.pop-in { animation: pop .3s var(--spring) both; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop-big { 0% { transform: scale(.5); opacity: 0; } 55% { transform: scale(1.1); opacity: 1; } 80% { transform: scale(.97); } 100% { transform: none; opacity: 1; } }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(7px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #3A3940; border-top-color: var(--ink-2); animation: spin .8s linear infinite; flex: none; }

/* ======================================================================= */
/* welcome: the games, scattered like stickers */
.welcome { padding-bottom: 0; }
.welcome .art {
  flex: 1; min-height: 0; position: relative; margin: 0 calc(-1 * var(--pad)) 0; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); align-content: start; gap: 18px 14px; padding: 18px 18px 0;
}
.welcome .art .tile {
  aspect-ratio: 4 / 5; border-radius: 22px; overflow: hidden; background: var(--surface);
  box-shadow: 0 0 0 2.5px var(--outline), 0 6px 0 var(--lip, #0E0E10), 0 6px 0 2.5px var(--outline);
  animation: tile-in .6s var(--spring) both; transform: rotate(var(--tilt, 0deg));
}
.welcome .art .tile img { width: 100%; height: 100%; object-fit: cover; }
.welcome .art .tile:nth-child(3n+2) { transform: translateY(-30px) rotate(var(--tilt, 0deg)); animation-name: tile-in-2; }
@keyframes tile-in { from { opacity: 0; transform: translateY(26px) scale(.86) rotate(var(--tilt, 0deg)); } }
@keyframes tile-in-2 { from { opacity: 0; transform: translateY(-4px) scale(.86) rotate(var(--tilt, 0deg)); } to { transform: translateY(-30px) rotate(var(--tilt, 0deg)); } }
.wordmark { font-weight: 850; font-size: 40px; line-height: .98; letter-spacing: -.035em; }
.welcome > .wrapw {
  position: relative; z-index: 2; margin: -34px calc(-1 * var(--pad)) 0; width: auto; padding: 24px var(--pad) calc(var(--sb) + 18px);
  background: var(--surface); border-radius: 32px 32px 0 0; box-shadow: 0 0 0 var(--ow) var(--outline), inset 0 2px 0 #26262A;
}
@media (min-width: 560px) { .welcome > .wrapw { max-width: 560px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; } }
.welcome .wordmark { margin: 4px 0 20px; }
.welcome .form { display: grid; gap: 10px; flex: none; }
.welcome .alt { display: grid; gap: 10px; margin-top: 4px; }
.welcome .or { display: flex; justify-content: center; }

/* home: the hub */
.home .wrapw { padding-bottom: calc(var(--sb) + 30px); }
.hub-top { display: flex; align-items: center; gap: 12px; min-height: 64px; margin: 2px 0 14px; }
.hub-top .me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 13px; text-align: left; border-radius: 999px; transition: transform .24s var(--spring); }
.hub-top .me:active { transform: scale(.97); }
.hub-top .who { min-width: 0; display: grid; gap: 2px; }
.hub-top .who b { font-size: 24px; font-weight: 850; letter-spacing: -.03em; line-height: 1.08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-top .who small { font-size: 13.5px; font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-top .who small.on { color: var(--good); }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 18px 4px 14px; border-radius: 999px;
  background: var(--face); color: var(--ink); font-weight: 750; font-size: 15.5px; letter-spacing: -.01em;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip);
  transition: transform .26s var(--spring), box-shadow .1s;
}
.pill .ic { width: 22px; height: 22px; }
.pill:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -3px 0 var(--face-lip); transition-duration: .06s; }
@media (max-width: 400px) { :lang(ru) .pill.join { width: 48px; height: 48px; padding: 0 0 4px; justify-content: center; } :lang(ru) .pill.join .lbl { display: none; } :lang(ru) .pill.join .ic { width: 24px; height: 24px; } }
.pill.quiet { height: 36px; padding: 0 12px; font-size: 14.5px; background: transparent; color: var(--muted); box-shadow: none; }
.pill.quiet:active { transform: scale(.95); }

.acts { display: grid; grid-template-columns: 1.12fr 1fr; gap: 10px; }
.act {
  position: relative; display: grid; align-content: end;
  min-height: 104px; padding: 12px 14px 17px 16px; border-radius: 22px; text-align: left; background: var(--face);
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip);
  transition: transform .28s var(--spring), box-shadow .1s;
}
.act .t { display: grid; gap: 3px; min-width: 0; }
.act b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; line-height: 1.12; }
.act small { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act > .ic { position: absolute; right: 12px; top: 11px; width: 38px; height: 38px; transform: rotate(-8deg); transition: transform .3s var(--spring); }
.act:active > .ic { transform: rotate(-14deg) scale(1.08); }
.act:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.act.primary { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--accent-lip); }
.act.primary:active { box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--accent-lip); }
.act.primary b { text-shadow: 0 1.5px 0 rgba(120, 30, 18, .45); }
.act.primary small { color: rgba(255, 255, 255, .88); }
.act.primary::before { content: ''; position: absolute; left: 12px; top: 8px; width: 13px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .42); transform: rotate(-8deg); pointer-events: none; }
.act small.faces { display: flex; align-items: center; gap: 8px; }
.act .stack { display: flex; }
.act .stack .avatar { outline-color: var(--accent-lip); }
.act .stack .avatar + .avatar { margin-left: -6px; }

.invites:not(:empty) { margin-top: 14px; display: grid; gap: 10px; }
.invite-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 9px; align-items: center; background: var(--card); border-radius: 22px;
  padding: 12px 14px 16px 12px; box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 -6px 0 #2A1714; animation: pop-big .45s var(--spring) both;
}
.invite-card > .avatar { grid-row: span 2; }
.invite-card .t { min-width: 0; font-size: 15.5px; font-weight: 550; color: var(--ink-2); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite-card .t b { font-weight: 800; color: var(--ink); }
.invite-card .btns { display: flex; align-items: center; gap: 8px; }

.strip { display: flex; gap: 10px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 3px var(--pad) 8px; scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad); scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.cont {
  flex: none; width: 240px; display: flex; align-items: center; gap: 14px; background: var(--face); border-radius: 22px; padding: 10px 14px 15px 10px;
  scroll-snap-align: start; text-align: left; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip);
  transition: transform .28s var(--spring), box-shadow .1s;
}
.cont:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.cont.mine { box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 -6px 0 var(--accent-lip); }
.cont .art { position: relative; flex: none; width: 58px; height: 58px; }
.cont .art img.g { width: 58px; height: 58px; border-radius: 16px; object-fit: cover; background: var(--surface-3); display: block; box-shadow: 0 0 0 2px var(--outline); }
.cont .art .avatar { position: absolute; right: -8px; bottom: -8px; }
.cont .t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cont .t b { font-size: 16px; font-weight: 780; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont .t span { font-size: 13.5px; color: var(--muted); font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont .t .turn { color: var(--ink-2); font-weight: 650; }
.cont .t .turn.mine { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 780; }
.cont .t .turn.mine::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--outline); animation: beat 1.6s ease-in-out infinite; }

/* the games: three to a row on a phone, more on a wider screen */
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; padding: 3px 3px 0; }
@media (min-width: 560px) { .games { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: grid; gap: 10px; align-content: start; text-align: left; animation: rise .5s var(--spring) both; animation-delay: calc(var(--i, 0) * 28ms); }
.tile .pic {
  position: relative; display: block; aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: var(--paint, var(--tone, var(--surface)));
  box-shadow: 0 0 0 2.5px var(--outline), 0 6px 0 var(--lip, #0E0E10), 0 6px 0 2.5px var(--outline);
  transition: transform .3s var(--spring), box-shadow .1s;
}
.tile .pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--spring); }
.tile:active .pic { transform: translateY(4px); box-shadow: 0 0 0 2.5px var(--outline), 0 2px 0 var(--lip, #0E0E10), 0 2px 0 2.5px var(--outline); transition-duration: .07s; }
.tile:active .pic img { transform: scale(1.05); transition-duration: .1s; }
.tile .name { font-size: 14.5px; font-weight: 750; letter-spacing: -.015em; line-height: 1.2; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.tile .name.long { font-size: 13.5px; letter-spacing: -.02em; line-height: 1.12; padding: 0 1px; white-space: normal; text-wrap: balance; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tile .new {
  position: absolute; left: 7px; top: 8px; padding: 4px 8px 6px; border-radius: 9px; background: var(--cream); color: #17151C;
  font-size: 11.5px; font-weight: 850; line-height: 1; transform: rotate(-7deg);
  box-shadow: inset 0 0 0 2px var(--outline), inset 0 -4px 0 var(--cream-lip);
}
.tile .turn { position: absolute; right: 9px; top: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2.5px var(--outline), inset -2px -3px 0 var(--accent-lip); animation: beat 1.6s ease-in-out infinite; }
.tile .here { position: absolute; left: 8px; bottom: 8px; display: flex; }
.tile .here .avatar + .avatar { margin-left: -7px; }
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 12px; padding: 4px 3px 8px; }
.pick .tile { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.9); } }
@keyframes beat { 50% { transform: scale(1.22); } }

.friends-row { display: flex; gap: 12px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 6px var(--pad) 2px; scrollbar-width: none; }
.friends-row::-webkit-scrollbar { display: none; }
.fr { flex: none; width: 70px; display: grid; justify-items: center; gap: 7px; text-align: center; transition: transform .26s var(--spring); }
.fr:active { transform: scale(.93); }
.fr b { font-size: 13.5px; font-weight: 720; max-width: 70px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.fr small { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: -6px; max-width: 74px; min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr small.on { color: var(--good); }
.friends-row .empty {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: var(--card); border-radius: 22px; padding: 10px 10px 14px 16px;
  color: var(--muted); font-weight: 600; font-size: 14.5px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip);
}

.cast { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cast button {
  display: grid; justify-items: center; gap: 8px; text-align: center; padding: 14px 4px 16px; border-radius: 22px; background: var(--face);
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip); transition: transform .28s var(--spring), box-shadow .1s;
}
.cast button:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.cast b { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.cast small { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: -6px; }

/* game page: the whole drawing on its own colour */
.gpage .hero { position: relative; margin: 0 calc(-1 * var(--pad)); }
.gpage .hero .pic {
  position: relative; height: clamp(250px, 40vh, 380px); padding-top: var(--st); overflow: hidden; display: flex; justify-content: center;
  background: var(--paint, var(--tone, var(--surface))); border-radius: 0 0 32px 32px;
  box-shadow: 0 2.5px 0 var(--outline), 0 8px 0 var(--lip, #0E0E10), 0 10.5px 0 var(--outline);
}
.gpage .hero .pic img { height: 100%; width: auto; max-width: 100%; flex: none; object-fit: contain; animation: hero-in .6s var(--spring) both; }
@keyframes hero-in { from { transform: scale(.82) translateY(14px); opacity: 0; } }
.gpage .hero .icon-btn { position: absolute; left: calc(var(--sl) + 14px); top: calc(var(--st) + 10px); }
.gpage.screen { padding-top: 0; }
.gpage h1 { font-size: 38px; font-weight: 850; letter-spacing: -.035em; line-height: 1; margin: 30px 0 16px; }
/* the options: rows of chips that fill the width; two named ones share a row when they fit (gamepage.js pairs them) */
.gpage .opts { --pair-gap: 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.gpage .opts .pair { display: flex; gap: var(--pair-gap); align-items: end; }
.gpage .opts .opt { display: grid; gap: 6px; align-content: end; min-width: 0; }
.gpage .opts .pair > .opt { flex: 1 1 0; }
.gpage .opts .oname { color: var(--muted); font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gpage .opts .oname.measure { justify-self: start; overflow: visible; }
.gpage .opts .chips { flex-wrap: nowrap; }
.gpage .opts .chip { flex: 1 0 auto; padding: 0 10px 3px; white-space: nowrap; }
.gpage .opts .chips.tight .chip { padding: 0 6px 3px; }
.gpage .opts .chips.grid { display: grid; }
.gpage .opts .chips.grid .chip { padding: 0 8px 3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gpage .opts .chips.measure { display: inline-flex; width: max-content; }
.gpage .opts .chips.measure .chip { flex: none; }
.gpage .actions { display: grid; gap: 12px; }
.gpage .vsbot { text-align: center; margin-top: 6px; }
.rank { background: var(--card); border-radius: 22px; padding: 4px 16px 8px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip); }
.rank .r { display: flex; align-items: center; gap: 12px; min-height: 62px; border-bottom: 2px solid #131315; }
.rank .r:last-child { border-bottom: 0; }
.rank .r .n { width: 20px; color: var(--muted); font-weight: 750; font-size: 15px; text-align: center; }
.rank .r:first-child .n { color: var(--gold); }
.rank .r .who { flex: 1; min-width: 0; }
.rank .r .who b { display: block; font-weight: 720; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .r .who small { display: block; color: var(--muted); font-size: 13px; font-weight: 550; }
.rank .r .pts { font-weight: 850; font-size: 17px; }
.rank .r.me .who b::after { content: attr(data-you); color: var(--muted); font-weight: 600; margin-left: 6px; }
.rank-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border-radius: 22px; padding: 14px 14px 18px 16px;
  color: var(--ink-2); font-weight: 600; font-size: 15px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip);
}

/* level sheet */
.levels { display: grid; gap: 10px; padding: 4px 0 8px; }
.lv {
  display: flex; align-items: center; gap: 14px; height: 76px; padding: 0 16px 5px 12px; border-radius: 22px; background: var(--face); text-align: left;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip); transition: transform .28s var(--spring), box-shadow .1s;
}
.lv:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.lv .t { flex: 1; display: grid; gap: 1px; min-width: 0; }
.lv b { font-size: 17.5px; font-weight: 800; }
.lv small { color: var(--muted); font-size: 14px; font-weight: 600; }
.lv small.rec { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 750; }
.btn .avatar { flex: none; }
.btn .avatar.small { outline-width: 2px; }
.lv.last { box-shadow: inset 0 0 0 2.5px var(--accent), inset 0 -6px 0 var(--accent-lip); }
.seat-count { margin: 0 0 14px; }

/* table */
.table-scr .qr-wrap { display: grid; gap: 18px; justify-items: center; margin: 4px 0 20px; }
.table-scr .qr { max-width: 272px; animation: pop-big .5s var(--spring) both; }
.table-scr.many .qr { max-width: 216px; padding: 14px 14px 20px; border-radius: 22px; }
.bigcode { display: flex; gap: 10px; }
.bigcode span {
  width: 60px; height: 74px; border-radius: 18px; display: grid; place-items: center; padding-bottom: 5px; background: var(--cream); color: #17151C;
  font-size: 40px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--cream-lip); animation: pop-big .45s calc(.14s + var(--i, 0) * .06s) var(--spring) both;
}
.table-scr.many .bigcode span { width: 50px; height: 62px; border-radius: 15px; font-size: 33px; }
.table-scr .btns.two { margin-bottom: 18px; }
.seats { display: grid; gap: 10px; }
.seat {
  display: flex; align-items: center; gap: 13px; min-height: 68px; padding: 8px 12px 13px 12px; background: var(--card); border-radius: 20px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip); animation: pop-big .42s var(--spring) both;
}
.seat .who { flex: 1; min-width: 0; font-weight: 720; }
.seat .who small { display: block; font-weight: 550; color: var(--muted); font-size: 13.5px; }
.seat.open { background: transparent; box-shadow: inset 0 0 0 2px #2A292F; }
.seat.open .who { color: var(--muted); font-weight: 600; }
.seat.open .avatar { outline: 0; }
.seat.open .avatar .ic { animation: pulse 1.8s ease-in-out infinite; }
/* an empty seat: its dashed ring turns slowly while it waits */
.seat.open .avatar::before { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2.5px dashed #46454D; animation: spin 7s linear infinite; }
.table-scr .foot { position: sticky; bottom: 0; margin-top: auto; padding: 16px 0 calc(var(--sb) + 14px); background: var(--ground); box-shadow: 0 -12px 12px -4px var(--ground); }
.table-scr.screen { padding-bottom: 0; }
.wait-line { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 600; min-height: 56px; }

/* join */
.join-scr { padding-bottom: calc(var(--sb) + 20px); }
.join-scr .body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.join-scr .scan-btn { margin-top: auto; }

/* searching */
.search-scr .body { flex: 1; display: grid; place-items: center; align-content: center; gap: 28px; text-align: center; }
.search-scr .ringer { width: 120px; height: 120px; border-radius: 50%; position: relative; display: grid; place-items: center; }
.search-scr .ringer::before, .search-scr .ringer::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--cream); animation: ring 2.2s var(--ease) infinite; }
.search-scr .ringer::after { animation-delay: 1.1s; }
.search-scr .ringer .avatar { animation: hop 2.2s var(--spring) infinite; }
@keyframes ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
.search-scr h2 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.search-scr .clock { font-size: 17px; color: var(--muted); font-weight: 650; }
.search-scr .foot { padding: 0 0 calc(var(--sb) + 18px); }

/* ---------- the game screen ---------- */
.play { padding: 0; background: var(--ground); transition: padding-bottom .42s var(--ease); }
/* while the result is up the stage ends just above its card and my bar goes under it (play.js sets --room) */
.play.room { padding-bottom: var(--room, 0px); }
.play.room .pbar.bottom { visibility: hidden; }
.play .pbar { display: flex; align-items: center; gap: 12px; padding: 8px calc(var(--pad) + var(--sr)) 8px calc(var(--pad) + var(--sl)); min-height: 66px; flex: none; position: relative; z-index: 3; }
.play .pbar.top { padding-top: calc(var(--st) + 6px); }
.play .pbar.bottom { padding-bottom: calc(var(--sb) + 8px); }
.play .pbar .who { flex: 1; min-width: 0; display: flex; flex-direction: column; transition: opacity .18s var(--ease), transform .3s var(--spring); }
.play .pbar .who b { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.015em; }
.play .pbar .who small { font-size: 13.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 19px; }
.play .pbar .who small.turn { color: var(--accent); font-weight: 750; }
.play .pbar.saying:not(.aside) .who { opacity: 0; transform: translateX(10px); }
.play .pbar .clock {
  min-width: 76px; height: 40px; border-radius: 13px; background: var(--face); display: grid; place-items: center; font-size: 18px; font-weight: 800; padding: 0 10px 4px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip); transition: background .2s, color .2s;
}
.play .pbar .clock.run { background: var(--cream); color: #17151C; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--cream-lip); }
.play .pbar .clock.low { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--accent-lip); animation: beat 1s ease-in-out infinite; }
/* whose move: an accent ring round the face that breathes; it pops when the move comes to you */
.play .pbar .avatar { --ring: 0px; box-shadow: 0 0 0 var(--ring) var(--accent), 0 0 0 calc(var(--ring) + 2px) var(--outline); transition: --ring .32s var(--spring); }
.play .pbar.turn .avatar { --ring: 6px; animation: ring-breathe 1.6s ease-in-out .3s infinite; }
.play .pbar.turn .avatar.hop { animation: hop .42s var(--spring), ring-breathe 1.6s ease-in-out .42s infinite; }
@keyframes ring-breathe { 0%, 100% { --ring: 6px; } 50% { --ring: 7.5px; } }
.play .pbar .claim { animation: pop-big .4s var(--spring) both; }
.play .slim { display: flex; align-items: center; gap: 8px; padding: calc(var(--st) + 4px) calc(var(--pad) - 6px + var(--sr)) 4px calc(var(--pad) - 6px + var(--sl)); min-height: 56px; flex: none; position: relative; z-index: 3; }
.play .slim .t { flex: 1; text-align: center; font-weight: 800; font-size: 16.5px; color: var(--ink-2); transition: opacity .18s; }
.play .slim.saying .t { opacity: 0; }
.play .stage { flex: 1; min-height: 0; position: relative; z-index: 1; }
/* a board's own part in a bar (chess's taken pieces), at its right: the name beside it keeps the room to be read */
.play .pslot { flex: 0 1 auto; min-width: 0; }
.play .pslot:empty { display: none; }
.play .pbar:has(> .pslot:not(:empty)) .who { min-width: 76px; }
.play .pbar:has(> .clock):has(> .pslot:not(:empty)) .who { min-width: 56px; }
/* a board's strip pinned at the top of the screen (chess's moves), above the top bar, which then needs no room for
   the notch */
.play .pstrip { flex: none; position: relative; z-index: 3; padding: calc(var(--st) + 6px) calc(var(--pad) + var(--sr)) 0 calc(var(--pad) + var(--sl)); }
.play.has-strip .pbar.top { padding-top: 8px; }
.play.has-strip .slim { padding-top: 4px; }
/* bars that hug the board: they stand just above and below a board that marks its box, and their bubbles and the
   thinking cloud go along (play.js sets how far) */
.play .pbar.top, .play .slim, .play .bubble.at-top, .play .think { translate: 0 var(--hug-t, 0px); }
.play .pbar.bottom, .play .bubble.at-bottom { translate: 0 var(--hug-b, 0px); }
.play.hug-move :is(.pbar, .slim, .bubble, .think) { transition: translate .42s cubic-bezier(.3, 1.3, .5, 1); }
.play .loading { position: absolute; inset: 0; display: grid; place-items: center; }

/* a speech bubble: it comes out of the speaker's face, in their own bar, and never over the board */
.bubble {
  position: absolute; z-index: 20; display: flex; align-items: center; gap: 8px; max-width: var(--max, 260px);
  background: var(--cream); color: #17151C; font-weight: 750; font-size: 15px; line-height: 1.18; letter-spacing: -.005em;
  padding: 8px 14px 11px; border-radius: 16px; pointer-events: none; transform-origin: 0 50%;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--cream-lip);
  animation: bubble-in .42s var(--spring) both;
}
.bubble .words { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble.long { font-size: 13.5px; padding-top: 6px; padding-bottom: 9px; }
.bubble .ic { width: 22px; height: 22px; margin-left: -3px; }
.bubble .avatar { margin-left: -6px; }
/* the tail, pointing back at the face */
.bubble::before, .bubble::after { content: ''; position: absolute; top: 50%; pointer-events: none; }
.bubble::before { left: -11px; margin-top: -9px; border: 9px solid transparent; border-right: 12px solid var(--outline); border-left: 0; }
.bubble::after { left: -6px; margin-top: -6.5px; border: 6.5px solid transparent; border-right: 9.5px solid var(--cream); border-left: 0; }
.bubble.notail::before, .bubble.notail::after { display: none; }
/* just outside the bar (the taken pieces left no room beside the face): above the top bar, its tail pointing down at
   the face, or under mine, pointing up */
.bubble.above { transform-origin: 26px calc(100% + 12px); }
.bubble.below { transform-origin: 26px -12px; }
.bubble:is(.above, .below)::before, .bubble:is(.above, .below)::after { top: auto; margin: 0; }
.bubble.above::before { bottom: -11px; left: 17px; border: 9px solid transparent; border-top: 12px solid var(--outline); border-bottom: 0; }
.bubble.above::after { bottom: -6px; left: 19.5px; border: 6.5px solid transparent; border-top: 9.5px solid var(--cream-lip); border-bottom: 0; }
.bubble.below::before { top: -11px; left: 17px; border: 9px solid transparent; border-bottom: 12px solid var(--outline); border-top: 0; }
.bubble.below::after { top: -6px; left: 19.5px; border: 6.5px solid transparent; border-bottom: 9.5px solid var(--cream); border-top: 0; }
.bubble.out { animation: bubble-out .22s var(--ease) both; }
@keyframes bubble-in { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes bubble-out { to { opacity: 0; transform: scale(.85); } }

/* the computer thinking: a thought cloud by its face, over its level line (or in the middle of a bar without faces) */
.think { position: absolute; z-index: 19; display: flex; align-items: center; pointer-events: none; transform-origin: 6px 28px; animation: think-in .34s var(--spring) both; }
.think.slim { transform-origin: 13px 50%; }
.think.slim .avatar { margin-right: -1px; }
.think.out { animation: think-out .18s var(--ease) both; }
.play > .saying ~ .think { visibility: hidden; }
.cloud { display: block; width: 56px; height: 34px; }
.cloud svg { display: block; overflow: visible; }
.cloud .o { fill: var(--outline); stroke: var(--outline); stroke-width: 4px; }
.cloud .s { fill: var(--cream-lip); }
.cloud .f { fill: var(--cream); }
.cloud .dot { fill: #17151C; transform-box: fill-box; transform-origin: 50% 50%; animation: think-dot 1.05s ease-in-out infinite; animation-delay: calc(var(--k) * .14s); }
@keyframes think-dot { 0%, 56%, 100% { transform: none; } 26% { transform: translateY(-3.5px); } }
@keyframes think-in { 0% { opacity: 0; transform: scale(.3); } 65% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes think-out { to { opacity: 0; transform: scale(.6); } }
.play .pbar.thinking .who small { opacity: 0; }
.play .pbar .who small { transition: opacity .15s, color .2s; }
.play .slim.thinking .t { opacity: 0; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 4px 0 8px; }
.quick button {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px 4px; border-radius: 17px; background: var(--face); font-weight: 750; font-size: 15.5px; text-align: left;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip); transition: transform .26s var(--spring), box-shadow .1s;
}
.quick button .ic { width: 28px; height: 28px; }
.quick button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick button:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.menu-list { display: grid; gap: 10px; padding: 2px 0 8px; }
.menu-list .row {
  border: 0; background: var(--face); border-radius: 18px; padding: 0 14px 5px; min-height: 62px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -6px 0 var(--face-lip);
}
.menu-list button.row { transition: transform .26s var(--spring), box-shadow .1s; }
.menu-list button.row:active { transform: translateY(2px); box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--face-lip); transition-duration: .06s; }
.menu-list .row:last-child { padding-bottom: 5px; }
.menu-list .row.red .k { color: var(--red-ink); }

/* the result: the two faces, who won, a word from the computer, again or home */
.result { position: relative; padding: 8px 0 2px; text-align: center; display: grid; gap: 6px; }
.result .faces { position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 30px; margin: 40px 0 4px; }
.result .face { position: relative; width: 112px; display: grid; justify-items: center; gap: 9px; animation: pop-big .5s .1s var(--spring) both; }
.result .face:nth-child(2) { animation-delay: .17s; }
.result .face b { font-size: 14.5px; font-weight: 750; color: var(--ink-2); max-width: 112px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .face.won .avatar { box-shadow: 0 0 0 5px var(--gold), 0 0 0 7px var(--outline); }
.result .face.lost .avatar { animation: droop .8s .5s var(--ease) both; }
.result .face.lost .avatar img { filter: saturate(.7) brightness(.9); transition: filter .6s .5s; }
@keyframes droop { 0% { transform: none; } 45% { transform: translateY(7px) rotate(-10deg); } 100% { transform: translateY(4px) rotate(-7deg); } }
.result .face .crown { position: absolute; z-index: 2; left: 50%; top: -33px; width: 46px; height: 46px; margin-left: -30px; transform: rotate(-12deg); animation: crown-in .6s .45s var(--spring) both; }
.result .face .crown .ic { width: 46px; height: 46px; }
@keyframes crown-in { 0% { opacity: 0; transform: translateY(-40px) rotate(-30deg) scale(.6); } 60% { opacity: 1; transform: translateY(4px) rotate(-8deg) scale(1.08, .92); } 100% { opacity: 1; transform: rotate(-12deg); } }
.result .vs { align-self: center; margin-bottom: 26px; font-size: 15px; font-weight: 800; color: var(--faint); letter-spacing: .02em; }
.result h2 { font-size: 44px; font-weight: 850; letter-spacing: -.04em; line-height: 1.02; margin-top: 16px; animation: title-in .55s var(--spring) both; }
@keyframes title-in { 0% { opacity: 0; transform: scale(.4); } 55% { opacity: 1; transform: scale(1.1, .94); } 78% { transform: scale(.97, 1.03); } 100% { opacity: 1; transform: none; } }
.result .why { color: var(--muted); font-size: 16px; font-weight: 600; }
/* the confetti flies behind the words, so they stay readable */
.result h2, .result .why, .result .said { position: relative; z-index: 3; }
.result .delta {
  margin: 12px auto 4px; display: inline-flex; align-items: baseline; gap: 10px; background: var(--face); border-radius: 14px; padding: 9px 16px 13px; font-weight: 800; font-size: 17px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--face-lip); animation: pop-big .5s .25s var(--spring) both;
}
.result .delta .up { color: var(--good); }
.result .delta .down { color: var(--red-ink); }
.result .btns { margin-top: 20px; }
.result .ask { color: var(--accent); font-weight: 750; font-size: 16px; margin-top: 8px; animation: pop-big .4s var(--spring) both; }
/* the computer's last word, said from its face above */
.result .said {
  position: relative; justify-self: center; max-width: 92%; margin: 16px 0 2px; padding: 10px 16px 14px; border-radius: 18px;
  background: var(--cream); color: #17151C; font-weight: 750; font-size: 15.5px; line-height: 1.25; text-align: left;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--cream-lip); animation: said-in .45s .65s var(--spring) both; transform-origin: var(--tail, 50%) 0;
}
.result .said::before, .result .said::after { content: ''; position: absolute; left: var(--tail, 50%); pointer-events: none; }
.result .said::before { top: -12px; margin-left: -10px; border: 10px solid transparent; border-bottom: 12px solid var(--outline); border-top: 0; }
.result .said::after { top: -7px; margin-left: -7.5px; border: 7.5px solid transparent; border-bottom: 9.5px solid var(--cream); border-top: 0; }
@keyframes said-in { 0% { opacity: 0; transform: scale(.5); } 60% { opacity: 1; transform: scale(1.05); } 100% { opacity: 1; transform: none; } }
/* on a short screen: smaller faces, the computer's word beside its face, less air, so the final board shows above */
.result.compact { gap: 4px; padding-top: 2px; }
.result.compact h2 { font-size: 38px; margin-top: 8px; }
.result.compact .why { font-size: 15px; }
.result.compact .faces { margin: 12px 0 0; gap: 14px; align-items: center; }
/* under a score line, room for the winner's crown, so it never touches the words */
.result.compact .why + .faces:has(.won) { margin-top: 28px; }
.result.compact .face { width: 76px; gap: 6px; }
.result.compact .face b { font-size: 13.5px; max-width: 76px; }
.result.compact .face .crown { top: -26px; width: 38px; height: 38px; margin-left: -25px; }
.result.compact .face .crown .ic { width: 38px; height: 38px; }
.result.compact .said { flex: 0 1 auto; min-width: 0; max-width: 168px; margin: 0 0 24px 4px; padding: 8px 13px 12px; font-size: 14.5px; transform-origin: 0 50%; }
.result.compact .said::before { left: -12px; top: 50%; margin: -9px 0 0; border: 9px solid transparent; border-right: 12px solid var(--outline); border-left: 0; }
.result.compact .said::after { left: -7px; top: 50%; margin: -6.5px 0 0; border: 6.5px solid transparent; border-right: 9.5px solid var(--cream); border-left: 0; }
.result.compact .delta { margin: 8px auto 2px; }
.result.compact .btns { margin-top: 14px; grid-template-columns: 56px minmax(0, 1fr); }
/* home as its picture only, on the left; the rematch beside it, under the thumb; adding a friend under both */
.result.compact .btns .home { order: -1; width: 56px; padding: 0 0 4px; }
.result.compact .btns .home > span { display: none; }
.result.compact .btns .home .ic { margin: 0; width: 26px; height: 26px; }
.result.compact .btns .friend { order: 1; grid-column: 1 / -1; }
.result.compact .btns .btn { min-width: 0; }
.result.compact .btns .btn > span { overflow: hidden; text-overflow: ellipsis; }
.result.win h2 { color: var(--gold); text-shadow: 0 4px 0 var(--gold-lip); }
.result.even h2 { color: var(--cream); text-shadow: 0 4px 0 var(--cream-lip); }
/* flat confetti on a win */
.confetti { position: absolute; left: 50%; top: 70px; width: 0; height: 0; pointer-events: none; z-index: 2; }
.confetti i {
  position: absolute; left: 0; top: 0; width: var(--w, 9px); height: var(--h, 13px); border-radius: 3px; background: var(--c);
  box-shadow: 0 0 0 1.5px var(--outline); opacity: 0; animation: confetti var(--t, 1.4s) cubic-bezier(.2, .6, .4, 1) var(--d, 0s) both;
}
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(.4); }
  35% { opacity: 1; transform: translate(calc(var(--x) * .8), var(--y)) rotate(calc(var(--r) * .5)) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 230px)) rotate(var(--r)) scale(.9); }
}

/* profile and friends */
.prof-head { display: grid; justify-items: center; gap: 12px; margin: 8px 0 24px; text-align: center; }
.prof-head .me-pic { position: relative; transition: transform .26s var(--spring); }
.prof-head .me-pic:active { transform: scale(.95); }
.prof-head .me-pic .edit {
  position: absolute; right: -4px; bottom: -2px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; padding-bottom: 3px;
  background: var(--face); box-shadow: 0 0 0 2.5px var(--outline), inset 0 -4px 0 var(--face-lip);
}
.prof-head .me-pic .edit .ic { width: 22px; height: 22px; }
.prof-head h2 { font-size: 30px; font-weight: 850; letter-spacing: -.03em; }
.prof-head .acts { display: flex; gap: 8px; }
.ratings { display: flex; gap: 10px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 3px var(--pad) 6px; scrollbar-width: none; }
.ratings::-webkit-scrollbar { display: none; }
.ratings .rt {
  flex: none; display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 10px 16px 14px 10px; min-width: 128px;
  box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -5px 0 var(--card-lip);
}
.ratings .rt img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 0 0 2px var(--outline); object-fit: cover; }
.ratings .rt b { display: block; font-size: 21px; font-weight: 850; letter-spacing: -.02em; line-height: 1.1; }
.ratings .rt span { font-size: 13px; color: var(--muted); font-weight: 600; }
.seg { display: flex; gap: 4px; background: #0E0E10; border-radius: 13px; padding: 4px; box-shadow: inset 0 0 0 var(--ow) #2A292F; }
.seg button { height: 34px; padding: 0 12px 2px; border-radius: 10px; font-size: 14.5px; font-weight: 700; color: var(--muted); transition: transform .24s var(--spring); }
.seg button.on { background: var(--cream); color: #17151C; padding-bottom: 4px; box-shadow: inset 0 0 0 var(--ow) var(--outline), inset 0 -4px 0 var(--cream-lip); }
.seg button:active { transform: scale(.95); }
.signout { margin-top: 26px; display: flex; justify-content: center; }
.signout .text-link { color: var(--red-ink); }
.qr-sheet { display: grid; gap: 16px; justify-items: center; padding: 6px 0 6px; text-align: center; }
.qr-sheet .who { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.add-friend { display: grid; gap: 10px; padding: 4px 0 6px; }
.add-friend .find { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.add-friend .find .btn { height: 60px; width: 60px; }
.friend-list .row .avatar { margin-right: 2px; }
/* no friends yet: three drawn faces, one line, the two ways to add someone */
.friends-empty { display: grid; justify-items: center; text-align: center; padding: 34px 0 8px; }
.friends-empty .pic { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.friends-empty .pic .avatar { animation: pop-big .5s var(--spring) both, bob 3.6s ease-in-out infinite; }
.friends-empty .pic .avatar:nth-child(1) { rotate: -10deg; margin: 18px -14px 0 0; animation-delay: .1s, .7s; }
.friends-empty .pic .avatar:nth-child(2) { z-index: 1; box-shadow: 0 0 0 8px var(--ground); animation-delay: 0s, 1.9s; }
.friends-empty .pic .avatar:nth-child(3) { rotate: 10deg; margin: 18px 0 0 -14px; animation-delay: .18s, 1.3s; }
.friends-empty p { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 24px; }
.friends-empty .btns { width: 100%; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.req-btns { display: flex; gap: 8px; align-items: center; }
.fsheet { display: grid; gap: 14px; padding: 4px 0 6px; }
.fsheet .top { display: flex; align-items: center; gap: 14px; }
.fsheet .top b { font-size: 23px; font-weight: 800; display: block; }
.fsheet .top small { color: var(--muted); font-weight: 600; }
.pick-game { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; padding: 3px; }
.pick-game button { display: grid; gap: 8px; text-align: center; font-size: 13.5px; font-weight: 720; transition: transform .26s var(--spring); }
.pick-game img { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: 18px; background: var(--surface-3); box-shadow: 0 0 0 2.5px var(--outline), 0 5px 0 var(--lip, #0E0E10), 0 5px 0 2.5px var(--outline); }
.pick-game button:active { transform: translateY(3px); }
/* the avatar picker: twelve drawn faces */
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 10px; padding: 8px 4px 10px; justify-items: center; }
.avatars button { position: relative; border-radius: 50%; transition: transform .3s var(--spring); }
.avatars button:active { transform: scale(.9); }
.avatars button.on .avatar { box-shadow: 0 0 0 5px var(--accent), 0 0 0 7px var(--outline); }
.avatars button .tick { position: absolute; right: -6px; bottom: -4px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--cream); box-shadow: 0 0 0 2.5px var(--outline), inset 0 -3px 0 var(--cream-lip); animation: pop-big .4s var(--spring) both; }
.avatars button .tick .ic { width: 20px; height: 20px; }

@media (min-width: 560px) {
  .screen > .wrapw, .screen .wrapw { max-width: 520px; margin-left: auto; margin-right: auto; width: 100%; }
}
/* less motion: every transition ends at once; animations keep their time and fading but lose their movement (core.js
   stillMotion), or, where the browser cannot do that, end at once too */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  html:not(.still) *, html:not(.still) *::before, html:not(.still) *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .confetti { display: none; }
}
/* the result redrawn in place (a rematch asked for) skips its entrance */
.result.still :is(.face, .crown, h2, .said, .delta, .avatar) { animation-duration: 1ms; animation-delay: 0s; }
