:root {
  color-scheme: dark;
  --bg: #06090e;
  --panel: #111a25;
  --panel-2: #162638;
  --line: #314a66;
  --text: #eff7ff;
  --muted: #9db2c9;
  --soft: #c9d7e6;
  --accent: #66dec8;
  --accent-2: #f2c45e;
  --danger: #e97072;
  --good: #7ee394;
  --felt: #0d2b25;
  --shadow: rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -8rem, #173856 0, #0b111a 35rem, var(--bg) 100%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px 14px calc(118px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(6, 9, 14, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  width: min(100%, 920px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
}

.back {
  color: var(--accent);
  text-decoration: none;
  font-weight: 850;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.hero,
.panel,
.game-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 32px var(--shadow);
}

.hero {
  padding: 21px;
  margin-bottom: 14px;
}

.panel {
  padding: 15px;
  margin-bottom: 12px;
}

.felt {
  background:
    radial-gradient(circle at 25% 20%, rgba(102, 222, 200, 0.12), transparent 18rem),
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)),
    var(--felt);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 850;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 8vw, 56px);
  line-height: 1.04;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.lede,
.muted,
small {
  color: var(--muted);
}

.lede {
  font-size: 18px;
  line-height: 1.38;
}

.game-list {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .game-list {
    grid-template-columns: 1fr 1fr;
  }
}

.game-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
}

.game-card strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.game-number {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 8px;
  background: #081118;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 29px;
  font-weight: 950;
}

.grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 720px) {
  .grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .grid.three {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-row:last-child {
  border-bottom: 0;
}

.label {
  color: var(--muted);
}

.value {
  text-align: right;
  font-weight: 850;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 11px;
}

.playing-card {
  width: 74px;
  min-height: 102px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: #f7f3e8;
  color: #121923;
  padding: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}

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

.playing-card.back {
  background:
    repeating-linear-gradient(45deg, rgba(102,222,200,0.22) 0 7px, rgba(242,196,94,0.12) 7px 14px),
    #0a1520;
  border-color: var(--line);
  color: var(--accent);
}

.playing-card button {
  all: unset;
}

.rank {
  font-weight: 950;
  font-size: 20px;
  line-height: 1;
}

.suit {
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 950;
}

.card-value {
  color: #45515e;
  font-size: 12px;
  font-weight: 850;
}

.red .card-value {
  color: #8c2430;
}

.pocketed {
  outline: 3px solid var(--accent-2);
}

.board-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0 5px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 500px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }
}

.action {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #04110e;
  font-size: 17px;
  font-weight: 950;
}

.action.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.action.warn {
  background: var(--accent-2);
  color: #1c1300;
}

.action.danger {
  background: var(--danger);
  color: #180303;
}

.action:disabled {
  opacity: 0.42;
}

.log {
  min-height: 92px;
  white-space: pre-wrap;
  color: var(--soft);
  line-height: 1.38;
  font-size: 17px;
}

.rules {
  margin: 0;
  padding-left: 20px;
  color: var(--soft);
  line-height: 1.42;
}

.rules li {
  margin: 6px 0;
}

.rule-card {
  padding: 13px;
  border-radius: 8px;
  background: rgba(8, 17, 24, 0.72);
  border: 1px solid rgba(255,255,255,0.1);
}

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

.stage-step {
  padding: 8px 5px;
  border-radius: 8px;
  text-align: center;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stage-step.active {
  color: #06110f;
  background: var(--accent);
}

.result-good {
  color: var(--good);
}

.result-bad {
  color: var(--danger);
}
