/* theme.css: DonationKings design system.
 *
 * Visual language follows the big sportsbook apps: a true-black canvas, one
 * loud green for anything actionable, gold reserved for totals and winners,
 * and dense cards that stack a header, leg rows and a box score.
 *
 * Deliberately NOT copied: any real sportsbook's logo, wordmark or tagline,
 * and any league's team logos. Team identity is drawn as a colour chip from
 * the feed's own colour fields instead of a helmet, which also means the UI
 * renders offline and never hotlinks an image.
 *
 * Dark only, on purpose. This app is used on a couch on a Sunday.
 */

:root {
  /* canvas */
  --bg: #000000;
  --surface: #15171a; /* bet card */
  --surface-2: #212429; /* buttons, inset panels */
  --surface-3: #1b1e22; /* box score panel */
  --line: #2b2f35;
  --line-soft: #202429;

  /* type */
  --text: #ffffff;
  --dim: #8b95a1;
  --mute: #646d78;

  /* brand + state */
  --green: #53d337;
  --green-deep: #2f8f1f;
  --green-bg: #15300f;
  --red: #f0565b;
  --red-bg: #37151a;
  --gold: #f0b429;
  --gold-soft: #ffe9a8;
  --gold-deep: #8a6a1f;
  --purple: #7c5cff;
  --purple-bg: #241a4d;
  --orange: #e8622c;
  --blue: #2f7fe8;

  --r-card: 16px;
  --r-pill: 999px;
  --r-btn: 12px;
  --pad: 16px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tnum: "tnum" 1, "lnum" 1; /* tabular figures so score columns line up */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 96px; } /* clearance for the floating tab bar */

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ===================================================================== */
/* App bar                                                                */
/* ===================================================================== */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--pad);
  background: var(--bg);
  /* A sticky bar is still in flow, so if its contents refuse to shrink they
   * set a minimum width for the whole document and every card below inherits
   * the overflow. Anything in here must be able to give. Clipping with
   * overflow:hidden is NOT the fix: it just hides the avatar instead. */
  max-width: 100%;
}

/* The bar has to survive a 320px phone, so the two fixed-size things (mark
 * and avatar) refuse to shrink and the wordmark truncates instead. Without
 * flex:0 0 auto the avatar gets squeezed into an oval. */
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; min-width: 0; flex: 1 1 auto; }
.brand svg { width: 30px; height: 30px; display: block; flex: 0 0 auto; }
.brand-name {
  font-size: 17px; font-weight: 800; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; /* without this the text refuses to shrink and widens the page */
  /* A hard cap, not a guess: the wordmark must never be able to push the
   * bankroll or the avatar off the bar, whatever font the device falls back
   * to. Headless Chrome picks a noticeably wider face than a real phone and
   * walked the avatar straight off the edge without this. */
  max-width: 148px;
}
.brand-name .king { color: var(--green); }

.bankroll {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--green-bg);
  color: var(--green);
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.avatar {
  position: relative;
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
}
.appbar .avatar { cursor: pointer; }
.avatar .dot {
  position: absolute; top: 1px; right: 1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); border: 2px solid var(--bg);
}

/* ===================================================================== */
/* Tabs: underline style (primary sections)                               */
/* ===================================================================== */

.tabs {
  display: flex;
  gap: 22px;
  padding: 2px var(--pad) 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 58px; z-index: 19;
  background: var(--bg);
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  padding: 10px 0 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--dim);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--green); }

/* ===================================================================== */
/* Chips: outlined pill filters                                           */
/* ===================================================================== */

.chiprow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.chiprow::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 9px 20px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  color: var(--dim);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--text); color: var(--text); font-weight: 700; }
.chip.icon { padding: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: var(--surface-2); border-radius: 50%; }
.chiprow .divider { flex: 0 0 auto; width: 1px; height: 26px; background: var(--line); }

/* ===================================================================== */
/* Bet card                                                               */
/* ===================================================================== */

.cards { display: flex; flex-direction: column; gap: 14px; padding: 0 var(--pad); }

.card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: var(--pad);
  position: relative;
  overflow: hidden;
}

/* The winner treatment: a brass frame plus a faint confetti wash at the top.
 * The frame is a gradient border drawn with the padding-box/border-box trick,
 * because a plain border cannot hold a gradient. */
