/* ninedarter — Material 3 Expressive design system (hand-rolled, no build step) */

/* ---------- Color tokens (seeded from --h, generated in OKLCH) ---------- */
:root {
  --h: 285;
  /* viewport units that stay true under the Display size zoom (html { zoom }) */
  --zoom: 1; --vh: calc(1dvh / var(--zoom)); --vw: calc(1vw / var(--zoom));
  --h3: calc(var(--h) + 70);
  color-scheme: light;
  --primary: oklch(0.47 0.17 var(--h));
  --on-primary: oklch(1 0 0);
  --primary-container: oklch(0.89 0.08 var(--h));
  --on-primary-container: oklch(0.28 0.12 var(--h));
  --primary-fixed-dim: oklch(0.8 0.11 var(--h));
  --secondary: oklch(0.5 0.06 var(--h));
  --on-secondary: oklch(1 0 0);
  --secondary-container: oklch(0.9 0.045 var(--h));
  --on-secondary-container: oklch(0.27 0.05 var(--h));
  --tertiary: oklch(0.5 0.13 var(--h3));
  --on-tertiary: oklch(1 0 0);
  --tertiary-container: oklch(0.9 0.08 var(--h3));
  --on-tertiary-container: oklch(0.28 0.1 var(--h3));
  --error: oklch(0.53 0.2 27);
  --on-error: oklch(1 0 0);
  --error-container: oklch(0.92 0.05 27);
  --on-error-container: oklch(0.32 0.12 27);
  --success: oklch(0.55 0.14 150);
  --success-container: oklch(0.91 0.08 150);
  --on-success-container: oklch(0.3 0.08 150);
  --surface: oklch(0.985 0.006 var(--h));
  --surface-dim: oklch(0.9 0.012 var(--h));
  --surface-container-lowest: oklch(1 0 0);
  --surface-container-low: oklch(0.966 0.01 var(--h));
  --surface-container: oklch(0.952 0.013 var(--h));
  --surface-container-high: oklch(0.935 0.015 var(--h));
  --surface-container-highest: oklch(0.915 0.017 var(--h));
  --on-surface: oklch(0.21 0.015 var(--h));
  --on-surface-variant: oklch(0.43 0.02 var(--h));
  --outline: oklch(0.62 0.02 var(--h));
  --outline-variant: oklch(0.85 0.015 var(--h));
  --inverse-surface: oklch(0.3 0.015 var(--h));
  --inverse-on-surface: oklch(0.95 0.01 var(--h));
  --inverse-primary: oklch(0.82 0.11 var(--h));
  --scrim: oklch(0 0 0 / 0.4);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.12), 0 2px 6px oklch(0 0 0 / 0.08);
  --shadow-3: 0 4px 8px oklch(0 0 0 / 0.12), 0 8px 24px oklch(0 0 0 / 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --primary: oklch(0.82 0.11 var(--h)); --on-primary: oklch(0.29 0.12 var(--h)); --primary-container: oklch(0.38 0.13 var(--h)); --on-primary-container: oklch(0.92 0.06 var(--h)); --primary-fixed-dim: oklch(0.8 0.11 var(--h)); --secondary: oklch(0.82 0.045 var(--h)); --on-secondary: oklch(0.29 0.04 var(--h)); --secondary-container: oklch(0.37 0.045 var(--h)); --on-secondary-container: oklch(0.91 0.035 var(--h)); --tertiary: oklch(0.83 0.09 var(--h3)); --on-tertiary: oklch(0.3 0.09 var(--h3)); --tertiary-container: oklch(0.4 0.1 var(--h3)); --on-tertiary-container: oklch(0.92 0.06 var(--h3)); --error: oklch(0.8 0.1 27); --on-error: oklch(0.3 0.1 27); --error-container: oklch(0.42 0.13 27); --on-error-container: oklch(0.92 0.04 27); --success: oklch(0.8 0.12 150); --success-container: oklch(0.38 0.08 150); --on-success-container: oklch(0.92 0.06 150); --surface: oklch(0.17 0.012 var(--h)); --surface-dim: oklch(0.17 0.012 var(--h)); --surface-container-lowest: oklch(0.14 0.01 var(--h)); --surface-container-low: oklch(0.2 0.013 var(--h)); --surface-container: oklch(0.22 0.014 var(--h)); --surface-container-high: oklch(0.26 0.015 var(--h)); --surface-container-highest: oklch(0.3 0.016 var(--h)); --on-surface: oklch(0.92 0.01 var(--h)); --on-surface-variant: oklch(0.8 0.02 var(--h)); --outline: oklch(0.63 0.02 var(--h)); --outline-variant: oklch(0.4 0.02 var(--h)); --inverse-surface: oklch(0.92 0.01 var(--h)); --inverse-on-surface: oklch(0.27 0.015 var(--h)); --inverse-primary: oklch(0.47 0.17 var(--h)); --scrim: oklch(0 0 0 / 0.6); }
}
:root[data-theme="dark"] { color-scheme: dark; --primary: oklch(0.82 0.11 var(--h)); --on-primary: oklch(0.29 0.12 var(--h)); --primary-container: oklch(0.38 0.13 var(--h)); --on-primary-container: oklch(0.92 0.06 var(--h)); --primary-fixed-dim: oklch(0.8 0.11 var(--h)); --secondary: oklch(0.82 0.045 var(--h)); --on-secondary: oklch(0.29 0.04 var(--h)); --secondary-container: oklch(0.37 0.045 var(--h)); --on-secondary-container: oklch(0.91 0.035 var(--h)); --tertiary: oklch(0.83 0.09 var(--h3)); --on-tertiary: oklch(0.3 0.09 var(--h3)); --tertiary-container: oklch(0.4 0.1 var(--h3)); --on-tertiary-container: oklch(0.92 0.06 var(--h3)); --error: oklch(0.8 0.1 27); --on-error: oklch(0.3 0.1 27); --error-container: oklch(0.42 0.13 27); --on-error-container: oklch(0.92 0.04 27); --success: oklch(0.8 0.12 150); --success-container: oklch(0.38 0.08 150); --on-success-container: oklch(0.92 0.06 150); --surface: oklch(0.17 0.012 var(--h)); --surface-dim: oklch(0.17 0.012 var(--h)); --surface-container-lowest: oklch(0.14 0.01 var(--h)); --surface-container-low: oklch(0.2 0.013 var(--h)); --surface-container: oklch(0.22 0.014 var(--h)); --surface-container-high: oklch(0.26 0.015 var(--h)); --surface-container-highest: oklch(0.3 0.016 var(--h)); --on-surface: oklch(0.92 0.01 var(--h)); --on-surface-variant: oklch(0.8 0.02 var(--h)); --outline: oklch(0.63 0.02 var(--h)); --outline-variant: oklch(0.4 0.02 var(--h)); --inverse-surface: oklch(0.92 0.01 var(--h)); --inverse-on-surface: oklch(0.27 0.015 var(--h)); --inverse-primary: oklch(0.47 0.17 var(--h)); --scrim: oklch(0 0 0 / 0.6); }

/* ---------- Shape, motion, type tokens ---------- */
:root {
  --r-xs: 4px; --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-l-inc: 20px; --r-xl: 28px; --r-xl-inc: 32px; --r-2xl: 48px; --r-full: 999px;
  /* M3 Expressive motion: spatial springs overshoot, effects springs do not */
  --spring-fast: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  --spring: cubic-bezier(0.38, 1.21, 0.22, 1);
  --spring-slow: cubic-bezier(0.39, 1.29, 0.35, 0.98);
  --effects: cubic-bezier(0.31, 0.94, 0.34, 1);
  --d-fast: 350ms; --d: 500ms; --d-slow: 650ms; --d-fx: 200ms;
  --font: "Roboto Flex", "Google Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-w: 96px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { height: 100%; }
/* body grows with long pages so its background covers everything (html carries the nav-bar colour for overscroll) */
body { min-height: 100%; }
body {
  font-family: var(--font); background: var(--surface); color: var(--on-surface);
  font-size: 16px; line-height: 1.45; letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  transition: background var(--d-fx) var(--effects);
}
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

.msr { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 24px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24; user-select: none; flex-shrink: 0; overflow: hidden; width: 1em; }
.msr.fill { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

/* Type scale (emphasized variants via weight + width axes) */
.display-l { font-size: 57px; line-height: 64px; font-weight: 750; font-stretch: 112%; letter-spacing: -0.02em; font-variation-settings: "wdth" 112; }
.display-m { font-size: 45px; line-height: 52px; font-weight: 700; letter-spacing: -0.01em; }
.headline-l { font-size: 32px; line-height: 40px; font-weight: 650; }
.headline-m { font-size: 28px; line-height: 36px; font-weight: 650; }
.headline-s { font-size: 24px; line-height: 32px; font-weight: 600; }
.title-l { font-size: 22px; line-height: 28px; font-weight: 600; }
.title-m { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: 0.01em; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 600; }
.body-m { font-size: 14px; line-height: 20px; }
.body-s { font-size: 12px; line-height: 16px; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: 0.02em; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.04em; }
.muted { color: var(--on-surface-variant); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: calc(100 * var(--vh)); }
.main { flex: 1; min-width: 0; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1200px; margin: 0 auto; width: 100%; }
.shell.fullscreen .main { padding-bottom: 0; max-width: none; }

.topbar { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 0; position: sticky; top: 0; z-index: 5; background: var(--surface); }
.topbar .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-word { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; font-stretch: 115%; font-variation-settings: "wdth" 120; }
.brand-word b { color: var(--primary); font-weight: 900; }

/* Navigation bar (mobile) */
.navbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: flex; justify-content: space-around; background: var(--surface-container); padding: 12px 8px calc(16px + env(safe-area-inset-bottom)); }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; cursor: pointer; padding: 0; color: var(--on-surface-variant); text-decoration: none; min-width: 0; }
.nav-item .pill { width: 56px; height: 32px; border-radius: var(--r-full); display: grid; place-items: center; position: relative; transition: background var(--d-fx) var(--effects); }
.nav-item .pill::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--secondary-container); transform: scaleX(0.3); opacity: 0; transition: transform var(--d-fast) var(--spring-fast), opacity var(--d-fx) var(--effects); }
.nav-item .pill .msr { position: relative; }
.nav-item.active { color: var(--on-surface); }
.nav-item.active .pill::before { transform: scaleX(1); opacity: 1; }
.nav-item.active .pill .msr { font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24; color: var(--on-secondary-container); }
.nav-item .label-m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Navigation rail (wide) */
@media (min-width: 840px) {
  .navbar { inset: 0 auto 0 0; width: var(--nav-w); flex-direction: column; justify-content: flex-start; gap: 12px; padding: 24px 0; background: var(--surface); }
  .navbar .nav-item { flex: 0; }
  .navbar .rail-fab { display: grid; }
  .shell:not(.fullscreen) .main { padding-left: calc(var(--nav-w) + 24px); padding-right: 24px; padding-bottom: 32px; }
}
.rail-fab { display: none; width: 56px; height: 56px; margin: 0 auto 28px; border-radius: var(--r-l); border: 0; background: var(--primary-container); color: var(--on-primary-container); place-items: center; cursor: pointer; transition: border-radius var(--d-fast) var(--spring-fast); }
.rail-fab:active { border-radius: var(--r-xl); }

