:root {
  --ice: #eaf2fb;          /* rink ice */
  --ice-2: #dceafa;
  --navy: #0b1f3a;         /* deep boards blue */
  --navy-2: #14315c;
  --steel: #2b6cb0;        /* faceoff blue */
  --red: #d11f2d;          /* goal line red */
  --red-dk: #9c0c1c;
  --silver: #c7d3e0;
  --ink: #0e1a2b;
  --gold: #e2b34a;
  --line: rgba(11, 31, 58, 0.14);
  --shadow: 0 12px 34px rgba(11, 31, 58, 0.28);
  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 640px at 50% -8%, #1a3a66 0%, var(--navy) 60%) fixed;
  background-color: var(--navy);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 22px 18px 70px; }
.hidden { display: none !important; }

/* ---------- Masthead ---------- */
.masthead { text-align: center; padding: 14px 0 20px; position: relative; }
.logo-btn {
  appearance: none; background: none; border: none; padding: 0; cursor: pointer;
  display: inline-block; line-height: 0; transition: transform .12s;
}
.logo-btn:hover { transform: scale(1.04); }
.logo-btn:active { transform: scale(.98); }
.puck {
  width: 116px; height: 116px; display: inline-block;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.4));
}
.home-btn {
  position: absolute; left: 0; top: 18px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.10); color: var(--ice);
  border: 1px solid rgba(255,255,255,.20); border-radius: 999px;
  padding: 9px 16px; font-family: var(--sans); font-weight: 800; font-size: 13px;
  cursor: pointer; transition: background .15s, transform .08s;
}
.home-btn:hover { background: rgba(255,255,255,.20); }
.home-btn:active { transform: translateY(1px); }
.home-btn svg { display: block; }
@media (max-width: 520px) {
  .home-btn { top: 14px; padding: 8px 12px; font-size: 0; gap: 0; }
  .home-btn svg { width: 18px; height: 18px; }
}
.tagline {
  color: var(--gold); font-weight: 800; letter-spacing: 3px;
  font-size: 12px; text-transform: uppercase; margin-top: 8px;
}

/* ---------- Panels ---------- */
.panel {
  background: var(--ice);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.5);
  position: relative;
  overflow: hidden;
}
.panel::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--red), var(--steel));
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer; font-family: var(--sans);
  font-weight: 800; letter-spacing: .4px; border-radius: 999px;
  padding: 13px 26px; font-size: 15px; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 6px 0 var(--red-dk); }
