/* ------------------------------------------------------------------ */
/* Tokens                                                             */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: dark;
  --bg: #070b10;
  --bg-deep: #05080c;
  --surface: #101821;
  --surface-2: #141f2b;
  --surface-3: #1a2836;
  --line: #243446;
  --line-soft: #1a2735;
  --text: #e8eef6;
  --text-soft: #c7d3e1;
  --muted: #93a4b8;
  --dim: #6b7c90;
  --accent: #5eead4;
  --accent-strong: #2dd4bf;
  --accent-soft: rgba(94, 234, 212, 0.1);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.1);
  --rose: #fb7185;
  --blue: #60a5fa;
  --purple: #c084fc;
  --green: #34d399;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1460px;
}

/* ------------------------------------------------------------------ */
/* Base                                                               */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(45, 212, 191, 0.08), transparent 60%),
    radial-gradient(900px 500px at 96% 2%, rgba(96, 165, 250, 0.06), transparent 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.015em;
}

a {
  color: var(--accent);
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #06201c;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(94, 234, 212, 0.28);
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/* Header                                                             */
/* ------------------------------------------------------------------ */

.app-header {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 22px 28px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 23px;
  color: #06201c;
  background: linear-gradient(145deg, var(--accent), #38bdf8);
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.22);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.brand-tag {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}

.house-edge-card {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "label label"
    "value note";
  align-items: baseline;
  column-gap: 12px;
  row-gap: 1px;
  padding: 9px 15px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(20, 31, 43, 0.95), rgba(13, 20, 28, 0.92));
  box-shadow: var(--shadow-soft);
}

.stat-label {
  grid-area: label;
  color: var(--dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-value {
  grid-area: value;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}

.stat-note {
  grid-area: note;
  align-self: end;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 720px;
}

.rule-chip {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(16, 24, 33, 0.8);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Tabs                                                               */
/* ------------------------------------------------------------------ */

.tab-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 16, 0.86);
  backdrop-filter: blur(18px);
}

.tabs {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 13px 16px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(94, 234, 212, 0.04);
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-index {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.tab[aria-selected="true"] .tab-index {
  color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Layout                                                             */
/* ------------------------------------------------------------------ */

.app-layout {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 24px 28px 52px;
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.workspace {
  min-width: 0;
}

.tab-panel {
  animation: panel-in 180ms ease both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* Rules panel                                                        */
/* ------------------------------------------------------------------ */

.rules-panel {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 29, 40, 0.96), rgba(13, 20, 28, 0.94));
  box-shadow: var(--shadow-soft);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.rules-panel::-webkit-scrollbar {
  width: 7px;
}

.rules-panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.rules-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
}

.rules-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.rules-head p {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 11px;
}

.rules-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.rules-toggle {
  display: none;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-soft);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  background: var(--surface-3);
  border-color: #31465c;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.08);
  border-color: transparent;
}

.btn-small {
  padding: 4px 7px;
  font-size: 11px;
}

.rules-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 15px;
}

.rule-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.rule-group legend {
  padding: 0;
  margin-bottom: 1px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.field-help {
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.35;
}

.field select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 28px 8px 10px;
  color: var(--text);
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% + 1px),
    calc(100% - 9px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: 12px;
  cursor: pointer;
}

.field select:hover {
  border-color: #31465c;
}

.field select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 1px 0;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  display: inline-block;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #263343;
  border: 1px solid #31445a;
  transition: background 140ms ease, border-color 140ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9fb0c4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 140ms ease, background 140ms ease;
}

.switch input:checked + .switch-track {
  background: rgba(45, 212, 191, 0.9);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #06201c;
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch input:disabled {
  cursor: not-allowed;
}

.switch-field.is-disabled {
  opacity: 0.48;
  cursor: default;
}

.rule-note {
  margin: -2px 0 0;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.4;
}

.rules-footnote {
  margin: 0;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.45;
}

/* ------------------------------------------------------------------ */
/* Intro                                                              */
/* ------------------------------------------------------------------ */

.intro-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 26px;
  align-items: end;
  padding: 27px 28px 25px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(45, 212, 191, 0.08), transparent 65%),
    linear-gradient(155deg, rgba(21, 32, 44, 0.96), rgba(12, 19, 27, 0.96));
  box-shadow: var(--shadow-soft);
}

.intro-card::after {
  content: "♠";
  position: absolute;
  right: 22px;
  top: -30px;
  color: rgba(94, 234, 212, 0.035);
  font-size: 180px;
  line-height: 1;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.intro-copy h1 {
  margin: 0 0 9px;
  font-size: clamp(28px, 3.5vw, 43px);
  font-weight: 760;
  letter-spacing: -0.045em;
}

.intro-copy > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 62ch;
}

.intro-meta {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 18px;
  align-items: stretch;
}

.intro-meta > div {
  min-width: 88px;
  padding-left: 13px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.intro-meta span {
  color: var(--dim);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-meta strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

#solve-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Status & diff banner                                               */
/* ------------------------------------------------------------------ */

.solver-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 12px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.solver-status.is-error {
  border-color: rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.06);
  color: #fecdd3;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose);
  flex: none;
}

.spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid rgba(94, 234, 212, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.spinner-large {
  width: 26px;
  height: 26px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.diff-banner {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.015));
}

.diff-icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.14);
  color: var(--amber);
  font-family: var(--mono);
  font-weight: 700;
}

