:root {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 60%);
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 80px 20px 40px;
}

main {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

p {
  line-height: 1.6;
  color: #cbd5f5;
}

.disclaimer {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-top: 12px;
}

.card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.55);
}

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

.bank-amount {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: #38bdf8;
}

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

.primary-button,
.secondary-button {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 24px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #0f172a;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.3);
}

.primary-button:hover,
.primary-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(56, 189, 248, 0.45);
}

.secondary-button {
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.secondary-button:hover,
.secondary-button:focus {
  transform: translateY(-1px);
  background: rgba(148, 163, 184, 0.25);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.link-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.25);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(56, 189, 248, 0.25);
}

.link-card span {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-top: 12px;
}

/* Baccarat */

.baccarat-table {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.baccarat-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.bet-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
}

.bet-options legend {
  padding: 0 8px;
  font-weight: 600;
  color: #e2e8f0;
}

.bet-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.bet-options input[type="radio"] {
  accent-color: #38bdf8;
}

.hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.hand-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
  min-height: 160px;
}

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

.playing-card {
  min-width: 56px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  box-shadow: inset 0 0 18px rgba(15, 23, 42, 0.6);
}

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

.hand-total {
  font-weight: 600;
  color: #f8fafc;
}

.round-summary {
  font-weight: 600;
  color: #f8fafc;
  min-height: 1.5em;
}

.side-bet-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
}

.side-bet-options legend {
  padding: 0 8px;
  font-weight: 600;
  color: #e2e8f0;
}

.side-bet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 160px);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.45);
}

.side-bet-toggle {
  display: flex;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.side-bet-toggle input[type="checkbox"] {
  accent-color: #fbbf24;
}

.side-bet-amount {
  font-weight: 600;
  color: #cbd5f5;
}

.side-bet-row input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

.tracker-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.roadmap header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.roadmap-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0;
}

.roadmap-placeholder {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  font-size: 0.9rem;
  color: #94a3b8;
  text-align: center;
}

.roadmap-scroll {
  position: relative;
  max-height: 260px;
  max-width: 100%;
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.roadmap-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.roadmap-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}

.roadmap-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.65);
}

.bead-grid,
.big-road-grid {
  display: inline-grid;
  grid-template-rows: repeat(6, auto);
  grid-auto-flow: column;
  gap: 6px;
  min-height: 180px;
  min-width: 100%;
  width: max-content;
}

.bead-cell,
.road-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  background: rgba(148, 163, 184, 0.35);
}

.big-road-grid .road-cell {
  border-radius: 12px;
  width: 36px;
  height: 36px;
}

.bead-cell.result-player,
.road-cell.result-player {
  background: rgba(56, 189, 248, 0.85);
}

.bead-cell.result-banker,
.road-cell.result-banker {
  background: rgba(239, 68, 68, 0.85);
  color: #fee2e2;
}

.bead-cell.result-tie,
.road-cell.result-tie {
  background: rgba(16, 185, 129, 0.85);
  color: #ecfdf5;
}

.road-cell.is-empty {
  background: transparent;
  border: 1px dashed rgba(148, 163, 184, 0.2);
}

.natural-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.8);
}

.tie-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ecfdf5;
}

.big-road-grid .tie-count {
  color: #f1f5f9;
}

@media (max-width: 640px) {
  .side-bet-row {
    grid-template-columns: 1fr;
  }

  .side-bet-amount {
    justify-self: start;
  }
}

/* Slots */

.slot-machine {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 16px;
  justify-items: center;
  padding: 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: clamp(3rem, 6vw, 4rem);
}

.reel {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: inset 0 0 30px rgba(15, 23, 42, 0.6);
}

.bet-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

input[type="number"] {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 1rem;
  width: 120px;
}

select {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 1rem;
  width: 100%;
  appearance: none;
}

.status-text {
  font-size: 1rem;
  color: #fbbf24;
  min-height: 1.5em;
}

/* Barn Derby */

.derby-game {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.derby-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.derby-form fieldset {
  border: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.derby-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: #e2e8f0;
}

.derby-form input[type="number"] {
  width: 100%;
}

.derby-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.derby-summary {
  font-weight: 600;
  color: #f8fafc;
  min-height: 1.5em;
}

.derby-track {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 60px 16px 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  min-height: 320px;
  overflow: hidden;
}

.derby-track::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 44px;
  bottom: 16px;
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(226, 232, 240, 0.85) 0,
    rgba(226, 232, 240, 0.85) 8px,
    rgba(56, 189, 248, 0.7) 8px,
    rgba(56, 189, 248, 0.7) 16px
  );
  border-radius: 999px;
  opacity: 0.85;
}

.derby-lane {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  position: relative;
  overflow: hidden;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.derby-lane.is-selected {
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.derby-lane.is-winning {
  border-color: rgba(250, 204, 21, 0.85);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35);
}

.derby-lane.is-placed {
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.derby-lane.is-show {
  border-color: rgba(72, 187, 120, 0.7);
  box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.25);
}

.lane-label {
  text-align: center;
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.95rem;
}

.lane-runway {
  position: relative;
  height: 48px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.lane-runway::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: 20px;
  width: 6px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(226, 232, 240, 0.85) 0,
    rgba(226, 232, 240, 0.85) 6px,
    rgba(56, 189, 248, 0.8) 6px,
    rgba(56, 189, 248, 0.8) 12px
  );
  border-radius: 999px;
  opacity: 0.9;
}

.derby-horse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 56px;
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-size: 1.5rem;
  font-weight: 700;
  transform: translate(var(--progress, 0px), -50%);
  transition: transform 0.25s ease;
}

.derby-horse.no-transition {
  transition: none !important;
}

.horse-icon {
  line-height: 1;
}

.derby-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-order {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.result-order li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.place-label {
  font-weight: 700;
  color: #38bdf8;
}

.derby-payout-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.derby-payout-table th,
.derby-payout-table td {
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 12px;
  text-align: left;
}

.derby-payout-table thead {
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
}

.derby-payout-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.6);
}

.derby-payout-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.45);
}

/* Blackjack */

.blackjack-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 72px;
}

.card-chip {
  min-width: 60px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  text-align: center;
  font-size: 1.2rem;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.15);
}

.hand-label {
  font-size: 0.95rem;
  color: #94a3b8;
  margin-bottom: 8px;
}

.message-area {
  min-height: 48px;
  font-size: 1.05rem;
  color: #f9a8d4;
}

.hand-total {
  flex-basis: 100%;
  font-size: 0.95rem;
  color: #38bdf8;
  margin-top: 4px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* Bonus modal */

.bonus-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(6px);
  z-index: 1200;
}

.bonus-modal.active {
  display: flex;
}

.bonus-content {
  background: rgba(2, 6, 23, 0.92);
  border-radius: 20px;
  padding: 32px;
  max-width: 420px;
  text-align: center;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.6);
}

.bonus-content h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.bonus-content p {
  margin-bottom: 20px;
  color: #cbd5f5;
}

/* Disclaimer acknowledgment gate */
.ack-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(6px);
  z-index: 2000;
  padding: 20px;
}
.ack-content {
  background: rgba(2, 6, 23, 0.96);
  border-radius: 20px;
  padding: 32px;
  max-width: 440px;
  text-align: center;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.6);
}
.ack-content h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}
.ack-content p {
  margin: 10px 0;
  color: #cbd5e1;
  line-height: 1.5;
}
.ack-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.ack-actions .secondary-button {
  display: inline-block;
  text-decoration: none;
}

@media (max-width: 640px) {
  body {
    padding-top: 100px;
  }

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