:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-muted: #eff4f1;
  --ink: #14202b;
  --muted: #5f6d79;
  --line: #d9e4dc;
  --accent: #22c55e;
  --accent-dark: #167c3d;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --danger: #dc2626;
  --gold: #d97706;
  --shadow: 0 18px 38px rgba(20, 32, 43, 0.09);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.14), transparent 32%),
    linear-gradient(180deg, #f9fbfc 0%, #eef2f5 100%);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.game-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.masthead,
.control-strip,
.round-banner,
.scoreboard-panel,
.play-panel,
.help-grid details,
.target-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.masthead,
.control-strip,
.round-banner,
.scoreboard-panel,
.play-panel,
.help-grid details {
  border-radius: 24px;
}

.masthead {
  padding: 24px;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-link,
.quit-link {
  text-decoration: none;
  font-weight: 700;
}

.brand-link {
  color: var(--ink);
}

.quit-link {
  color: var(--accent-dark);
}

.hero-card {
  margin-top: 22px;
  padding: 28px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(20, 32, 43, 0.97), rgba(20, 32, 43, 0.9)),
    linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(34, 197, 94, 0));
  color: #fff;
}

.eyebrow,
.panel-kicker,
.banner-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 0.95;
}

.tm {
  font-size: 0.4em;
  vertical-align: top;
}

.byline-brand {
  display: block;
  margin-top: 8px;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
}

.byline-family {
  display: inline-block;
  margin-left: 0.45em;
  font-style: italic;
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 244, 186, 0.96);
}

.tagline {
  margin: 14px 0 10px;
  font-size: 1.08rem;
  font-weight: 700;
}

.hero-copy,
.setup-note,
.detail-copy p,
.score-breakdown,
.cards-heading p,
.log-list,
.player-note {
  color: var(--muted);
}

.hero-copy {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.86);
}

.hero-actions,
.panel-actions,
.target-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  background: var(--accent);
  color: #06210f;
}

.button.secondary {
  background: var(--panel-muted);
  border-color: var(--line);
  color: var(--ink);
}

.button.is-flashing {
  animation: next-round-flash 1.05s ease-in-out infinite;
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
}

.button.tertiary {
  background: transparent;
  border-color: rgba(20, 32, 43, 0.18);
  color: var(--ink);
}