.diff-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.diff-copy strong {
  color: #fde68a;
  font-size: 12px;
}

.diff-copy > span {
  line-height: 1.45;
}

.diff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.diff-chip {
  appearance: none;
  border: 1px solid rgba(251, 191, 36, 0.24);
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.07);
  color: #fde68a;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
}

.diff-chip:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.45);
}

.diff-more {
  color: var(--dim);
  font-size: 10px;
  align-self: center;
}

/* ------------------------------------------------------------------ */
/* Loading                                                            */
/* ------------------------------------------------------------------ */

.loading-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.loading-card strong {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 2px;
}

.loading-card p {
  margin: 0;
  line-height: 1.5;
}

.loading-card-quiet {
  margin-top: 20px;
  padding: 22px 24px;
  opacity: 0.72;
}

/* ------------------------------------------------------------------ */
/* Charts                                                             */
/* ------------------------------------------------------------------ */

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 2px 0 12px;
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  font-size: 10.5px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(16, 24, 33, 0.72);
}

.legend-item strong {
  color: var(--action, var(--text));
  font-family: var(--mono);
  font-size: 10px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--action, var(--muted));
  flex: none;
}

.legend-flip {
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.05);
}

.chart-hint {
  margin: 0;
  color: var(--dim);
  font-size: 10.5px;
}

.strategy-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.strategy-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-card {
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 28, 39, 0.96), rgba(12, 19, 27, 0.95));
  box-shadow: var(--shadow-soft);
}

.chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.chart-card-head h3 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 700;
}

.chart-card-head p {
  margin: 0;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.4;
  max-width: 68ch;
}

.chart-count {
  flex: none;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  padding-top: 2px;
  white-space: nowrap;
}

.chart-scroll {
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.chart-scroll::-webkit-scrollbar {
  height: 7px;
}

.chart-scroll::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.strategy-table {
  width: 100%;
  min-width: 604px;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}

.strategy-table th {
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  vertical-align: middle;
}

.strategy-table thead th {
  height: 22px;
  letter-spacing: 0.04em;
}

.strategy-table th.hand-col {
  width: 54px;
  text-align: left;
  padding-left: 5px;
}

.strategy-table tbody th {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding-left: 5px;
  white-space: nowrap;
}

.strategy-table td {
  padding: 0;
}

/* Action color tokens: the letter and text always carry the signal too. */
.action-S {
  --action: #34d399;
  --action-bg: rgba(52, 211, 153, 0.12);
  --action-border: rgba(52, 211, 153, 0.28);
}

.action-H {
  --action: #60a5fa;
  --action-bg: rgba(96, 165, 250, 0.12);
  --action-border: rgba(96, 165, 250, 0.28);
}

.action-D {
  --action: #fbbf24;
  --action-bg: rgba(251, 191, 36, 0.11);
  --action-border: rgba(251, 191, 36, 0.3);
}

.action-P {
  --action: #c084fc;
  --action-bg: rgba(192, 132, 252, 0.12);
  --action-border: rgba(192, 132, 252, 0.3);
}

.action-R {
  --action: #fb7185;
  --action-bg: rgba(251, 113, 133, 0.11);
  --action-border: rgba(251, 113, 133, 0.3);
}

.strategy-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 37px;
  padding: 0;
  border: 1px solid var(--action-border, var(--line));
  border-radius: 7px;
  background: var(--action-bg, var(--surface-2));
  color: var(--action, var(--text));
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 90ms ease,
    filter 100ms ease,
    box-shadow 120ms ease;
}