.btn-red:hover { background: #e0303d; }
.btn-red:active { box-shadow: 0 2px 0 var(--red-dk); }
.btn-navy { background: var(--navy); color: var(--ice); }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: #fff; color: var(--navy); border: 2px solid var(--line); }
.btn-ghost:hover { background: var(--ice-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-lg { padding: 17px 38px; font-size: 18px; }

/* ---------- Intro ---------- */
.intro { padding: 32px 30px 34px; text-align: center; }
.intro h2 { font-family: var(--serif); font-size: 27px; color: var(--navy); margin-bottom: 10px; }
.intro p { color: #33475f; max-width: 600px; margin: 0 auto 12px; line-height: 1.6; }
.rules { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 24px 0 26px; text-align: left; }
.rule { background: #fff; border-radius: 12px; padding: 16px; border: 1px solid var(--line); }
.rule .num { font-family: var(--serif); font-weight: 800; color: var(--red); font-size: 22px; }
.rule h4 { color: var(--navy); margin: 6px 0 4px; font-size: 15px; }
.rule p { font-size: 13px; color: #5a6b7d; margin: 0; }
.load-note { color: #6a7c8e; font-size: 13px; margin-top: 14px; }

/* ---------- Mode indicator ---------- */
.modeIndicator {
  display: inline-block; background: rgba(255,255,255,.12); color: var(--ice);
  font-weight: 800; font-size: 13px; letter-spacing: .5px; padding: 7px 16px;
  border-radius: 999px; margin: 0 auto 14px; border: 1px solid rgba(255,255,255,.18);
}
#game { text-align: center; }

/* ---------- Board layout ---------- */
.board { display: grid; grid-template-columns: 320px 1fr; gap: 16px; text-align: left; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } }

.lineup-panel { padding: 16px; }
.play-panel { padding: 20px; min-height: 360px; }

/* ---------- Bar ---------- */
.bar { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bar-item { display: flex; flex-direction: column; }
.bar-item .k { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: #6a7c8e; font-weight: 700; }
.bar-item .v { font-size: 14px; font-weight: 800; color: var(--navy); }

/* ---------- Lineup board ---------- */
.lineup { display: flex; flex-direction: column; gap: 7px; }
.slot {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; min-height: 50px; transition: background .15s, border-color .15s;
}
.slot .pos {
  flex: 0 0 38px; text-align: center; font-weight: 800; font-size: 13px;
  color: #fff; background: var(--navy); border-radius: 7px; padding: 6px 0;
}
.slot.filled .pos { background: var(--steel); }
.slot[data-slot="G"] .pos { background: var(--red); }
.slot .nm { font-weight: 800; color: var(--ink); font-size: 14px; }
.slot .meta { font-size: 11px; color: #6a7c8e; }
.slot .empty { color: #9aa9b8; font-size: 13px; font-style: italic; }
.slot .ov { margin-left: auto; font-weight: 800; color: var(--navy); font-size: 18px; }
.slot.target { border-color: var(--red); background: #fff5f5; box-shadow: 0 0 0 2px rgba(209,31,45,.18); }

/* Open slots are tappable to filter the candidate list by position. */
.slot.openslot { cursor: pointer; }
.slot.openslot:hover { border-color: var(--steel); background: #f3f8ff; }
.slot .slot-filter { margin-left: auto; color: #b6c2d0; font-size: 18px; font-weight: 700; opacity: 0; transition: opacity .12s; }
.slot.openslot:hover .slot-filter { opacity: 1; }
.slot.filtering { border-color: var(--steel); background: #eaf3ff; box-shadow: 0 0 0 2px rgba(43,108,176,.25); }
.slot.filtering .slot-filter { opacity: 1; color: var(--steel); }
.slot.filtering .pos { background: var(--steel); }

/* ---------- Reels ---------- */
.reels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.reel {
  background: var(--navy); border-radius: 12px; padding: 16px 12px; text-align: center;
  border: 2px solid var(--navy-2); overflow: hidden; position: relative;
}
.reel-label { color: var(--gold); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 800; margin-bottom: 8px; }
.reel-val { color: var(--ice); font-family: var(--serif); font-weight: 800; font-size: 22px; line-height: 1.15; min-height: 52px; display: flex; align-items: center; justify-content: center; }
.reel.spin .reel-val { animation: flick .07s linear infinite; opacity: .85; }
@keyframes flick { 0% { transform: translateY(-2px); } 50% { transform: translateY(2px); } 100% { transform: translateY(-2px); } }

.play-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- Candidate cards ---------- */
.cands { margin-top: 18px; }
.cands-title { font-weight: 800; color: var(--navy); font-size: 15px; margin-bottom: 12px; text-align: center; }
.cands-title .filter-hint { font-weight: 600; color: #9aa9b8; font-size: 12px; font-style: italic; }
.filter-clear {
  appearance: none; border: none; cursor: pointer; font-family: var(--sans);
  background: var(--steel); color: #fff; font-weight: 800; font-size: 11px;
  padding: 4px 11px; border-radius: 999px; margin-left: 6px; letter-spacing: .3px;
  vertical-align: middle;
}
.filter-clear:hover { background: #2f7bc4; }
.cards-empty {
  grid-column: 1 / -1; text-align: center; color: #6a7c8e; font-size: 14px;
  padding: 22px 14px; background: #fff; border: 1px dashed var(--line); border-radius: 12px;
}
.cards-empty .filter-clear { margin-top: 8px; display: inline-block; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pcard {
  appearance: none; cursor: pointer; text-align: left; font-family: var(--sans);
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  position: relative; overflow: hidden; transition: transform .1s, box-shadow .15s, border-color .15s;
}
.pcard:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(11,31,58,.18); border-color: var(--steel); }
.pcard .stripe { position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: var(--steel); }
.pcard[data-pos="G"] .stripe { background: var(--red); }
.pcard .ovr { position: absolute; top: 10px; right: 11px; font-weight: 800; font-size: 26px; color: var(--navy); line-height: 1; }
.pcard .ovr small { display: block; font-size: 8px; letter-spacing: 1px; color: #9aa9b8; text-align: right; }
.pcard .nm { font-weight: 800; font-size: 15px; color: var(--ink); padding-right: 42px; line-height: 1.15; }
.pcard .yr { font-size: 11px; color: #6a7c8e; margin: 3px 0 8px; }
.pcard .plus-tag { display: inline-block; background: var(--navy); color: var(--ice); font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; letter-spacing: .4px; }
.pcard .stat { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 9px; font-size: 11px; color: #45576b; }
.pcard .stat b { color: var(--ink); }
.pcard.hidden-stats .stat, .pcard.hidden-stats .plus-tag, .pcard.hidden-stats .ovr { visibility: hidden; }

/* ---------- Result ---------- */
.result { padding: 30px 28px 34px; text-align: center; }
.record { font-family: var(--serif); font-weight: 800; font-size: 84px; color: var(--navy); line-height: 1; }
.record .l { color: var(--red); }
.vtag { display: inline-block; margin: 10px 0 4px; font-weight: 800; letter-spacing: 1px; font-size: 18px; padding: 8px 22px; border-radius: 999px; background: var(--gold); color: var(--navy); }
.vtag.perfect { background: var(--red); color: #fff; }
.vline { color: #33475f; max-width: 520px; margin: 8px auto 0; line-height: 1.5; }
.boxscore { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 22px 0; }
.bs { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 6px; }
.bs .k { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: #6a7c8e; font-weight: 700; }
.bs .v { font-size: 22px; font-weight: 800; color: var(--navy); }
.weak { background: #fff5f5; border: 1px solid rgba(209,31,45,.25); border-radius: 10px; padding: 11px 14px; color: #7a2530; font-size: 13px; margin: 4px 0 18px; }
.weak.ringer { background: #f0f7ff; border-color: rgba(43,108,176,.3); color: #1d4a73; }
.roster-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 22px; }
@media (max-width: 520px) { .roster-strip { grid-template-columns: repeat(2,1fr); } .boxscore { grid-template-columns: repeat(2,1fr); } }
.rs-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: left; }
.rs-card .p { font-size: 10px; font-weight: 800; color: var(--red); letter-spacing: .5px; }
.rs-card .n { font-weight: 800; color: var(--ink); font-size: 14px; line-height: 1.15; margin-top: 2px; }
.rs-card .m { font-size: 11px; color: #6a7c8e; margin-top: 2px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: var(--ice); padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.foot { text-align: center; color: rgba(234,242,251,.4); font-size: 12px; margin-top: 26px; }

/* ---------- Mode toggle ---------- */
.mode-toggle { display: inline-flex; flex-wrap: wrap; justify-content: center; background: #fff; border-radius: 14px; padding: 5px; gap: 4px; margin: 6px 0 20px; border: 1px solid var(--line); }
.mode-toggle button { border: none; background: transparent; padding: 9px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--navy); font-size: 13px; font-family: var(--sans); transition: background .15s, color .15s; }
.mode-toggle button:hover { background: var(--ice-2); }
.mode-toggle button.on { background: var(--navy); color: var(--ice); }

/* ---------- Daily card ---------- */
.daily-card { padding: 20px 22px; margin-top: 16px; text-align: left; }
.dc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.dc-num { font-family: var(--serif); font-weight: 800; font-size: 30px; color: var(--red); flex: 0 0 auto; }
.dc-title { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 19px; }
.dc-desc { font-size: 13px; color: #51637a; margin-top: 3px; line-height: 1.45; }
.dc-result { background: var(--ice-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--navy); margin-bottom: 12px; }
.dc-result .rk { color: var(--red); }
.daily-card .btn { width: 100%; }

/* ---------- Constraint banner ---------- */
.constraint-banner { background: rgba(226,179,74,.16); border: 1px solid rgba(226,179,74,.5); color: #6b531a; border-radius: 12px; padding: 11px 16px; font-size: 13px; line-height: 1.45; margin-bottom: 14px; text-align: center; }
.constraint-banner b { color: var(--navy); }

/* ---------- Budget meter ---------- */
.game-budget { max-width: 520px; margin: 0 auto 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.gb-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.gb-spent { font-weight: 800; font-size: 20px; color: var(--navy); }
.gb-spent.over { color: var(--red); }
.gb-remain { font-size: 13px; font-weight: 700; color: #6a7c8e; }
.gb-track { height: 9px; background: var(--ice-2); border-radius: 999px; overflow: hidden; }
.gb-meter { height: 100%; width: 0; background: var(--steel); border-radius: 999px; transition: width .25s; }
.gb-meter.warn { background: var(--red); }

/* ---------- Price badge on cards ---------- */
.pcard .pcost { position: absolute; bottom: 10px; right: 11px; font-weight: 800; font-size: 14px; color: var(--green); background: rgba(47,107,60,.1); padding: 2px 8px; border-radius: 999px; }
.pcard .stat { padding-right: 56px; }

/* ---------- Result verdict variants ---------- */
.vtag.bears { background: #6a4a2a; color: #fff; }
.vtag.caphell { background: var(--green); color: #fff; }
.vline.strong { font-weight: 600; color: #2a3a4d; }
.weak.caphell { background: rgba(47,107,60,.1); border-color: rgba(47,107,60,.3); color: #2a5236; }

/* ---------- Daily leaderboard panel ---------- */
.lb { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 4px 0 20px; text-align: left; }
.lb-title { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 16px; margin-bottom: 12px; text-align: center; }
.lb-you { background: var(--navy); color: var(--ice); border-radius: 10px; padding: 10px 14px; font-size: 14px; text-align: center; margin-bottom: 12px; }
.lb-list { display: flex; flex-direction: column; gap: 3px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.lb-row:nth-child(odd) { background: #f4f8fd; }
.lb-row.me { background: rgba(226,179,74,.22); font-weight: 800; }
.lb-rank { flex: 0 0 28px; font-weight: 800; color: #6a7c8e; }
.lb-name { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wl { font-weight: 800; color: var(--navy); }
.lb-join { display: flex; gap: 8px; margin-bottom: 6px; }
.lb-join input { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; font-size: 14px; font-family: var(--sans); }
.lb-join .btn { padding: 10px 20px; }
.lb-note { font-size: 12px; color: #8a99a8; text-align: center; margin-top: 8px; }
.lb-loading, .lb-err { text-align: center; color: #6a7c8e; padding: 14px; font-size: 14px; }
.lb-err { color: var(--red); }

/* ---------- Result mode switcher ---------- */
.again-label { color: #8a99a8; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin: 22px 0 10px; }
.again-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.amode { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 999px; padding: 9px 16px; font-weight: 800; font-size: 13px; cursor: pointer; font-family: var(--sans); transition: background .15s; }
.amode:hover { background: var(--ice-2); }
.amode.cur { background: var(--navy); color: var(--ice); border-color: var(--navy); }
.modeIndicator.daily { background: rgba(226,179,74,.22); color: var(--gold); border-color: rgba(226,179,74,.4); }
