:root {
  --navy: #14233f;
  --navy-2: #1d3257;
  --cream: #f5edd8;
  --cream-2: #efe4c6;
  --red: #c8102e;
  --red-dk: #9c0c23;
  --gold: #d9a441;
  --ink: #1a1a1a;
  --green: #2f6b3c;
  --line: rgba(20, 35, 63, 0.14);
  --shadow: 0 10px 30px rgba(20, 35, 63, 0.18);
  --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 600px at 50% -10%, #1d3257 0%, var(--navy) 55%) fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 22px 18px 80px; }

/* ---------- Masthead ---------- */
.masthead { text-align: center; padding: 14px 0 22px; }
.logo {
  display: inline-flex; align-items: baseline; gap: 10px;
  font-family: var(--serif); font-weight: 800; letter-spacing: -1px;
  color: var(--cream);
}
.logo .score { font-size: 64px; line-height: 1; }
.logo .dash { color: var(--red); }
.tagline {
  color: var(--gold); font-weight: 700; letter-spacing: 3px;
  font-size: 12px; text-transform: uppercase; margin-top: 6px;
}
.subtag { color: rgba(245,237,216,0.6); font-size: 13px; margin-top: 8px; }

/* ---------- Card surface ---------- */
.panel {
  background: var(--cream);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(20,35,63,0.04) 1px, transparent 1px);
  background-size: 4px 4px; pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer; font-family: var(--sans);
  font-weight: 800; letter-spacing: .4px; border-radius: 999px;
  padding: 14px 28px; 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: #d51a38; }
.btn-red:active { box-shadow: 0 2px 0 var(--red-dk); }
.btn-navy { background: var(--navy); color: var(--cream); }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--navy); border: 2px solid var(--line); }
.btn-ghost:hover { background: rgba(20,35,63,.05); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-lg { padding: 18px 40px; font-size: 18px; }

/* ---------- Intro ---------- */
.intro { padding: 34px 30px 36px; text-align: center; }
.intro h2 { font-family: var(--serif); font-size: 26px; color: var(--navy); margin-bottom: 8px; }
.intro p { color: #3a3a3a; max-width: 560px; margin: 0 auto 10px; line-height: 1.55; }
.rules { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 26px 0; text-align: left; }
.rule { background: var(--cream-2); border-radius: 12px; padding: 16px; border: 1px solid var(--line); }
.rule .num { font-family: var(--serif); font-weight: 800; color: var(--red); font-size: 20px; }
.rule h4 { color: var(--navy); margin: 6px 0 4px; font-size: 15px; }
.rule p { font-size: 13px; color: #555; margin: 0; }
.mode-toggle { display: inline-flex; flex-wrap: wrap; justify-content: center; background: var(--cream-2); border-radius: 16px; padding: 5px; gap: 4px; margin: 8px 0 24px; border: 1px solid var(--line); }
.mode-toggle button { border: none; background: transparent; padding: 9px 20px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--navy); font-size: 13px; }
.mode-toggle button.on { background: var(--navy); color: var(--cream); }

/* ---------- Game layout ---------- */
.gamebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pill { background: rgba(245,237,216,.12); color: var(--cream); border: 1px solid rgba(245,237,216,.18); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.pill b { color: var(--gold); }

/* ---------- Lineup board ---------- */
.lineup { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 16px; margin-bottom: 16px; }
@media (min-width: 720px) { .lineup { grid-template-columns: repeat(3, 1fr); } }
.slot {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px;
  background: var(--cream-2); border: 1px dashed var(--line); min-height: 52px;
}
.slot.filled { border-style: solid; background: #fff; border-color: rgba(20,35,63,.18); }
.slot.target { outline: 2px solid var(--gold); outline-offset: 1px; }
.slot .pos { font-family: var(--serif); font-weight: 800; color: var(--navy); width: 30px; font-size: 15px; flex: none; }
.slot .empty { color: #9a8f72; font-size: 12px; }
.slot .nm { font-weight: 700; font-size: 13.5px; color: var(--ink); line-height: 1.15; }
.slot .meta { font-size: 11px; color: #6a6a6a; }
.slot .ov { margin-left: auto; font-weight: 800; font-size: 13px; color: #fff; background: var(--navy); border-radius: 7px; padding: 3px 7px; flex: none; }

/* ---------- Slot machine ---------- */
.machine { padding: 22px 18px 24px; text-align: center; margin-bottom: 16px; }
.reels { display: flex; justify-content: center; gap: 12px; margin: 6px 0 18px; }
.reel { flex: 1; max-width: 300px; background: var(--navy); border-radius: 14px; padding: 16px 14px; color: var(--cream); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); position: relative; overflow: hidden; }
.reel .label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.reel .val { font-family: var(--serif); font-weight: 800; font-size: 21px; margin-top: 5px; min-height: 27px; }
.reel.spin .val { animation: blur .4s linear infinite; }
@keyframes blur { 0%,100%{ filter: blur(0); opacity:1 } 50%{ filter: blur(1.5px); opacity:.7 } }
.controls { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }

/* ---------- Candidate cards ---------- */
.cands { padding: 4px 16px 20px; }
.cands h3 { text-align: center; font-family: var(--serif); color: var(--navy); margin: 6px 0 14px; font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.pcard {
  background: #fff; border-radius: 12px; border: 1px solid rgba(20,35,63,.14);
  padding: 12px; cursor: pointer; text-align: left; transition: transform .1s, box-shadow .15s, border-color .15s;
  position: relative; overflow: hidden;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold); }
.pcard .stripe { position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--red); }
.pcard .ovr { position: absolute; top: 10px; right: 10px; font-family: var(--serif); font-weight: 800; font-size: 20px; color: var(--navy); }
.pcard .ovr small { display: block; font-size: 8px; letter-spacing: 1px; color: #999; text-align: right; font-family: var(--sans); }
.pcard .pos-tag { display: inline-block; background: var(--navy); color: var(--cream); font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; letter-spacing: 1px; margin-top: 8px; }
.pcard .nm { font-weight: 800; font-size: 15px; color: var(--ink); margin: 8px 0 2px; line-height: 1.1; padding-right: 34px; }
.pcard .yr { font-size: 12px; color: #777; }
.pcard .stat { display: flex; gap: 10px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pcard .stat span { font-size: 11px; color: #444; }
.pcard .stat b { color: var(--navy); }
.pcard.hidden-stats .stat, .pcard.hidden-stats .ovr { filter: blur(5px); }
.pcard .pcost { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); text-align: right; font-family: var(--serif); font-weight: 800; color: var(--green); font-size: 16px; }

/* ---------- Results ---------- */
.result { padding: 30px 24px 34px; text-align: center; }
.record { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 76px; line-height: 1; letter-spacing: -2px; }
.record .l { color: var(--red); }
.vtag { display: inline-block; background: var(--gold); color: var(--navy); font-weight: 800; letter-spacing: 3px; padding: 6px 18px; border-radius: 999px; margin: 14px 0 8px; font-size: 13px; }
.vtag.perfect { background: var(--red); color: #fff; }
.vtag.bears { background: #8a5a2b; color: #fff; }
.vtag.stearns { background: var(--green); color: #fff; }
.vline { color: #444; max-width: 480px; margin: 0 auto 18px; line-height: 1.5; }
.boxscore { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin: 22px 0; }
@media (min-width: 560px) { .boxscore { grid-template-columns: repeat(4,1fr); } }
.bs { background: var(--cream-2); border-radius: 12px; padding: 14px 8px; border: 1px solid var(--line); }
.bs .k { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #8a7d5e; }
.bs .v { font-family: var(--serif); font-weight: 800; font-size: 24px; color: var(--navy); margin-top: 3px; }
.weak { background: rgba(200,16,46,.08); border: 1px solid rgba(200,16,46,.25); border-radius: 10px; padding: 11px 14px; font-size: 13px; color: var(--red-dk); margin: 6px auto 20px; max-width: 520px; }
.weak.ringer { background: rgba(138,90,43,.1); border-color: rgba(138,90,43,.35); color: #7a4a23; }
.weak.stearns { background: rgba(47,107,60,.1); border-color: rgba(47,107,60,.35); color: var(--green); }
.roster-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 8px; margin: 18px 0; }
.rs-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px; text-align: left; }
.rs-card .p { font-size: 10px; font-weight: 800; color: var(--red); letter-spacing: 1px; }
.rs-card .n { font-size: 12.5px; font-weight: 700; line-height: 1.15; margin: 2px 0; }
.rs-card .m { font-size: 10.5px; color: #777; }
.actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
/* ---------- Daily challenge ---------- */
.daily-card { padding: 20px 24px 22px; text-align: center; border-top: 4px solid var(--gold); margin-bottom: 16px; }
.daily-card .dc-tag { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #8a7d5e; font-weight: 800; }
.daily-card .dc-tag b { color: var(--gold); }
.daily-card .dc-name { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 27px; margin: 6px 0 4px; }
.daily-card .dc-desc { color: #555; font-size: 14px; max-width: 500px; margin: 0 auto 16px; line-height: 1.5; }
.daily-card .dc-result { background: var(--cream-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; font-size: 14px; font-weight: 800; color: var(--navy); margin: 0 auto 14px; display: inline-block; }
.daily-card .dc-result b { color: var(--green); }
.constraint-banner { background: rgba(217,164,65,.14); border: 1px solid rgba(217,164,65,.45); color: var(--cream); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; text-align: center; font-size: 13.5px; line-height: 1.4; }
.constraint-banner b { color: var(--gold); }

.again-label { text-align: center; margin-top: 22px; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #8a7d5e; }
.again-modes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.again-modes .amode { border: 2px solid var(--line); background: transparent; color: var(--navy); border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 13px; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.again-modes .amode:hover { background: rgba(20,35,63,.06); }
.again-modes .amode.cur { background: var(--navy); color: var(--cream); border-color: var(--navy); }

/* ---------- Daily leaderboard ---------- */
.lb { margin: 24px auto 4px; max-width: 480px; text-align: left; background: var(--cream-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.lb-title { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 17px; text-align: center; margin-bottom: 12px; }
.lb-join { display: flex; gap: 8px; }
.lb-join input { flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; font-family: var(--sans); background: #fff; min-width: 0; }
.lb-join input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.lb-note { font-size: 11.5px; color: #8a7d5e; text-align: center; margin-top: 8px; }
.lb-loading, .lb-err { text-align: center; color: #777; font-size: 13px; padding: 8px; }
.lb-err { color: var(--red-dk); }
.lb-you { text-align: center; font-size: 14px; color: var(--navy); margin-bottom: 10px; }
.lb-you b { color: var(--red); }
.lb-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.lb-row:nth-child(odd) { background: rgba(255,255,255,.5); }
.lb-row.me { background: var(--navy); color: var(--cream); font-weight: 700; }
.lb-rank { width: 26px; font-weight: 800; color: #8a7d5e; flex: none; text-align: center; }
.lb-row.me .lb-rank { color: var(--gold); }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-wl { font-family: var(--serif); font-weight: 800; color: var(--navy); flex: none; }
.lb-row.me .lb-wl { color: #fff; }

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

/* ---------- Salary-cap draft ---------- */
.budgetbar { padding: 16px 18px; margin-bottom: 14px; }
.budgetbar .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.budgetbar .lbl { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #8a7d5e; }
.budgetbar .amt { font-family: var(--serif); font-weight: 800; font-size: 22px; color: var(--navy); }
.budgetbar .amt.over { color: var(--red); }
.meter { height: 12px; border-radius: 999px; background: var(--cream-2); overflow: hidden; border: 1px solid var(--line); }
.meter .fill { height: 100%; background: linear-gradient(90deg, var(--green), #4a9c5e); transition: width .25s, background .25s; }
.meter .fill.warn { background: linear-gradient(90deg, var(--gold), #e0b25a); }
.meter .fill.over { background: linear-gradient(90deg, var(--red), #e0394f); }

.draftboard { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 16px; margin-bottom: 14px; }
@media (min-width: 720px) { .draftboard { grid-template-columns: repeat(3, 1fr); } }
.dslot { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; background: var(--cream-2); border: 1px dashed var(--line); min-height: 56px; cursor: pointer; transition: border-color .12s, background .12s; }
.dslot:hover { border-color: var(--gold); }
.dslot.filled { border-style: solid; background: #fff; cursor: default; }
.dslot .pos { font-family: var(--serif); font-weight: 800; color: var(--navy); width: 32px; font-size: 14px; flex: none; }
.dslot .add { color: var(--red); font-weight: 800; font-size: 13px; }
.dslot .nm { font-weight: 700; font-size: 13.5px; line-height: 1.1; }
.dslot .meta { font-size: 11px; color: #6a6a6a; }
.dslot .right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.dslot .ov { font-weight: 800; font-size: 12px; color: #fff; background: var(--navy); border-radius: 7px; padding: 3px 7px; }
.dslot .cost { font-family: var(--serif); font-weight: 800; color: var(--green); font-size: 13px; }
.dslot .x { border: none; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; color: #b1a892; padding: 0 2px; }
.dslot .x:hover { color: var(--red); }

/* picker modal */
.modal { position: fixed; inset: 0; background: rgba(20,35,63,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; backdrop-filter: blur(2px); }
@media (min-width: 640px) { .modal { align-items: center; } }
.sheet { background: var(--cream); width: 100%; max-width: 540px; max-height: 86vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow); }
@media (min-width: 640px) { .sheet { border-radius: 18px; } }
.sheet .head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet .head .t { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 19px; }
.sheet .head .sub { font-size: 12px; color: #8a7d5e; margin-top: 2px; }
.sheet .search { display: flex; gap: 8px; margin-top: 12px; }
.sheet .search input { flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; font-family: var(--sans); background: #fff; }
.sheet .search input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.sheet .closeX { border: none; background: var(--cream-2); border-radius: 9px; padding: 0 14px; font-size: 18px; cursor: pointer; color: var(--navy); }
.plist { overflow-y: auto; padding: 8px; }
.prow { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.prow:hover { background: var(--cream-2); }
.prow.cant { opacity: .5; }
.prow .ov { font-family: var(--serif); font-weight: 800; color: var(--navy); font-size: 18px; width: 30px; text-align: center; flex: none; }
.prow .info { flex: 1; min-width: 0; }
.prow .nm { font-weight: 700; font-size: 14px; line-height: 1.15; }
.prow .meta { font-size: 11.5px; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .cost { font-family: var(--serif); font-weight: 800; font-size: 15px; color: var(--green); flex: none; }
.prow .cost.cant { color: var(--red); }
.plist .more { text-align: center; color: #8a7d5e; font-size: 12px; padding: 12px; }

.hidden { display: none !important; }
.foot { text-align: center; color: rgba(245,237,216,.45); font-size: 12px; margin-top: 26px; line-height: 1.6; }
.foot a { color: rgba(245,237,216,.7); }