.control-strip,
.round-banner {
  margin-top: 18px;
  padding: 18px 22px;
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

.name-entry {
  display: grid;
  gap: 8px;
  min-width: min(100%, 260px);
  font-weight: 700;
}

.name-entry span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.name-entry input {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.name-entry input:focus {
  outline: 2px solid rgba(34, 197, 94, 0.24);
  outline-offset: 1px;
  border-color: rgba(34, 197, 94, 0.65);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.name-requirement {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.round-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.round-banner h2,
.panel-header h2,
.cards-heading h3,
.player-summary h3 {
  margin: 0;
}

.banner-metrics,
.summary-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-pill,
.summary-stat {
  min-width: 110px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

.metric-pill span,
.summary-stat span,
.summary-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.metric-pill strong,
.summary-stat strong,
.summary-score strong {
  font-size: 1.15rem;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.scoreboard-panel,
.play-panel {
  padding: 24px;
}

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

.player-grid {
  display: grid;
  gap: 14px;
}

.player-tile {
  padding: 18px;
  border-radius: 18px;
  background: #fbfcfd;
  border: 1px solid var(--line);
}

.player-tile.is-current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.player-tile.is-human .player-name::after {
  content: "You";
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 700;
}

.player-topline,
.player-footer,
.player-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.player-name {
  margin: 0;
  font-size: 1.05rem;
}

.player-total {
  text-align: right;
}

.player-total span,
.player-footer span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
}

.player-total strong {
  font-size: 1.4rem;
}

.status-pill,
.dealer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
}

.status-pill.bank {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.status-pill.crash {
  color: var(--danger);
  background: rgba(220, 38, 38, 0.1);
}

.status-pill.live {
  color: var(--ink);
}

.dealer-pill {
  color: #7c5208;
  background: rgba(217, 119, 6, 0.12);
}

.player-footer {
  margin-top: 14px;
  flex-wrap: wrap;
}

.current-player-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfd;
}

.summary-score {
  min-width: 128px;
  text-align: right;
}

.summary-score span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.summary-score strong {
  font-size: 2.1rem;
  color: var(--accent-dark);
}

.score-breakdown {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.cards-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.95fr);
  gap: 18px;
  margin-top: 18px;
}

.cards-column {
  min-width: 0;
}

.cards-heading {
  margin-bottom: 10px;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.empty-state {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: var(--panel-muted);
}

.game-card {
  width: 150px;
  min-height: 174px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(20, 32, 43, 0.07);
}

.game-card.number {
  border-color: rgba(34, 197, 94, 0.28);
}

.game-card.bonus {
  border-color: rgba(217, 119, 6, 0.28);
}

.game-card.action {
  border-color: rgba(20, 32, 43, 0.22);
}

.game-card.keeper {
  border-color: rgba(59, 130, 246, 0.28);
}

.card-type {
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.card-title {
  margin: 8px 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
}

.card-subtitle {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.card-value {
  font-size: 2.1rem;
  font-weight: 900;
}

.card-copy {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.log-list {
  margin: 0;
  padding: 0 0 0 18px;
  max-height: 500px;
  overflow: auto;
}

.log-list li + li {
  margin-top: 10px;
}

.help-grid {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.help-grid details {
  padding: 18px 20px;
}

.help-grid summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.help-grid summary::-webkit-details-marker {
  display: none;
}

.detail-copy {
  margin-top: 14px;
}

.detail-copy p {
  margin: 0;
}

.detail-copy p + p {
  margin-top: 12px;
}

.target-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 32, 43, 0.52);
  padding: 20px;
  z-index: 30;
}

.target-dialog {
  width: min(560px, 100%);
  border-radius: 24px;
  padding: 24px;
}

.target-dialog h2 {
  margin: 0 0 10px;
}

.target-dialog p {
  color: var(--muted);
}

.target-options {
  margin-top: 20px;
}

.target-options .button {
  flex: 1 1 180px;
}

.crash-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 32, 43, 0.36);
  padding: 20px;
  z-index: 40;
}

.crash-dialog {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 28px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(255, 245, 157, 0.98) 0%, rgba(253, 224, 71, 0.98) 28%, rgba(249, 115, 22, 0.96) 58%, rgba(220, 38, 38, 0.96) 100%);
  box-shadow: 0 28px 56px rgba(20, 32, 43, 0.28);
  color: #29120a;
  animation: crash-pop 0.28s ease-out;
}

.crash-burst {
  font-size: 4rem;
  line-height: 1;
}

.crash-dialog h2 {
  margin: 10px 0 8px;
  font-size: clamp(2rem, 5vw, 2.8rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.crash-dialog p {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(41, 18, 10, 0.86);
}

.winner-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 32, 43, 0.42);
  padding: 20px;
  z-index: 45;
}

.winner-dialog {
  position: relative;
  overflow: hidden;
  width: min(620px, 100%);
  padding: 34px 30px 28px;
  border-radius: 30px;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94) 58%, rgba(239, 244, 241, 0.96) 100%);
  box-shadow: 0 34px 76px rgba(20, 32, 43, 0.24);
  text-align: center;
  border: 1px solid rgba(34, 197, 94, 0.22);
  animation: winner-pop 0.38s ease-out;
}

.winner-celebration {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.streamer,
.confetti {
  position: absolute;
  display: block;
}

.streamer {
  top: -20px;
  width: 10px;
  height: 160px;
  border-radius: 999px;
  opacity: 0.88;
  animation: streamer-sway 2.4s ease-in-out infinite;
}

.streamer-a { left: 12%; background: linear-gradient(180deg, #22c55e, #166534); transform: rotate(-18deg); }
.streamer-b { left: 30%; background: linear-gradient(180deg, #facc15, #d97706); transform: rotate(10deg); animation-delay: -0.5s; }
.streamer-c { right: 27%; background: linear-gradient(180deg, #60a5fa, #1d4ed8); transform: rotate(-8deg); animation-delay: -1.1s; }
.streamer-d { right: 10%; background: linear-gradient(180deg, #f472b6, #be185d); transform: rotate(18deg); animation-delay: -0.8s; }

.confetti {
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: confetti-fall 3.6s linear infinite;
  opacity: 0.9;
}

.confetti-1 { left: 8%; top: -12px; background: #22c55e; animation-delay: -0.2s; }
.confetti-2 { left: 20%; top: -24px; background: #f97316; animation-delay: -1.3s; }
.confetti-3 { left: 36%; top: -16px; background: #38bdf8; animation-delay: -2.4s; }
.confetti-4 { left: 48%; top: -22px; background: #eab308; animation-delay: -0.9s; }
.confetti-5 { left: 60%; top: -10px; background: #ec4899; animation-delay: -2.1s; }
.confetti-6 { left: 72%; top: -28px; background: #22c55e; animation-delay: -1.6s; }
.confetti-7 { left: 84%; top: -18px; background: #6366f1; animation-delay: -0.7s; }
.confetti-8 { left: 92%; top: -6px; background: #f97316; animation-delay: -2.9s; }

.winner-dialog h2 {
  position: relative;
  margin: 6px 0 8px;
  font-size: clamp(2.2rem, 6vw, 3.3rem);
  line-height: 1;
}

.winner-scoreline {
  position: relative;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.winner-copy {
  position: relative;
  max-width: 420px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 1rem;
}

.winner-actions {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

@keyframes next-round-flash {
  0%,
  100% {
    background: var(--panel-muted);
    color: var(--ink);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.12);
    transform: translateY(0);
  }

  50% {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-dark);
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.08);
    transform: translateY(-1px);
  }
}

@keyframes crash-pop {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }

  70% {
    transform: scale(1.04);
    opacity: 1;
  }

  100% {
    transform: scale(1);
  }
}

@keyframes winner-pop {
  0% {
    transform: translateY(18px) scale(0.92);
    opacity: 0;
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes streamer-sway {
  0%,
  100% {
    transform: translateY(0) rotate(-10deg);
  }

  50% {
    transform: translateY(8px) rotate(12deg);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-12px) rotate(0deg);
  }

  100% {
    transform: translateY(360px) rotate(420deg);
  }
}

@media (max-width: 1080px) {
  .table-layout,
  .cards-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .game-shell {
    width: min(100% - 20px, 100%);
    padding-top: 12px;
  }

  .masthead,
  .control-strip,
  .round-banner,
  .scoreboard-panel,
  .play-panel,
  .help-grid details {
    border-radius: 18px;
  }

  .masthead,
  .scoreboard-panel,
  .play-panel {
    padding: 18px;
  }

  .topline,
  .round-banner,
  .panel-header,
  .player-topline,
  .player-footer,
  .player-summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .control-strip {
    align-items: flex-start;
  }

  .summary-score,
  .player-total {
    text-align: left;
  }

  .game-card {
    width: 100%;
  }
}
