:root {
  color-scheme: light;
  --ink: #f7fbf8;
  --muted: #b8c8c2;
  --line: rgba(255, 255, 255, 0.18);
  --paper: rgba(255, 255, 255, 0.08);
  --panel: rgba(5, 20, 18, 0.78);
  --felt: #126044;
  --felt-deep: #0c382d;
  --gold: #c99735;
  --pink: #f044a8;
  --pink-hot: #ff6ac6;
  --pink-soft: #ffd6ef;
  --red: #c72a2a;
  --ruby: #9f1d27;
  --blue: #176aa8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(2, 8, 10, 0.08), rgba(2, 8, 10, 0.72)),
    url("./assets/dealer-table-bg.svg") center top / cover no-repeat fixed,
    #061014;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(34, 185, 223, 0.16), transparent 34%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.62), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.62));
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 42vh;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(2, 8, 10, 0.74));
  z-index: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  z-index: 1;
}

.app-shell.locked {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.serial-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 20%, rgba(49, 190, 230, 0.18), transparent 35%),
    rgba(2, 8, 10, 0.62);
  backdrop-filter: blur(10px);
}

.serial-gate.show {
  display: grid;
}

.serial-card {
  width: min(430px, 100%);
  padding: 22px;
  display: grid;
  gap: 12px;
  color: #f7fbf8;
  background:
    linear-gradient(180deg, rgba(12, 45, 40, 0.96), rgba(4, 14, 14, 0.95)),
    rgba(5, 20, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.serial-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: #111916;
  background: linear-gradient(180deg, #ffe19a, #c99735);
  border-radius: 50%;
}

.serial-card h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.serial-card p {
  margin: 0;
  color: #c7d5ce;
  line-height: 1.5;
}

.serial-label {
  color: #fff7df;
  font-size: 13px;
  font-weight: 700;
}

.serial-input {
  min-height: 48px;
  width: 100%;
  padding: 0 12px;
  color: #f7fbf8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  outline: 0;
  font-size: 16px;
  letter-spacing: 1px;
}

.serial-input:focus {
  border-color: rgba(255, 225, 154, 0.72);
  box-shadow: 0 0 0 3px rgba(201, 151, 53, 0.18);
}

.serial-button {
  min-height: 48px;
  color: #111916;
  background: linear-gradient(180deg, #ffe19a, #c99735);
  border: 1px solid rgba(255, 232, 164, 0.72);
  border-radius: var(--radius);
  font-weight: 900;
}

.serial-error {
  min-height: 20px;
  color: #ffd2d2 !important;
  font-size: 13px;
}

.topbar {
  min-height: 74px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #f7fbf8;
  background: rgba(5, 12, 14, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.brand p {
  margin: 4px 0 0;
  color: #c7d5ce;
  font-size: 13px;
}

.brand-cards {
  width: 70px;
  height: 44px;
  position: relative;
  flex: 0 0 auto;
}

.mini-card {
  width: 30px;
  height: 40px;
  position: absolute;
  top: 2px;
  display: grid;
  place-items: center;
  color: #17211d;
  background: #fffdf8;
  border: 1px solid rgba(19, 25, 22, 0.22);
  border-radius: 5px;
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.26);
  font-weight: 900;
}

.mini-card:first-child {
  left: 8px;
  rotate: -9deg;
}

.mini-card:last-child {
  right: 8px;
  rotate: 10deg;
}

.red {
  color: var(--red);
}

.black {
  color: #151916;
}

.top-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.rule-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.rule-pills span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: #fff7df;
  border: 1px solid rgba(201, 151, 53, 0.45);
  border-radius: 999px;
  background: rgba(201, 151, 53, 0.12);
  font-size: 13px;
  white-space: nowrap;
}

.share-button {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #111916;
  background: linear-gradient(180deg, #ffe19a, #c99735);
  border: 1px solid rgba(255, 232, 164, 0.72);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  font-size: 13px;
  font-weight: 800;
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

.share-button:hover,
.share-button:focus-visible {
  outline: 0;
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(440px, 1fr) minmax(270px, 330px);
  gap: 16px;
  padding: 16px;
}

.panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.25);
}

.panel {
  min-height: 0;
  overflow: auto;
}

.input-panel,
.tab-panel {
  padding: 16px;
}

.control-card + .control-card {
  margin-top: 18px;
}

.section-heading {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading h2,
.strategy-card h3,
.explain-grid h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.player-heading {
  margin-top: 0;
}

.heading-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f7fbf8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    background 120ms ease;
}

.icon-button:hover,
.icon-button:focus-visible,
.card-button:hover,
.card-button:focus-visible {
  border-color: rgba(255, 225, 154, 0.68);
  outline: 0;
  transform: translateY(-1px);
}

.icon-button.danger:hover,
.icon-button.danger:focus-visible {
  color: #ffffff;
  border-color: var(--ruby);
  background: var(--ruby);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-grid {
  display: grid;
  gap: 8px;
}

.dealer-grid,
.player-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.card-button {
  position: relative;
  min-height: 48px;
  padding: 4px 3px;
  display: grid;
  place-items: center;
  color: #161b18;
  background: #fffdf8;
  border: 1px solid #d4d9d2;
  border-radius: var(--radius);
  box-shadow: 0 6px 14px rgba(21, 33, 29, 0.07);
  font-size: 17px;
  font-weight: 900;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.card-button.selected {
  color: #ffffff;
  background: linear-gradient(180deg, var(--pink-hot), var(--pink));
  border-color: var(--pink-soft);
  box-shadow:
    0 0 0 3px rgba(240, 68, 168, 0.26),
    0 8px 18px rgba(240, 68, 168, 0.2);
}

.card-button[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #161016;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
}

.hand-display {
  min-height: 86px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 155, 198, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.07);
}

.hand-card {
  width: 48px;
  height: 66px;
  position: relative;
  display: grid;
  place-items: center;
  color: #161b18;
  background: #fffefa;
  border: 2px solid var(--pink);
  border-radius: 6px;
  box-shadow:
    0 0 0 2px rgba(255, 214, 239, 0.28),
    0 8px 18px rgba(21, 33, 29, 0.14);
  font-size: 20px;
  font-weight: 900;
}

.hand-card button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--ruby);
  border: 0;
  border-radius: 50%;
  line-height: 1;
}

.empty-hand {
  width: 100%;
  color: #c9d7d1;
  font-size: 14px;
  text-align: center;
}

.rules-summary {
  margin-top: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.rules-summary div {
  padding: 8px 2px;
  display: grid;
  gap: 4px;
}

.rules-summary div + div {
  border-top: 1px solid var(--line);
}

.rules-summary strong {
  font-size: 14px;
}

.rules-summary span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

input[type="checkbox"] {
  width: 40px;
  height: 23px;
  appearance: none;
  position: relative;
  border-radius: 999px;
  border: 1px solid #b8c2bd;
  background: #dfe5e1;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.24);
  transition: transform 140ms ease;
}

input[type="checkbox"]:checked {
  border-color: var(--felt);
  background: var(--felt);
}

input[type="checkbox"]:checked::after {
  transform: translateX(17px);
}

.table-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(420px, 1fr) auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 24, 22, 0.58), rgba(4, 13, 13, 0.84)),
    rgba(5, 20, 18, 0.7);
}