/* ---------- Buttons (shape-morphing on press) ---------- */
.btn {
  --bh: 48px; --br: calc(var(--bh) / 2); --brp: 12px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--bh); padding: 0 24px; border: 0; border-radius: var(--br); cursor: pointer; overflow: hidden;
  font-weight: 600; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; user-select: none;
  background: var(--surface-container-high); color: var(--primary);
  transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx) var(--effects), color var(--d-fx) var(--effects), transform var(--d-fast) var(--spring-fast), box-shadow var(--d-fx);
}
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--d-fx) var(--effects); pointer-events: none; }
.btn:hover::after { opacity: 0.08; }
.btn:active::after { opacity: 0.12; }
.btn:active { border-radius: var(--brp); }
.btn:focus-visible { outline: 3px solid var(--secondary); outline-offset: 2px; }
.btn[disabled] { opacity: 0.38; pointer-events: none; }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.btn.outlined { background: transparent; box-shadow: inset 0 0 0 1px var(--outline-variant); color: var(--on-surface-variant); }
.btn.text { background: transparent; padding: 0 12px; }
.btn.danger { background: var(--error-container); color: var(--on-error-container); }
.btn.xs { --bh: 32px; padding: 0 12px; font-size: 13px; --brp: 8px; }
.btn.s { --bh: 40px; padding: 0 16px; font-size: 14px; }
.btn.m { --bh: 56px; padding: 0 24px; font-size: 16px; --brp: 16px; }
.btn.l { --bh: 96px; padding: 0 48px; font-size: 24px; --brp: 28px; gap: 12px; }
.btn.l .msr { font-size: 32px; }
.btn.xl { --bh: 136px; padding: 0 64px; font-size: 32px; --brp: 40px; }
.btn.square { --br: var(--r-l); --brp: calc(var(--bh) / 2); }
.btn.block { width: 100%; }
.icon-btn { --bh: 40px; width: var(--bh); padding: 0; background: transparent; color: var(--on-surface-variant); }
.icon-btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.icon-btn.filled { background: var(--primary); color: var(--on-primary); }
.icon-btn.m { --bh: 56px; }
.icon-btn.l { --bh: 72px; }
.icon-btn.l .msr { font-size: 32px; }

/* Button group (connected, M3 Expressive) */
.bgroup { display: flex; gap: 2px; flex-wrap: nowrap; }
.bgroup .seg { flex: 1; --bh: 44px; height: var(--bh); border: 0; cursor: pointer; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; background: var(--surface-container-highest); color: var(--on-surface-variant); border-radius: var(--r-s); transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx), color var(--d-fx), flex-grow var(--d) var(--spring); white-space: nowrap; min-width: 0; }
.bgroup .seg:first-child { border-radius: 22px var(--r-s) var(--r-s) 22px; }
.bgroup .seg:last-child { border-radius: var(--r-s) 22px 22px var(--r-s); }
.bgroup .seg:only-child { border-radius: 22px; }
.bgroup .seg.on { background: var(--secondary); color: var(--on-secondary); border-radius: 22px; flex-grow: 1.25; }
.bgroup .seg:active { border-radius: var(--r-xs); }
.bgroup.s .seg { --bh: 36px; font-size: 13px; padding: 0 8px; }
.bgroup.wrap { flex-wrap: wrap; gap: 6px; }
.bgroup.wrap .seg { border-radius: var(--r-l); flex: 1 0 auto; }
.bgroup.wrap .seg.on { border-radius: 22px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px 0 6px; border-radius: var(--r-m); border: 0; box-shadow: inset 0 0 0 1px var(--outline-variant); background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--on-surface-variant); transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx); }
.chip.on { background: var(--secondary-container); color: var(--on-secondary-container); box-shadow: none; border-radius: var(--r-l-inc); }
.chip .avatar { width: 26px; height: 26px; font-size: 12px; }
.chip.plain { padding: 0 14px; }

/* ---------- Cards & surfaces ---------- */
.card { background: var(--surface-container-low); border-radius: var(--r-xl); padding: 20px; }
.card.high { background: var(--surface-container-high); }
.card.outlined { background: var(--surface); box-shadow: inset 0 0 0 1px var(--outline-variant); }
.card.primary { background: var(--primary-container); color: var(--on-primary-container); }
.card.secondary { background: var(--secondary-container); color: var(--on-secondary-container); }
.card.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.s { gap: 8px; }
.stack.l { gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { margin: 24px 4px 12px; color: var(--on-surface-variant); }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.resp { grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid.resp { grid-template-columns: 1fr 1fr; } }
.setup-pad { padding-bottom: 24px; }
.divider { height: 1px; background: var(--outline-variant); border: 0; margin: 8px 0; }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-2xl); padding: 28px; background: var(--primary-container); color: var(--on-primary-container); min-height: 260px; display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; isolation: isolate; }
.hero .deco { position: absolute; right: -40px; top: -40px; width: 260px; height: 260px; z-index: -1; color: var(--primary-fixed-dim); opacity: 0.7; animation: spin 28s linear infinite; }
.hero .deco2 { position: absolute; right: 120px; top: 90px; width: 90px; height: 90px; z-index: -1; color: var(--tertiary); opacity: 0.35; animation: spin 18s linear infinite reverse; }
.hero h1 { font-size: clamp(40px, calc(9 * var(--vw)), 72px); line-height: 0.95; font-weight: 850; letter-spacing: -0.035em; font-stretch: 118%; font-variation-settings: "wdth" 125; }
@keyframes spin { to { transform: rotate(360deg); } }

.mode-card { position: relative; display: flex; flex-direction: column; gap: 10px; text-align: left; border: 0; cursor: pointer; padding: 20px; min-height: 168px; border-radius: var(--r-xl); background: var(--surface-container); color: var(--on-surface); overflow: hidden; transition: border-radius var(--d) var(--spring), transform var(--d-fast) var(--spring-fast), background var(--d-fx); }
.mode-card:hover { border-radius: var(--r-2xl); }
.mode-card:active { transform: scale(0.97); border-radius: var(--r-l); }
.mode-card .shape { width: 56px; height: 56px; display: grid; place-items: center; position: relative; color: var(--c-bg); }
.mode-card .shape svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform var(--d-slow) var(--spring); }
.mode-card:hover .shape svg { transform: rotate(45deg) scale(1.08); }
.mode-card .shape .msr { position: relative; color: var(--c-fg); }
.mode-card .desc { color: var(--on-surface-variant); font-size: 14px; }
.mode-card .go { position: absolute; right: 16px; top: 16px; color: var(--on-surface-variant); }
.c-primary { --c-bg: var(--primary-container); --c-fg: var(--on-primary-container); }
.c-secondary { --c-bg: var(--secondary-container); --c-fg: var(--on-secondary-container); }
.c-tertiary { --c-bg: var(--tertiary-container); --c-fg: var(--on-tertiary-container); }
.c-error { --c-bg: var(--error-container); --c-fg: var(--on-error-container); }
.c-success { --c-bg: var(--success-container); --c-fg: var(--on-success-container); }

/* ---------- Avatars (M3 Expressive shapes) ---------- */
.avatar { position: relative; width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 17px; color: oklch(0.28 0.1 var(--ph)); }
.avatar svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: oklch(0.86 0.09 var(--ph)); transition: transform var(--d-slow) var(--spring); }
.avatar span { position: relative; }
.avatar.l { width: 64px; height: 64px; font-size: 24px; }
.avatar.xl { width: 96px; height: 96px; font-size: 36px; }
:root[data-theme="dark"] .avatar { color: oklch(0.92 0.06 var(--ph)); }
:root[data-theme="dark"] .avatar svg { fill: oklch(0.4 0.11 var(--ph)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: oklch(0.92 0.06 var(--ph)); } :root:not([data-theme="light"]) .avatar svg { fill: oklch(0.4 0.11 var(--ph)); } }
.avatar.spin svg { animation: spin 6s linear infinite; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 2px; border-radius: var(--r-xl); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; background: var(--surface-container-low); border: 0; text-align: left; width: 100%; cursor: pointer; border-radius: var(--r-xs); transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx); }
.list-item:first-child { border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl); }
.list-item:last-child { border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }
.list-item:hover { background: var(--surface-container); }
.list-item:active { border-radius: var(--r-l); }
.list-item .lead { width: 40px; height: 40px; border-radius: var(--r-m); display: grid; place-items: center; background: var(--secondary-container); color: var(--on-secondary-container); flex-shrink: 0; }
.list-item .meta { color: var(--on-surface-variant); font-size: 13px; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 10px; }
.field > .label-l { color: var(--on-surface-variant); padding-left: 4px; }
.textfield { height: 56px; padding: 0 16px; border-radius: var(--r-l); border: 0; background: var(--surface-container-highest); outline: none; box-shadow: inset 0 -2px 0 var(--outline); transition: box-shadow var(--d-fx), border-radius var(--d-fast) var(--spring-fast); width: 100%; font-size: 16px; }
.textfield:focus { box-shadow: inset 0 -3px 0 var(--primary); border-radius: var(--r-s); }
.switch { position: relative; width: 52px; height: 32px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-container-highest); box-shadow: inset 0 0 0 2px var(--outline); transition: background var(--d-fx); }
.switch .thumb { position: absolute; left: 8px; top: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); transition: all var(--d-fast) var(--spring-fast); }
.switch input:checked ~ .track { background: var(--primary); box-shadow: none; }
.switch input:checked ~ .thumb { left: 24px; top: 4px; width: 24px; height: 24px; background: var(--on-primary); }
.switch:active .thumb { width: 28px; height: 28px; top: 2px; left: 2px; }
.switch input:checked:active ~ .thumb { left: 22px; }
.setting { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--surface-container-low); border-radius: var(--r-xs); }
.list > .setting:first-child { border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl); }
.list > .setting:last-child { border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }
.setting .msr { color: var(--on-surface-variant); }

/* Slider (expressive: thick track + handle bar) */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 16px; border-radius: 8px; background: linear-gradient(to right, var(--primary) 0 var(--pct, 50%), var(--secondary-container) var(--pct, 50%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 44px; margin-top: -14px; border-radius: 2px; background: var(--primary); box-shadow: 0 0 0 6px var(--surface); }
.slider::-moz-range-track { height: 16px; border-radius: 8px; background: var(--secondary-container); }
.slider::-moz-range-progress { height: 16px; border-radius: 8px; background: var(--primary); }
.slider::-moz-range-thumb { width: 4px; height: 44px; border: 0; border-radius: 2px; background: var(--primary); }

/* Hue swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 48px; height: 48px; border: 0; border-radius: var(--r-l); cursor: pointer; background: oklch(0.6 0.15 var(--sh)); transition: border-radius var(--d-fast) var(--spring-fast), transform var(--d-fast) var(--spring-fast); display: grid; place-items: center; color: white; }
.swatch.on { border-radius: 50%; transform: scale(1.08); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px oklch(0.6 0.15 var(--sh)); }

/* ---------- Dialog & snackbar ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: grid; place-items: center; padding: 24px; animation: fade var(--d-fx) var(--effects); }
.dialog { width: min(440px, 100%); max-height: calc(90 * var(--vh)); overflow: auto; background: var(--surface-container-high); border-radius: var(--r-xl-inc); padding: 24px; display: flex; flex-direction: column; gap: 16px; animation: pop var(--d) var(--spring); box-shadow: var(--shadow-3); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dialog .icon-head { align-self: center; color: var(--secondary); }
@keyframes pop { from { transform: scale(0.85) translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.snackbar { position: fixed; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--inverse-surface); color: var(--inverse-on-surface); padding: 14px 20px; border-radius: var(--r-l); box-shadow: var(--shadow-3); animation: snack var(--d) var(--spring); max-width: calc(calc(100 * var(--vw)) - 32px); font-size: 14px; display: flex; align-items: center; gap: 12px; }
@keyframes snack { from { transform: translate(-50%, 40px) scale(0.9); opacity: 0; } }
@media (min-width: 840px) { .snackbar { bottom: 24px; } }

/* ---------- Setup ---------- */
.setup-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .setup-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.start-bar { position: sticky; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 4; display: flex; justify-content: center; padding: 24px 0 0; pointer-events: none; }
.start-bar .btn.l { --bh: 80px; }
.start-bar .btn { pointer-events: auto; box-shadow: var(--shadow-3); }
@media (min-width: 840px) { .start-bar { bottom: 24px; } }
.bot-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-l); background: var(--surface-container-highest); }

