/* Cashblaster on the web: the desktop's colours (shared/window/theme.py),
   laid out for phones first and widening on bigger screens. */
:root {
  --bg: #e9edf2; --surface: #ffffff; --sunken: #f6f8fa; --border: #ccd4de;
  --header: #101c2e; --header-muted: #9fb0c6; --text: #18212d; --muted: #566276;
  --accent: #1f6feb; --accent-dark: #1658c4; --green: #1a8f47; --green-soft: #e3f4e9;
  --red: #c8322b; --red-soft: #fbe7e5; --chip: #e1e7ef; --orange: #c2560c;
  --orange-soft: #fdebd9; --tabs: #1658c4; --tabs-text: #dbe7fd;
  --tint-post: #f0f2f5; --tint-in: #fdf2f1; --tint-soon: #fff8e8;
  --edge-in: #f2c9c4; --edge-soon: #f2dfb0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Inter, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 11px; }
.red { color: var(--red); } .green { color: var(--green); } .faint { color: #a7b0bc; }
.error { color: var(--red); font-weight: 600; } .warn { color: var(--orange); }
.center { text-align: center; }
main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); max-width: 1500px; margin: 0 auto; }
main.wide { max-width: 2400px; }

/* header: a back button in the left corner, the brand, the tools on the right
   (under the rest on a phone) */