.strategy-cell:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.strategy-cell:active {
  transform: translateY(0);
}

.strategy-cell.selected {
  outline: 2px solid var(--text);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(232, 238, 246, 0.08);
  z-index: 1;
}

.strategy-cell.flipped {
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.55),
    0 0 0 1px rgba(251, 191, 36, 0.2);
}

.strategy-cell.selected.flipped {
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.65),
    0 0 0 4px rgba(251, 191, 36, 0.16);
}

.flip-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.16);
  flex: none;
}

.strategy-cell .flip-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.action-letter {
  transform: translateY(0.3px);
}

/* ------------------------------------------------------------------ */
/* Cell detail                                                        */
/* ------------------------------------------------------------------ */

.detail-card {
  margin-top: 18px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(96, 165, 250, 0.035), transparent 65%),
    linear-gradient(180deg, rgba(18, 28, 39, 0.97), rgba(12, 19, 27, 0.96));
  box-shadow: var(--shadow-soft);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 15px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.detail-head h3 {
  margin: 0 0 4px;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 720;
  letter-spacing: -0.03em;
}

.detail-sub {
  margin: 0;
  color: var(--dim);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 11px 6px 6px;
  border: 1px solid var(--action-border, var(--line));
  border-radius: 999px;
  background: var(--action-bg, var(--surface-2));
  color: var(--action, var(--text));
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-letter {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--action, var(--text));
  color: #061016;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 28px;
}

.detail-col {
  min-width: 0;
}

.detail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-section-head h4 {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.detail-section-head span {
  color: var(--dim);
  font-size: 10px;
  white-space: nowrap;
}

.ev-chart {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ev-row {
  display: grid;
  grid-template-columns: 78px minmax(90px, 1fr) 64px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.ev-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

.ev-row.is-best .ev-action {
  color: var(--text);
  font-weight: 650;
}

.ev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--action, var(--muted));
  flex: none;
}

.ev-track {
  position: relative;
  height: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.75);
  overflow: hidden;
}

.ev-zero {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 50%;
  width: 1px;
  background: rgba(232, 238, 246, 0.24);
  z-index: 1;
}

.ev-fill {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 4px;
  background: var(--action, var(--muted));
  opacity: 0.82;
  min-width: 1px;
}

.ev-row.is-best .ev-fill {
  opacity: 1;
  box-shadow: 0 0 10px var(--action);
}

.ev-value {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ev-row.is-best .ev-value {
  color: var(--text);
  font-weight: 700;
}

.ev-note,
.fine-print {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.5;
}

.explanation {
  margin: 15px 0 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.65;
  max-width: 64ch;
}

.explanation strong {
  color: var(--text);
  font-weight: 650;
}

.detail-flip {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--amber);
  border-radius: 0 6px 6px 0;
  background: rgba(251, 191, 36, 0.055);
  color: #fde68a;
  font-size: 10.5px;
  line-height: 1.5;
}

.canvas-wrap {
  margin-top: 2px;
  padding: 8px 9px 3px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(5, 8, 12, 0.55);
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 224px;
}

/* ------------------------------------------------------------------ */
/* Placeholders & footer                                              */
/* ------------------------------------------------------------------ */

.placeholder-panel {
  padding-top: 10px;
}

.placeholder-panel h1 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 760;
  letter-spacing: -0.045em;
}

.placeholder-panel > p:not(.eyebrow) {
  max-width: 64ch;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.placeholder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin-top: 26px;
  padding: 50px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(16, 24, 33, 0.5);
  text-align: center;
}

.placeholder-icon {
  color: var(--accent);
  font-size: 32px;
  line-height: 1;
  margin-bottom: 3px;
}

.placeholder-card strong {
  color: var(--text-soft);
  font-size: 13px;
}

.placeholder-card span:last-child {
  color: var(--dim);
  font-size: 11px;
}