.felt-scene {
  min-height: 420px;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(ellipse at 50% 64%, rgba(47, 189, 235, 0.38) 0 18%, transparent 45%),
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.13) 0 13%, transparent 14%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, rgba(7, 127, 171, 0.72), rgba(8, 85, 118, 0.86));
}

.felt-scene::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -42%;
  height: 78%;
  border: 4px solid rgba(255, 255, 255, 0.26);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.felt-scene::after {
  content: "";
  position: absolute;
  left: 11%;
  right: 11%;
  bottom: -34%;
  height: 64%;
  border: 1px solid rgba(255, 212, 100, 0.7);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.dealer-zone,
.player-zone,
.result-board {
  position: absolute;
  z-index: 1;
}

.dealer-zone {
  left: 50%;
  top: 26px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 8px;
}

.player-zone {
  left: 50%;
  bottom: 28px;
  width: min(420px, 84%);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 8px;
}

.zone-label {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  color: #fff7df;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  font-weight: 700;
}

.large-card {
  width: 66px;
  height: 92px;
  display: grid;
  place-items: center;
  color: #151916;
  background: #fffdf8;
  border: 1px solid rgba(17, 25, 22, 0.24);
  border-radius: 7px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.26);
  font-size: 30px;
  font-weight: 900;
}