.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  background: var(--header); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
.brand { color: #fff; white-space: nowrap; font-weight: 800; letter-spacing: .04em; text-decoration: none; font-size: 17px; }
.top-row { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.subtitle { color: var(--header-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 16px; padding: 9px 16px; border-radius: 10px; border: 1px solid #3d84f2; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 4px rgba(0,0,0,.25); }
.back-btn:hover, .back-btn:active { background: var(--accent-dark); }
.tools { display: flex; gap: 8px; }
.tools:not(:has(*)) { display: none; }
.tool-btn { display: inline-block; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; white-space: nowrap;
  text-decoration: none; color: #fff; background: #22344f; border: 1px solid #3a5070; }
a.tool-btn:hover { background: #2c4366; }
.tool-btn.on { background: var(--accent); border-color: var(--accent); }
.tool-btn.off { color: #6f7f95; background: #172539; border-color: #24344a; cursor: not-allowed; }
@media (max-width: 760px) {
  .subtitle { font-size: 12px; }
  .top-row { width: 100%; gap: 8px; }
  .back-btn { font-size: 15px; padding: 8px 12px; }
  .tools { order: 10; width: 100%; }
  .tools { gap: 6px; }
  .tool-btn { flex: 1 1 auto; text-align: center; padding: 8px 6px; font-size: 13px; }
  .tool-btn.small { flex: 0 0 auto; padding: 8px 10px; }
}
@media (max-width: 480px) {
  .tool-sport { display: none; }
  .tool-btn { font-size: 12px; padding: 8px 4px; }
  .tool-btn.small { padding: 8px 8px; }
}

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 12px 0; }
button, .button { font: inherit; }
button.accent { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; }

/* sign in */
.login { max-width: 360px; margin: 40px auto; display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.login input { font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }

/* sport picker */
.picker { text-align: center; padding-top: 24px; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 20px; }
.tile { width: min(42vw, 240px); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; background: var(--surface); border: 2px solid var(--border);
  border-radius: 24px; text-decoration: none; color: var(--text); padding: 12px; }
a.tile:hover, a.tile:active { border-color: var(--accent); background: var(--chip); }
.tile-icon svg { width: 62%; height: auto; max-width: 150px; }
.tile-icon { display: flex; justify-content: center; width: 100%; }
.tile-name { font-size: 26px; font-weight: 800; }
.tile-sub { color: var(--muted); font-size: 12px; }
.tile.soon { background: #eef1f4; color: var(--muted); }
.tile.soon svg { filter: grayscale(1) opacity(.45); }

/* loading */
.spinner { width: 34px; height: 34px; margin: 6px auto 12px; border-radius: 50%;
  border: 4px solid var(--chip); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the week: one column on a phone (each group's heading above its games),
   every group side by side across the screen on anything wider */
.week { text-align: center; margin: 6px 0 14px; }
.week h1 { font-size: clamp(26px, 3.2vw + 12px, 46px); line-height: 1.1; }
.week .dates { font-size: clamp(15px, 1vw + 10px, 22px); margin: 4px 0 0; }
.groups { display: flex; flex-direction: column; gap: 18px; }
.group h2 { text-align: center; font-size: clamp(17px, .6vw + 13px, 21px); }
.group > p { text-align: center; margin: 0 0 8px; }
.cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) {
  .groups { flex-direction: row; align-items: flex-start; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
  .group { flex: 1 1 0; min-width: 215px; }
  .group.wide { flex-grow: 2; min-width: 442px; }
  .group.wide .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .group > p { font-size: 12px; }
}
/* too narrow for the whole week across (app.js adds .stacked): one column,
   as on a phone, centred */
.groups.stacked { flex-direction: column; align-items: stretch; overflow: visible; max-width: 640px; margin: 0 auto; gap: 18px; }
.groups.stacked .group { flex: none; min-width: 0; }
.groups.stacked .group.wide .cards { grid-template-columns: minmax(0, 1fr); }
.groups.stacked .group > p { font-size: inherit; }
.game { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 12px 8px; color: var(--text); text-decoration: none; }
a.game:hover { border-color: var(--accent); }
.game.post { background: var(--tint-post); }
.game.in { background: var(--tint-in); border-color: var(--edge-in); }
.game.soon { background: var(--tint-soon); border-color: var(--edge-soon); }
.sides { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; }
.side { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.side .badge { width: 60px; height: 50px; }
.side b { font-size: 16px; }
.mid { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.at { font-size: 26px; font-weight: 800; color: var(--muted); line-height: 1.1; }
.score { font-size: 24px; font-weight: 800; } .score.lost { color: var(--muted); }
.chance { font-size: 17px; font-weight: 800; color: var(--muted); } .chance.pick { color: var(--green); }
.live { background: var(--red-soft); color: var(--red); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 10px; }
.final { color: var(--muted); font-weight: 700; }
.foot { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; text-align: center; font-size: 12px; color: var(--muted); }
.foot.rough { color: var(--red); }

/* a game */
.matchup { text-align: center; }
.matchup h1 { font-size: clamp(20px, 1.4vw + 14px, 30px); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.chip { background: var(--chip); border-radius: 10px; padding: 3px 9px; font-size: 12px; }
.chip.warn { background: var(--orange-soft); color: var(--orange); font-weight: 600; }
.chip.fresh { color: var(--muted); }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; position: sticky; top: 44px; background: var(--bg); z-index: 4; }
.cats::-webkit-scrollbar { display: none; }
.cats a:first-child { margin-left: auto; } .cats a:last-child { margin-right: auto; }
.cats a { flex: none; padding: 7px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); font-weight: 600; font-size: 14px; }
.cats a.on { background: var(--tabs); color: #fff; border-color: var(--tabs); }
.filters summary { font-weight: 700; cursor: pointer; }
.filters form { display: grid; gap: 10px; margin-top: 10px; }
.filters fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.filters legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.filters label { font-size: 14px; }
.odds-note { margin: 4px 2px 8px; }
.lineset h2, .propset h2 { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 8px; }
.propset h2 { justify-content: flex-start; border-bottom: 2px solid #46556c; padding-bottom: 4px; }
.lineset h2 .badge { width: 54px; height: 44px; }
.pair, .grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pair { grid-template-columns: 1fr 1fr; } .grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); } }
.pcard { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; color: var(--text); cursor: pointer; }
.pcard:active, .pcard.on { border-color: var(--accent); }
.pc-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pc-who { display: flex; flex-direction: column; }
.proj { color: var(--accent); font-size: 12px; font-weight: 700; }
.fav { flex: none; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 8px; background: var(--chip); color: var(--muted); }
.fav.favorable { background: var(--green-soft); color: var(--green); }
.fav.unfavorable { background: var(--red-soft); color: var(--red); }
table.lines { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
table.lines th { text-align: left; color: var(--muted); font-weight: 600; padding: 1px 4px 1px 0; white-space: nowrap; }
table.lines td { text-align: center; padding: 1px 2px; white-space: nowrap; }

/* why sheet */
.sheet { position: fixed; inset: 0; background: rgba(16, 28, 46, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-box { background: var(--surface); width: 100%; max-width: 640px; max-height: 85vh; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-box { border-radius: 18px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sheet-head .close { background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 12px 16px 20px; }
.why-doc { white-space: pre-wrap; font-size: 14px; }
.why-doc .name { font-size: 19px; font-weight: 800; }
.why-doc .meta { color: var(--muted); font-size: 13px; }
.why-doc .section { display: block; margin: 14px 0 2px; color: var(--accent); font-weight: 800; font-size: 11px; letter-spacing: .05em; }
.why-doc .key { color: var(--muted); font-size: 13px; }
.why-doc .val { font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; }
.why-doc .big { color: var(--accent); font-weight: 800; font-size: 17px; }
.why-doc .pos { color: var(--green); font-weight: 700; }
.why-doc .neg { color: var(--red); font-weight: 700; }
.why-doc .flat { color: var(--muted); font-weight: 700; }
.why-doc .bullet { color: var(--accent); }
.why-doc .sub { color: var(--muted); font-size: 13px; }

/* the Parlay generator and the Parlay Builder */
.keep-lines { white-space: pre-line; }
.button { display: inline-block; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 700; }
.button.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
button.accent:disabled { opacity: .6; }
.accent-text { color: var(--accent); }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.tool-head h1 { font-size: clamp(22px, 1.6vw + 14px, 32px); margin: 0; }
.tool-head .go { font-size: 17px; padding: 12px 22px; }
.tool-note { margin: 6px 0 10px; }
.tool { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .tool { grid-template-columns: minmax(330px, 380px) 1fr; } }
.tool-side .panel { margin-top: 0; }
.tool-main > .panel:first-child { margin-top: 0; }
.pfilters summary { font-weight: 800; font-size: 16px; cursor: pointer; }
.pform { margin-top: 10px; }
.sec-tabs { display: none; }
.pform.tabbed .sec-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.sec-tab { flex: 1; min-width: 70px; padding: 8px 6px; border: 1px solid var(--border); background: var(--sunken); border-radius: 9px;
  font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.sec-tab.on { background: var(--tabs); color: #fff; border-color: var(--tabs); }
.sec { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.sec legend { font-weight: 800; font-size: 15px; padding: 0; margin-bottom: 6px; }
.pform.tabbed .sec legend { display: none; }
.sec h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; }
.check.big { font-size: 16px; font-weight: 600; padding: 6px 0; }
.check input { width: 18px; height: 18px; }
.legs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--border); border-radius: 10px; font-weight: 700; background: var(--sunken); }
.pill input:checked + span { background: var(--tabs); color: #fff; border-color: var(--tabs); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); }
.pill.any { grid-column: 1 / -1; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.field input { font: inherit; padding: 9px; border: 1px solid var(--border); border-radius: 9px; width: 100%; }
.field input.bad { border-color: var(--red); background: var(--red-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick { display: flex; gap: 6px; margin: 4px 0; }
.small-btn { font: inherit; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--sunken); cursor: pointer; }
.link-btn { font: inherit; font-size: 11px; border: 0; background: none; color: var(--accent); cursor: pointer; text-transform: none; padding: 0 3px; }
.gtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.gtile { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--sunken); font-weight: 700; font-size: 14px; }
.gtile:has(input:checked) { border-color: var(--accent); background: #e8f0fd; }
.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }
.parlays { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.parlay { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.parlay.best { border: 3px solid var(--green); }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.p-title { font-size: 20px; font-weight: 800; }
.p-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; font-weight: 700; }
.edge { padding: 0 5px; border-radius: 5px; margin-top: 1px; }
.edge.good { background: var(--green-soft); color: var(--green); } .edge.bad { background: var(--red-soft); color: var(--red); }
.p-legs { background: var(--sunken); border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.p-leg + .p-leg { margin-top: 5px; }
.p-leg .row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.p-leg .price { white-space: nowrap; }
.best-tag { display: inline-block; margin-top: 6px; background: var(--green); color: #fff; font-weight: 700; font-size: 13px; padding: 2px 10px; border-radius: 6px; }
.p-notes { margin-top: 6px; }
.pager { display: flex; justify-content: space-between; margin: 12px 0; }
.slip-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 8px; }
.slip-legs { background: var(--sunken); border-radius: 8px; padding: 2px 8px; margin-top: 8px; }
.blists { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: start; }
/* the Builder's lists: three across when they fit beside the filters, else
   one column of drop-downs beside them (and below everything on a phone) */
@media (min-width: 1400px) { .blists { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.blist { margin: 0; }
.b-row { display: grid; grid-template-columns: 2fr 3fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--chip); align-items: start; }
.b-row:last-child { border-bottom: 0; }
.b-who, .b-bet { display: flex; flex-direction: column; font-size: 14px; min-width: 0; }
.b-act { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.after { color: var(--green); font-weight: 800; white-space: nowrap; }
.add-btn { font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--green); border: 0; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.x { font: inherit; font-size: 18px; font-weight: 800; color: var(--red); background: none; border: 0; cursor: pointer; padding: 0 4px; }

/* the Builder on a wide screen: the filters and the parlay each take half
   the left column, the lists the right; each scrolls on its own (app.js
   sizes .tool.fit to the window) */
@media (min-width: 900px) {
  .tool.fit { min-height: 360px; }
  .tool.fit > * { height: 100%; overflow: auto; }
  .tool.fit .tool-side { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; overflow: hidden; }
  .tool.fit .tool-side > * { overflow: auto; margin: 0; min-height: 0; }
  .tool.fit .sec-tabs { position: sticky; top: -12px; background: var(--surface); padding: 8px 0 6px; margin-top: -8px; z-index: 1; }
  .pfilters > summary { pointer-events: none; list-style: none; }
  .pfilters > summary::-webkit-details-marker { display: none; }
}
@media (min-width: 1400px) {
  .blist > summary { pointer-events: none; list-style: none; }
  .blist > summary::-webkit-details-marker { display: none; }
}
.blist > summary { cursor: pointer; }
.blist > summary h2 { display: inline; }
.blist > summary .tiny { display: block; margin: 2px 0 6px; }

/* Users (admins) */
.users { max-width: 640px; margin: 0 auto; }
.users h1 { margin: 6px 0 10px; }
.users h2 { font-size: 17px; margin: 0 0 10px; }
.panel.ok { background: var(--green-soft); color: var(--green); font-weight: 700; }
.user-form { display: grid; gap: 6px; }
.user-form .accent { justify-self: start; padding: 10px 22px; font-size: 16px; }
.user-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--chip); }
.user-row:last-child { border-bottom: 0; }
.user-row .who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tags { display: inline-flex; gap: 4px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: #fff; }
.tag.plain { background: var(--chip); color: var(--muted); }
.user-actions { width: 100%; }
.user-actions summary { cursor: pointer; color: var(--accent); font-weight: 700; font-size: 14px; }
.user-actions[open] { background: var(--sunken); border-radius: 10px; padding: 10px; }
.user-buttons { display: flex; gap: 8px; margin-top: 10px; }
.small-btn.danger { color: var(--red); border-color: var(--red); }

/* "Copy legs & open DraftKings": phones and tablets only (a touch screen) */
.dk { display: none; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
@media (hover: none) and (pointer: coarse) { .dk { display: flex; } }
.dk-btn { display: block; width: 100%; text-align: center; font: inherit; font-weight: 800; font-size: 15px;
  padding: 11px 12px; border-radius: 10px; border: 0; color: #fff; background: #53a318; text-decoration: none; }
.dk-btn.plain { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.dk-btn.copied::after { content: "  \2713 Copied"; }
.dk-debug { width: 100%; font-size: 11px; color: var(--muted); }
.dk-debug code { display: block; word-break: break-all; margin-top: 4px; }
