/* Minesweeper — a calm sea look: sea-glass tiles over sand by day, over deep water by night.
   The board itself is drawn on a canvas (js/board.js); this is everything around it. */
:root {
  color-scheme: light;
  --bg: #e8f3f1; --bg-2: #d6ebe6; --surface: #ffffff; --surface-2: #eef5f4; --text: #12242b; --muted: #4d6169;
  --line: rgba(18, 50, 58, 0.13); --accent: #0a706e; --accent-ink: #ffffff; --accent-soft: rgba(10, 112, 110, 0.12);
  --hot: #cf3927; --hot-soft: rgba(207, 57, 39, 0.12); --tile-a: #63cfc6; --tile-b: #38aeaa; --tile-lip: #1f7f7e;
  --shadow: 20, 60, 70; --backdrop: rgba(14, 40, 46, 0.38);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  --ca-accent: #0a706e; /* the accounts SDK's sheets and chip */
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1620; --bg-2: #0f2130; --surface: #15232f; --surface-2: #1c2d3b; --text: #e9f1f5; --muted: #a2b5c0;
  --line: rgba(190, 225, 240, 0.15); --accent: #4bd0c9; --accent-ink: #04201f; --accent-soft: rgba(75, 208, 201, 0.16);
  --hot: #ff8370; --hot-soft: rgba(255, 131, 112, 0.16); --tile-a: #3a86a8; --tile-b: #27657f; --tile-lip: #123a4e;
  --shadow: 0, 0, 0; --backdrop: rgba(2, 8, 14, 0.6);
  --ca-accent: #4bd0c9;
}
* { box-sizing: border-box; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS
   fallback; this copy covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-2), var(--bg) 62%) var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* a game page: no text selection or long-press callouts anywhere, HUD and
   menus included; form fields and prose (the rules) opt back in */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select, .prose p, .prose li { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
canvas:focus-visible { outline: none; }

/* ------------------------------------------------------------------ the page */
.app {
  height: calc(100dvh / var(--ca-zoom, 1)); display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.top { grid-row: 1; }
.hud { grid-row: 2; }
.race-bar { grid-row: 3; }
.stage { grid-row: 4; }
.dock { grid-row: 5; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 4px; min-height: 56px; }
/* the round's mode (a daily, a challenge, a duel, a race, practice): in the bar's middle beside the brand
   (on a phone the brand keeps only its mark and icon then), in the side column above the HUD */
.mode-line { margin: 0; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-wrap: balance; }
.top .mode-line { flex: 1 0 auto; text-align: center; }
.hud .mode-line { display: none; }
@media (max-width: 599.98px) {
  .top.with-line .ca-start { flex: none; width: var(--ca-brand-icon-w); }
  .top .mode-line { flex: 1 1 0; }
}

.hud { display: flex; align-items: center; gap: 8px; padding: 4px 14px 8px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 2px rgba(var(--shadow), 0.06);
}
.chip svg { width: 18px; height: 18px; color: var(--muted); }
.chip .flag-ink { color: var(--hot); }
.chip b { font-weight: 650; }
.size-chip { appearance: none; cursor: pointer; min-height: 44px; min-width: 0; flex: 0 1 auto; margin-right: auto; gap: 4px; transition: transform 0.2s var(--spring), background 0.2s; }
.size-chip b { overflow: hidden; text-overflow: ellipsis; }
.size-chip small { font-size: 14px; color: var(--muted); font-weight: 550; }
.size-chip svg { margin-left: auto; padding-left: 2px; box-sizing: content-box; }
.size-chip:active { transform: scale(0.97); }
#st-mines-box { min-width: 64px; justify-content: center; }
#st-time-box { min-width: 96px; justify-content: center; }
#st-time-box.off b { visibility: hidden; }

.stage { position: relative; min-height: 0; min-width: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
.zoom { position: absolute; top: 8px; right: 10px; display: flex; gap: 6px; }
.zoom.idle { display: none; }
@media (pointer: coarse) { .zoom:not(.on) { display: none; } }
.round {
  appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; cursor: pointer; transition: transform 0.2s var(--spring), opacity 0.2s; box-shadow: 0 2px 8px rgba(var(--shadow), 0.12);
}
.round:active { transform: scale(0.92); }
.round:disabled { opacity: 0.45; cursor: default; }
.zoom .round { width: 40px; height: 40px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.zoom .round svg { width: 20px; height: 20px; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.countdown > span { font-size: clamp(34px, calc(12vmin / var(--ca-zoom, 1)), 84px); font-weight: 800; letter-spacing: -0.02em; color: var(--text); text-align: center; padding: 0 16px; animation: pop 0.5s var(--spring) both; text-shadow: 0 2px 18px var(--bg); }
.countdown.cover { background: color-mix(in srgb, var(--bg) 84%, transparent); pointer-events: auto; }
.countdown .stuck { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 24px; max-width: 360px; text-align: center; animation: rise 0.28s var(--ease) both; }
.countdown .stuck p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.hintbox {
  position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 4; margin: 0 auto; max-width: 520px; padding: 12px 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 34px -10px rgba(var(--shadow), 0.45); animation: rise 0.28s var(--ease) both;
}
.hintbox.top { bottom: auto; top: 8px; }
.hintbox p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.4; }
.hint-btns { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

.dock { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px 10px; width: 100%; max-width: 600px; margin: 0 auto; }
.dock-btn {
  appearance: none; border: 0; background: none; color: var(--text); cursor: pointer; min-width: 56px; min-height: 52px; padding: 4px 6px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 600; flex: 0 1 96px;
  transition: transform 0.2s var(--spring), background 0.2s, opacity 0.2s;
}
.dock-btn svg { width: 24px; height: 24px; }
.dock-btn:active { transform: scale(0.94); background: var(--accent-soft); }
.dock-btn:disabled { opacity: 0.4; cursor: default; }
.mode { position: relative; display: flex; padding: 4px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(var(--shadow), 0.1); flex: 0 0 auto; }
.mode::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 14px; background: var(--accent);
  transition: transform 0.34s var(--spring), background 0.25s;
}
.mode.flagging::before { transform: translateX(100%); background: var(--hot); }
.mode button {
  appearance: none; position: relative; border: 0; background: none; cursor: pointer; min-width: 76px; min-height: 50px; padding: 4px 10px; border-radius: 14px; flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12.5px; font-weight: 650; color: var(--muted); transition: color 0.25s;
}
.mode button[aria-checked="true"] { color: var(--accent-ink); }
:root[data-theme="dark"] .mode.flagging button[aria-checked="true"] { color: #2a0b06; }
.mode button svg { width: 22px; height: 22px; }

/* the racers: who is where on the same board */
.race-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 14px 8px; }
.race-bar.many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.racer { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.racer.me { border-color: var(--accent); }
.racer.out { opacity: 0.6; }
.fig { position: relative; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.fig > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.who-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; }
.who b { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.who small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform 0.4s var(--ease); }
.racer.out .bar i { background: var(--hot); }

/* a wide window, or a phone on its side: the controls stand beside the board */
@media (min-width: 760px) and (min-aspect-ratio: 11/10), (orientation: landscape) and (max-height: 540px) {
  .app { grid-template-columns: clamp(196px, calc(27vw / var(--ca-zoom, 1)), 304px) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  .top, .hud, .race-bar, .dock { grid-column: 1; }
  .stage { grid-column: 2; grid-row: 1 / -1; }
  .hud { flex-wrap: wrap; }
  .top .mode-line { display: none; }
  .hud .mode-line { display: -webkit-box; flex: 1 1 100%; padding: 0 2px; }
  .size-chip { flex: 1 1 100%; }
  #st-mines-box, #st-time-box { flex: 1 1 0; }
  .race-bar, .race-bar.many { grid-template-columns: minmax(0, 1fr); align-content: start; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
  .dock { grid-row: 5; flex-wrap: wrap; justify-content: center; row-gap: 6px; max-width: none; }
  .size-chip { margin-right: 0; }
  .mode { order: -1; flex: 1 1 100%; }
  .mode button { min-width: 0; flex-direction: row; gap: 6px; font-size: 14px; }
  .dock-btn { flex: 1 1 0; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .top { min-height: 48px; padding-top: 6px; }
  .hud { padding-bottom: 4px; gap: 6px; }
  .chip { min-height: 36px; }
  .size-chip { min-height: 44px; }
  .mode button { min-height: 46px; flex-direction: column; gap: 1px; font-size: 12.5px; }
  .dock { padding-top: 4px; padding-bottom: 6px; }
  .dock-btn { min-height: 44px; }
  .dock-btn svg { width: 22px; height: 22px; }
  .race-bar { padding-bottom: 4px; }
}
@media (max-width: 359px) {
  .top, .hud, .dock, .race-bar { padding-left: 10px; padding-right: 10px; }
  .hud { gap: 6px; }
  .chip { padding: 0 9px; font-size: 14px; }
  .size-chip small { display: none; }
  #st-mines-box { min-width: 56px; }
  #st-time-box { min-width: 86px; }
  .mode button { min-width: 66px; padding: 4px 6px; }
}

/* ------------------------------------------------------- buttons and pieces */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 15.5px; cursor: pointer; text-align: center;
  transition: transform 0.2s var(--spring), opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14.5px; border-radius: 12px; }
.btn.wide { width: 100%; }
.btn.ghost, .btn.subtle { background: none; border-color: transparent; color: var(--accent); }
.btn svg { width: 19px; height: 19px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

.backdrop { position: fixed; inset: 0; z-index: 40; background: var(--backdrop); opacity: 0; transition: opacity 0.25s; }
.backdrop.show { opacity: 1; }
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 62px); z-index: 80; transform: translate(-50%, -14px); opacity: 0; pointer-events: none;
  max-width: calc(100vw / var(--ca-zoom, 1) - 28px); padding: 11px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14.5px; font-weight: 600;
  text-align: center; box-shadow: 0 10px 30px -10px rgba(var(--shadow), 0.6); transition: transform 0.28s var(--spring), opacity 0.2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ------------------------------------------------------------------- sheets */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: calc(88dvh / var(--ca-zoom, 1)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 50px -12px rgba(var(--shadow), 0.4);
  padding-bottom: env(safe-area-inset-bottom); transform: translateY(102%); transition: transform 0.34s var(--ease);
}
.sheet.show { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 4px 20px; flex: 0 0 auto; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.sheet-head .round { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.sheet-tabs { flex: 0 0 auto; padding: 4px 14px 6px; }
.sheet-tabs:empty { display: none; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 22px; -webkit-overflow-scrolling: touch; }
.sheet-body h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; letter-spacing: -0.01em; }
.sheet-body h3:first-child { margin-top: 6px; }
.sheet-body h4 { font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; font-weight: 650; }
.sheet-body p { margin: 0 0 10px; }
.prose p, .prose li { font-size: 15px; line-height: 1.5; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.version { color: var(--muted); font-size: 13px; margin-top: 18px; }
@media (min-width: 640px) and (min-height: 460px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: min(480px, calc(100vw / var(--ca-zoom, 1) - 40px)); border-radius: 24px; padding-bottom: 0;
    transform: translate(-50%, -46%) scale(0.98); opacity: 0; transition: transform 0.3s var(--ease), opacity 0.22s; max-height: min(calc(86dvh / var(--ca-zoom, 1)), 780px);
  }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
}

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); overflow-x: auto; scrollbar-width: none; overscroll-behavior: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  appearance: none; flex: 1 0 auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 11px; background: none; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14.5px; font-weight: 650; white-space: nowrap; transition: background 0.2s, color 0.2s;
}
.tabs button svg { width: 18px; height: 18px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(var(--shadow), 0.14); }
.tabs.small { margin-bottom: 10px; flex-wrap: wrap; }
.tabs.small button { flex: 1 1 auto; }
.tabs.small button { font-size: 13.5px; padding: 0 10px; }

.sizes, .ways { display: flex; flex-direction: column; gap: 8px; }
.size-card, .way {
  appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; border-radius: 16px; border: 1.5px solid transparent;
  background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; transition: transform 0.2s var(--spring), border-color 0.2s;
}
.size-card:active, .way:active { transform: scale(0.98); }
.size-card.current { border-color: var(--accent); }
.way:disabled { opacity: 0.5; cursor: default; }
.way > svg { width: 26px; height: 26px; color: var(--accent); margin: 0 5px; }
.size-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.size-text b { font-size: 15.5px; font-weight: 650; }
.size-text small { font-size: 13px; color: var(--muted); }
.size-best { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.size-best small { font-size: 11.5px; color: var(--muted); }
.size-best b { font-size: 14.5px; font-weight: 650; }
.glyph { flex: 0 0 36px; height: 36px; display: grid; place-items: center; }
.glyph::before {
  content: ""; width: var(--gw, 24px); height: var(--gh, 30px); border-radius: 4px;
  background: linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px) 0 0 / 5px 5px, linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px) 0 0 / 5px 5px, linear-gradient(var(--tile-a), var(--tile-b));
  box-shadow: 0 2px 0 var(--tile-lip);
}
.daily-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; background: linear-gradient(140deg, var(--accent-soft), transparent 75%), var(--surface-2); }
.daily-top { display: flex; align-items: center; gap: 12px; }
.daily-card p { margin: 0; font-size: 14.5px; }
.daily-card p.done { color: var(--accent); font-weight: 650; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.tile span { font-size: 12.5px; line-height: 1.25; color: var(--muted); }
.tile b { display: flex; align-items: center; gap: 4px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile b span { font-size: inherit; color: inherit; }
.tile b svg { width: 18px; height: 18px; color: var(--hot); }
@media (max-width: 359px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.size-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.size-pick button {
  appearance: none; min-height: 52px; padding: 4px 2px; border-radius: 12px; border: 1.5px solid transparent; background: var(--surface-2); color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; transition: border-color 0.2s, transform 0.2s var(--spring);
}
.size-pick button b { font-size: 12.5px; font-weight: 650; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size-pick button small { font-size: 11.5px; color: var(--muted); }
.size-pick button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 400px) { .size-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.board-host, .record-host { min-height: 56px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row-text b { font-size: 15.5px; font-weight: 600; }
.row-text small { font-size: 13px; color: var(--muted); }
.row.toggle { position: relative; cursor: pointer; }
.row.toggle input { position: absolute; opacity: 0; width: 52px; height: 32px; right: 0; margin: 0; cursor: pointer; }
.switch { flex: 0 0 auto; position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); transition: background 0.25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--spring); }
.row.toggle input:checked ~ .switch { background: var(--accent); border-color: transparent; }
.row.toggle input:checked ~ .switch::after { transform: translateX(20px); }
.row.toggle input:focus-visible ~ .switch { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.row.choice { flex-wrap: wrap; }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
.seg button { appearance: none; border: 0; background: none; color: var(--muted); min-height: 38px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(var(--shadow), 0.14); }
.select { font: inherit; font-size: 15px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; }
#settings-body .btn.subtle { margin-top: 8px; padding: 0 4px; }

.table { display: flex; flex-direction: column; border-radius: 14px; background: var(--surface-2); padding: 4px 12px; }
.tr { display: grid; grid-template-columns: minmax(0, 1.5fr) 1fr 0.8fr 1fr; gap: 8px; align-items: center; min-height: 42px; font-size: 14.5px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); }
.tr:last-child { border-bottom: 0; }
.tr > :nth-child(n + 2) { text-align: right; }
.tr.head { font-size: 12px; color: var(--muted); min-height: 32px; }
.tr b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.friend-list { display: flex; flex-direction: column; gap: 6px; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border-radius: 14px; background: var(--surface-2); }
.friend-row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* ------------------------------------------------------- the end of a round */
.result {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 14px); z-index: 30; width: min(400px, calc(100vw / var(--ca-zoom, 1) - 24px));
  max-height: calc(100dvh / var(--ca-zoom, 1) - 28px); overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 18px 12px; border-radius: 24px; background: var(--surface); color: var(--text); text-align: center; border: 1px solid var(--line);
  box-shadow: 0 24px 70px -18px rgba(var(--shadow), 0.55); transform: translate(-50%, 30px) scale(0.96); opacity: 0; transition: transform 0.45s var(--spring), opacity 0.25s;
}
.result.show { transform: translate(-50%, 0); opacity: 1; }
.result h2 { margin: 0 0 4px; font-size: 24px; font-weight: 750; letter-spacing: -0.02em; color: var(--accent); }
.result.lost h2 { color: var(--hot); }
.result p { margin: 0 0 10px; font-size: 14.5px; color: var(--muted); }
.result-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.result-stats > div { flex: 1 1 0; max-width: 150px; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; }
.result-stats small { font-size: 12px; color: var(--muted); }
.result-stats b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .btn.ghost { min-height: 44px; }
@media (orientation: landscape) and (max-height: 540px) {
  .result { left: auto; right: calc(env(safe-area-inset-right) + 12px); bottom: 12px; width: min(340px, calc(52vw / var(--ca-zoom, 1))); padding: 12px 14px 8px; transform: translate(0, 30px) scale(0.96); }
  .result.show { transform: none; }
  .result h2 { font-size: 20px; }
  .result-stats { margin-bottom: 8px; }
  .result-stats b { font-size: 18px; }
  .result .stack { flex-direction: row; flex-wrap: wrap; }
  .result .stack .btn { flex: 1 1 40%; min-height: 44px; font-size: 14px; padding: 0 10px; }
}
.confirm {
  position: fixed; left: 50%; top: 50%; z-index: 60; width: min(360px, calc(100vw / var(--ca-zoom, 1) - 32px)); padding: 20px 18px 16px; border-radius: 22px;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 70px -18px rgba(var(--shadow), 0.6); transform: translate(-50%, -46%) scale(0.96); opacity: 0;
  transition: transform 0.3s var(--spring), opacity 0.2s;
}
.confirm.show { transform: translate(-50%, -50%); opacity: 1; }
.confirm p { margin: 0 0 16px; font-size: 16px; line-height: 1.4; text-align: center; }
.confirm-btns { display: flex; gap: 8px; }
.confirm-btns .btn { flex: 1 1 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !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 ---- */