.card.is-won {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--gold-deep) 0%, var(--gold) 28%, var(--gold-soft) 50%, var(--gold) 72%, var(--gold-deep) 100%) border-box;
}
.card.is-won::before {
  content: "";
  position: absolute; inset: 0 0 auto; height: 120px;
  pointer-events: none;
  opacity: .5;
  background:
    radial-gradient(5px 9px at 12% 14%, var(--gold) 0 50%, transparent 51%),
    radial-gradient(4px 8px at 32% 8%, #ff9c3f 0 50%, transparent 51%),
    radial-gradient(5px 9px at 52% 18%, var(--gold-soft) 0 50%, transparent 51%),
    radial-gradient(4px 7px at 71% 9%, var(--green) 0 50%, transparent 51%),
    radial-gradient(5px 9px at 88% 16%, var(--gold) 0 50%, transparent 51%),
    radial-gradient(3px 6px at 22% 26%, var(--gold-soft) 0 50%, transparent 51%),
    radial-gradient(3px 6px at 63% 28%, var(--gold) 0 50%, transparent 51%);
}
.card.is-won > * { position: relative; }

.crownline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.crownline .mark { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; letter-spacing: -.01em; }
.crownline .mark svg { width: 24px; height: 24px; }
.crownline .tagline {
  font-size: 12px; font-weight: 800; letter-spacing: .1em;
  color: var(--dim); text-transform: uppercase; text-align: right;
}
.crownline .tagline b { color: var(--gold); font-weight: 800; }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-title {
  font-size: 21px; font-weight: 800; letter-spacing: -.02em;
  margin: 0; flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-title .sep { color: var(--mute); font-weight: 400; }
.card-title .odds { color: var(--text); font-weight: 800; }

.card-sub { color: var(--dim); font-size: 14px; margin: 4px 0 0; }

.status {
  flex: 0 0 auto;
  padding: 7px 16px; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 700;
}
.status.won { background: var(--green-bg); color: var(--green); }
.status.lost { background: var(--red-bg); color: var(--red); }
.status.pending { background: var(--surface-2); color: var(--dim); }
.status.live { background: var(--red-bg); color: var(--red); display: flex; align-items: center; gap: 7px; }
.status.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); animation: pulse 1.6s ease-in-out infinite;
}
.status.void { background: var(--surface-2); color: var(--dim); }
.status.needs_review { background: var(--purple-bg); color: #b5a3ff; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.money { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 0; font-size: 19px; flex-wrap: wrap; }
.money .label { color: var(--dim); font-weight: 500; font-size: 17px; }
.money .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.money .val.paid { color: var(--text); }
.money .sep { color: var(--mute); }

.badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.badge { padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 700; }
.badge.boost { background: var(--purple); color: #fff; }
.badge.sgp { background: var(--surface-2); color: var(--dim); }
.badge.capped { background: var(--red-bg); color: var(--red); }

.infobtn {
  width: 100%; margin-top: 14px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: var(--r-btn);
  background: var(--surface-2); color: var(--text);
  font-size: 16px; font-weight: 700;
}
.infobtn:hover { background: #262a30; }

/* ===================================================================== */
/* Leg rows                                                               */
/* ===================================================================== */

.legs { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }

.leg { display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: start; }

.leg-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
  margin-top: 1px;
}
.leg-icon.won { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1.5px rgba(83,211,55,.35); }
.leg-icon.lost { background: var(--red-bg); color: var(--red); box-shadow: inset 0 0 0 1.5px rgba(240,86,91,.35); }
.leg-icon.pending { background: var(--surface-2); color: var(--dim); box-shadow: inset 0 0 0 1.5px var(--line); }
.leg-icon.push,
.leg-icon.void { background: var(--surface-2); color: var(--dim); box-shadow: inset 0 0 0 1.5px var(--line); }
.leg-icon.needs_review { background: var(--purple-bg); color: #b5a3ff; box-shadow: inset 0 0 0 1.5px rgba(124,92,255,.4); }

.leg-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.leg-market { color: var(--dim); font-size: 15px; margin-top: 1px; }
.leg-note { color: var(--mute); font-size: 13px; margin-top: 3px; }
.leg-note.review { color: #b5a3ff; }

/* Live progress, which is this app's own addition rather than a sportsbook
 * pattern: a bar per leg so a slip can be watched mid-game. */
.prog { margin-top: 8px; }
.prog-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--dim); margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.prog-meta b { color: var(--text); font-weight: 700; }
.prog-bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.prog-bar i { display: block; height: 100%; border-radius: 4px; background: var(--dim); transition: width .4s ease; }
.prog.is-clinched .prog-bar i { background: var(--green); }
.prog.is-dead .prog-bar i { background: var(--red); }
.prog.is-live .prog-bar i { background: var(--gold); }
.prog-tag { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.prog.is-clinched .prog-tag { color: var(--green); }
.prog.is-dead .prog-tag { color: var(--red); }

/* ===================================================================== */
/* Box score                                                              */
/* ===================================================================== */

/* The box score sits at full card width as a sibling of the legs, not inside
 * a leg's indent, so the quarter columns still fit on a narrow phone. */
.box {
  background: var(--surface-3);
  border-radius: 10px;
  padding: 11px 12px;
  font-variant-numeric: tabular-nums;
}
.box table { width: 100%; border-collapse: collapse; table-layout: auto; }
.box th, .box td { padding: 5px 0 5px 6px; text-align: right; font-size: 14px; white-space: nowrap; }
.box th:first-child, .box td:first-child { text-align: left; width: 99%; padding-left: 0; }
.box thead th { color: var(--dim); font-size: 12px; font-weight: 600; padding-bottom: 6px; }
.box td { color: var(--dim); font-weight: 600; }
.box td.total { color: var(--gold); font-weight: 800; }
.box th:not(:first-child), .box td:not(:first-child) { min-width: 24px; }

.team { display: flex; align-items: center; gap: 9px; min-width: 0; }
.team .chipmark {
  width: 25px; height: 25px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 900; letter-spacing: -.03em;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.18);
  flex: 0 0 auto;
}
.team .tname {
  color: var(--text); font-weight: 700; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis;
}
.team .tname .abbr { color: var(--dim); font-weight: 600; margin-right: 5px; }

/* ===================================================================== */
/* Card footer                                                            */
/* ===================================================================== */

.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.ghostbtn {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); color: var(--text);
  font-size: 15px; font-weight: 600;
}
.ghostbtn:hover { background: var(--surface-2); }

.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; font-size: 13px;
}
.tag { padding: 4px 10px; border-radius: 5px; background: var(--green-bg); color: var(--green); font-weight: 700; font-size: 13px; }
.tag.ineligible { background: var(--red-bg); color: var(--red); }
.placed { color: var(--mute); font-variant-numeric: tabular-nums; }

/* ===================================================================== */
/* Section headings and leaderboard                                       */
/* ===================================================================== */

.section { padding: 22px var(--pad) 10px; }
.section h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.section p { color: var(--dim); font-size: 14px; margin: 4px 0 0; }

.lb { padding: 0 var(--pad); display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: grid; grid-template-columns: 24px 34px 1fr auto; gap: 11px;
  align-items: center;
  background: var(--surface); border-radius: 12px; padding: 12px 14px;
}
.lb-row.me { box-shadow: inset 0 0 0 1.5px var(--green-deep); }
.lb-rank { color: var(--mute); font-weight: 800; font-size: 15px; text-align: center; }
.lb-row.lead .lb-rank { color: var(--gold); }
.lb-who { min-width: 0; display: flex; flex-direction: column; }
.lb-name {
  font-weight: 700; font-size: 16px;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-sub { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-right { display: flex; flex-direction: column; align-items: flex-end; }
.lb-amt { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.lb-amt.up { color: var(--green); }
.lb-amt.down { color: var(--red); }
.lb-amt.bust { color: var(--mute); text-decoration: line-through; }
.lb-risk { color: var(--gold); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-row.history .lb-rank { color: var(--dim); font-size: 13px; }

.avatar.sm { width: 34px; height: 34px; font-size: 12px; }

/* A tiny crown next to whoever runs the league. */
.crown-mini {
  width: 13px; height: 11px; flex: 0 0 auto;
  background: var(--gold);
  clip-path: polygon(0% 100%, 8% 18%, 32% 52%, 50% 2%, 68% 52%, 92% 18%, 100% 100%);
}

/* ===================================================================== */
/* Leagues                                                                */
/* ===================================================================== */

.chiprow.leagues { padding-top: 10px; padding-bottom: 4px; }
.league-chip { display: flex; align-items: center; gap: 8px; }
.league-chip .count {
  font-size: 12px; font-weight: 700; color: var(--mute);
  background: var(--surface-2); border-radius: var(--r-pill); padding: 1px 7px;
}
.league-chip[aria-pressed="true"] .count { color: var(--text); }
.owner-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }
.add-league { display: flex; align-items: center; gap: 6px; color: var(--green); border-color: var(--green-deep); }
.add-league svg { width: 16px; height: 16px; }

.league-head { padding: 16px var(--pad) 4px; }
.league-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.league-title h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.owner-tag {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--gold); background: rgba(240,180,41,.12);
  padding: 4px 9px; border-radius: 5px;
}
.league-sub { color: var(--dim); font-size: 14px; margin: 5px 0 0; }
.dot-sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--mute); vertical-align: middle; margin: 0 8px; }

.chiprow.modes { padding-top: 10px; padding-bottom: 12px; }
.chiprow.modes .chip { padding: 8px 16px; font-size: 14px; }

/* Invite */
.invite {
  margin: 4px var(--pad) 0;
  background: var(--surface); border-radius: var(--r-card);
  padding: 18px; text-align: center;
}
.invite-label { color: var(--dim); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.invite-code {
  font-size: 34px; font-weight: 900; letter-spacing: .22em;
  color: var(--green); margin: 8px 0 14px; text-indent: .22em;
  font-variant-numeric: tabular-nums;
}
.invite-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ghostbtn.primary { border-color: var(--green-deep); color: var(--green); }
.invite-note { color: var(--mute); font-size: 12px; margin: 12px 0 0; }

/* Forms */
.league-forms { padding-bottom: 4px; }
.card.form { margin: 0 var(--pad); display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--dim); font-size: 13px; font-weight: 600; }
.field input {
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--r-btn); padding: 13px 14px;
  color: var(--text); font-size: 16px; font-family: inherit; width: 100%;
}
.field input:focus { outline: none; border-color: var(--green-deep); }
.field-note { color: var(--mute); font-size: 12px; margin: 0; }
.bigbtn {
  width: 100%; padding: 15px; border-radius: var(--r-btn);
  background: var(--green); color: #07240a;
  font-size: 16px; font-weight: 800;
}
.bigbtn:hover { filter: brightness(1.07); }