.app-footer {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 20px 28px 30px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.noscript {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  padding: 12px 16px;
  border: 1px solid var(--rose);
  border-radius: 10px;
  background: #2a1118;
  color: #fecdd3;
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (min-width: 1380px) {
  .strategy-body {
    grid-template-columns: minmax(0, 1fr) 356px;
  }

  .detail-card {
    position: sticky;
    top: 72px;
    margin-top: 0;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
  }

  .detail-card .detail-head {
    flex-direction: column;
    gap: 10px;
  }

  .detail-card .detail-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .detail-card::-webkit-scrollbar {
    width: 7px;
  }

  .detail-card::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
  }
}

@media (max-width: 1160px) {
  .app-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 20px;
    padding-inline: 22px;
  }

  .app-header,
  .tabs,
  .app-footer {
    padding-inline: 22px;
  }

  .intro-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .intro-meta {
    gap: 12px;
  }

  .intro-meta > div {
    min-width: 0;
  }

  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
}

@media (max-width: 960px) {
  .app-header {
    flex-direction: column;
    gap: 14px;
    padding-top: 18px;
  }

  .header-right {
    width: 100%;
    align-items: flex-start;
  }

  .rule-chips {
    justify-content: flex-start;
  }

  .app-layout {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 16px;
  }

  .rules-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .rules-toggle {
    display: inline-block;
  }

  .rules-panel.is-collapsed {
    padding-bottom: 12px;
  }

  .rules-panel.is-collapsed .rules-form {
    display: none;
  }

  .chart-hint {
    width: 100%;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .app-header {
    padding: 16px 16px 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 20px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-tag {
    font-size: 9.5px;
  }

  .house-edge-card {
    width: 100%;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "label label"
      "value note";
  }

  .stat-value {
    font-size: 25px;
  }

  .stat-note {
    white-space: normal;
    text-align: right;
  }

  .rule-chips {
    max-height: 54px;
    overflow: hidden;
    gap: 4px;
  }

  .tabs {
    padding-inline: 12px;
  }

  .tab {
    padding: 11px 11px 9px;
    font-size: 12px;
    gap: 5px;
  }

  .app-layout {
    padding: 13px 12px 36px;
    gap: 14px;
  }

  .rules-panel {
    padding: 14px;
    border-radius: 13px;
  }

  .intro-card {
    padding: 20px 18px;
    border-radius: 13px;
  }

  .intro-copy h1 {
    font-size: clamp(27px, 9vw, 37px);
  }

  .intro-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }

  .intro-meta > div:last-child {
    grid-column: 1 / -1;
  }

  .chart-card {
    padding: 13px 10px 9px;
    border-radius: 13px;
  }

  .chart-card-head {
    padding-inline: 3px;
  }

  .chart-count {
    display: none;
  }

  .strategy-table {
    min-width: 548px;
    border-spacing: 3px;
  }

  .strategy-cell {
    min-height: 34px;
    font-size: 11px;
    border-radius: 6px;
  }

  .strategy-table tbody th {
    font-size: 10px;
  }

  .detail-card {
    margin-top: 14px;
    padding: 17px 14px 18px;
    border-radius: 13px;
  }

  .detail-head {
    flex-direction: column;
    gap: 10px;
  }

  .detail-grid {
    gap: 20px;
  }

  .ev-row {
    grid-template-columns: 70px minmax(70px, 1fr) 58px;
    gap: 6px;
    font-size: 10.5px;
  }

  .explanation {
    font-size: 12px;
  }

  .diff-banner {
    padding: 11px;
    gap: 9px;
  }

  .diff-icon {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .legend {
    gap: 4px;
  }

  .legend-item {
    padding: 2px 6px;
    font-size: 9.5px;
  }

  .app-footer {
    padding: 16px 16px 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .placeholder-card {
    padding: 38px 18px;
  }
}

@media (max-width: 390px) {
  .rule-chip:nth-child(n + 7) {
    display: none;
  }

  .ev-row {
    grid-template-columns: 62px minmax(60px, 1fr) 55px;
  }
}

/* ------------------------------------------------------------------ */
/* Play table                                                         */
/* ------------------------------------------------------------------ */

.module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.module-head h1 {
  margin: 0 0 9px;
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 760;
  letter-spacing: -0.045em;
}

.module-head .lede {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

@media (min-width: 720px) {
  .play-head {
    align-items: flex-end;
  }
}

.play-bankroll {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  padding: 12px 16px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(20, 31, 43, 0.95), rgba(13, 20, 28, 0.92));
  box-shadow: var(--shadow-soft);
}

.play-bankroll .stat-label,
.play-bankroll .stat-note {
  grid-area: auto;
  white-space: normal;
}

.play-bankroll strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 18px;
  align-items: start;
}

.table-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(18, 28, 39, 0.97), rgba(11, 18, 26, 0.97));
  box-shadow: var(--shadow);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.shoe-meter {
  flex: 1;
  min-width: 0;
  max-width: 380px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "label note"
    "track track";
  align-items: center;
  gap: 5px 12px;
}

.shoe-meter .stat-label {
  grid-area: label;
}

.shoe-meter .stat-note {
  grid-area: note;
  justify-self: end;
  white-space: normal;
  text-align: right;
}

.shoe-track {
  grid-area: track;
  height: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-deep);
}

