:root {
  color-scheme: dark;
  --bg: #07110f;
  --panel: rgba(17, 31, 28, 0.92);
  --panel-2: #132a24;
  --felt: #0f523b;
  --felt-dark: #0a3529;
  --gold: #e9b949;
  --cream: #f4ecd8;
  --ink: #12201c;
  --muted: #a7bbb4;
  --red: #c94d55;
  --line: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 111, 82, 0.28), transparent 38%),
    linear-gradient(145deg, #091714, var(--bg));
  color: var(--cream);
}
button, input { font: inherit; }
select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { width: min(1440px, 96vw); margin: 0 auto; padding: 28px 0 60px; }
.topbar { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.eyebrow, .tag { color: var(--gold); font-size: 12px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 4px 0 0; font-size: clamp(30px, 4vw, 52px); line-height: 1; }
.subtitle { margin: 10px 0 0; color: var(--muted); }
.match-meta { display: flex; gap: 10px; }
.match-meta span, .chip-badge { border: 1px solid var(--line); background: rgba(0,0,0,.2); border-radius: 999px; padding: 8px 12px; color: var(--muted); font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.welcome-panel { min-height: 540px; padding: clamp(28px, 5vw, 70px); display: grid; align-content: center; grid-template-columns: 1fr auto; gap: 60px; }
.welcome-panel h2 { font-size: clamp(28px, 4vw, 48px); margin: 8px 0 18px; max-width: 720px; }
.welcome-panel p, .welcome-panel li { color: #c9d7d2; line-height: 1.7; }
.welcome-panel ul { padding-left: 20px; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 12px; margin-top: 22px; max-width: 680px; }
.setup-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.setup-grid select, .skill-panel select { color: var(--cream); background: #07110f; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.primary, .secondary { border-radius: 12px; padding: 12px 18px; border: 1px solid transparent; font-weight: 800; }
.primary { color: #152018; background: linear-gradient(135deg, #f6cf66, var(--gold)); box-shadow: 0 8px 24px rgba(233,185,73,.18); }
.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary.large { align-self: center; padding: 18px 28px; font-size: 17px; }
.secondary { color: var(--cream); background: transparent; border-color: var(--line); }
.game-layout { display: grid; grid-template-columns: 270px 1fr; gap: 18px; }
.standings-panel { padding: 18px; height: fit-content; }
.section-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-title small { color: var(--muted); font-weight: 500; }
.standing-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: center; }
.standing-row.you { color: var(--gold); }
.seat-dot { width: 10px; height: 10px; border-radius: 50%; background: #4f806d; }
.standing-row.you .seat-dot { background: var(--gold); }
.score { font-size: 22px; font-weight: 900; }
.rule-note { margin-top: 18px; background: rgba(233,185,73,.08); border: 1px solid rgba(233,185,73,.18); padding: 14px; border-radius: 12px; }
.rule-note strong, .rule-note span { display: block; }
.rule-note span { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.skill-summary { margin-top: 12px; padding: 13px; border-radius: 12px; background: rgba(79,114,147,.12); border: 1px solid rgba(105,156,202,.2); font-size: 12px; line-height: 1.65; color: #c8dcea; }
.skill-summary strong { color: var(--cream); }
.table-zone { display: grid; gap: 16px; }
.table-felt { min-height: 500px; border-radius: 38px; border: 10px solid #462f20; background: radial-gradient(circle, var(--felt), var(--felt-dark)); box-shadow: inset 0 0 80px rgba(0,0,0,.34), 0 22px 60px rgba(0,0,0,.3); padding: 25px 34px; display: grid; grid-template-rows: auto 1fr auto; }
.opponents { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.opponent { text-align: center; background: rgba(0,0,0,.16); border-radius: 12px; padding: 10px; }
.opponent strong, .opponent span { display: block; }
.opponent span { color: #b9d1c8; font-size: 12px; margin-top: 4px; }
.board-area { align-self: center; max-width: 680px; width: 100%; margin: 0 auto; }
.section-title.light { border-color: rgba(255,255,255,.2); }
.player-area { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.player-info { display: grid; gap: 10px; }
.player-info > div:first-child { display: flex; align-items: center; gap: 10px; }
.hand-readout { color: #d5e7df; font-size: 14px; }
.card-row { display: flex; gap: 8px; min-height: 92px; align-items: center; }
.card-row.centered { justify-content: center; }
.card { width: 62px; height: 88px; border-radius: 9px; background: var(--cream); color: var(--ink); display: grid; place-items: center; font-family: Georgia, serif; font-weight: 900; font-size: 22px; box-shadow: 0 6px 14px rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.7); position: relative; }
.card.red { color: #b12e39; }
.card.back { background: repeating-linear-gradient(45deg, #162e49, #162e49 6px, #244b73 6px, #244b73 12px); border-color: #d9e5ef; color: white; }
.card.best { outline: 3px solid var(--gold); transform: translateY(-5px); }
.action-panel { padding: 18px 20px; }
.message { color: #d6e1dd; line-height: 1.6; }
.skill-panel { margin-top: 14px; padding: 14px; border: 1px solid rgba(105,156,202,.28); background: rgba(40,76,104,.14); border-radius: 12px; }
.skill-panel h3 { margin: 0 0 8px; color: #b9d9f2; }
.skill-panel p { margin: 6px 0 10px; color: var(--muted); font-size: 13px; }
.skill-panel .skill-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-panel label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.candidate.skill-target { border-color: #74b6e8; background: rgba(68,139,194,.14); }
.candidate-header { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin: 8px 0 14px; }
.candidate-header h2 { margin: 0; font-size: 20px; }
.candidate-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.legend { color: var(--muted); font-size: 12px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 10px; }
.dot.known { background: var(--gold); } .dot.unknown { background: #4f7293; }
.candidate-grid { display: grid; grid-template-columns: repeat(10, minmax(64px, 1fr)); gap: 8px; }
.candidate { min-width: 0; padding: 7px 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); text-align: center; transition: .15s; }
.candidate:hover { background: rgba(255,255,255,.08); }
.candidate.selected { border-color: var(--gold); background: rgba(233,185,73,.1); }
.candidate .card { width: 48px; height: 68px; font-size: 17px; margin: 0 auto 6px; }
.candidate label { display: block; color: var(--muted); font-size: 11px; }
.bet-controls { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.bet-control { background: rgba(0,0,0,.18); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.bet-control input { width: 80px; background: #07110f; color: var(--cream); border: 1px solid var(--line); border-radius: 7px; padding: 7px; }
.action-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.reveal-table { overflow-x: auto; margin-top: 12px; }
.reveal-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.reveal-table th, .reveal-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: center; }
.reveal-table th { color: var(--muted); }
.winner-banner { padding: 16px; border: 1px solid rgba(233,185,73,.25); background: rgba(233,185,73,.08); border-radius: 12px; margin-top: 12px; }

@media (max-width: 900px) {
  .topbar { align-items: start; gap: 16px; }
  .game-layout { grid-template-columns: 1fr; }
  .standings-panel { order: 2; }
  .candidate-grid { grid-template-columns: repeat(5, 1fr); }
  .welcome-panel { grid-template-columns: 1fr; }
  .player-area { flex-direction: column-reverse; align-items: start; }
}

@media (max-width: 560px) {
  .app-shell { width: 100%; padding: 18px 10px 40px; }
  .topbar { display: block; }
  .match-meta { margin-top: 14px; }
  .table-felt { padding: 18px 12px; border-width: 6px; }
  .opponents { gap: 6px; }
  .opponent { padding: 8px 4px; }
  .candidate-grid { grid-template-columns: repeat(2, 1fr); }
  .setup-grid { grid-template-columns: 1fr; }
  .card { width: 52px; height: 74px; }
}