.table-hand {
  min-height: 92px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.table-hand .large-card {
  margin-left: -9px;
}

.table-hand .large-card:first-child {
  margin-left: 0;
}

.table-hand .large-card:nth-child(odd) {
  rotate: -2deg;
}

.table-hand .large-card:nth-child(even) {
  rotate: 2deg;
}

.result-board {
  left: 50%;
  top: 52%;
  width: min(520px, calc(100% - 32px));
  padding: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(12, 45, 40, 0.94), rgba(4, 14, 14, 0.94)),
    rgba(9, 23, 19, 0.86);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.action-badge {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: var(--radius);
  color: #ffffff;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.12);
}

.action-badge strong {
  font-size: 32px;
  letter-spacing: 0;
}

.action-badge .icon {
  width: 27px;
  height: 27px;
}

.action-badge.split {
  background: #7d3f98;
}

.action-badge.stand,
.action-badge.blackjack {
  background: var(--felt-deep);
}

.action-badge.hit {
  background: var(--blue);
}

.action-badge.double {
  background: var(--gold);
}

.action-badge.bust {
  background: var(--ruby);
}

#actionSubtitle {
  margin: 12px 0 0;
  color: #dce9e2;
  font-size: 16px;
  line-height: 1.55;
  text-align: center;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.metrics-row div {
  min-height: 66px;
  padding: 9px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.09);
  text-align: center;
}

.metrics-row span {
  color: #bfd1c9;
  font-size: 12px;
}

.metrics-row strong {
  color: #ffffff;
  font-size: 22px;
}

.chip-stack {
  position: relative;
  width: 72px;
  height: 36px;
  margin-top: -6px;
}

.chip-stack span {
  position: absolute;
  width: 42px;
  height: 15px;
  border-radius: 50%;
  border: 4px solid #fff6df;
  background: var(--ruby);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.14);
}

.chip-stack span:nth-child(1) {
  left: 0;
  bottom: 0;
}

.chip-stack span:nth-child(2) {
  left: 15px;
  bottom: 9px;
  background: var(--blue);
}

.chip-stack span:nth-child(3) {
  left: 30px;
  bottom: 18px;
  background: var(--gold);
}

.explain-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.14);
  border-top: 1px solid var(--line);
}

.explain-grid article {
  min-height: 124px;
  padding: 15px;
  background: rgba(4, 18, 16, 0.8);
}

.explain-grid p,
.strategy-card p,
.action-list p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 44px;
  color: #c7d5ce;
  background: transparent;
  border: 0;
  font-weight: 700;
}

.tabs button[aria-selected="true"] {
  color: #ffffff;
  background: linear-gradient(180deg, rgba(25, 118, 83, 0.92), rgba(10, 62, 49, 0.92));
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-list div,
.strategy-card,
.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.action-list div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 9px;
  align-items: center;
}