/* ---------- Game screen ---------- */
.game { display: flex; flex-direction: column; min-height: calc(100 * var(--vh)); max-width: 1100px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.game-top { display: flex; align-items: center; gap: 4px; min-height: 56px; }
.game-top .info { flex: 1; text-align: center; }
.game-body { flex: 1; display: grid; gap: 12px; grid-template-columns: 1fr; align-content: start; }
@media (min-width: 900px) and (min-height: 600px) { .game-body { grid-template-columns: 1.1fr 1fr; align-items: stretch; align-content: stretch; padding-bottom: 16px; } .game-body .input-panel { align-self: end; } }
.players { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-content: start; }
.players.many { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pcard { position: relative; border-radius: var(--r-l); padding: 14px 16px; background: var(--surface-container); display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow: hidden; transition: border-radius var(--d-slow) var(--spring), background var(--d-fx) var(--effects), color var(--d-fx), transform var(--d) var(--spring); }
.pcard.active { border-radius: var(--r-2xl) var(--r-l) var(--r-2xl) var(--r-l); background: var(--primary-container); color: var(--on-primary-container); transform: scale(1.0); }
.pcard .pname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pcard .pname .title-m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .rem { font-size: clamp(54px, calc(13 * var(--vw)), 96px); line-height: 0.92; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; font-stretch: 110%; font-variation-settings: "wdth" 115; transition: transform var(--d) var(--spring); }
.pcard.active .rem { transform-origin: left center; }
.players.many .pcard .rem { font-size: clamp(42px, calc(10 * var(--vw)), 72px); }
.pcard .sub { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--on-surface-variant); }
.pcard.active .sub { color: var(--on-primary-container); opacity: 0.85; }
.pcard .legs { display: flex; gap: 6px; align-items: center; }
.pcard .legs .pip { min-width: 30px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--surface-container-highest); color: var(--on-surface); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.pcard.active .legs .pip { background: var(--primary); color: var(--on-primary); }
.pcard .hint { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pcard .hint b { background: var(--tertiary-container); color: var(--on-tertiary-container); padding: 3px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.pcard.active .hint b { background: var(--tertiary); color: var(--on-tertiary); }
.pcard .last { font-size: 13px; }
.pcard .bump { animation: bump var(--d) var(--spring-fast); }
@keyframes bump { from { transform: scale(1.12); } }
.pcard .turn-dot { position: absolute; right: 14px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); opacity: 0; transform: scale(0); transition: all var(--d) var(--spring-fast); }
.pcard.active .turn-dot { opacity: 1; transform: scale(1); }

.visits { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.visits span { flex-shrink: 0; padding: 4px 10px; border-radius: 10px; background: var(--surface-container-high); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.visits span.bust { background: var(--error-container); color: var(--on-error-container); }
.visits span.hi { background: var(--tertiary-container); color: var(--on-tertiary-container); }

.input-panel { display: flex; flex-direction: column; gap: 10px; background: var(--surface-container-low); border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding: 16px 16px 16px; margin: 0 -16px; }
@media (min-width: 900px) { .input-panel { border-radius: var(--r-2xl); margin: 0; } }
.entry { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 8px 0 20px; border-radius: var(--r-xl); background: var(--surface-container-highest); }
.entry .value { flex: 1; font-size: 40px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.entry .value.placeholder { color: var(--on-surface-variant); opacity: 0.5; font-weight: 600; font-size: 22px; }
.entry .value.err { color: var(--error); animation: shake 300ms; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { height: clamp(52px, calc(8.2 * var(--vh)), 72px); border: 0; cursor: pointer; border-radius: var(--r-xl); background: var(--surface-container-highest); color: var(--on-surface); font-size: 28px; font-weight: 650; display: grid; place-items: center; user-select: none; transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx), transform 120ms; font-variant-numeric: tabular-nums; }
.key:active { border-radius: var(--r-m); background: var(--surface-dim); }
.key.ok { background: var(--primary); color: var(--on-primary); }
.key.ok:active { background: var(--primary); filter: brightness(1.1); }
.key.alt { background: var(--secondary-container); color: var(--on-secondary-container); }
.key.alt .msr { font-size: 28px; }
.quick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.quick button { height: 40px; border: 0; border-radius: var(--r-m); background: var(--tertiary-container); color: var(--on-tertiary-container); font-weight: 700; font-size: 15px; cursor: pointer; transition: border-radius var(--d-fast) var(--spring-fast); font-variant-numeric: tabular-nums; }
.quick button:active { border-radius: 20px; }

/* Dart-by-dart pad */
.dartpad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dartpad button { height: clamp(42px, calc(6.4 * var(--vh)), 56px); border: 0; border-radius: var(--r-l); background: var(--surface-container-highest); font-size: 20px; font-weight: 650; cursor: pointer; transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx); font-variant-numeric: tabular-nums; color: var(--on-surface); }
.dartpad button:active { border-radius: var(--r-s); }
.dartpad.m2 button.n { background: var(--secondary-container); color: var(--on-secondary-container); }
.dartpad.m3 button.n { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.dartpad button.closed { opacity: 0.35; }
.dartpad button:disabled { opacity: 0.38; cursor: default; }
.dartpad button.alt { background: var(--secondary-container); color: var(--on-secondary-container); }
.dartpad button.go { background: var(--primary); color: var(--on-primary); }
.input-panel.waiting > :not(.botmsg) { opacity: 0.35; pointer-events: none; transition: opacity var(--d-fx); }
.dartpad button.wide { grid-column: span 2; }
.dart-slots { display: flex; gap: 8px; }
.dart-slots .slot { flex: 1; height: 48px; border-radius: var(--r-l); background: var(--surface-container-highest); display: grid; place-items: center; font-weight: 750; font-size: 18px; color: var(--on-surface-variant); transition: all var(--d-fast) var(--spring-fast); }
.dart-slots .slot.filled { background: var(--primary-container); color: var(--on-primary-container); border-radius: var(--r-2xl); }
.dart-slots .slot.next { box-shadow: inset 0 0 0 2px var(--primary); }

/* Cricket board */
.cricket { display: grid; gap: 4px; align-content: start; }
.cricket .crow { display: grid; align-items: center; gap: 4px; }
.cricket .cell { height: 44px; display: grid; place-items: center; border-radius: var(--r-m); background: var(--surface-container); font-weight: 700; }
.cricket .cell.num { background: var(--secondary-container); color: var(--on-secondary-container); font-size: 18px; border-radius: var(--r-xl); }
.cricket .cell.num.dead { opacity: 0.4; text-decoration: line-through; }
.cricket .cell.activecol { background: var(--primary-container); color: var(--on-primary-container); }
.cricket .head { height: auto; padding: 10px 6px; flex-direction: column; display: flex; gap: 2px; align-items: center; border-radius: var(--r-l); text-align: center; min-width: 0; }
.cricket .head .pts { font-size: 32px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.cricket .head .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mark { width: 28px; height: 28px; }
.mark path, .mark circle { stroke: currentColor; stroke-width: 3; fill: none; stroke-linecap: round; }

/* Wavy progress */
.wavy { width: 100%; height: 16px; display: block; overflow: visible; }
.wavy .track { stroke: var(--secondary-container); stroke-width: 4; stroke-linecap: round; fill: none; }
.wavy .ind { stroke: var(--primary); stroke-width: 4; stroke-linecap: round; fill: none; }
.wavy .wave { animation: wave 1s linear infinite; }
@keyframes wave { to { transform: translateX(-24px); } }

/* Training big target */
.big-target { text-align: center; padding: 24px; border-radius: var(--r-2xl); background: var(--primary-container); color: var(--on-primary-container); position: relative; overflow: hidden; isolation: isolate; }
.big-target .v { font-size: clamp(80px, calc(22 * var(--vw)), 150px); line-height: 1; font-weight: 850; letter-spacing: -0.04em; font-stretch: 115%; font-variation-settings: "wdth" 120; font-variant-numeric: tabular-nums; }
.big-target .deco { position: absolute; width: 220px; height: 220px; left: 50%; top: 50%; margin: -110px; z-index: -1; color: var(--primary-fixed-dim); opacity: 0.45; animation: spin 20s linear infinite; }
.hit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Results & stats ---------- */
.winner { text-align: center; padding: 32px 16px; border-radius: var(--r-2xl); background: var(--tertiary-container); color: var(--on-tertiary-container); position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.winner .burst { position: absolute; width: 420px; height: 420px; left: 50%; top: 50%; margin: -210px; z-index: -1; color: var(--tertiary); opacity: 0.18; animation: spin 30s linear infinite; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall 2.4s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes fall { to { transform: translateY(calc(110 * var(--vh))) rotate(720deg); } }
table.stats { width: 100%; border-collapse: separate; border-spacing: 0 2px; font-variant-numeric: tabular-nums; }
table.stats th, table.stats td { padding: 10px 12px; text-align: right; background: var(--surface-container-low); }
table.stats th:first-child, table.stats td:first-child { text-align: left; border-radius: var(--r-m) 0 0 var(--r-m); color: var(--on-surface-variant); }
table.stats th:last-child, table.stats td:last-child { border-radius: 0 var(--r-m) var(--r-m) 0; }
table.stats thead th { background: transparent; font-size: 13px; color: var(--on-surface-variant); }
table.stats td.best { color: var(--primary); font-weight: 800; }
.table-wrap { overflow-x: auto; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { padding: 16px; border-radius: var(--r-xl); background: var(--surface-container); display: flex; flex-direction: column; gap: 2px; }
.tile .v { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .k { font-size: 13px; color: var(--on-surface-variant); font-weight: 500; }
.tile.hero-tile { background: var(--primary-container); color: var(--on-primary-container); grid-column: span 2; border-radius: var(--r-2xl); }
.tile.hero-tile .k { color: inherit; opacity: 0.8; }
.tile.hero-tile .v { font-size: 52px; }
.chart { width: 100%; height: 200px; display: block; }
.chart .grid-l { stroke: var(--outline-variant); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .ln { stroke: var(--primary); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: var(--primary); opacity: 0.12; }
.chart .dot { fill: var(--primary); stroke: var(--surface-container-low); stroke-width: 2; }
.chart text { fill: var(--on-surface-variant); font-size: 11px; font-family: var(--font); }
.empty { text-align: center; padding: 48px 16px; color: var(--on-surface-variant); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty svg { width: 120px; height: 120px; color: var(--secondary-container); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--tertiary-container); color: var(--on-tertiary-container); font-size: 12px; font-weight: 700; }
.badge.win { background: var(--primary); color: var(--on-primary); }

.screen-enter { animation: enter var(--d) var(--spring); }
@keyframes enter { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }

/* ---------- v1.0.1: profile, auth, roster ---------- */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.display-s { font-size: 36px; line-height: 44px; font-weight: 750; letter-spacing: -0.015em; }
.avatar.xxl { width: 136px; height: 136px; font-size: 52px; }
.avatar.photo svg path { fill: oklch(0.86 0.09 var(--ph)); }
.avatar.photo.spin svg { animation: none; }
.avatar.photo.spin { animation: pulse 1.6s var(--effects) infinite alternate; }
@keyframes pulse { to { transform: scale(1.07); } }
.profile-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px 20px; border-radius: var(--r-2xl); background: var(--primary-container); color: var(--on-primary-container); text-align: center; }
.avatar-edit { position: relative; }
.avatar-edit .cam { position: absolute; right: -4px; bottom: -4px; --bh: 52px; box-shadow: 0 0 0 4px var(--primary-container); }
.name-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; color: inherit; padding: 4px 12px; border-radius: var(--r-l); max-width: 100%; }
.name-btn:hover { background: color-mix(in oklch, currentColor 8%, transparent); }
.name-btn .display-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-hero .badge { gap: 4px; height: 26px; padding: 0 10px; }
.tf-wrap { position: relative; display: flex; align-items: center; }
.tf-wrap .textfield { flex: 1; }
.tf-icon { position: absolute; left: 14px; color: var(--on-surface-variant); pointer-events: none; }
.textfield.with-icon { padding-left: 48px; }
.tf-eye { position: absolute; right: 6px; }
.textfield.err { box-shadow: inset 0 -3px 0 var(--error); }
.err-text { color: var(--error); }
.err-box { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r-l); background: var(--error-container); color: var(--on-error-container); font-size: 14px; }

.roster { display: flex; flex-direction: column; gap: 6px; }
.roster-row { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px; border-radius: var(--r-xl); background: var(--surface-container-highest); min-height: 84px; animation: enter var(--d) var(--spring); }
.roster-row:first-child { border-radius: var(--r-xl) var(--r-xl) var(--r-s) var(--r-s); }
.roster-row:last-child { border-radius: var(--r-s) var(--r-s) var(--r-xl) var(--r-xl); }
.roster-row:only-child { border-radius: var(--r-xl); }
.roster-row .order { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 14px; }
.roster-row .kind { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--on-surface-variant); }
.roster-row .slider { height: 32px; }
.col-btns { display: flex; flex-direction: column; }
.col-btns .icon-btn { --bh: 32px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(46 * var(--vh)); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.pick-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; cursor: pointer; padding: 10px 12px; min-height: 76px; border-radius: var(--r-l); background: var(--surface-container-highest); color: var(--on-surface); transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx); }
.pick-row:active { border-radius: var(--r-2xl); }
.pick-row.on { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: var(--r-2xl); }
.pick-row .pick-check { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-container); flex-shrink: 0; transition: all var(--d-fast) var(--spring-fast); }
.pick-row.on .pick-check { background: var(--primary); color: var(--on-primary); transform: rotate(360deg); }
.pick-row.add { background: transparent; box-shadow: inset 0 0 0 1px var(--outline-variant); }
.pick-row.add .avatar { color: var(--on-secondary-container); background: var(--secondary-container); border-radius: var(--r-l); }
.pick-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px 12px; color: var(--on-surface-variant); font-size: 14px; }
/* ---------- v1.0.2: teams, practice, install ---------- */
.team-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.team-members .tm { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 16px; font-size: 13px; max-width: 100%; opacity: 0.65; transition: all var(--d-fast) var(--spring-fast); }
.team-members .tm .avatar { width: 26px; height: 26px; font-size: 11px; }
.team-members .tm.on { opacity: 1; background: var(--primary); color: var(--on-primary); font-weight: 700; }
.team-chip { width: 34px; height: 34px; flex-shrink: 0; border: 0; cursor: pointer; border-radius: 12px; font-weight: 800; font-size: 15px; transition: border-radius var(--d-fast) var(--spring-fast), transform var(--d-fast) var(--spring-fast); }
.team-chip:active { border-radius: 50%; transform: scale(0.9); }
.team-chip.k0 { background: var(--primary); color: var(--on-primary); }
.team-chip.k1 { background: var(--tertiary); color: var(--on-tertiary); }
.team-chip.k2 { background: var(--secondary); color: var(--on-secondary); }
.team-chip.k3 { background: var(--error); color: var(--on-error); }
.cricket.compact .cell { height: 30px; border-radius: var(--r-s); font-size: 14px; }
.cricket.compact .cell.num { font-size: 14px; border-radius: var(--r-l); }
.cricket.compact .mark { width: 20px; height: 20px; }
.cricket.compact .head { height: auto; }
.mode-card.small { min-height: 132px; padding: 16px; }
.mode-card.small .title-l { font-size: 18px; line-height: 24px; }
.mode-card.small .shape { width: 44px; height: 44px; }
.grid.practice { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.install-card { border-radius: var(--r-2xl); flex-wrap: wrap; }.cricket.compact { max-height: max(220px, calc(calc(100 * var(--vh)) - 470px)); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.cricket.compact > .crow:first-child { position: sticky; top: 0; z-index: 1; background: var(--surface); padding-bottom: 4px; }
@media (min-width: 900px) and (min-height: 600px) { .cricket.compact { max-height: calc(calc(100 * var(--vh)) - 90px); } }
.cricket .cell.num.next { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 3px var(--primary-container); }

.bed-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bed-choice .key { height: auto; min-height: 120px; display: flex; flex-direction: column; gap: 6px; padding: 14px 10px; font-size: 14px; font-weight: 600; text-align: center; }
.bed-choice .key .big { font-size: 40px; font-weight: 850; line-height: 1; }
.dartpad button.bedonly { opacity: 0.6; }

/* ---------- v1.0.3: home, social, chat ---------- */
.hero-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .hero-row { grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); } }
.hero { background: radial-gradient(120% 140% at 100% 0%, var(--primary-fixed-dim) 0%, transparent 55%), linear-gradient(135deg, var(--primary-container), color-mix(in oklch, var(--primary-container) 70%, var(--tertiary-container))); }
.hero::after { content: ""; position: absolute; left: -60px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%; background: var(--tertiary); opacity: 0.12; z-index: -1; }
.welcome { position: relative; overflow: hidden; border-radius: var(--r-2xl); padding: 18px; background: var(--surface-container); display: flex; flex-direction: column; gap: 14px; isolation: isolate; }
.welcome::before { content: ""; position: absolute; right: -50px; top: -50px; width: 150px; height: 150px; border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; background: var(--secondary-container); z-index: -1; animation: spin 24s linear infinite; }
.welcome-head { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 0; text-align: left; color: inherit; cursor: pointer; }
.welcome-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.welcome-stats > div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: var(--r-l); background: var(--surface-container-high); }
.welcome-stats .v { font-size: 22px; font-weight: 800; line-height: 1.1; }
.welcome-stats .k { font-size: 12px; color: var(--on-surface-variant); font-weight: 600; }
.spark { width: 100%; height: 34px; }
.spark polyline { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--primary); }
.welcome-friends, .welcome-cta { display: flex; align-items: center; gap: 10px; border: 0; cursor: pointer; border-radius: var(--r-l); padding: 8px 12px; background: var(--secondary-container); color: var(--on-secondary-container); font: inherit; font-weight: 600; font-size: 14px; transition: border-radius var(--d-fast) var(--spring-fast); }
.welcome-friends:active, .welcome-cta:active { border-radius: var(--r-2xl); }
.stackav { display: flex; }
.stackav .avatar { width: 30px; height: 30px; font-size: 12px; margin-right: -8px; }
.welcome-friends .body-s { margin-left: 10px; }
.badge-btn { position: relative; }
.dot-badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--error); color: var(--on-error); font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--surface); animation: pop var(--d) var(--spring-fast); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 800; }
.section-title { display: flex; align-items: center; gap: 8px; }
.mode-card { background: color-mix(in oklch, var(--c-bg) 45%, var(--surface-container)); }
.mode-card:hover { background: color-mix(in oklch, var(--c-bg) 70%, var(--surface-container)); }
.list-item .strong { font-weight: 800; color: var(--on-surface); }
.conv .meta.ellipsis { max-width: 80%; }
.h2h { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.h2h .side { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.h2h .score { font-size: 44px; font-weight: 850; letter-spacing: -0.03em; }
/* chat */
.chat { display: flex; flex-direction: column; height: calc(100 * var(--vh)); max-width: 760px; margin: 0 auto; }
.chat-top { position: sticky; top: 0; }
.chat-peer { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px 8px; border-radius: var(--r-l); min-width: 0; }
.chat-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 8px 4px 16px; }
.chat-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); background: var(--surface-container); padding: 4px 12px; border-radius: 12px; margin: 10px 0 6px; }
.bubble { align-self: flex-start; max-width: 78%; padding: 10px 14px 6px; border-radius: 20px 20px 20px 6px; background: var(--surface-container-high); display: flex; flex-direction: column; gap: 2px; white-space: pre-wrap; word-break: break-word; animation: enter var(--d-fast) var(--spring); }
.bubble.mine { align-self: flex-end; border-radius: 20px 20px 6px 20px; background: var(--primary); color: var(--on-primary); }
.bubble .time { align-self: flex-end; font-size: 11px; opacity: 0.7; display: inline-flex; align-items: center; gap: 2px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--surface); }
.chat-input textarea { resize: none; height: auto; min-height: 56px; max-height: 140px; padding-top: 16px; border-radius: 28px; }
/* =====================================================================
   v1.0.4 — responsive game layout
   One full-height screen on every device: portrait = scores on top and the
   input filling the bottom; landscape = scores left, input right.
   ===================================================================== */