/* Owner controls, deliberately understated */
.owner-panel { margin: 14px var(--pad) 0; background: var(--surface); border-radius: var(--r-card); }
.owner-panel > summary {
  padding: 15px 18px; cursor: pointer; font-weight: 700; font-size: 15px;
  color: var(--dim); list-style: none;
}
.owner-panel > summary::-webkit-details-marker { display: none; }
.owner-panel > summary::after { content: " \25be"; }
.owner-panel[open] > summary { color: var(--text); border-bottom: 1px solid var(--line-soft); }
.owner-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.owner-members { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.owner-member { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.owner-member > span:nth-child(2) { margin-right: auto; }
.linkbtn { color: var(--dim); font-size: 13px; font-weight: 600; text-decoration: underline; }
.linkbtn.danger { color: var(--red); }

/* ===================================================================== */
/* Floating bottom tab bar                                                */
/* ===================================================================== */

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 14px; width: calc(100% - 24px); max-width: 520px;
  display: flex; align-items: center; justify-content: space-around;
  padding: 7px 6px;
  background: rgba(30, 33, 38, .92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 30px;
  box-shadow: 0 8px 28px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.06);
  z-index: 30;
}
.tabbar button {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px;
  border-radius: 22px;
  color: var(--dim);
  font-size: 11px; font-weight: 600;
}
.tabbar button svg { width: 23px; height: 23px; }
.tabbar button[aria-selected="true"] { color: var(--green); background: rgba(83,211,55,.12); }
.tabbar .nbadge {
  position: absolute; top: 2px; left: 54%;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}

/* ===================================================================== */
/* Utilities                                                              */
/* ===================================================================== */

/* Below this the wordmark is the first thing to go: the crown still
 * identifies the app, and the bankroll and avatar are both load-bearing.
 * Font metrics differ between devices, so this is a width budget rather than
 * a guess about how wide the word happens to render. */
@media (max-width: 400px) {
  .brand-name { display: none; }
}

/* ===================================================================== */
/* Notices and entry                                                      */
/* ===================================================================== */

.notice {
  margin: 10px var(--pad) 0;
  padding: 11px 14px; border-radius: var(--r-btn);
  background: var(--surface-2); color: var(--dim);
  font-size: 13px; line-height: 1.45;
}
.notice.warn { background: var(--red-bg); color: var(--red); }

.field select {
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--r-btn); padding: 13px 14px;
  color: var(--text); font-size: 16px; font-family: inherit; width: 100%;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field select:focus { outline: none; border-color: var(--green-deep); }

.entry { display: flex; flex-direction: column; gap: 14px; }
.entry-legs { display: flex; flex-direction: column; gap: 10px; }
.entry-leg-top { display: grid; grid-template-columns: 74px 1fr 64px auto; gap: 7px; align-items: center; }
.entry-leg-top select,
.entry-leg-top input {
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 9px; padding: 11px 10px;
  color: var(--text); font-size: 15px; font-family: inherit; min-width: 0;
}
.entry-leg-top select { appearance: none; text-align: center; font-weight: 700; font-size: 13px; }
.entry-leg-top input:focus,
.entry-leg-top select:focus { outline: none; border-color: var(--green-deep); }
.entry-odds { text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.entry-del { color: var(--mute); font-size: 15px; padding: 6px 4px; }
.entry-del:hover { color: var(--red); }

/* The parser's readback, shown while typing. If the app cannot tell what you
 * meant it says so now, not at grading time when money is committed. */
.entry-read { font-size: 12px; padding: 4px 0 0 81px; }
.entry-read.ok { color: var(--green); }
.entry-read.bad { color: var(--gold); }

.entry-money { display: grid; grid-template-columns: 1fr 100px; gap: 10px; }

.entry-summary {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline;
  padding: 13px 14px; border-radius: var(--r-btn);
  background: var(--surface-3); font-size: 15px;
}
.entry-summary b { font-weight: 800; font-variant-numeric: tabular-nums; }
.entry-summary.muted { color: var(--dim); font-size: 13px; }
.entry-prob { color: var(--dim); font-size: 13px; margin-left: auto; }

.bigbtn[disabled] { background: var(--surface-2); color: var(--mute); cursor: not-allowed; }
.bigbtn[disabled]:hover { filter: none; }

/* ===================================================================== */
/* Reading a screenshot                                                   */
/* ===================================================================== */

.scan { display: flex; flex-direction: column; gap: 14px; }
.scan-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r-card);
  background: var(--surface-3); color: var(--dim);
}
.scan-drop:hover { border-color: var(--green-deep); color: var(--text); }
.scan-drop.busy { cursor: progress; border-style: solid; border-color: var(--green-deep); }
.scan-icon { color: var(--green); }
.scan-title { font-size: 17px; font-weight: 700; color: var(--text); }
.scan-sub { font-size: 13px; max-width: 34ch; line-height: 1.45; }