.action-list p {
  grid-column: 2;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot.split {
  background: #7d3f98;
}

.dot.stand {
  background: var(--felt-deep);
}

.dot.hit {
  background: var(--blue);
}

.dot.double {
  background: var(--gold);
}

.strategy-card {
  margin-top: 14px;
}

.history-list {
  display: grid;
  gap: 9px;
}

.history-item {
  display: grid;
  gap: 6px;
}

.history-item strong {
  color: #ffffff;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  min-height: 82px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  color: #ffffff;
  background: #131b18;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 340px) 1fr;
  }

  .side-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  body {
    background:
      linear-gradient(180deg, rgba(2, 8, 10, 0.08), rgba(2, 8, 10, 0.82)),
      url("./assets/dealer-table-bg.svg") center top / auto 620px no-repeat scroll,
      #061014;
  }

  body::before {
    background:
      linear-gradient(180deg, rgba(2, 8, 10, 0.06), rgba(2, 8, 10, 0.78) 560px),
      linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.4));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    align-items: center;
    padding: 10px 12px;
    min-height: 62px;
  }

  .brand-cards {
    display: none;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    display: none;
  }

  .rule-pills {
    display: none;
  }

  .share-button {
    min-width: 44px;
    padding: 0 10px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .panel,
  .table-panel {
    border-radius: 12px;
  }

  .input-panel,
  .tab-panel {
    padding: 12px;
  }

  .section-heading {
    min-height: 32px;
    margin-bottom: 10px;
  }

  .card-grid {
    gap: 7px;
  }

  .dealer-grid,
  .player-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card-button {
    min-height: 48px;
    font-size: 18px;
  }

  .hand-display {
    min-height: 78px;
    padding: 8px;
  }

  .hand-card {
    width: 44px;
    height: 60px;
    font-size: 19px;
  }

  .table-panel {
    grid-template-rows: minmax(420px, auto) auto;
  }

  .felt-scene {
    min-height: 420px;
  }

  .large-card {
    width: 50px;
    height: 70px;
    font-size: 23px;
  }

  .result-board {
    top: 52%;
    width: calc(100% - 22px);
    padding: 12px;
  }

  .action-badge {
    min-height: 54px;
  }

  .action-badge strong {
    font-size: 25px;
  }

  #actionSubtitle {
    margin-top: 9px;
    font-size: 14px;
  }

  .metrics-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
  }

  .metrics-row div {
    min-height: 54px;
    padding: 7px 4px;
  }

  .metrics-row span {
    font-size: 11px;
  }

  .metrics-row strong {
    font-size: 18px;
  }

  .dealer-zone {
    top: 18px;
  }

  .player-zone {
    bottom: 20px;
    width: min(360px, 88%);
  }

  .table-hand {
    min-height: 74px;
  }

  .table-hand .large-card {
    margin-left: -7px;
  }

  .chip-stack {
    transform: scale(0.86);
    transform-origin: top center;
  }

  .explain-grid {
    grid-template-columns: 1fr;
  }

  .explain-grid article {
    min-height: auto;
    padding: 12px;
  }

  .rules-summary {
    margin-top: 12px;
  }

  .serial-card {
    padding: 18px;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 8px;
  }

  .share-button {
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .share-button .icon {
    width: 18px;
    height: 18px;
  }

  .workspace {
    padding: 8px;
  }

  .felt-scene {
    min-height: 405px;
  }

  .result-board {
    top: 51%;
  }

  .action-badge strong {
    font-size: 23px;
  }

  .metrics-row strong {
    font-size: 17px;
  }
}

