/* Four in a Row — three looks of its own (Night lake, Birch, Coral reef), the board with holes over
   the discs, sheets and plates. Every disc carries its symbol (a ring, a diamond): colour is never
   the only signal. Motion is transform and opacity. */
:root,
:root[data-theme='birch'] {
  color-scheme: light;
  --bg: #efe9df;
  --bg2: #e4dccd;
  --glow1: rgba(214, 95, 55, 0.18);
  --glow2: rgba(63, 112, 191, 0.16);
  --surface: #fffdf8;
  --surface2: #f5efe4;
  --text: #24201b;
  --muted: #655a4d;
  --line: rgba(60, 40, 20, 0.13);
  --accent: #a8462a;
  --accent-ink: #ffffff;
  --ca-accent: #a8462a;
  --f1: #ecdcbc; --f2: #d9c196; --f3: #c3a575;
  --r1: #fff7e6; --r2: #94744a;
  --cavity: #3a2c20; --cavity2: #1d140d;
  --frame-shadow: rgba(70, 45, 20, 0.35);
  --p1-hi: #ffc0a3; --p1: #d65f37; --p1-lo: #8a2f14; --p1-mark: rgba(255, 236, 222, 0.75);
  --p2-hi: #b5d0ff; --p2: #3f70bf; --p2-lo: #1f3d74; --p2-mark: rgba(226, 238, 255, 0.78);
  --win: #fff6d8;
  --lit: rgba(255, 255, 255, 0.24);
}
:root[data-theme='dusk'] {
  color-scheme: dark;
  --bg: #0f1722;
  --bg2: #142235;
  --glow1: rgba(240, 164, 50, 0.14);
  --glow2: rgba(79, 201, 184, 0.13);
  --surface: #172233;
  --surface2: #1e2c41;
  --text: #eef2f7;
  --muted: #a9b5c7;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #f2b450;
  --accent-ink: #231505;
  --ca-accent: #f2b450;
  --f1: #2f6678; --f2: #1f4b5b; --f3: #153646;
  --r1: #ecca86; --r2: #7c5f2e;
  --cavity: #07101a; --cavity2: #02060b;
  --frame-shadow: rgba(0, 0, 0, 0.55);
  --p1-hi: #ffe6a8; --p1: #f0a432; --p1-lo: #9b5a0c; --p1-mark: rgba(120, 60, 0, 0.55);
  --p2-hi: #cffff6; --p2: #4fc9b8; --p2-lo: #1b7a71; --p2-mark: rgba(0, 62, 56, 0.55);
  --win: #fff3c4;
  --lit: rgba(255, 255, 255, 0.12);
}
:root[data-theme='coral'] {
  color-scheme: dark;
  --bg: #1d1018;
  --bg2: #2a1422;
  --glow1: rgba(255, 111, 77, 0.17);
  --glow2: rgba(239, 220, 188, 0.1);
  --surface: #2a1823;
  --surface2: #34202d;
  --text: #fbeef0;
  --muted: #d7b8c0;
  --line: rgba(255, 255, 255, 0.11);
  --accent: #ff8a66;
  --accent-ink: #2a0d05;
  --ca-accent: #ff8a66;
  --f1: #6a3156; --f2: #4c2240; --f3: #35172d;
  --r1: #f6cdbb; --r2: #94525a;
  --cavity: #12070e; --cavity2: #060205;
  --frame-shadow: rgba(0, 0, 0, 0.55);
  --p1-hi: #ffc9b6; --p1: #ff6f4d; --p1-lo: #a8341d; --p1-mark: rgba(255, 238, 230, 0.7);
  --p2-hi: #fffbf2; --p2: #efdcbc; --p2-lo: #a48a60; --p2-mark: rgba(110, 80, 40, 0.55);
  --win: #fff1e0;
  --lit: rgba(255, 255, 255, 0.11);
}

* { box-sizing: border-box; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS fallback */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: calc(100dvh / var(--ca-zoom, 1));
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2), var(--bg) 70%);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* a game page: no text selection or callouts anywhere; the rules' prose opts back in */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.prose p, .prose li, input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
svg[hidden], [hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg .glow { position: absolute; width: calc(70vmax / var(--ca-zoom, 1)); height: calc(70vmax / var(--ca-zoom, 1)); border-radius: 50%; filter: blur(60px); opacity: 0.9; }
.bg .g1 { background: radial-gradient(circle, var(--glow1), transparent 65%); left: calc(-25vmax / var(--ca-zoom, 1)); top: calc(-30vmax / var(--ca-zoom, 1)); }
.bg .g2 { background: radial-gradient(circle, var(--glow2), transparent 65%); right: calc(-25vmax / var(--ca-zoom, 1)); bottom: calc(-30vmax / var(--ca-zoom, 1)); }
html[data-ca-lite] .bg .glow { filter: none; }

.app {
  position: relative;
  z-index: 1;
  height: calc(100dvh / var(--ca-zoom, 1));
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  /* one column that never grows past the screen: the header's nowrap title must not widen the page */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: calc(env(safe-area-inset-top) + var(--ca-space-top, 0px)) calc(env(safe-area-inset-right) + 10px) calc(env(safe-area-inset-bottom) + 8px) calc(env(safe-area-inset-left) + 10px);
}

/* ---- the top bar ---- */
/* (4 px at the right at least: the chip's 44 px target reaches 4 px past it, and less would read as a
   bar short of room — the SDK would leave the tools in the menu) */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 4px; min-height: 56px; }
