/* ============================================================
   Bridge Game-Show Suite — one shared visual identity.
   Warm paper, navy + gold, traditional card colors, serif display.
   Designed to read from the back of a room on a projector and to
   still work on a phone. Honors reduced-motion.
   ============================================================ */

:root {
  --paper:      #f4eede;   /* warm off-white background            */
  --paper-2:    #efe7d3;   /* slightly deeper panel                */
  --ink:        #20242c;   /* body text                            */
  --navy:       #1c2b4a;   /* primary                              */
  --navy-2:     #2c3f66;
  --gold:       #b8892b;   /* primary accent                       */
  --gold-2:     #d8ad4a;
  --suit-red:   #c0202f;   /* hearts / diamonds                    */
  --suit-black: #16181d;   /* spades / clubs                       */
  --line:       #d8ccae;   /* hairline on paper                    */
  --good:       #2e7d4f;
  --shadow:     0 2px 0 rgba(28,43,74,.12), 0 6px 22px rgba(28,43,74,.10);
  --radius:     14px;

  --serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, #faf5e9 0%, var(--paper) 60%);
  color: var(--ink);
  font: 17px/1.5 var(--serif);
  min-height: 100vh;
}

.suit-red   { color: var(--suit-red); }
.suit-black { color: var(--suit-black); }

a { color: var(--navy); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(14px, 4vw, 34px);
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--gold);
}
.topbar .brand {
  font-weight: 700; letter-spacing: .3px;
  font-size: clamp(18px, 2.4vw, 24px);
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
}
.topbar .brand .pips { letter-spacing: 1px; }
.topbar .brand .pips .r { color: #ff9ba3; }
.topbar .spacer { flex: 1; }
.topbar .crumb { font-family: var(--sans); font-size: 14px; opacity: .85; }
.topbar a.homelink { color: var(--gold-2); font-family: var(--sans); font-size: 14px; text-decoration: none; }
.topbar a.homelink:hover { text-decoration: underline; }

main { max-width: 1120px; margin: 0 auto; padding: clamp(16px, 3vw, 30px); }

/* ---------- Buttons (utility = sans) ---------- */
.btn {
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  border: 1px solid var(--navy); background: #fff; color: var(--navy);
  padding: 9px 15px; border-radius: 10px; cursor: pointer;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: #f0f3fb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.gold:hover { background: var(--gold-2); }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:focus-visible, a:focus-visible, [tabindex]:focus-visible, .tile:focus-visible {
  outline: 3px solid var(--gold-2); outline-offset: 2px;
}
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 18px; }
.toolbar .grow { flex: 1; }

/* ============================================================
   Scoreboard (shared team scoring)
   ============================================================ */