.shell.fullscreen .main { padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
.game { height: calc(100 * var(--vh)); min-height: 0; max-width: 1680px; overflow: hidden; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.game-top { flex: none; min-height: 52px; }
.game-top .info { min-width: 0; }
.game-top .info .title-m, .game-top .info .body-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-body { flex: 1 1 auto; min-height: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; align-items: stretch; padding-bottom: 0; }
.game-body .input-panel { align-self: stretch; }

/* --- score cards (X01): fill their area, numbers scale with the card --- */
.players, .players.many { min-height: 0; height: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); align-content: stretch; gap: 8px; overflow: hidden; }
.players:has(> .pcard:only-child) { grid-template-columns: minmax(0, 1fr); }
.players > .pcard { container-type: size; min-height: 0; padding: 10px 14px; gap: 4px; }
.players > .pcard .rem, .players.many > .pcard .rem { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; font-size: clamp(28px, min(30cqw, 42cqh), 210px); line-height: 0.9; }
.players > .pcard .sub { font-size: clamp(11px, 3.4cqw, 15px); gap: 4px 10px; }
.players > .pcard .hint b { font-size: clamp(11px, 3.4cqw, 16px); padding: 3px 9px; }
@container (max-height: 175px) { .pcard .visits { display: none; } }
@container (max-height: 135px) { .pcard .sub span:nth-child(n+2) { display: none; } .pcard .pname .avatar { width: 30px; height: 30px; font-size: 13px; } }
@container (max-height: 100px) { .pcard .sub { display: none; } }
@container (max-width: 180px) { .pcard .pname .title-m { font-size: 14px; } .pcard .legs .pip { min-width: 24px; height: 22px; padding: 0 6px; font-size: 12px; } .pcard .pname { gap: 6px; } }

/* --- input panel --- */
.input-panel, .game-body .input-panel { margin: 0; border-radius: var(--r-2xl); padding: 10px; gap: 8px; min-height: 0; display: flex; flex-direction: column; }
.entry { flex: none; min-height: clamp(44px, calc(7 * var(--vh)), 64px); }
.entry .value { font-size: clamp(26px, calc(5 * var(--vh)), 40px); }
.entry .value.placeholder { font-size: clamp(16px, calc(2.6 * var(--vh)), 22px); }
.quick { flex: none; }
.quick button { height: clamp(30px, calc(5 * var(--vh)), 44px); font-size: clamp(12px, calc(1.9 * var(--vh)), 15px); }
.input-panel .keypad:not(.row1), .input-panel .dartpad { flex: none; height: clamp(196px, calc(42 * var(--vh)), 470px); grid-auto-rows: minmax(0, 1fr); }
.input-panel .dartpad.cols4 { height: clamp(150px, calc(30 * var(--vh)), 330px); }
.key, .dartpad button { height: auto; min-height: 0; }
.key { font-size: clamp(20px, calc(3.6 * var(--vh)), 34px); }
.dartpad button { font-size: clamp(15px, calc(2.6 * var(--vh)), 22px); }
.keypad.row1 { flex: none; height: clamp(64px, calc(13 * var(--vh)), 128px); grid-auto-rows: minmax(0, 1fr); }
.keypad.cols4, .dartpad.cols4 { grid-template-columns: repeat(4, 1fr); }
.hit-row { flex: none; height: clamp(72px, calc(16 * var(--vh)), 150px); }
.hit-row .key { height: 100%; }
.key.big { font-size: clamp(22px, calc(4.6 * var(--vh)), 42px); }
.key.slim { flex: none; height: clamp(40px, calc(6 * var(--vh)), 52px); }
.dart-slots { flex: none; }
.dart-slots .slot { height: clamp(34px, calc(5.5 * var(--vh)), 48px); font-size: clamp(14px, calc(2.2 * var(--vh)), 18px); }
.input-panel .bgroup { flex: none; }
.input-panel .bgroup .seg { --bh: clamp(34px, calc(5 * var(--vh)), 44px); }
.input-panel > .label-l { flex: none; }

/* --- training: target area scrolls, big target grows on tall screens --- */
.train-side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.train-side .big-target { flex: 1 0 auto; min-height: 140px; display: flex; flex-direction: column; justify-content: center; padding: clamp(14px, calc(3 * var(--vh)), 28px); }
.big-target .v { font-size: clamp(56px, min(calc(22 * var(--vw)), calc(15 * var(--vh))), 180px); }

/* --- cricket board fills its area --- */
.cricket, .cricket.compact { min-height: 0; height: 100%; max-height: none; overflow-y: auto; overscroll-behavior: contain; grid-template-rows: auto; grid-auto-rows: minmax(26px, 1fr); align-content: stretch; }
.cricket .cell, .cricket.compact .cell { height: 100%; min-height: 26px; }
.cricket .head, .cricket.compact .head { height: auto; }
.cricket .mark { height: min(30px, 72%); width: auto; aspect-ratio: 1; }
.cricket > .crow:first-child { position: sticky; top: 0; z-index: 1; background: var(--surface); padding-bottom: 2px; }
.cricket .head .pts { font-size: clamp(20px, calc(3.6 * var(--vh)), 34px); }

/* --- landscape: scores left, input right --- */
@media (orientation: landscape) and (min-width: 560px) {
  .game-body { grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.85fr); grid-template-rows: minmax(0, 1fr); }
  .game-body .input-panel { height: 100%; justify-content: center; }
  .input-panel .keypad:not(.row1), .input-panel .dartpad, .input-panel .dartpad.cols4 { flex: 1 1 auto; height: auto; max-height: 640px; }
  .keypad.row1, .hit-row { flex: 1 1 auto; height: auto; max-height: 260px; }
  .players { grid-auto-flow: row; }
}
@media (orientation: landscape) and (min-width: 1200px) {
  .game-body { grid-template-columns: minmax(0, 1fr) minmax(380px, 540px); gap: 16px; padding-bottom: 8px; }
  .game-body .input-panel { padding: 16px; gap: 10px; }
}
/* phones held sideways: everything tighter so the whole keypad fits */
@media (orientation: landscape) and (max-height: 520px) {
  .game-top { min-height: 40px; }
  .game-top .btn.icon-btn { --bh: 36px; }
  .game-body { gap: 8px; }
  .game-body .input-panel { padding: 6px; gap: 5px; border-radius: var(--r-xl); }
  .entry { min-height: 38px; padding-left: 14px; }
  .entry .value { font-size: 22px; }
  .entry .value.placeholder { font-size: 15px; }
  .quick { gap: 4px; }
  .quick button { height: 28px; font-size: 12px; }
  .keypad { gap: 5px; }
  .key { font-size: 20px; border-radius: var(--r-l); }
  .dartpad { gap: 4px; }
  .dartpad button { font-size: 14px; border-radius: var(--r-m); }
  .dart-slots .slot { height: 30px; font-size: 13px; }
  .input-panel .bgroup .seg { --bh: 30px; font-size: 12px; }
  .players > .pcard { padding: 8px 12px; }
  .cricket .head { padding: 3px; gap: 0; }
  .cricket .head .avatar { width: 26px; height: 26px; font-size: 11px; }
  .train-side .big-target { min-height: 100px; }
  .big-target .v { font-size: clamp(44px, calc(18 * var(--vh)), 90px); }
}
/* very short portrait screens (small phones) */
@media (orientation: portrait) and (max-height: 640px) {
  .game-top { min-height: 44px; }
  .game-body { gap: 6px; }
  .game-body .input-panel { padding: 8px; gap: 6px; }
}
/* bigger numbers, and secondary text that grows with the card */
.players > .pcard .rem, .players.many > .pcard .rem { font-size: clamp(30px, min(44cqw, 50cqh), 240px); }
.players > .pcard .sub { font-size: clamp(11px, 3.6cqw, 19px); }
.players > .pcard .hint b { font-size: clamp(11px, 4cqw, 24px); padding: 0.25em 0.75em; border-radius: 0.8em; }
.players > .pcard .visits span { font-size: clamp(12px, 3.6cqw, 18px); }
.players > .pcard .pname .title-m { font-size: clamp(14px, 4.4cqw, 24px); line-height: 1.2; }
@container (min-width: 300px) and (min-height: 260px) { .pcard .pname .avatar { width: 56px; height: 56px; font-size: 22px; } .pcard .legs .pip { min-width: 38px; height: 32px; font-size: 16px; border-radius: 16px; } }
.key.ok .label-l { font-size: clamp(13px, calc(2.2 * var(--vh)), 20px); }
@media (min-width: 768px) and (min-height: 700px) {
  .game-top { min-height: 60px; }
  .game-top .info .title-m { font-size: 19px; }
  .game-top .info .body-s { font-size: 14px; }
  .game-top .btn.icon-btn { --bh: 48px; }
  .game-top .btn.icon-btn .msr { font-size: 28px; }
}
.players > .pcard .pname .title-m { font-size: clamp(14px, 5cqw, 26px); }
.players > .pcard .sub { font-size: clamp(11px, 4cqw, 20px); }
.players > .pcard .hint b { font-size: clamp(11px, 4.6cqw, 26px); }
.dartpad.cols4 button.wide.go { grid-column: span 3; }
@media (orientation: portrait) and (max-height: 780px) {
  .cricket .head { padding: 4px 4px 6px; gap: 0; }
  .cricket .head .avatar { width: 26px; height: 26px; font-size: 11px; }
  .cricket .head .nm { font-size: 11px; }
  .cricket .head .pts { font-size: 20px; }
  .cricket, .cricket.compact { grid-auto-rows: minmax(24px, 1fr); }
  .cricket .cell, .cricket.compact .cell { min-height: 24px; }
  .cricket ~ .input-panel .dartpad:not(.cols4) { height: clamp(170px, calc(34 * var(--vh)), 420px); }
}
.players > .pcard .team-members .tm { font-size: clamp(11px, 3.8cqw, 18px); }
.players > .pcard .team-members .tm .avatar { width: clamp(22px, 7cqw, 40px); height: clamp(22px, 7cqw, 40px); font-size: clamp(10px, 3cqw, 16px); }
.players > .pcard .label-l { font-size: clamp(12px, 3.8cqw, 18px); }
.train-side .big-target .deco { --ds: clamp(200px, calc(42 * var(--vh)), 560px); width: var(--ds); height: var(--ds); margin: calc(var(--ds) / -2); }
.input-panel > .key { flex: none; height: clamp(50px, calc(9 * var(--vh)), 92px); }
@media (orientation: landscape) and (max-height: 520px) { .input-panel > .key { height: 40px; } }