.shoe-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 240ms ease;
}

.table-count {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.table-count strong {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.felt {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 446px;
  padding: 24px clamp(16px, 3.5vw, 34px) 20px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(94, 234, 212, 0.1), transparent 58%),
    radial-gradient(115% 130% at 50% 108%, #0b3a2e 0%, #08291f 52%, #061d17 100%);
  box-shadow:
    inset 0 0 0 6px rgba(0, 0, 0, 0.16),
    inset 0 0 80px rgba(0, 0, 0, 0.38),
    0 16px 40px rgba(0, 0, 0, 0.24);
}

.felt::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 13px;
  pointer-events: none;
}

.felt > * {
  position: relative;
  z-index: 1;
}

.dealer-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 146px;
}

.dealer-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dealer-line .eyebrow {
  margin: 0;
}

.dealer-total {
  padding: 2px 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(2, 10, 8, 0.3);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.felt-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 234, 212, 0.28), transparent);
}

.table-message {
  min-height: 21px;
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}

.player-area {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  min-height: 158px;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 94px;
}

.playing-card {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 9px;
  background: linear-gradient(150deg, #f8fafc, #e6edf5);
  color: #0b1220;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.38),
    inset 0 -2px 0 rgba(15, 23, 42, 0.12);
  line-height: 1;
  user-select: none;
  animation: card-in 200ms ease both;
}

.playing-card::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 5px;
  pointer-events: none;
}