.scoreboard { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 20px; }
.team {
  flex: 1 1 180px; min-width: 160px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
  border-top: 5px solid var(--navy);
}
.team.active { border-top-color: var(--gold); background: #fffdf6; }
.team .name {
  font-family: var(--sans); font-weight: 700; font-size: 15px;
  width: 100%; border: none; background: transparent; color: var(--navy);
  padding: 2px 0; border-bottom: 1px dashed transparent;
}
.team .name:focus { outline: none; border-bottom-color: var(--gold); }
.team .score {
  font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: clamp(30px, 5vw, 46px); color: var(--navy); line-height: 1.05; margin: 4px 0 6px;
}
.team .adj { display: flex; flex-wrap: wrap; gap: 6px; }
.team.win .score { color: var(--gold); }

/* ============================================================
   JEOPARDY — the board IS a bidding box
   ============================================================ */
.jeop-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(5px, 1vw, 10px);
  background: var(--navy);
  padding: clamp(6px, 1.2vw, 12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.jeop-col { display: flex; flex-direction: column; gap: clamp(5px, 1vw, 10px); }
.jeop-head {
  text-align: center; color: #fff; padding: 10px 6px 12px;
  border-bottom: 3px solid var(--gold);
}
.jeop-head .sym { font-size: clamp(24px, 4vw, 40px); line-height: 1; }
.jeop-head .sym.r { color: #ff9ba3; }
.jeop-head .sym.b { color: #fff; }
.jeop-head .subj {
  font-family: var(--sans); font-size: clamp(10px, 1.2vw, 13px);
  margin-top: 6px; opacity: .9; min-height: 2.4em;
}
.tile {
  aspect-ratio: 5 / 3; border: none; border-radius: 8px; cursor: pointer;
  background: linear-gradient(180deg, #fbf3dc, #efdca9);
  color: var(--navy); font-family: var(--serif); font-weight: 700;
  font-size: clamp(20px, 3.4vw, 34px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: inset 0 0 0 2px rgba(184,137,43,.35);
  transition: transform .08s ease, filter .15s ease;
}
.tile:hover { filter: brightness(1.05); transform: translateY(-1px); }
.tile:active { transform: translateY(0); }
.tile .bidbig { line-height: 1; }
.tile .tileval { font-family: var(--sans); font-size: clamp(10px, 1.1vw, 13px); font-weight: 700; color: var(--navy); opacity: .65; }
.tile.spent {
  background: #2a3a5c; color: #58688a; box-shadow: none; cursor: default;
}
.tile.spent .tileval { color: #58688a; }
.tile.spent:hover { transform: none; filter: none; }

/* ============================================================
   FEUD — the survey board IS a traveler slip on green baize
   ============================================================ */
.baize {
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,.04) 0 8px, transparent 8px 16px),
    radial-gradient(120% 120% at 50% 0%, #2f7d55 0%, #1f5c3d 100%);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(14px, 3vw, 30px);
}
.slip {
  background: #fbf7ea; border-radius: 10px; padding: clamp(14px, 2.5vw, 26px);
  box-shadow: 0 8px 30px rgba(0,0,0,.28);
  max-width: 760px; margin: 0 auto;
}
.slip .qline { font-family: var(--sans); font-size: 13px; color: var(--gold); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.slip .question { font-size: clamp(20px, 3.2vw, 30px); font-weight: 700; color: var(--navy); margin: 4px 0 16px; }
.slip .rows { display: flex; flex-direction: column; gap: 8px; }
.answer-row {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #fff; text-align: left; width: 100%; font-family: var(--serif);
  transition: background .12s ease;
}
.answer-row .rank {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--navy); color: #fff; font-family: var(--sans); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.answer-row .txt { flex: 1; font-size: clamp(16px, 2.2vw, 20px); color: #b9ae93; }
.answer-row .pts { font-family: var(--sans); font-weight: 700; color: #b9ae93; font-variant-numeric: tabular-nums; }
.answer-row.hidden .txt { letter-spacing: 2px; }
.answer-row.revealed { background: #fff8e6; cursor: default; }
.answer-row.revealed .txt { color: var(--ink); }
.answer-row.revealed .pts { color: var(--gold); }
.answer-row.revealed .rank { background: var(--gold); }

.feud-bank { text-align: center; margin: 14px auto 4px; }
.feud-bank .label { font-family: var(--sans); font-size: 13px; color: #dfeee4; opacity: .9; }
.feud-bank .value { font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 6vw, 52px); color: #fff; line-height: 1; }
.feud-bank .value .x2 { color: var(--gold-2); font-size: .5em; vertical-align: super; }

.strikes { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.strike-card {
  width: 44px; height: 60px; border-radius: 7px; background: #fff;
  border: 2px solid var(--suit-red); display: flex; align-items: center; justify-content: center;
  color: var(--suit-red); font-weight: 800; font-size: 30px; font-family: var(--serif);
  box-shadow: 0 3px 8px rgba(0,0,0,.25);
}
.strike-card.off { opacity: .28; background: transparent; box-shadow: none; }

.vuln-toggle { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 14px; }
.pill {
  font-family: var(--sans); font-size: 12px; font-weight: 700; border-radius: 999px;
  padding: 3px 10px; border: 1px solid var(--line); color: var(--navy); background:#fff;
}
.pill.on { background: var(--suit-red); border-color: var(--suit-red); color: #fff; }

/* ---------- Sensitive-content flag ---------- */
.flag {
  font-family: var(--sans); font-size: 13px; background: #fff3d6; border: 1px solid var(--gold);
  color: #7a5a12; border-radius: 10px; padding: 10px 12px; margin: 0 auto 14px; max-width: 760px;
}

/* ============================================================
   Cards / hub / generic panels
   ============================================================ */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2.5vw, 26px); }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 8px; }
.game-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: transform .1s ease, box-shadow .15s ease;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(28,43,74,.18); }
.game-card .cover { height: 150px; display: flex; align-items: center; justify-content: center; font-size: 62px; }
.game-card .cover.jeop { background: var(--navy); color: var(--gold-2); }
.game-card .cover.feud { background: radial-gradient(120% 120% at 50% 0%, #2f7d55, #1f5c3d); color: #fff; }
.game-card .body { padding: 16px 18px 20px; }
.game-card h3 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.game-card p { margin: 0; font-size: 15px; color: #4a4f5a; }
.game-card .device { font-family: var(--sans); font-size: 12.5px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.game-card.soon { opacity: .7; }
.game-card.soon .cover { filter: grayscale(.5); }
.badge-soon { font-family: var(--sans); font-size: 11px; font-weight: 700; background: var(--line); color: #6b6350; border-radius: 999px; padding: 2px 9px; }

.lead { font-size: 18px; color: #40454f; max-width: 60ch; }
.section-title { font-size: 22px; color: var(--navy); margin: 26px 0 10px; border-bottom: 2px solid var(--gold); padding-bottom: 6px; }

/* ---------- Modal (host preview / reveal) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(20,24,32,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 50;
}
.modal {
  background: var(--paper); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.4);
  max-width: 620px; width: 100%; max-height: 88vh; overflow: auto; padding: clamp(18px, 3vw, 30px);
  border-top: 6px solid var(--gold);
}
.modal h2 { margin: 0 0 4px; color: var(--navy); }
.modal .reveal-clue { font-size: 19px; margin: 12px 0; }
.modal .reveal-answer { font-size: 24px; font-weight: 700; color: var(--good); margin: 10px 0 20px; }
.modal .award-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Editor list ---------- */
.editor-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; margin-bottom: 10px; }
.editor-item label { font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--navy); display: block; margin: 8px 0 3px; }
.editor-item input, .editor-item textarea {
  width: 100%; font-family: var(--serif); font-size: 15px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.editor-item textarea { min-height: 60px; resize: vertical; }
.muted { color: #7a7f88; font-family: var(--sans); font-size: 13px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .game-card:hover, .tile:hover, .btn:active { transform: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .jeop-head .subj { display: none; }
  .team { flex-basis: calc(50% - 6px); min-width: 0; }
}