/* the daily puzzle: the game's own round button, beside the SDK's tools and in their look */
.top .ca-start { margin-right: auto; }
.daily-btn .dot { top: 2px; right: 2px; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: background-color 0.15s;
}
.icon-btn:hover { background: var(--surface2); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
/* what is being played, under the board: one line that never widens the page */
.match-line { margin: 0; padding: 2px 8px 0; min-width: 0; text-align: center; color: var(--muted); font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the stage: plates and the board ---- */
.stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'p1 p2' 'board board';
  gap: 8px;
  align-items: center;
  justify-items: stretch;
  padding-top: 4px;
}
/* face to face on one device: the far player's plate across the board, upside down */
body.f2f .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: 'p2' 'board' 'p1'; justify-items: center; }
#plate-2 { grid-area: p2; }
#plate-1 { grid-area: p1; }
.board-wrap { grid-area: board; position: relative; width: 100%; height: 100%; min-height: 0; display: grid; place-items: center; }
@media (orientation: landscape) and (max-height: 620px), (min-width: 940px) and (min-aspect-ratio: 5/4) {
  .stage, body.f2f .stage { grid-template-columns: minmax(118px, 190px) minmax(0, 1fr) minmax(118px, 190px); grid-template-rows: minmax(0, 1fr); grid-template-areas: 'p1 board p2'; gap: 10px; justify-items: center; padding-top: 0; }
  .plate { flex-direction: column; text-align: center; padding: 14px 10px; width: 100%; }
  .plate .who { align-items: center; }
}

.plate {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  padding: 7px 12px 7px 8px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border: 1px solid var(--line);
  transition: box-shadow 0.25s, background-color 0.25s;
}
.plate .token { position: relative; display: grid; place-items: center; width: 38px; height: 38px; flex: none; }
.plate .token .disc-icon { width: 34px; height: 34px; }
.plate .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.plate .who b { font-size: 15.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.f2f .plate { min-width: min(280px, 100%); }
.plate .who small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .tally { position: absolute; top: -7px; right: -7px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); font-size: 13px; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.plate.p1.active { box-shadow: 0 0 0 2px var(--p1), 0 10px 30px -14px var(--p1); }
.plate.p2.active { box-shadow: 0 0 0 2px var(--p2), 0 10px 30px -14px var(--p2); }
.plate.active .who small { color: var(--text); font-weight: 600; }
.plate.thinking .token::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.plate.won .token .disc-icon { animation: pulse 1.2s ease-in-out infinite; }
body.f2f #plate-2 { transform: rotate(180deg); }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* the disc look, shared by the board, the hand and the icons */
.d1 { --d-hi: var(--p1-hi); --d: var(--p1); --d-lo: var(--p1-lo); --d-mark: var(--p1-mark); }
.d2 { --d-hi: var(--p2-hi); --d: var(--p2); --d-lo: var(--p2-lo); --d-mark: var(--p2-mark); }
.disc-icon { position: relative; display: inline-block; width: 1.5em; height: 1.5em; border-radius: 50%; flex: none; vertical-align: middle;
  background: radial-gradient(circle at 34% 28%, var(--d-hi), var(--d) 52%, var(--d-lo) 100%);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.28), inset 0 1.5px 2px rgba(255, 255, 255, 0.35), 0 2px 5px -2px rgba(0, 0, 0, 0.45); }
.disc-icon::after { content: ''; position: absolute; inset: 31%; border: 2px solid var(--d-mark); border-radius: 50%; }
.disc-icon.d2::after { inset: 33%; border-radius: 3px; transform: rotate(45deg) scale(0.86); }
.disc-icon.split { background: linear-gradient(90deg, var(--p1) 50%, var(--p2) 50%); }
.disc-icon.split::after { display: none; }

/* ---- the board ---- */
.board { position: relative; width: calc((var(--w, 7) + 0.4) * var(--cell, 44px)); --pad: calc(0.2 * var(--cell, 44px)); }
.drop-zone { position: relative; height: calc(1.06 * var(--cell, 44px)); }
.well { position: relative; width: 100%; height: calc((var(--h, 6) + 0.4) * var(--cell, 44px)); }
.cavity { position: absolute; inset: var(--pad); border-radius: calc(0.12 * var(--cell, 44px));
  background: radial-gradient(120% 90% at 50% 0%, var(--cavity), var(--cavity2)); }
