:root {
  color-scheme: dark;
  --ink: #f5f6f2;
  --muted: #a9b7b0;
  --page: #06110e;
  --panel: #0b1c17;
  --panel-strong: #102821;
  --felt: #0d6b46;
  --felt-dark: #084c34;
  --gold: #e7bd61;
  --gold-bright: #ffd77c;
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(31, 112, 78, 0.2), transparent 34rem),
    var(--page);
}

button, summary { font: inherit; }
button { color: inherit; }

button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: #07130f;
  background: var(--gold-bright);
  border-radius: 0.5rem;
  transform: translateY(-160%);
}

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

.site-header {
  width: min(1440px, 100%);
  margin: 0 auto;
  min-height: 68px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  color: #1b1608;
  background: var(--gold);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 900;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.12);
}

nav { display: flex; gap: 0.4rem; }

.text-button {
  padding: 0.65rem 0.85rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.text-button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.text-button:disabled { opacity: 0.4; cursor: wait; }

main {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
}

.intro {
  max-width: 760px;
  margin: 3.6rem auto 2.1rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.intro > p:last-child {
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(560px, 1fr) minmax(200px, 240px);
  gap: 1rem;
  align-items: start;
}

.side-panel {
  padding: 1.15rem;
  background: linear-gradient(160deg, rgba(18, 48, 39, 0.98), rgba(8, 25, 20, 0.98));
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.metric {
  padding: 0.9rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.metric span { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.metric strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.primary-metric { padding-top: 0; }
.primary-metric strong { color: var(--gold-bright); font-size: 1.65rem; }

.session-stats { padding-top: 1.1rem; }
.session-stats h2 { margin: 0 0 0.8rem; font-size: 0.92rem; }
.session-stats dl { margin: 0; display: grid; gap: 0.55rem; }
.session-stats dl div { display: flex; justify-content: space-between; color: var(--muted); }
.session-stats dd { margin: 0; color: var(--ink); font-weight: 750; }
.fine-print { margin: 1.2rem 0 0; color: #83948c; font-size: 0.74rem; line-height: 1.5; }

.table-wrap { min-width: 0; }

.table {
  position: relative;
  min-height: 570px;
  padding: 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(22, 139, 92, 0.85), transparent 68%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 6px),
    var(--felt-dark);
  border: 8px solid #35271d;
  border-radius: 1.6rem 1.6rem 7rem 7rem;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.28), var(--shadow);
}

.table::after {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(255, 221, 151, 0.23);
  border-radius: 1rem 1rem 6.3rem 6.3rem;
}

.dealer-zone, .hand-panel { position: relative; z-index: 1; }

.zone-heading, .hand-heading {
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: rgba(255,255,255,0.9);
  font-size: 0.83rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-label { color: rgba(255,255,255,0.66); font-weight: 500; }
.score-label strong, .score-pill { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }

.score-pill {
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(4, 33, 22, 0.65);
  text-align: center;
}

.card-row {
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.65rem;
}

.empty-label, .empty-hand span { color: var(--ink); font-size: 0.86rem; }

.playing-card {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  height: 128px;
  overflow: hidden;
  color: #151515;
  background: #fffefa;
  border: 1px solid rgba(0,0,0,0.55);
  border-radius: 0.65rem;
  box-shadow: 0 7px 13px rgba(0,0,0,0.28);
  animation: card-in 220ms ease-out both;
}

.playing-card.red { color: #c52332; }

.card-corner {
  position: absolute;
  top: 0.4rem;
  left: 0.48rem;
  display: grid;
  line-height: 0.9;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.card-corner small { font-size: 0.82rem; }
.card-corner-bottom { inset: auto 0.48rem 0.4rem auto; transform: rotate(180deg); }
.card-suit { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); font-size: 2.8rem; }

.card-back {
  border: 5px solid #f1efe4;
  background-color: #162b55;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.13) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.13) 75%),
    linear-gradient(45deg, rgba(255,255,255,.13) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.13) 75%);
  background-position: 0 0, 7px 7px;
  background-size: 14px 14px;
  box-shadow: inset 0 0 0 2px #162b55, 0 7px 13px rgba(0,0,0,0.28);
}

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

.table-rule {
  position: relative;
  z-index: 1;
  width: min(430px, 82%);
  margin: 0.05rem auto 0.35rem;
  padding: 0.45rem 1rem;
  display: flex;
  justify-content: space-around;
  gap: 1rem;
  color: #fff7e8;
  border: 1px solid rgba(255, 225, 165, 0.22);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-hands { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.7rem; }

.hand-panel {
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  transition: 160ms ease;
}

.hand-panel.active { background: rgba(3, 46, 29, 0.28); border-color: rgba(255, 215, 124, 0.32); }
.hand-result { display: block; margin-top: -0.35rem; text-align: center; font-weight: 850; }
.result-win, .result-blackjack { color: #ffe193; }
.result-loss { color: #ffc1be; }
.result-push { color: #d6e3dc; }

.round-status {
  min-height: 52px;
  margin: -0.3rem 1.25rem 0;
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 0.8rem 1rem;
  color: var(--ink);
  background: #10261f;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  box-shadow: 0 10px 24px rgba(0,0,0,0.24);
  text-align: center;
  font-weight: 700;
}

.round-status[data-tone="blackjack"], .round-status[data-tone="win"] { color: #ffe29a; }
.round-status[data-tone="loss"], .round-status[data-tone="warning"] { color: #ffc1be; }

.action-bar {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.action-bar button, .deal-button {
  min-height: 48px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 0.65rem;
  background: #16372d;
  box-shadow: 0 5px 14px rgba(0,0,0,0.2);
  cursor: pointer;
  font-weight: 760;
}

.action-bar button { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; }
.action-bar button:hover:not(:disabled) { background: #1e4a3d; transform: translateY(-1px); }
.action-bar button:disabled, .deal-button:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
kbd { padding: 0.1rem 0.3rem; color: var(--muted); background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.12); border-radius: 0.25rem; font-size: 0.7rem; }

.betting-panel h2 { margin: 0; font-size: 1rem; }
.betting-panel > p { margin: 0.35rem 0 1rem; color: var(--muted); font-size: 0.82rem; }

.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin-bottom: 1rem; }

.chip {
  position: relative;
  width: 58px;
  height: 58px;
  margin: auto;
  color: white;
  border: 5px dashed rgba(255,255,255,0.72);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,0.18), 0 5px 11px rgba(0,0,0,0.28);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
  transition: 150ms ease;
}

.chip:hover:not(:disabled) { transform: translateY(-3px) rotate(3deg); }
.chip:disabled { opacity: 0.28; cursor: not-allowed; }
.chip-one { background: #3f4b55; }
.chip-five { background: #b62c3b; }
.chip-ten { background: #2254a0; }
.chip-twenty-five { background: #237346; }
.chip-hundred { background: #1b1b1c; }

.deal-button {
  width: 100%;
  color: #1d1607;
  background: linear-gradient(#f2d486, #d9aa4d);
  border-color: #f8df9e;
}

.deal-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.bet-links { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.7rem; }
.bet-links button { min-height: 38px; border: 1px solid var(--line); border-radius: 0.5rem; background: transparent; color: var(--muted); cursor: pointer; }
.bet-links button:hover:not(:disabled) { color: var(--ink); background: rgba(255,255,255,0.05); }
.bet-links button:disabled { opacity: 0.35; cursor: not-allowed; }

.content-grid {
  max-width: 1060px;
  margin: 5rem auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.content-grid article, .faq {
  padding: 1.5rem;
  color: var(--muted);
  background: rgba(13, 31, 25, 0.68);
  border: 1px solid var(--line);
  border-radius: 1rem;
  line-height: 1.65;
}

.content-grid h2, .faq h2 { margin: 0 0 0.85rem; color: var(--ink); font-size: 1.1rem; }
.content-grid p, .content-grid ol, .content-grid ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.content-grid p { padding-left: 0; }
.content-grid li + li { margin-top: 0.45rem; }
.check-list { list-style: "✓  "; }

.faq { max-width: 1060px; margin: 1rem auto 5rem; }
.faq details { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.faq details:first-of-type { border-top: 0; }
.faq summary { color: var(--ink); cursor: pointer; font-weight: 720; }
.faq details p { margin: 0.65rem 0 0; font-size: 0.9rem; }

footer { padding: 1.6rem; color: #7f9088; border-top: 1px solid var(--line); text-align: center; font-size: 0.78rem; }

dialog {
  width: min(540px, calc(100% - 2rem));
  padding: 1.4rem;
  color: var(--ink);
  background: #10251e;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 1rem;
  box-shadow: 0 25px 80px rgba(0,0,0,0.65);
}

dialog::backdrop { background: rgba(0, 7, 5, 0.8); backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-header h2 { margin: 0; }
.dialog-header button { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: rgba(255,255,255,0.08); cursor: pointer; font-size: 1.4rem; }
dialog > p { color: var(--muted); line-height: 1.55; }
.rules-list { margin: 1rem 0; }
.rules-list div { display: grid; grid-template-columns: 5rem 1fr; gap: 0.8rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.rules-list dt { font-weight: 800; }
.rules-list dd { margin: 0; color: var(--muted); }
.dialog-note { padding: 0.8rem; background: rgba(255,255,255,0.04); border-radius: 0.6rem; font-size: 0.85rem; }

@media (max-width: 1080px) {
  .game-shell { grid-template-columns: minmax(170px, 210px) minmax(0, 1fr); }
  .betting-panel { grid-column: 1; grid-row: 2; }
  .table-wrap { grid-column: 2; grid-row: 1 / span 2; }
}

@media (max-width: 760px) {
  .site-header { padding: 0 0.9rem; }
  main { width: min(100% - 1rem, 680px); }
  .intro { margin: 2.6rem auto 1.5rem; }
  .game-shell { display: flex; flex-direction: column; }
  .table-wrap { order: 1; width: 100%; }
  .stats-panel { order: 2; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .betting-panel { order: 3; width: 100%; }
  .session-stats, .fine-print { grid-column: 1 / -1; }
  .chips { grid-template-columns: repeat(5, 1fr); }
  .table { min-height: 540px; padding: 1rem; border-width: 6px; border-radius: 1.1rem 1.1rem 4rem 4rem; }
  .playing-card { flex-basis: 76px; width: 76px; height: 111px; }
  .card-row { min-height: 130px; padding-inline: 0.2rem; }
  .player-hands { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .content-grid { margin-top: 3.5rem; grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .brand > span:last-child { display: none; }
  .text-button { padding-inline: 0.55rem; font-size: 0.85rem; }
  .intro { padding-inline: 0.5rem; }
  .table { min-height: 490px; padding: 0.75rem; }
  .playing-card { flex-basis: 62px; width: 62px; height: 91px; border-radius: 0.45rem; }
  .card-row { min-height: 106px; gap: 0.35rem; }
  .card-corner { top: 0.3rem; left: 0.34rem; font-size: 0.8rem; }
  .card-corner small { font-size: 0.64rem; }
  .card-corner-bottom { inset: auto 0.34rem 0.3rem auto; }
  .card-suit { font-size: 2rem; }
  .table-rule { width: 92%; font-size: 0.59rem; gap: 0.35rem; }
  .zone-heading, .hand-heading { font-size: 0.68rem; }
  .player-hands { grid-template-columns: 1fr; }
  .hand-panel { padding: 0.4rem; }
  .action-bar button { min-width: 0; font-size: 0.78rem; }
  kbd { display: none; }
  .chips { gap: 0.25rem; }
  .chip { width: 48px; height: 48px; border-width: 4px; font-size: 0.72rem; }
  .round-status { margin-inline: 0.4rem; font-size: 0.85rem; }
}

@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; }
}