.playing-card .card-rank {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.playing-card .card-suit {
  margin-top: 4px;
  font-size: 22px;
}

.playing-card.is-red {
  color: #b91c1c;
}

.playing-card.is-back {
  border-color: #3b5f7c;
  background: repeating-linear-gradient(135deg, #1c3a56 0 7px, #142c43 7px 14px);
  color: rgba(226, 240, 255, 0.5);
}

.playing-card.is-back::after {
  border-color: rgba(255, 255, 255, 0.14);
}

.playing-card.is-back .card-back {
  font-size: 22px;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(-6px) rotate(-1.5deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

.table-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 156px;
  padding: 9px 12px 11px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(3, 12, 9, 0.22);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.table-hand.is-active {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.06);
  box-shadow:
    0 0 0 1px rgba(94, 234, 212, 0.1),
    0 0 28px rgba(45, 212, 191, 0.12);
}

.table-hand.is-bust {
  opacity: 0.72;
}

.hand-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hand-label {
  color: var(--dim);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hand-total {
  padding: 1px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.hand-wager {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10px;
}

.hand-net {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
}

.empty-table {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 132px;
  padding: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
}

.insurance-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(251, 191, 36, 0.34);
  border-radius: 10px;
  background: var(--amber-soft);
  color: #fde68a;
  font-size: 11.5px;
  line-height: 1.5;
}

.insurance-bar > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 6px;
  border: 1px solid var(--action-border, var(--line));
  border-radius: 9px;
  background: var(--action-bg, var(--surface-2));
  color: var(--action, var(--text));
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease, border-color 120ms ease;
}

.action-btn:hover:not(:disabled) {
  border-color: var(--action, var(--accent));
  filter: brightness(1.15);
}

.action-btn:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.3;
}

.action-btn kbd {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
}

.bet-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.bet-controls {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.bet-field {
  width: 90px;
}

.bet-field .field-label {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bet-field input {
  width: 100%;
  padding: 8px 6px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 700;
}

#play-deal {
  min-width: 104px;
}

.round-result {
  min-height: 18px;
  margin-left: auto;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #04211c;
  font-weight: 800;
}

.btn-primary:hover {
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #04211c;
  filter: brightness(1.06);
}

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.play-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-card {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 28, 39, 0.96), rgba(12, 19, 27, 0.95));
  box-shadow: var(--shadow-soft);
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.control-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
}

.control-copy {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.control-head select {
  max-width: 152px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 11px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}

.check-field input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.check-field.compact {
  font-size: 10px;
  white-space: nowrap;
}

.coach-box {
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(4, 11, 18, 0.42);
  font-size: 11.5px;
  line-height: 1.55;
}

.coach-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--dim);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.coach-value {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.coach-box .coach-value {
  display: inline-block;
  margin-left: 6px;
}

.coach-hint {
  border-color: rgba(94, 234, 212, 0.24);
  background: rgba(94, 234, 212, 0.05);
}

.coach-grade {
  border-color: rgba(96, 165, 250, 0.2);
}

.coach-box .action-badge {
  margin-right: 6px;
  vertical-align: middle;
}

.grade-ok {
  color: var(--green);
}

.grade-miss {
  color: var(--rose);
}

.count-display {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.count-display > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(5, 12, 18, 0.35);
}

.count-display span {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.count-display strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.count-hidden {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--dim);
  font-size: 11px;
}

.stat-stack {
  display: flex;
  flex-direction: column;
}

.stat-stack > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.stat-stack > div:last-child {
  border-bottom: 0;
}

.stat-stack span {
  color: var(--muted);
}

.stat-stack strong {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.session-card .form-grid .field:last-child {
  grid-column: 1 / -1;
}

.field input {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-deep);
  color: var(--text);
  font-size: 12px;
}

.field input:hover {
  border-color: #31465c;
}

.field input:focus {
  border-color: var(--accent);
  outline: none;
}

.history-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 28, 39, 0.96), rgba(12, 19, 27, 0.95));
  box-shadow: var(--shadow-soft);
}

.history-card .chart-card-head {
  margin-bottom: 10px;
}

.history-card .chart-card-head h2 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 700;
}

.history-card .chart-card-head p {
  margin: 0;
  color: var(--dim);
  font-size: 10.5px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.data-table th,
.data-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

.data-table thead th {
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.mini-cards {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10.5px;
}

.empty-cell {
  padding: 18px;
  color: var(--dim);
  text-align: center;
}

.is-gain {
  color: var(--green);
}

.is-cost {
  color: var(--rose);
}

@media (max-width: 1180px) {
  .play-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .play-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 720px) {
  .module-head {
    flex-direction: column;
    gap: 14px;
  }

  .play-bankroll {
    width: 100%;
  }

  .play-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-card {
    padding: 11px;
    border-radius: 15px;
  }

  .felt {
    gap: 12px;
    min-height: 360px;
    padding: 18px 12px 14px;
    border-radius: 14px;
  }

  .dealer-area {
    min-height: 126px;
  }

  .player-area {
    min-height: 140px;
  }

  .card-row {
    gap: 6px;
    min-height: 80px;
  }

  .playing-card {
    width: 56px;
    height: 80px;
    border-radius: 8px;
  }

  .playing-card .card-rank {
    font-size: 20px;
  }

  .playing-card .card-suit {
    font-size: 18px;
  }

  .table-hand {
    min-width: 136px;
    padding: 8px 9px 10px;
  }

  .action-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bet-bar {
    align-items: stretch;
  }

  .bet-controls {
    flex: 1 1 100%;
  }

  .bet-field {
    flex: 1;
    width: auto;
  }

  #play-deal {
    flex: 1;
  }

  .round-result {
    flex: 1 0 100%;
    margin-left: 0;
    text-align: right;
  }
}

@media (max-width: 420px) {
  .playing-card {
    width: 50px;
    height: 72px;
  }

  .playing-card .card-rank {
    font-size: 18px;
  }

  .playing-card .card-suit {
    font-size: 16px;
  }

  .table-hand {
    min-width: 124px;
  }

  .count-display {
    grid-template-columns: minmax(0, 1fr);
  }
}

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