.scan-confirm { display: flex; flex-direction: column; gap: 14px; }
.scan-shot {
  width: 100%; max-height: 240px; object-fit: contain; object-position: top;
  border-radius: var(--r-btn); background: #000;
  border: 1px solid var(--line);
}
.scan-confirm textarea {
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--r-btn); padding: 12px 13px; width: 100%;
  color: var(--text); font-size: 14px; line-height: 1.5; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.scan-confirm textarea:focus { outline: none; border-color: var(--green-deep); }

.scan-found { font-size: 14px; color: var(--dim); }
.scan-found b { color: var(--text); font-weight: 800; }
.scan-legs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.scan-legs li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  background: var(--surface-3); border-radius: 9px; padding: 10px 12px; font-size: 14px;
}
.scan-legs .odds { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* One-tap grading for a leg the engine refused to call. */
.leg-fix { display: flex; gap: 7px; margin-top: 8px; flex-wrap: wrap; }
.leg-fix button {
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line); color: var(--dim);
  font-size: 12px; font-weight: 700;
}
.leg-fix button:hover { color: var(--text); border-color: var(--dim); }
.leg-fix button.won:hover { color: var(--green); border-color: var(--green-deep); }
.leg-fix button.lost:hover { color: var(--red); border-color: var(--red); }

.empty { padding: 48px var(--pad); text-align: center; color: var(--dim); }
.empty svg { width: 46px; height: 46px; opacity: .3; margin-bottom: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (min-width: 560px) {
  :root { --pad: 20px; }
  .cards, .lb, .tabs, .chiprow, .appbar, .section { max-width: 560px; margin-inline: auto; }
}