/* ===== v1.0.4 — responsive app screens ===== */
/* setup: docked start bar with its own background instead of a floating button over the options */
.start-bar { position: sticky; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 4; margin: 0 -16px; padding: 18px 16px 12px; background: linear-gradient(to bottom, transparent, var(--surface) 34%); pointer-events: auto; }
.start-bar .btn, .start-bar .btn.l { --bh: 64px; width: min(100%, 420px); font-size: 20px; box-shadow: var(--shadow-3); }
@media (min-width: 840px) { .start-bar { bottom: 0; margin: 0; padding-bottom: 20px; } .start-bar .btn, .start-bar .btn.l { --bh: 72px; width: auto; min-width: 280px; } }
@media (max-width: 420px) { .setup-grid .grid.cols-2 { grid-template-columns: 1fr; } }
.setup-grid .bgroup .seg { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* home: compact hero on phones, game cards two per row on phones and stretched on tablets */
@media (max-width: 599px) {
  .hero { min-height: 0; padding: 22px; gap: 12px; }
  .hero h1 { font-size: clamp(34px, calc(11 * var(--vw)), 52px); }
  .hero .btn.m { --bh: 48px; padding: 0 18px; font-size: 15px; }
  .hero .row { gap: 8px; }
  .hero .deco { width: 190px; height: 190px; }
}
.grid.auto.games { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
@media (max-width: 599px) {
  .grid.auto.games, .grid.practice { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mode-card { min-height: 0; padding: 14px; gap: 6px; }
  .mode-card .title-l { font-size: 17px; line-height: 22px; }
  .mode-card .desc { font-size: 12.5px; line-height: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .mode-card .shape { width: 40px; height: 40px; }
  .mode-card .go { right: 10px; top: 10px; }
}
@media (max-width: 359px) { .mode-card .desc { display: none; } }
/* wide screens: give the main column more room */
@media (min-width: 1400px) { .main { max-width: 1320px; } }
@media (max-width: 374px) { .hero .btn.m { --bh: 44px; padding: 0 14px; font-size: 14px; } .hero .btn.m .msr { display: none; } .welcome .spark { display: none; } }
.install-card .grow { min-width: min(100%, 190px); }
@media (max-width: 420px) { .install-card > .btn { width: 100%; } }
/* phones held sideways: navigation rail on the left instead of a tall bottom bar */
@media (orientation: landscape) and (max-height: 520px) and (min-width: 560px) and (max-width: 839px) {
  .navbar { inset: 0 auto 0 0; width: 76px; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 0; background: var(--surface-container); }
  .navbar .nav-item { flex: 0; }
  .navbar .nav-item .pill { width: 48px; height: 28px; }
  .navbar .nav-item .label-m { font-size: 10px; }
  .shell:not(.fullscreen) .main { padding-left: 92px; padding-right: 16px; padding-bottom: 24px; }
  .start-bar { bottom: 0; margin: 0; padding-bottom: 10px; }
  .start-bar .btn, .start-bar .btn.l { --bh: 56px; }
  .snackbar { bottom: 16px; }
}
@media (max-height: 520px) {
  .start-bar { padding-top: 10px; padding-bottom: 8px; }
  .start-bar .btn, .start-bar .btn.l { --bh: 46px; font-size: 17px; min-width: 200px; }
  .start-bar .btn .msr { font-size: 24px; }
}

/* v1.0.4b — touch-friendly sliders: whole track is the touch target, bigger handle */
.slider { height: 48px; touch-action: pan-y; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.slider::-webkit-slider-runnable-track { height: 18px; border-radius: 9px; }
.slider::-webkit-slider-thumb { width: 10px; height: 40px; margin-top: -11px; border-radius: 5px; box-shadow: 0 0 0 5px var(--surface); }
.slider::-moz-range-track { height: 18px; border-radius: 9px; }
.slider::-moz-range-progress { height: 18px; border-radius: 9px; }
.slider::-moz-range-thumb { width: 10px; height: 40px; border-radius: 5px; }
.slider:active::-webkit-slider-thumb { width: 6px; }
@media (max-width: 599px) { .hero .btn.m { padding: 0 16px; } }
@media (max-width: 400px) { .hero .btn.m { padding: 0 13px; font-size: 14px; } .hero .row { gap: 6px; } }

/* ===== v1.0.5 ===== */
/* iOS: visible press feedback on every game key (iOS only fires :active with a touch listener, added in main.js) */
.key, .dartpad button, .quick button, .bed-choice .key { transition: transform 90ms ease-out, border-radius var(--d-fast) var(--spring-fast), background var(--d-fx), filter 90ms; }
.key:active, .dartpad button:active:not(:disabled), .quick button:active:not(:disabled) { transform: scale(0.93); filter: brightness(0.92); }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* game screens: the page itself never scrolls, bounces or pinches */
html.locked, html.locked body { overflow: hidden; overscroll-behavior: none; height: 100%; }
html.locked body { position: fixed; inset: 0; width: 100%; }
html.locked .game { touch-action: pan-x pan-y; }
.game, .game * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* --- Cricket board --- */
.cricket { --numcol: clamp(58px, calc(15 * var(--vw)), 92px); }
.cricket .cell.num { font-size: clamp(20px, min(calc(5.4 * var(--vw)), calc(3.6 * var(--vh))), 32px); font-weight: 850; letter-spacing: -0.02em; background: var(--inverse-surface, #2f2f36); color: var(--inverse-on-surface, #f2f0f7); font-variant-numeric: tabular-nums; }
.cricket .cell.num.txt { font-size: clamp(13px, min(calc(3.6 * var(--vw)), calc(2.4 * var(--vh))), 20px); }
.cricket.compact .cell.num { font-size: clamp(16px, min(calc(4.4 * var(--vw)), calc(2.8 * var(--vh))), 26px); }
.cricket.compact .cell.num.txt { font-size: clamp(12px, min(calc(3 * var(--vw)), calc(2 * var(--vh))), 18px); }
.cricket .cell.closed:not(.activecol) { background: color-mix(in oklch, var(--surface-container) 70%, var(--primary) 12%); }
.cricket .crow { position: relative; }
.cricket .crow.dead > .cell { opacity: 0.38; filter: saturate(0.3); }
.cricket .crow.dead > .cell.num { opacity: 0.5; text-decoration: none; }
.cricket .crow.dead::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--on-surface); opacity: 0.75; pointer-events: none; }
.cricket .crow.dead.headrow::after { display: none; }
.cricket .cell.corner { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; background: var(--surface-container-high); color: var(--on-surface-variant); border-radius: var(--r-l); font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; padding: 4px 2px; }
.cricket .cell.corner b { font-size: clamp(22px, calc(3.6 * var(--vh)), 34px); font-weight: 850; color: var(--on-surface); line-height: 1; font-variant-numeric: tabular-nums; }
.cricket .cell.corner.bo { background: var(--tertiary-container); color: var(--on-tertiary-container); font-size: 12px; }
.cricket .head .legs-won { font-size: 12px; font-weight: 600; opacity: 0.85; white-space: nowrap; }
.cricket .head .legs-won b { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; margin-left: 2px; border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 13px; }
.cricket .head .pts.bo { font-size: clamp(14px, calc(2.4 * var(--vh)), 20px); }
/* Bull / Red Bull keys: same look whatever Single/Double/Triple is selected */
.dartpad button.b { background: color-mix(in oklch, var(--surface-container-highest) 75%, #2e9e5b 25%); color: var(--on-surface); font-size: clamp(14px, calc(2.3 * var(--vh)), 20px); }
.dartpad button.b.red { background: #c62f3a; color: #fff; }
.dartpad button.go.miss { background: var(--secondary-container); color: var(--on-secondary-container); }
.dartpad button.go { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bulloff-head { text-align: center; padding: 6px 4px 2px; }
.input-panel .dartpad.bulloff-pad { grid-template-columns: repeat(3, 1fr); height: clamp(110px, calc(20 * var(--vh)), 220px); }
.dartpad.bulloff-pad button { font-size: clamp(18px, calc(3 * var(--vh)), 28px); }
@media (orientation: portrait) and (max-height: 780px) {
  .cricket .head .legs-won { font-size: 10px; }
  .cricket .head .legs-won b { min-width: 20px; height: 18px; font-size: 11px; }
  .cricket .cell.corner b { font-size: 20px; }
}

/* --- X01: bigger names, teams and checkout routes; bigger quick scores --- */
.players > .pcard .pname .title-m { font-size: clamp(16px, 6.4cqw, 34px); font-weight: 700; }
.players > .pcard .pname .avatar { width: clamp(32px, 11cqw, 64px); height: clamp(32px, 11cqw, 64px); font-size: clamp(13px, 4.4cqw, 26px); }
.players > .pcard .label-l { font-size: clamp(14px, 5.4cqw, 26px); font-weight: 700; }
.players > .pcard .team-members .tm { font-size: clamp(13px, 4.8cqw, 22px); }
.players > .pcard .team-members .tm .avatar { width: clamp(26px, 9cqw, 48px); height: clamp(26px, 9cqw, 48px); font-size: clamp(11px, 3.6cqw, 18px); }
.players > .pcard .legs .pip { min-width: clamp(28px, 9cqw, 48px); height: clamp(24px, 7.4cqw, 40px); font-size: clamp(13px, 4.4cqw, 22px); border-radius: 999px; }
.players > .pcard .hint { gap: clamp(4px, 1.6cqw, 10px); }
.players > .pcard .hint b { font-size: clamp(16px, 7.4cqw, 40px); padding: 0.18em 0.6em; border-radius: 0.6em; font-weight: 800; }
@container (max-height: 135px) { .players > .pcard .hint b { font-size: clamp(14px, 6cqw, 22px); } }
.quick { gap: 6px; }
.quick button, .input-panel .quick button { height: clamp(42px, calc(6.6 * var(--vh)), 64px); font-size: clamp(16px, calc(2.6 * var(--vh)), 22px); font-weight: 800; border-radius: var(--r-l); }
.quick button:disabled { opacity: 0.35; cursor: default; }
@media (orientation: landscape) and (max-height: 520px) { .quick button, .input-panel .quick button { height: 34px; font-size: 14px; } }
.players > .pcard .pname .title-m { font-size: clamp(18px, 7cqw, 34px); }
.players > .pcard .label-l { font-size: clamp(16px, 6cqw, 26px); }
.players > .pcard .team-members { gap: 4px 6px; }
.players > .pcard .team-members .tm { font-size: clamp(15px, 5.6cqw, 22px); padding: 2px 10px 2px 2px; border-radius: 999px; }
.players > .pcard .team-members .tm .avatar { width: clamp(28px, 9cqw, 48px); height: clamp(28px, 9cqw, 48px); }
.players > .pcard .hint b { font-size: clamp(18px, 8.4cqw, 40px); }
.players > .pcard .sub { font-size: clamp(12px, 4.6cqw, 20px); }
@media (orientation: portrait) { .input-panel .keypad:not(.row1) { height: clamp(196px, calc(38 * var(--vh)), 470px); } }
/* long boards (Fullboard / Tactics) in portrait: slimmer header and keypad so more rows stay visible */
@media (orientation: portrait) {
  .cricket.compact .head { padding: 4px 3px; gap: 0; }
  .cricket.compact .head .avatar { width: 24px; height: 24px; font-size: 10px; }
  .cricket.compact .head .nm { font-size: 11px; }
  .cricket.compact .head .pts { font-size: clamp(18px, calc(2.6 * var(--vh)), 28px); }
  .cricket.compact .cell.corner b { font-size: 20px; }
  .cricket.compact ~ .input-panel .dartpad:not(.cols4) { height: clamp(165px, calc(31 * var(--vh)), 400px); }
  .cricket.compact ~ .input-panel { gap: 6px; padding: 8px; }
}
.dartpad button.b { line-height: 1.05; padding: 0 2px; overflow: hidden; }

/* ===== v1.0.5b — Cricket: who is throwing ===== */
.cricket .head { position: relative; transition: background var(--d-fx), box-shadow var(--d) var(--spring); }
.cricket .head.activecol { box-shadow: inset 0 0 0 2px var(--primary); }
.cricket .head .turn-dot { position: absolute; right: 8px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 50% { transform: scale(0.6); opacity: 0.6; } }
.cricket .head .thrower { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; line-height: 1.3; }
.cricket .head .thrower .msr { font-size: 14px; }
.cricket .head .tav { display: inline-grid; border-radius: 50%; opacity: 0.55; transition: opacity var(--d-fast), transform var(--d) var(--spring); }
.cricket .head .tav.on { opacity: 1; transform: scale(1.12); box-shadow: 0 0 0 2px var(--primary); }
@media (orientation: portrait) and (max-height: 780px) { .cricket .head .thrower { font-size: 10px; padding: 1px 6px 1px 4px; } }

/* ===== v1.0.5c — X01 bull-off ===== */
.players > .pcard .bo-throw { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 12px 4px 8px; border-radius: 999px; background: var(--tertiary-container); color: var(--on-tertiary-container); font-size: clamp(13px, 4.6cqw, 20px); font-weight: 600; }
.players > .pcard .bo-throw b { font-weight: 850; }

/* ===== v1.0.6 — team slots ===== */
.team-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.team-col { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: var(--r-xl); background: var(--surface-container-highest); min-width: 0; border-top: 4px solid var(--tc, var(--primary)); }
.team-col.k0 { --tc: oklch(0.65 0.15 250); } .team-col.k1 { --tc: oklch(0.65 0.17 25); } .team-col.k2 { --tc: oklch(0.68 0.15 145); } .team-col.k3 { --tc: oklch(0.75 0.14 85); }
.team-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.team-head .team-chip { width: 28px; height: 28px; display: grid; place-items: center; cursor: default; }
.team-slot { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px 4px; border-radius: var(--r-l); background: var(--surface-container); animation: enter var(--d) var(--spring); min-width: 0; }
.team-slot:first-of-type { box-shadow: inset 0 0 0 2px var(--tc); }
.team-slot .ts-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-slot .kind { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--on-surface-variant); }
.team-slot .ts-btns { display: flex; justify-content: space-between; }
.team-slot .ts-btns .btn.icon-btn { --bh: 36px; }
.team-slot .slider { height: 30px; }
.team-empty { padding: 16px 8px; text-align: center; font-size: 13px; color: var(--on-surface-variant); border: 2px dashed var(--outline-variant); border-radius: var(--r-l); }
@media (min-width: 1000px) { .team-board.n3, .team-board.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===== v1.0.6 — who starts ===== */
.start-opts { display: flex; flex-direction: column; gap: 8px; }
.start-opt { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border: 0; cursor: pointer; border-radius: var(--r-xl); background: var(--secondary-container); color: var(--on-secondary-container); transition: border-radius var(--d-fast) var(--spring-fast), transform 90ms; }
.start-opt:active { border-radius: var(--r-m); transform: scale(0.98); }
.start-opt .ico { width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.start-opt b { display: block; font-size: 17px; }
.start-opt small { display: block; font-size: 13px; opacity: 0.8; }
.start-opt.quiet { background: var(--surface-container-highest); color: var(--on-surface); }
.start-opt.quiet .ico { background: var(--surface-container); color: var(--on-surface); }
/* coin */
.coin-stage { position: relative; height: 230px; display: grid; place-items: center; perspective: 900px; }
.coin { position: relative; width: 180px; height: 180px; transform-style: preserve-3d; transition: transform 2.2s cubic-bezier(0.2, 0.75, 0.25, 1); }
.coin.flying { animation: coin-up 2.2s cubic-bezier(0.3, 0.6, 0.4, 1); }
@keyframes coin-up { 0% { translate: 0 0; } 45% { translate: 0 -70px; } 100% { translate: 0 0; } }
.coin-face { position: absolute; inset: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #e5bd4f 45%, #b8862a 100%); box-shadow: inset 0 0 0 7px #c99a34, inset 0 0 0 10px #f3d47a, 0 6px 18px rgb(0 0 0 / 0.35); color: #4a3510; }
.coin-face.back { transform: rotateY(180deg); background: radial-gradient(circle at 35% 30%, #f4f4f6, #b9bcc6 45%, #868a96 100%); box-shadow: inset 0 0 0 7px #9a9eaa, inset 0 0 0 10px #e1e3ea, 0 6px 18px rgb(0 0 0 / 0.35); color: #2b2e36; }
.coin-face .avatar.xl { width: 104px; height: 104px; }
.coin-name { font-weight: 800; font-size: 15px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin-shadow { position: absolute; bottom: 8px; width: 120px; height: 14px; border-radius: 50%; background: rgb(0 0 0 / 0.25); filter: blur(4px); }
.coin-shadow.flying { animation: coin-shadow 2.2s cubic-bezier(0.3, 0.6, 0.4, 1); }
@keyframes coin-shadow { 45% { transform: scale(0.6); opacity: 0.5; } }
.coin-result { text-align: center; min-height: 1.5em; font-weight: 800; }
/* bull-off board */
.bull-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bull-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 0; cursor: pointer; border-radius: var(--r-xl); background: var(--surface-container-highest); color: var(--on-surface); min-width: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: all var(--d-fast) var(--spring-fast); }
.bull-chip:nth-child(2) { }
.bull-chip.on { background: var(--primary-container); color: var(--on-primary-container); box-shadow: inset 0 0 0 2px var(--primary); }
.bull-chip.win { background: var(--primary); color: var(--on-primary); }
.bull-chip .bc-text { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; line-height: 1.2; }
.bull-chip .bc-name { font-weight: 800; font-size: 15px; max-width: 100%; }
.bull-chip .bc-side { font-size: 12px; opacity: 0.75; max-width: 100%; }
.bull-chip .bc-dist { font-size: 18px; font-weight: 850; font-variant-numeric: tabular-nums; }
.bull-pick { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: var(--r-l); background: var(--surface-container); }
.bull-board { width: min(100%, 360px); aspect-ratio: 1; align-self: center; border-radius: 50%; cursor: crosshair; touch-action: none; box-shadow: 0 0 0 4px var(--surface-container-highest); }
.bull-dart .halo { fill: oklch(0.85 0.14 var(--ph) / 0.45); stroke: #fff; stroke-width: 0.8; }
.bull-dart .tip { fill: oklch(0.7 0.2 var(--ph)); stroke: #fff; stroke-width: 1; }
.bull-dart text { font-size: 9px; font-weight: 800; fill: #fff; paint-order: stroke; stroke: #000; stroke-width: 2.4px; }

/* ===== v1.0.7 — choose the game first ===== */
.game-pick-field { padding-bottom: 12px; border-bottom: 1px solid var(--outline-variant); }
.game-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gp-main { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px; border: 0; cursor: pointer; border-radius: var(--r-xl); background: var(--surface-container-highest); color: var(--on-surface); text-align: left; transition: border-radius var(--d-fast) var(--spring-fast), background var(--d-fx), transform 90ms; }
.gp-main .title-m { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-main:active { transform: scale(0.97); }
.gp-main.on.c-primary { background: var(--primary); color: var(--on-primary); border-radius: var(--r-2xl); }
.gp-main.on.c-tertiary { background: var(--tertiary); color: var(--on-tertiary); border-radius: var(--r-2xl); }
.game-pick-field .chips { flex-wrap: wrap; overflow: visible; }

/* ===== v1.0.8 — Cricket: tap the scoreboard ===== */
.cricket-board-mode .cricket .cell.tap { cursor: pointer; transition: transform 90ms ease-out, background var(--d-fx), filter 90ms; -webkit-tap-highlight-color: transparent; }
.cricket-board-mode .cricket .cell.tap:hover { filter: brightness(1.08); }
.cricket-board-mode .cricket .cell.tap:active { transform: scale(0.95); filter: brightness(0.9); }
.cricket-board-mode .cricket .mark { height: min(40px, 78%); }
.cricket-board-mode .cricket .cell.num { font-size: clamp(22px, min(6vw, 4dvh), 36px); }
.board-taps { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; min-height: 34px; }
.board-taps .tapchip { padding: 4px 12px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 15px; animation: bump var(--d) var(--spring-fast); }
.input-panel .dartpad.board-pad { grid-template-columns: 1fr 3fr; height: clamp(56px, calc(9 * var(--vh)), 84px); }
.dartpad.board-pad button { font-size: clamp(16px, calc(2.6 * var(--vh)), 22px); }
@media (orientation: landscape) and (min-width: 560px) { .input-panel .dartpad.board-pad { flex: none; height: clamp(56px, calc(14 * var(--vh)), 110px); } }
/* v1.0.8a — free tapping: multiplier + undo in one row */
.board-free { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.board-free .board-undo { height: auto; min-height: 48px; width: 72px; }
.cricket-board-mode .board-taps { text-align: center; }
/* v1.0.8b — teams in free tapping: pick who gets the marks */
.cricket .head .tav.pick { cursor: pointer; }
.cricket .head .thrower.soft { background: var(--secondary-container); color: var(--on-secondary-container); }

/* ===== v1.0.9 — Arena: tournament + online (coming soon) ===== */
.arena-screen { display: flex; flex-direction: column; min-height: calc(100 * var(--vh) - 96px - env(safe-area-inset-bottom)); }
.arena-split { flex: 1; display: grid; grid-template-rows: repeat(2, minmax(220px, 1fr)); gap: 12px; padding-bottom: 8px; }
@media (min-width: 840px) { .arena-split { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: min(640px, calc(100 * var(--vh) - 140px)); } .arena-screen { min-height: 0; } }
.arena-card { position: relative; overflow: hidden; border: 0; cursor: pointer; border-radius: var(--r-2xl); padding: 28px 24px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; text-align: left; transition: border-radius var(--d-slow) var(--spring), transform var(--d) var(--spring); }
.arena-card:active { transform: scale(0.98); border-radius: var(--r-xl); }
.arena-card.c-primary { background: var(--primary-container); color: var(--on-primary-container); }
.arena-card.c-tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.arena-card .arena-deco { position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; opacity: 0.18; }
.arena-card .arena-deco svg { width: 100%; height: 100%; fill: currentColor; }
.arena-card .arena-icon { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 32px; margin-bottom: auto; }
.arena-card.c-primary .arena-icon { background: var(--primary); color: var(--on-primary); }
.arena-card.c-tertiary .arena-icon { background: var(--tertiary); color: var(--on-tertiary); }
.arena-card .arena-title { font-size: clamp(28px, 7vw, 44px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.arena-card .arena-sub { font-size: 15px; opacity: 0.85; max-width: 420px; }
.arena-card .arena-soon { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 16px; border-radius: 999px; background: var(--surface); color: var(--on-surface); font-weight: 700; font-size: 15px; }

/* ===== v1.1.0 ===== */
/* X01 result: average chart + leg table */
.avg-chart .ln { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.avg-chart .leg-break { stroke: var(--outline-variant); stroke-dasharray: 4 5; stroke-width: 1.5; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.leg-table td, .leg-table th { white-space: nowrap; }
.leg-table td:nth-child(2) { max-width: 140px; }
.leg-table .badge { height: 18px; padding: 0 6px; font-size: 11px; }
/* doubles map */
.dbl-map { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dbl-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 2px; border-radius: var(--r-m); background: var(--surface-container-highest); font-size: 11px; line-height: 1.1; }
.dbl-cell b { font-size: 17px; font-weight: 850; }
.dbl-cell.h0 { background: color-mix(in oklch, var(--error-container) 70%, var(--surface-container-highest)); color: var(--on-error-container); }
.dbl-cell.h1 { background: color-mix(in oklch, oklch(0.75 0.14 85) 35%, var(--surface-container-highest)); }
.dbl-cell.h2 { background: color-mix(in oklch, oklch(0.7 0.15 150) 50%, var(--surface-container-highest)); }
.dbl-cell.h3 { background: oklch(0.62 0.16 150); color: #fff; }
.dbl-cell.hx { opacity: 0.4; }
/* ATC skip buttons */
.hit-row:has(.step1) { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.hit-row .key small { display: block; font-size: 0.55em; opacity: 0.8; }
.hit-row .key.step2 { background: var(--secondary); color: var(--on-secondary); }
.hit-row .key.step3 { background: var(--tertiary); color: var(--on-tertiary); }
@supports selector(:has(a)) { .input-panel .hit-row:has(.step1) { height: clamp(140px, calc(30 * var(--vh)), 300px); } }
/* full bull-off board */
.bull-board { width: min(100%, 420px); border-radius: 0; box-shadow: none; overflow: visible; }
.bull-board .bb-num { fill: #f4f1e8; font-size: 21px; font-weight: 800; text-anchor: middle; dominant-baseline: central; font-family: var(--font); }
.bull-board .bb-brand { fill: #e5bd4f; font-size: 13px; font-weight: 800; letter-spacing: 3px; font-family: var(--font); text-transform: lowercase; }
.bull-board .bb-brand.small { fill: #9b978c; font-size: 9px; letter-spacing: 2px; }
.bull-dart text { font-size: 13px; }
@media (max-width: 520px) { .leg-table .avatar { display: none; } .leg-table td, .leg-table th { padding-left: 6px; padding-right: 6px; font-size: 13px; } }

/* ===== v1.1.1 — in-game settings ===== */
.gs-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-container); }
.gs-row:first-child { border-radius: var(--r-l) var(--r-l) var(--r-xs) var(--r-xs); }
.gs-row:last-child { border-radius: var(--r-xs) var(--r-xs) var(--r-l) var(--r-l); }
.gs-row:only-child { border-radius: var(--r-l); }
.dialog .field .label-l { display: inline-flex; align-items: center; gap: 6px; }

/* ===== v1.1.2 — nationality ===== */
.flag { display: inline-block; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12); background: var(--surface-container-highest); }
.avatar { position: relative; }
.avatar .av-flag { position: absolute; right: -3%; bottom: -3%; width: 38%; height: 38%; min-width: 14px; min-height: 14px; max-width: 34px; max-height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgb(0 0 0 / 0.3); z-index: 1; pointer-events: none; }
/* tiny avatars (chips, team rows, stacked friends) stay clean */
.chip .avatar .av-flag, .stackav .avatar .av-flag, .team-members .tm .avatar .av-flag, .cricket .head .tav .avatar .av-flag, .tapchip .av-flag { display: none; }
.country-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 10px; border: 0; cursor: pointer; border-radius: 999px; background: color-mix(in oklch, var(--surface) 35%, transparent); color: inherit; font: inherit; font-weight: 650; }
.country-btn .flag { width: 24px; height: 24px; }
.country-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.field-wrap { position: relative; display: flex; align-items: center; }
.field-wrap > .msr { position: absolute; left: 14px; color: var(--on-surface-variant); pointer-events: none; }
.field-wrap .textfield { padding-left: 46px; }
.country-list { display: flex; flex-direction: column; gap: 2px; max-height: min(420px, calc(55 * var(--vh))); overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px; }
.country-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border: 0; border-radius: var(--r-m); background: transparent; color: var(--on-surface); font: inherit; text-align: left; cursor: pointer; }
.country-row:hover { background: var(--surface-container-highest); }
.country-row.on { background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 700; }
.country-row.clear { color: var(--on-surface-variant); }
.country-row .flag { width: 28px; height: 28px; }
.avatar-edit .cam { right: auto; left: -4px; } /* v1.1.2: the flag sits bottom right */

/* ===== v1.1.3 — profile layout: friends | my stats & history | my profile ===== */
.profile-layout { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) minmax(260px, 320px); gap: 16px; align-items: start; }
.profile-layout .pl-side { position: sticky; top: 12px; max-height: calc(100 * var(--vh) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.profile-layout .pl-main { min-width: 0; }
.profile-layout .stat-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.me-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-2xl); background: var(--primary-container); color: var(--on-primary-container); }
.me-card .me-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.me-card .me-id { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.me-card .name-btn { padding: 2px 6px; margin-left: -6px; justify-content: flex-start; }
.me-card .name-btn .headline-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.me-card .me-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.me-card .me-meta .badge { gap: 3px; height: 22px; padding: 0 8px; font-size: 11px; }
.me-card .me-mail { font-size: 12px; opacity: 0.75; max-width: 100%; }
.me-card .me-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.me-card .avatar-edit .cam { --bh: 34px; left: -6px; bottom: -6px; box-shadow: 0 0 0 3px var(--primary-container); }
.me-card .country-btn { height: 36px; }
.pl-friends .card { padding: 14px; }
.pl-friends .list-item .avatar.l { width: 48px; height: 48px; font-size: 18px; }
.pl-friends .row:has(.tf-wrap) { flex-wrap: wrap; }
.pl-friends .tf-wrap { min-width: 0; }
/* phones and tablets: compact profile card on top, friends in their own tab */
@media (max-width: 1179px) { .profile-screen .me-card { padding: 14px; } }

/* ===== v1.1.3a — balanced profile ===== */
/* equal side columns, one gap and one corner radius everywhere */
.profile-layout { grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 16px; }
.profile-layout .card, .profile-layout .me-card { border-radius: var(--r-xl); }
/* stats: 4 even columns, values sized to the tile so nothing clips */
.profile-screen .stat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.profile-screen .tile { min-height: 92px; padding: 14px; justify-content: space-between; border-radius: var(--r-l); min-width: 0; }
.profile-screen .tile .k { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-screen .tile .v { font-size: clamp(20px, 2.2vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-screen .tile.hero-tile { grid-column: span 2; border-radius: var(--r-l); }
.profile-screen .tile.hero-tile .v { font-size: clamp(30px, 3.4vw, 46px); }
@media (max-width: 640px) { .profile-screen .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .profile-screen .tile .v { font-size: 24px; } .profile-screen .tile.hero-tile .v { font-size: 40px; } }
.profile-screen .card:has(.chart) { border-radius: var(--r-l); }
/* friends: full-width search with a round add button */
.pl-friends .row:has(.tf-wrap), .profile-screen .row:has(.tf-wrap) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pl-friends .row:has(.tf-wrap) > .btn { width: 56px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
.pl-friends .row:has(.tf-wrap) > .btn .msr { font-size: 24px; }
.pl-friends .list-item { padding: 10px 8px; gap: 12px; }
.pl-friends .list-item .title-m { font-size: 15px; }
/* profile card: smaller photo, everything on one rhythm */
.me-card { gap: 10px; padding: 14px; }
.me-card .avatar.xl { width: 72px; height: 72px; font-size: 28px; }
.me-card .avatar-edit .cam { --bh: 30px; }
.me-card .avatar-edit .cam .msr { font-size: 16px; }
.me-card .name-btn .headline-s { font-size: 20px; }
.me-card .me-actions { justify-content: space-between; }
.me-card .me-actions .btn.text { padding: 0 8px; }
/* account settings under the card: compact rows matching the friends list */
.pl-me .setting { padding: 10px 12px; gap: 12px; }
.pl-me .setting .title-s { font-size: 14px; }
.pl-me .setting .body-s { font-size: 12px; }
.pl-me .setting .btn.s { --bh: 34px; padding: 0 12px; font-size: 13px; }
/* values scale with their own tile (no clipping); tiles wrap instead of squeezing */
.profile-layout { grid-template-columns: 264px minmax(0, 1fr) 264px; }
.profile-screen .stat-tiles { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
.profile-screen .tile { container-type: inline-size; }
.profile-screen .tile .v { overflow: visible; text-overflow: clip; font-size: clamp(18px, 22cqi, 30px); }
.profile-screen .tile.hero-tile .v { font-size: clamp(28px, 20cqi, 46px); }
.profile-screen .tile .k { white-space: normal; overflow: visible; line-height: 1.25; }
.pl-me .setting .grow { min-width: 0; }
.pl-me .setting .title-s, .pl-me .setting .body-s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-me .setting > .msr { font-size: 20px; }
.me-card .me-top { gap: 12px; }
.bull-chip .bc-edit { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; opacity: 0.75; }

/* ===== v1.1.4 — unfinished matches on the home screen ===== */
.paused-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding: 14px; border-radius: var(--r-2xl); background: var(--tertiary-container); color: var(--on-tertiary-container); }
.paused-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-l); background: color-mix(in oklch, var(--surface) 45%, transparent); }
.paused-item .avatar { width: 32px; height: 32px; font-size: 13px; }
.paused-item .btn.text { color: inherit; }

/* ===== v1.1.5 — Cricket on tablets and laptops ===== */
/* team header (free tapping): the member chips pick who gets the marks */
.cricket .head .tapper-pick { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 100%; }
.cricket .head .tp { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; height: 34px; padding: 0 12px 0 4px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; background: color-mix(in oklch, var(--on-surface) 8%, transparent); color: inherit; transition: background var(--d-fx), transform 90ms; }
.cricket .head .tp:active { transform: scale(0.95); }
.cricket .head .tp .avatar { width: 26px; height: 26px; font-size: 11px; }
.cricket .head .tp.on { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 2px var(--primary-container); }
/* free-tap panel: live leg stats on top, Single/Double/Triple + undo pinned to the bottom */
.cricket-board-mode .input-panel { justify-content: flex-start; }
.board-stats { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 2px; }
.board-stats .bs-side { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-l); background: var(--surface-container-high); }
.board-stats .bs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.board-stats .bs-legs { font-size: 13px; font-weight: 600; white-space: nowrap; }
.board-stats .bs-legs b { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 7px; margin-left: 4px; border-radius: 12px; background: var(--primary); color: var(--on-primary); }
.board-stats .bs-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
.board-stats .bs-nums div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--r-m); background: var(--surface-container); }
.board-stats .bs-nums span { font-size: 12px; color: var(--on-surface-variant); }
.board-stats .bs-nums b { font-size: clamp(20px, calc(3 * var(--vh)), 30px); font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1.1; }
.board-stats .bs-members { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; }
.board-stats .bs-members span { display: inline-flex; align-items: center; gap: 6px; }
.board-stats .bs-members .avatar { width: 24px; height: 24px; font-size: 10px; }
.cricket-board-mode .board-taps { margin-top: auto; }
/* phones (panel under the board) and short landscape phones: no stats, keep the board big */
@media (orientation: portrait) and (max-width: 899px), (max-height: 520px) { .board-stats { display: none; } }
/* bigger team/player headers on large screens */
@media (min-width: 900px) and (min-height: 600px) {
  .cricket .head { padding: 12px 8px; gap: 4px; }
  .cricket .head .avatar { width: 52px; height: 52px; font-size: 20px; }
  .cricket .head .row .avatar { width: 44px; height: 44px; }
  .cricket .head .nm { font-size: 16px; font-weight: 700; }
  .cricket .head .pts { font-size: clamp(30px, calc(4.4 * var(--vh)), 46px); }
  .cricket .head .legs-won { font-size: 14px; }
  .cricket .head .tp { height: 38px; font-size: 15px; }
  .cricket .head .tp .avatar { width: 30px; height: 30px; }
  .cricket .head .thrower { font-size: 14px; padding: 3px 10px 3px 8px; }
}
/* X01 on tablets/laptops: checkout route spans the card in big equal chips; names and details grow with tall cards */
.players > .pcard .hint { display: grid; grid-template-columns: repeat(var(--hn, 3), minmax(0, 1fr)); gap: clamp(4px, 1.6cqw, 10px); width: 100%; }
.players > .pcard .hint b { font-size: clamp(18px, min(10cqw, 6cqh), 60px); padding: 0.22em 0.2em; text-align: center; border-radius: 0.45em; }
.players > .pcard .pname .title-m { font-size: clamp(18px, min(9cqw, 5cqh), 40px); }
.players > .pcard .pname .avatar { width: clamp(32px, min(12cqw, 8cqh), 72px); height: clamp(32px, min(12cqw, 8cqh), 72px); }
.players > .pcard .sub { font-size: clamp(12px, min(5.2cqw, 3cqh), 22px); }
.players > .pcard .visits span { font-size: clamp(12px, min(4.6cqw, 2.8cqh), 20px); padding: 0.25em 0.6em; }
.players > .pcard .legs .pip { min-width: clamp(28px, min(10cqw, 6cqh), 52px); height: clamp(24px, min(8cqw, 5cqh), 44px); font-size: clamp(13px, min(5cqw, 3cqh), 24px); }
.players > .pcard .hint b { font-size: clamp(18px, min(12.5cqw, 7cqh), 68px); padding: 0.3em 0.2em; }

/* ===== v1.1.5a — free tapping has no turns: the selected member is only outlined, nothing glows ===== */
.cricket .head .tp.on { background: var(--secondary-container); color: var(--on-secondary-container); box-shadow: inset 0 0 0 2px var(--outline); }
.cricket-board-mode .cricket .head, .cricket-board-mode .cricket .head.activecol { box-shadow: none; }
.board-free { grid-template-columns: minmax(0, 1fr); } /* v1.1.5b: one undo button (top bar) */

/* ===== v1.1.6 — X01 keyboard mode: shortcuts on top, the typing bar at the very bottom ===== */
.kb-bar { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 6px 6px 6px 18px; border-radius: var(--r-2xl); background: var(--surface-container-highest); box-shadow: inset 0 0 0 2px var(--outline-variant); transition: box-shadow var(--d-fx); }
.kb-bar:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.kb-input { flex: 1; min-width: 0; height: clamp(56px, calc(9 * var(--vh)), 84px); border: 0; outline: none; background: transparent; color: var(--on-surface); font: inherit; font-size: clamp(30px, calc(5 * var(--vh)), 52px); font-weight: 850; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kb-input::placeholder { color: var(--on-surface-variant); font-size: 0.55em; font-weight: 600; letter-spacing: 0; }
.kb-input.err { animation: shake 0.3s; color: var(--error); }
.kb-rest { font-size: clamp(16px, calc(2.4 * var(--vh)), 22px); font-weight: 700; color: var(--on-surface-variant); white-space: nowrap; }
.kb-bar .kb-ok { height: clamp(52px, calc(8 * var(--vh)), 76px); min-width: clamp(96px, 18vw, 140px); flex: none; border-radius: var(--r-xl); }
.input-panel:has(.kb-bar) .quick button { height: clamp(48px, calc(8 * var(--vh)), 72px); font-size: clamp(18px, calc(2.8 * var(--vh)), 26px); }