@media (max-width: 780px) {
  body {
    min-height: 100svh;
    background: #061014;
  }

  body::before,
  body::after {
    display: none;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .topbar {
    position: fixed;
    top: 8px;
    right: 8px;
    left: auto;
    z-index: 9;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .brand,
  .rule-pills {
    display: none;
  }

  .top-tools {
    display: block;
  }

  .share-button {
    width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 0;
    color: #ffffff;
    background: rgba(4, 20, 19, 0.78);
    border-color: rgba(255, 255, 255, 0.24);
  }

  .share-button .icon {
    width: 19px;
    height: 19px;
  }

  .workspace {
    position: relative;
    width: min(100%, 520px);
    min-height: 100svh;
    margin: 0 auto;
    padding: 34px 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    overflow: hidden;
    background:
      linear-gradient(180deg, rgba(9, 123, 153, 0.94), rgba(7, 92, 121, 0.98)),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 14px);
    border-radius: 20px 20px 0 0;
  }

  .workspace::before,
  .workspace::after {
    content: "";
    position: absolute;
    left: -28%;
    right: -28%;
    bottom: -16%;
    height: 43%;
    pointer-events: none;
    border-radius: 50% 50% 0 0;
  }

  .workspace::before {
    border: 4px solid rgba(255, 255, 255, 0.28);
  }

  .workspace::after {
    left: -10%;
    right: -10%;
    bottom: -10%;
    height: 34%;
    border: 1px solid rgba(255, 214, 92, 0.78);
  }

  .input-panel,
  .table-panel {
    display: contents;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .control-card,
  .felt-scene,
  .explain-grid {
    position: relative;
    z-index: 1;
  }

  .control-card {
    width: min(100%, 430px);
    padding: 12px;
    background: rgba(1, 18, 15, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
  }

  .dealer-control {
    order: 1;
    margin-top: 24px;
  }

  .player-control {
    order: 3;
    margin-top: 0;
  }

  .section-heading {
    min-height: 34px;
    margin-bottom: 10px;
  }

  .section-heading h2 {
    font-size: 16px;
  }

  .heading-actions {
    gap: 8px;
  }

  .icon-button {
    width: 38px;
    min-height: 38px;
    background: rgba(255, 255, 255, 0.1);
  }

  .dealer-grid,
  .player-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
  }

  .card-button {
    min-height: 44px;
    padding: 0;
    border-radius: 8px;
    font-size: 18px;
  }

  .hand-display {
    min-height: 78px;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.08);
  }

  .hand-card {
    width: 44px;
    height: 58px;
    font-size: 19px;
  }

  .rules-summary,
  .side-panel,
  .dealer-zone,
  .player-zone,
  .chip-stack {
    display: none;
  }

  .felt-scene {
    order: 2;
    width: min(100%, 430px);
    min-height: 224px;
    margin: -6px 0;
    overflow: visible;
    background: transparent;
  }

  .felt-scene::before,
  .felt-scene::after {
    display: none;
  }

  .result-board {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    margin: 30px auto;
    padding: 14px;
    transform: none;
    border-color: rgba(255, 255, 255, 0.2);
    background:
      linear-gradient(180deg, rgba(3, 37, 31, 0.96), rgba(1, 18, 15, 0.96)),
      rgba(2, 18, 16, 0.95);
  }

  .action-badge {
    min-height: 64px;
    background: #1e7bb5;
  }

  .action-badge strong {
    font-size: 31px;
  }

  .action-badge .icon {
    width: 25px;
    height: 25px;
  }

  #actionSubtitle {
    margin-top: 12px;
    font-size: 15px;
  }

  .metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
  }

  .metrics-row div {
    min-height: 64px;
    padding: 8px 4px;
  }

  .metrics-row span {
    font-size: 12px;
  }

  .metrics-row strong {
    font-size: 22px;
  }

  .explain-grid {
    order: 4;
    width: calc(100% + 20px);
    margin: 0 -10px;
    grid-template-columns: 1fr;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.12);
  }

  .explain-grid article {
    min-height: auto;
    padding: 13px 16px;
    background: rgba(2, 18, 16, 0.88);
  }

  .explain-grid h3 {
    font-size: 16px;
  }

  .explain-grid p {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.55;
  }
}

@media (max-width: 420px) {
  .workspace {
    padding-inline: 8px;
  }

  .control-card,
  .felt-scene {
    width: 100%;
  }

  .control-card {
    padding: 10px;
  }

  .dealer-control {
    margin-top: 20px;
  }

  .dealer-grid,
  .player-grid {
    gap: 6px;
  }

  .card-button {
    min-height: 40px;
    font-size: 17px;
  }

  .felt-scene {
    min-height: 214px;
  }

  .result-board {
    margin: 27px auto;
    padding: 12px;
  }

  .action-badge strong {
    font-size: 28px;
  }

  .metrics-row {
    gap: 6px;
  }

  .metrics-row strong {
    font-size: 20px;
  }

  .explain-grid {
    width: calc(100% + 16px);
    margin-inline: -8px;
  }
}