.discs { position: absolute; left: var(--pad); top: var(--pad); width: calc(var(--w, 7) * var(--cell, 44px)); height: calc(var(--h, 6) * var(--cell, 44px)); }
.disc, .ghost {
  position: absolute; left: 0; top: 0; width: var(--cell, 44px); height: var(--cell, 44px);
  transform: translate3d(calc(var(--c, 0) * var(--cell, 44px)), calc(var(--y, 0) * var(--cell, 44px)), 0);
  will-change: transform;
}
.disc::before, .ghost::before {
  content: ''; position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--d-hi), var(--d) 52%, var(--d-lo) 100%);
  box-shadow: inset 0 calc(-0.05 * var(--cell, 44px)) calc(0.07 * var(--cell, 44px)) rgba(0, 0, 0, 0.32), inset 0 calc(0.035 * var(--cell, 44px)) calc(0.05 * var(--cell, 44px)) rgba(255, 255, 255, 0.4);
}
.disc b, .ghost::after { position: absolute; inset: 31%; border-radius: 50%; border: calc(0.05 * var(--cell, 44px)) solid var(--d-mark); }
.disc.d2 b, .ghost.d2::after { inset: 33.5%; border-radius: 16%; transform: rotate(45deg) scale(0.86); }
.disc::after { content: ''; position: absolute; inset: 3%; border-radius: 50%; box-shadow: 0 0 0 calc(0.06 * var(--cell, 44px)) var(--win), 0 0 calc(0.4 * var(--cell, 44px)) var(--win); opacity: 0; }
.disc.win::after { animation: halo 1.4s ease-in-out 0.2s infinite; }
.ended .disc:not(.win) { opacity: 0.42; transition: opacity 0.6s; }
.disc.gone { opacity: 0; transition: opacity 0.35s, transform 0.4s cubic-bezier(0.5, 0, 0.9, 0.5); }
@keyframes halo { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; overflow: visible; filter: drop-shadow(0 calc(0.12 * var(--cell, 44px)) calc(0.22 * var(--cell, 44px)) var(--frame-shadow)); }
html[data-ca-lite] .frame { filter: none; }
.frame .f1 { stop-color: var(--f1); } .frame .f2 { stop-color: var(--f2); } .frame .f3 { stop-color: var(--f3); }
.frame .r1 { stop-color: var(--r1); } .frame .r2 { stop-color: var(--r2); }
.frame .face { fill: url(#face); }
.frame .rim { fill: none; stroke: url(#rim); stroke-width: 0.04; opacity: 0.85; }
.frame .gloss { stroke: rgba(255, 255, 255, 0.32); stroke-width: 0.035; stroke-linecap: round; }

.win-bar {
  position: absolute; z-index: 3; pointer-events: none;
  left: calc((0.2 + var(--x, 0)) * var(--cell, 44px)); top: calc((0.2 + var(--yy, 0)) * var(--cell, 44px));
  width: calc(var(--len, 1) * var(--cell, 44px)); height: calc(0.12 * var(--cell, 44px)); margin-top: calc(-0.06 * var(--cell, 44px));
  border-radius: 99px; background: var(--win); box-shadow: 0 0 calc(0.25 * var(--cell, 44px)) var(--win);
  transform-origin: 0 50%; transform: rotate(var(--ang, 0rad)) scaleX(0); opacity: 0.9;
}
.win-bar.show { transform: rotate(var(--ang, 0rad)) scaleX(1); transition: transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1) 0.15s; }

.cols { position: absolute; z-index: 4; left: var(--pad); right: var(--pad); top: calc(-1.06 * var(--cell, 44px)); bottom: 0; display: grid; grid-template-columns: repeat(var(--w, 7), 1fr); touch-action: none; }
.col { position: relative; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; border-radius: calc(0.2 * var(--cell, 44px)); }
.col::before { content: ''; position: absolute; left: 6%; right: 6%; top: calc(1.06 * var(--cell, 44px)); bottom: var(--pad); border-radius: calc(0.45 * var(--cell, 44px)); background: var(--lit); opacity: 0; transition: opacity 0.18s; }
.col.lit::before { opacity: 1; }
.no-guide .col.lit::before { opacity: 0; }
.col:focus-visible { outline-offset: -2px; }
.col.no { animation: nope 0.32s; }
@keyframes nope { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.ghost { --y: 0; left: var(--pad); opacity: 0; transition: opacity 0.16s; pointer-events: none; z-index: 1; }
.ghost.on { opacity: 1; }
.ghost.glide { transition: opacity 0.16s, transform 0.24s cubic-bezier(0.3, 0.7, 0.3, 1); }
.ghost::after { content: ''; }
.ghost.hint::before { box-shadow: 0 0 0 calc(0.06 * var(--cell, 44px)) var(--win), 0 0 calc(0.35 * var(--cell, 44px)) var(--win); }
.ghost.on.hint { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { opacity: 0.6; } }

.pops { display: grid; grid-template-columns: repeat(var(--w, 7), 1fr); margin: calc(0.06 * var(--cell, 44px)) var(--pad) 0; height: calc(0.72 * var(--cell, 44px)); }
.pops[hidden] { display: none; }
.pop { margin: 0 8%; border: 1px solid var(--line); border-radius: 0 0 calc(0.3 * var(--cell, 44px)) calc(0.3 * var(--cell, 44px)); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: opacity 0.2s, background-color 0.2s; }
.pop svg { width: 60%; height: 60%; max-width: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pop:disabled { opacity: 0.25; cursor: default; }
.pop.d1:not(:disabled) { background: var(--p1); color: var(--p1-lo); border-color: transparent; }
.pop.d2:not(:disabled) { background: var(--p2); color: var(--p2-lo); border-color: transparent; }

.banner {
  position: absolute; left: 50%; top: 6px; z-index: 6; max-width: 92%;
  padding: 9px 16px; border-radius: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.5); font-weight: 600; font-size: 14.5px; text-align: center;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none; transition: opacity 0.22s, transform 0.22s;
}
.banner.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- the actions ---- */
.actions { display: flex; justify-content: center; gap: 8px; padding: 6px 0 2px; flex-wrap: nowrap; }
.btn {
  min-height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.subtle { background: transparent; color: var(--muted); }
.btn[hidden] { display: none; }
.btn.thinking svg { animation: bob 0.8s ease-in-out infinite; }
@media (max-width: 360px) { .actions .btn { padding: 0 10px; font-size: 14px; gap: 6px; } }
@media (max-width: 350px) { .actions .btn svg { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 80; max-width: calc(90vw / var(--ca-zoom, 1));
  padding: 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14.5px;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- sheets and dialogs ---- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(5, 8, 14, 0.46); }
.backdrop.soft { background: rgba(5, 8, 14, 0.26); }
.backdrop[hidden] { display: none; }
.sheet {
  position: fixed; z-index: 50; left: 50%; bottom: 0; width: min(560px, 100%);
  max-height: calc(90dvh / var(--ca-zoom, 1));
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px -24px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%); animation: up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[hidden] { display: none; }
@media (min-width: 700px) and (min-height: 560px) {
  .sheet { bottom: auto; top: 50%; border-radius: 22px; transform: translate(-50%, -50%); animation: pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: calc(86dvh / var(--ca-zoom, 1)); }
}
@keyframes up { from { transform: translate(-50%, 40px); opacity: 0.4; } }
@keyframes pop-in { from { transform: translate(-50%, -46%); opacity: 0.4; } }
.sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 6px 20px; flex: none; }
.sheet h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.sheet-body { overflow: auto; overscroll-behavior: contain; padding: 4px 20px 18px; min-height: 0; }
.sheet-foot { flex: none; padding: 10px 20px 16px; border-top: 1px solid var(--line); }
.sheet-foot:empty { display: none; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.prose p, .prose li { color: var(--text); line-height: 1.55; }
.prose ul { padding-left: 20px; margin: 6px 0; }
.prose li { margin: 4px 0; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 14px; margin: 12px 2px 0; }
.start { width: 100%; }

.choices { display: grid; gap: 6px; }
.choice {
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left;
  padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; min-height: 56px;
}
.choice .pips { grid-row: 1 / 3; display: flex; gap: 4px; align-items: center; justify-content: center; }
.choice .pips i:not(.disc-icon):not(.link) { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.choice .pips i.on:not(.disc-icon) { background: var(--accent); }
.choice .pips.two { gap: 0; }
.choice .pips .disc-icon { width: 22px; height: 22px; }
.choice .pips .disc-icon + .disc-icon { margin-left: -6px; }
.choice .pips .link { width: 10px; height: 2px; border-radius: 1px; background: var(--muted); }
.choice b { font-size: 15.5px; }
.choice small { color: var(--muted); font-size: 13px; line-height: 1.3; }
[role='radio'][aria-checked='true'] { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent) inset; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.opt .disc-icon { width: 20px; height: 20px; }
.opts.small .opt { min-height: 40px; padding: 0 11px; font-size: 13.5px; }
.variants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.variant { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); cursor: pointer; min-height: 56px; }
.variant .mini { grid-row: 1 / 3; width: 34px; height: 28px; border-radius: 6px; background:
  radial-gradient(circle, var(--cavity) 38%, transparent 41%) 0 0 / var(--gx) var(--gy), linear-gradient(var(--f1), var(--f3)); }
.variant .mini.v-classic, .variant .mini.v-popout { --gx: calc(34px / 7); --gy: calc(28px / 6); }
.variant .mini.v-wide { --gx: calc(34px / 8); --gy: calc(28px / 7); }
.variant .mini.v-grand { --gx: calc(34px / 9); --gy: calc(28px / 7); }
.variant .mini.v-popout { box-shadow: 0 3px 0 -1px var(--p1); }
.variant b { font-size: 15px; }
.variant small { color: var(--muted); font-size: 12.5px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; border: 1px solid var(--line); }
.swatch.t-dusk { background: linear-gradient(135deg, #1f4b5b 50%, #f0a432 50%); }
.swatch.t-birch { background: linear-gradient(135deg, #d9c196 50%, #d65f37 50%); }
.swatch.t-coral { background: linear-gradient(135deg, #4c2240 50%, #ff6f4d 50%); }
.swatch.t-auto { background: linear-gradient(135deg, #d9c196 50%, #1f4b5b 50%); }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--line); flex: none; transition: background-color 0.2s; }
.toggle .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.about { font-size: 13.5px; margin-top: 18px; }
.version { font-size: 13px; margin-top: 16px; }

.daily-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; width: 100%; text-align: left; margin: 8px 0 2px; padding: 12px 14px; border-radius: 16px; border: 1px solid transparent; cursor: pointer;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface2)), var(--surface2)); }
.daily-card .daily-icon { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 12px; align-self: center;
  background: radial-gradient(circle at 50% 62%, var(--p1) 26%, transparent 28%), linear-gradient(var(--f1), var(--f3)); }
.daily-card b { font-size: 15.5px; }
.daily-card small { color: var(--muted); font-size: 13px; }
.daily-hero { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; margin-top: 6px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, var(--surface2)), var(--surface2)); }
.daily-hero b { font-size: 22px; letter-spacing: -0.01em; }
.daily-hero small { color: var(--muted); font-size: 13.5px; }
.daily-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 4px; }
.daily-facts span { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 14px; background: var(--surface2); text-align: center; }
.daily-facts b { font-size: 20px; font-variant-numeric: tabular-nums; }
.daily-facts small { color: var(--muted); font-size: 12px; line-height: 1.25; }

table.levels { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 6px; }
table.levels th, table.levels td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14.5px; }
table.levels th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
table.levels .num { text-align: right; }
table.levels .best { font-weight: 700; }
ul.recent { list-style: none; margin: 0; padding: 0; }
ul.recent li { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
ul.recent .when { color: var(--muted); font-size: 13px; }
ul.recent .res { font-size: 13px; }
ul.recent li[data-outcome='win'] .res { color: var(--accent); }
.friends { margin-top: 10px; }
.friends-head { display: flex; flex-direction: column; gap: 6px; }
.friends-note { font-size: 13px; margin: 8px 0 0; }

.dialog {
  position: fixed; z-index: 60; left: 50%; top: 50%; width: min(400px, calc(100vw / var(--ca-zoom, 1) - 28px));
  transform: translate(-50%, -50%); padding: 24px 20px 18px; border-radius: 24px; background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.6); text-align: center; animation: dlg 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dialog[hidden] { display: none; }
@keyframes dlg { from { transform: translate(-50%, -46%) scale(0.96); opacity: 0; } }
.dialog h2 { margin: 6px 0 6px; font-size: 23px; letter-spacing: -0.015em; }
.dialog p { margin: 0 0 12px; color: var(--muted); }
.dialog .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.dialog .row .btn { flex: 1 1 auto; }
.result .glow { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent); }
.result-disc { position: relative; display: block; margin: 0 auto; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--d-hi), var(--d) 52%, var(--d-lo) 100%);
  box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.28), inset 0 3px 4px rgba(255, 255, 255, 0.35), 0 10px 24px -10px var(--d, #000); }
.result-disc::after { content: ''; position: absolute; inset: 31%; border-radius: 50%; border: 3px solid var(--d-mark); }
.result-disc.d2::after { inset: 33%; border-radius: 4px; transform: rotate(45deg) scale(0.86); }
.result-disc.draw { background: linear-gradient(90deg, var(--p1) 50%, var(--p2) 50%); }
.result-disc.draw::after, .result-disc.miss::after { display: none; }
.result-disc.miss { background: var(--surface2); box-shadow: inset 0 0 0 2px var(--line); }
.result-stats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.result-stats b { color: var(--text); font-variant-numeric: tabular-nums; }

/* small screens: the header and the plates give way before the board does */
@media (max-height: 600px) and (orientation: portrait) {
  .top { min-height: 48px; padding-top: 4px; }
  .plate { padding: 4px 12px 4px 6px; }
  .plate .token, .plate .token .disc-icon { width: 30px; height: 30px; }
  .btn { min-height: 44px; }
}
/* a phone on its side: the actions go to a column at the right, the plates narrow — the board takes the height */
@media (orientation: landscape) and (max-height: 460px) {
  .app { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: 'top top' 'stage actions'; column-gap: 8px; }
  .top { grid-area: top; min-height: 44px; padding: 2px 4px; }
  .stage { grid-area: stage; }
  .actions { grid-area: actions; flex-direction: column; justify-content: center; padding: 0; gap: 8px; }
  .actions .btn { width: 48px; padding: 0; }
  .actions .btn span { display: none; }
  /* (the side column has no room for it: as before, the line is left out) */
  .match-line { display: none; }
  .stage, body.f2f .stage { grid-template-columns: minmax(78px, 96px) minmax(0, 1fr) minmax(78px, 96px); gap: 6px; }
  .plate { padding: 8px 4px; gap: 4px; }
  .plate .token, .plate .token .disc-icon { width: 28px; height: 28px; }
  .plate .who b { font-size: 13.5px; }
  .plate .who small { font-size: 12px; }
}

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

/* cloud-apps bar 1.30.0 */
:root { --ca-brand-icon-w: 89px; } /* the brand's width with the icon alone (the mark, the divider, the app's icon) */
.ca-start { display: flex; align-items: center; flex: 0 100 auto; min-width: min(var(--ca-brand-icon-w), 100%); }
.ca-brand { display: flex; align-items: center; min-width: 0; height: 40px; color: inherit; font-family: inherit; }
.ca-brand a { display: flex !important; align-items: center !important; box-sizing: border-box !important; color: inherit !important; text-decoration: none !important; border-radius: 12px !important; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease; }
.ca-brand-home { flex: none !important; justify-content: center !important; width: 40px !important; height: 40px !important; padding: 0 !important; margin: 0 0 0 -5px !important; }
.ca-brand-home img { display: block !important; width: 30px !important; height: 30px !important; margin: 0 !important; transition: transform .38s cubic-bezier(.34, 1.56, .64, 1); }
.ca-brand-sep { flex: none; display: block; width: 1.5px; height: 18px; margin: 0 4px; border-radius: 1px; background: currentColor; opacity: .22; transform: rotate(18deg); }
.ca-brand-app { flex: 0 1 auto !important; min-width: 44px !important; height: 40px !important; padding: 0 9px 0 5px !important; margin: 0 !important; }
.ca-brand-in { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; column-gap: 9px; min-width: 0; height: 40px; overflow: hidden; }
.ca-brand-in img { flex: none; display: block !important; width: 30px !important; height: 30px !important; margin: 5px 0 !important; border-radius: 8px; }
.ca-brand[data-ca-icon] .ca-brand-name { display: none !important; }
.ca-brand[data-ca-icon] .ca-brand-app { padding-right: 5px !important; }
.ca-brand-name { display: block; height: 40px; margin: 0 !important; padding: 0 !important; line-height: 40px !important; white-space: nowrap; font-family: var(--ca-brand-font, inherit); font-size: 17px !important; font-weight: 700; letter-spacing: -.015em; color: inherit; text-shadow: var(--ca-brand-shadow, none); }
@media (hover: hover) { .ca-brand a:hover { background-color: color-mix(in srgb, currentColor 7%, transparent); } .ca-brand-home:hover img { transform: rotate(-6deg) scale(1.06); } }
.ca-brand a:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: -3px; }
.ca-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; min-width: 0; }
.ca-tools { display: flex; align-items: center; gap: 6px; }
.ca-tools[hidden] { display: none !important; }
.ca-tool { position: relative; flex: none; display: inline-grid; place-items: center !important; box-sizing: border-box !important; width: 36px !important; height: 36px !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; padding: 0 !important; margin: 0; border-radius: 50% !important;
  border: 1px solid var(--ca-tool-line, color-mix(in srgb, currentColor 16%, transparent)) !important; background: var(--ca-tool-bg, color-mix(in srgb, currentColor 6%, transparent)) !important; color: var(--ca-tool-ink, inherit) !important;
  font: inherit; line-height: 0 !important; letter-spacing: 0; text-decoration: none !important; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, transform .12s ease; }
.ca-tool[hidden] { display: none !important; }
.ca-tool::before { content: ""; position: absolute; inset: -4px; }
.ca-tool svg { display: block; width: 20px !important; height: 20px !important; margin: 0 !important; pointer-events: none; }
.ca-tool svg[hidden] { display: none !important; }
@media (hover: hover) { .ca-tool:hover { background: var(--ca-tool-hover, color-mix(in srgb, currentColor 13%, transparent)) !important; } }
.ca-tool:active { transform: scale(.94); }
.ca-tool:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: 2px; }
.ca-tool-talk { color: var(--ca-accent, #4f6bff) !important; border-color: color-mix(in srgb, var(--ca-accent, #4f6bff) 50%, transparent) !important; background: color-mix(in srgb, var(--ca-accent, #4f6bff) 13%, transparent) !important; }
.ca-tool .ca-tlive { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 30%, transparent); }
.ca-tool-talk.ca-new::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; pointer-events: none; animation: ca-bar-ring 1.2s ease-out 2; }
@keyframes ca-bar-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ca-accent, #4f6bff) 55%, transparent); } to { box-shadow: 0 0 0 11px transparent; } }
.ca-tool .ca-tcount, .ca-tool .ca-tunread { position: absolute; right: -5px; display: grid; place-items: center; box-sizing: border-box; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: #fff; font: 700 10.5px/1 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; pointer-events: none; }
.ca-tool .ca-tcount { bottom: -5px; background: #1f9d55; }
.ca-tool .ca-tunread { top: -5px; background: #e5484d; }
@media (max-width: 599.98px), (max-height: 499.98px) { .ca-tools-app { display: none !important; } }
.ca-end[data-ca-cramped] .ca-tools-app { display: none !important; }
.ca-end[data-ca-tight] .ca-tool-friends { display: none !important; }
@media (prefers-reduced-motion: reduce) { .ca-tool, .ca-brand a, .ca-brand-home img { transition: none; } .ca-tool-talk.ca-new::after { animation: none; } }
/* end of the cloud-apps bar */
/* ---- cloud-apps: big screens (App Standard §6.5) — written by `cloud-apps vendor-sdk`; do not edit ---- */
/* Past 1584 × 990 the page is laid out at about 1440 × 900 and zoomed to fill the screen; viewport
   units in this file are divided by --ca-zoom. cloud-kit.js turns it off where the engine has no
   standard zoom (html[data-ca-zoom="off"]). */
@media (min-width: 1585px) and (min-height: 991px) { :root { --ca-zoom: 1.1; } }
@media (min-width: 1656px) and (min-height: 1035px) { :root { --ca-zoom: 1.15; } }
@media (min-width: 1728px) and (min-height: 1080px) { :root { --ca-zoom: 1.2; } }
@media (min-width: 1800px) and (min-height: 1125px) { :root { --ca-zoom: 1.25; } }
@media (min-width: 1872px) and (min-height: 1170px) { :root { --ca-zoom: 1.3; } }
@media (min-width: 1945px) and (min-height: 1215px) { :root { --ca-zoom: 1.35; } }
@media (min-width: 2016px) and (min-height: 1260px) { :root { --ca-zoom: 1.4; } }
@media (min-width: 2088px) and (min-height: 1305px) { :root { --ca-zoom: 1.45; } }
@media (min-width: 2160px) and (min-height: 1350px) { :root { --ca-zoom: 1.5; } }
@media (min-width: 2232px) and (min-height: 1395px) { :root { --ca-zoom: 1.55; } }
@media (min-width: 2304px) and (min-height: 1440px) { :root { --ca-zoom: 1.6; } }
@media (min-width: 2376px) and (min-height: 1485px) { :root { --ca-zoom: 1.65; } }
@media (min-width: 2448px) and (min-height: 1530px) { :root { --ca-zoom: 1.7; } }
@media (min-width: 2520px) and (min-height: 1575px) { :root { --ca-zoom: 1.75; } }
@media (min-width: 2592px) and (min-height: 1620px) { :root { --ca-zoom: 1.8; } }
@media (min-width: 2664px) and (min-height: 1665px) { :root { --ca-zoom: 1.85; } }
@media (min-width: 2736px) and (min-height: 1710px) { :root { --ca-zoom: 1.9; } }
@media (min-width: 2808px) and (min-height: 1755px) { :root { --ca-zoom: 1.95; } }
@media (min-width: 2880px) and (min-height: 1800px) { :root { --ca-zoom: 2; } }
@media (min-width: 2952px) and (min-height: 1845px) { :root { --ca-zoom: 2.05; } }
@media (min-width: 3024px) and (min-height: 1890px) { :root { --ca-zoom: 2.1; } }
@media (min-width: 3096px) and (min-height: 1935px) { :root { --ca-zoom: 2.15; } }
@media (min-width: 3169px) and (min-height: 1981px) { :root { --ca-zoom: 2.2; } }
@media (min-width: 3240px) and (min-height: 2025px) { :root { --ca-zoom: 2.25; } }
@media (min-width: 3312px) and (min-height: 2070px) { :root { --ca-zoom: 2.3; } }
@media (min-width: 3384px) and (min-height: 2115px) { :root { --ca-zoom: 2.35; } }
@media (min-width: 3456px) and (min-height: 2160px) { :root { --ca-zoom: 2.4; } }
@media (min-width: 3529px) and (min-height: 2205px) { :root { --ca-zoom: 2.45; } }
@media (min-width: 3600px) and (min-height: 2250px) { :root { --ca-zoom: 2.5; } }
@media (min-width: 3672px) and (min-height: 2295px) { :root { --ca-zoom: 2.55; } }
@media (min-width: 3744px) and (min-height: 2340px) { :root { --ca-zoom: 2.6; } }
@media (min-width: 3816px) and (min-height: 2385px) { :root { --ca-zoom: 2.65; } }
@media (min-width: 3889px) and (min-height: 2430px) { :root { --ca-zoom: 2.7; } }
@media (min-width: 3960px) and (min-height: 2475px) { :root { --ca-zoom: 2.75; } }
@media (min-width: 4032px) and (min-height: 2520px) { :root { --ca-zoom: 2.8; } }
@media (min-width: 4104px) and (min-height: 2565px) { :root { --ca-zoom: 2.85; } }
@media (min-width: 4176px) and (min-height: 2610px) { :root { --ca-zoom: 2.9; } }
@media (min-width: 4248px) and (min-height: 2655px) { :root { --ca-zoom: 2.95; } }
@media (min-width: 4320px) and (min-height: 2700px) { :root { --ca-zoom: 3; } }
@media (min-width: 4392px) and (min-height: 2745px) { :root { --ca-zoom: 3.05; } }
@media (min-width: 4464px) and (min-height: 2790px) { :root { --ca-zoom: 3.1; } }
@media (min-width: 4536px) and (min-height: 2835px) { :root { --ca-zoom: 3.15; } }
@media (min-width: 4608px) and (min-height: 2880px) { :root { --ca-zoom: 3.2; } }
@media (min-width: 4680px) and (min-height: 2925px) { :root { --ca-zoom: 3.25; } }
@media (min-width: 4752px) and (min-height: 2970px) { :root { --ca-zoom: 3.3; } }
@media (min-width: 4824px) and (min-height: 3015px) { :root { --ca-zoom: 3.35; } }
@media (min-width: 4896px) and (min-height: 3060px) { :root { --ca-zoom: 3.4; } }
@media (min-width: 4968px) and (min-height: 3105px) { :root { --ca-zoom: 3.45; } }
@media (min-width: 5040px) and (min-height: 3150px) { :root { --ca-zoom: 3.5; } }
@media (min-width: 5112px) and (min-height: 3195px) { :root { --ca-zoom: 3.55; } }
@media (min-width: 5184px) and (min-height: 3240px) { :root { --ca-zoom: 3.6; } }
@media (min-width: 5256px) and (min-height: 3285px) { :root { --ca-zoom: 3.65; } }
@media (min-width: 5328px) and (min-height: 3330px) { :root { --ca-zoom: 3.7; } }
@media (min-width: 5400px) and (min-height: 3375px) { :root { --ca-zoom: 3.75; } }
@media (min-width: 5472px) and (min-height: 3420px) { :root { --ca-zoom: 3.8; } }
@media (min-width: 5544px) and (min-height: 3465px) { :root { --ca-zoom: 3.85; } }
@media (min-width: 5616px) and (min-height: 3510px) { :root { --ca-zoom: 3.9; } }
@media (min-width: 5688px) and (min-height: 3555px) { :root { --ca-zoom: 3.95; } }
@media (min-width: 5760px) and (min-height: 3600px) { :root { --ca-zoom: 4; } }
@media (min-width: 5832px) and (min-height: 3645px) { :root { --ca-zoom: 4.05; } }
@media (min-width: 5904px) and (min-height: 3690px) { :root { --ca-zoom: 4.1; } }
@media (min-width: 5977px) and (min-height: 3736px) { :root { --ca-zoom: 4.15; } }
@media (min-width: 6048px) and (min-height: 3780px) { :root { --ca-zoom: 4.2; } }
@media (min-width: 6120px) and (min-height: 3825px) { :root { --ca-zoom: 4.25; } }
@media (min-width: 6192px) and (min-height: 3870px) { :root { --ca-zoom: 4.3; } }
@media (min-width: 6264px) and (min-height: 3915px) { :root { --ca-zoom: 4.35; } }
@media (min-width: 6337px) and (min-height: 3961px) { :root { --ca-zoom: 4.4; } }
@media (min-width: 6408px) and (min-height: 4005px) { :root { --ca-zoom: 4.45; } }
@media (min-width: 6480px) and (min-height: 4050px) { :root { --ca-zoom: 4.5; } }
@media (min-width: 6552px) and (min-height: 4095px) { :root { --ca-zoom: 4.55; } }
@media (min-width: 6624px) and (min-height: 4140px) { :root { --ca-zoom: 4.6; } }
@media (min-width: 6697px) and (min-height: 4185px) { :root { --ca-zoom: 4.65; } }
@media (min-width: 6768px) and (min-height: 4230px) { :root { --ca-zoom: 4.7; } }
@media (min-width: 6840px) and (min-height: 4275px) { :root { --ca-zoom: 4.75; } }
@media (min-width: 6912px) and (min-height: 4320px) { :root { --ca-zoom: 4.8; } }
@media (min-width: 6984px) and (min-height: 4365px) { :root { --ca-zoom: 4.85; } }
@media (min-width: 7057px) and (min-height: 4410px) { :root { --ca-zoom: 4.9; } }
@media (min-width: 7128px) and (min-height: 4455px) { :root { --ca-zoom: 4.95; } }
@media (min-width: 7200px) and (min-height: 4500px) { :root { --ca-zoom: 5; } }
@media (min-width: 1585px) and (min-height: 991px) {
  html { zoom: var(--ca-zoom, 1); }
  html[data-ca-zoom='off'] { --ca-zoom: 1 !important; }
}
/* ---- end of big screens ---- */
