/* LastSet theme: black and gold (default). Light = ivory and gold, chosen in Settings. */
:root {
  --bg: #050505; --surface: #111111; --surface2: #1a1913; --text: #f4efe0; --muted: #a69f8a;
  --line: #2b2819; --accent: #d4af37; --accent-ink: #0a0800; --good: #7bc47f; --warn: #e6b422; --bad: #ff7a6b;
  --chart1: #d4af37; --chart2: #e8d48a; --heat0: #171612; --heat1: #40350f; --heat2: #7a6419; --heat3: #b8921f; --heat4: #f0d060;
  --gold-hi: #ecd26b; --gold-lo: #c39a22;
  --shadow: 0 0 0 1px rgba(212, 175, 55, .05);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #faf7ee; --surface: #fffdf6; --surface2: #f3ecd8; --text: #1c1810; --muted: #7a705a;
  --line: #e6dcc0; --accent: #c9a227; --accent-ink: #1a1500; --good: #2f8f4e; --warn: #b07a00; --bad: #c43d2f;
  --chart1: #b8860b; --chart2: #8a6d1d; --heat0: #efe8d2; --heat1: #f3e3a4; --heat2: #e2c35a; --heat3: #c9a227; --heat4: #8a6a0a;
  --gold-hi: #e3c457; --gold-lo: #b8921f;
  --shadow: 0 1px 2px rgba(60, 45, 0, .08), 0 4px 14px rgba(60, 45, 0, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: 76px; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .pad { padding: 16px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.brand svg { color: var(--accent); }
.tabs { display: none; gap: 4px; }
.tabs a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a.on { background: var(--surface2); color: var(--text); }
.tabs a.cta { background: var(--accent); color: var(--accent-ink); }
.bottom { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; font-weight: 600; text-decoration: none; color: var(--muted); }
.bottom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom a.on { color: var(--accent); }
.bottom a.plus svg { background: var(--accent); color: var(--accent-ink); stroke: var(--accent-ink); border-radius: 12px; padding: 3px; width: 32px; height: 26px; }
@media (min-width: 860px) { .tabs { display: flex; } .bottom { display: none; } body { padding-bottom: 32px; } }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card > h2 { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.stat .d { font-size: 12.5px; margin-top: 2px; }
.up { color: var(--good); } .down { color: var(--bad); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 13px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; color: var(--muted); padding: 6px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--surface2); color: var(--text); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .seg button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.search { width: 100%; max-width: 420px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; text-decoration: none; }
.row:hover .name { color: var(--accent); }
.row .name { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { color: var(--muted); font-size: 12.5px; text-align: right; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface2); border-radius: 999px; padding: 2px 9px; font-size: 12.5px; color: var(--muted); }
.chip.pr { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 700; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.35; transform: translate(-50%, -110%); white-space: nowrap; z-index: 3; }
.axis text { fill: var(--muted); font-size: 11px; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.heat { display: block; width: 100%; height: auto; }
.heat rect { rx: 2; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; border-top: 0; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.warm { color: var(--muted); }
.pr-star { color: var(--accent); font-weight: 700; }
.ex-card { border-top: 1px solid var(--line); padding: 12px 0; }
.ex-card:first-child { border-top: 0; }
.ex-card .head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ex-card .head a { font-weight: 700; text-decoration: none; }
.ex-card .head a:hover { color: var(--accent); }
.sets { margin-top: 3px; color: var(--text); font-variant-numeric: tabular-nums; }
.raw { margin-top: 4px; color: var(--muted); font: 12.5px ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.flag { color: var(--warn); font-size: 12.5px; font-weight: 600; }
.month { margin: 18px 0 6px; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.set-row { display: grid; grid-template-columns: 24px 1fr 1fr auto auto; gap: 6px; align-items: center; margin-top: 6px; }
.set-row input { width: 100%; }
.set-row .n { color: var(--muted); text-align: center; font-size: 12.5px; }
.last-hint { background: var(--surface2); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 13px; display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.form-row .field { flex: 1 1 160px; }
.modal { position: fixed; z-index: 50; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal[hidden], .toast[hidden] { display: none; }
.modal .sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px; }
@media (min-width: 700px) { .modal { align-items: center; padding: 20px; } .modal .sheet { border-radius: 18px; } }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 15px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 92vw; }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.notice { border-left: 3px solid var(--warn); background: var(--surface2); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spark { display: block; }
.timer { position: fixed; right: 14px; bottom: 90px; z-index: 30; }
@media (min-width: 860px) { .timer { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.today-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 14px; margin-bottom: 14px; }
.today-head h1 { font-size: 26px; letter-spacing: -.01em; }
.mchips { display: flex; flex-wrap: wrap; gap: 8px; }
.mchip { display: flex; flex-direction: column; align-items: flex-start; gap: 0; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 12px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; min-width: 84px; }
.mchip small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.mchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mchip.on small { color: inherit; opacity: .85; }
.item .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.item .head .name { font-weight: 700; font-size: 16px; text-decoration: none; overflow-wrap: anywhere; }
.item .head select { padding: 4px 6px; border-radius: 8px; }
.hint { margin-top: 6px; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
.tsets { margin-top: 8px; display: grid; gap: 8px; }
.tset { display: grid; grid-template-columns: 20px minmax(0, 1.15fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tset .n { color: var(--muted); font-size: 12.5px; text-align: center; }
.tset .u { color: var(--muted); font-size: 13px; }
.step { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.step input { width: 100%; min-width: 0; border: 0; border-radius: 0; text-align: center; padding: 9px 2px; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.step button { flex: none; width: 36px; border: 0; background: var(--surface2); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.step button:active { background: var(--line); }
.chk { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 44px; height: 42px; cursor: pointer; }
.chk input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chk span { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 700; color: var(--muted); font-size: 14px; }
.chk input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.chk input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.tset .delta { grid-column: 2 / -1; font-size: 12.5px; font-weight: 700; margin-top: -4px; }
.tset .delta.up { color: var(--good); } .tset .delta.down { color: var(--bad); }
.tset.is-done .step { opacity: .6; }
.finish { position: fixed; z-index: 25; left: 0; right: 0; bottom: 64px; padding: 8px 16px; display: flex; justify-content: center; pointer-events: none; }
.finish .btn { pointer-events: auto; width: 100%; max-width: 520px; justify-content: center; padding: 13px; font-size: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.28); }
@media (min-width: 860px) { .finish { bottom: 12px; } }
.timer { bottom: 130px; }
@media (min-width: 860px) { .timer { bottom: 70px; } }
.timer { right: auto; left: 14px; }
.timer .btn { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.sup-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.supbtn { border: 1px solid var(--line); background: var(--surface2); color: var(--muted); border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.supbtn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.sup { background: color-mix(in srgb, var(--chart2) 20%, transparent); color: var(--chart2); font-weight: 700; }
.xbtn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0 0 4px; font: inherit; }
.xbtn:hover { color: var(--bad); }
.sw-big { font-size: 56px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin: 14px 0 18px; }
#rest-btn.running { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
#rest-btn { font-variant-numeric: tabular-nums; min-width: 84px; justify-content: center; }
.sore-row { padding: 8px 0; border-top: 1px solid var(--line); }
.sore-row:first-of-type { border-top: 0; }
.sore-name { font-weight: 700; margin-bottom: 6px; }
.sore-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sore-opts button { border: 1px solid var(--line); background: var(--surface2); color: var(--muted); border-radius: 10px; padding: 9px 2px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.sore-opts button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sore-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.sore-note.good { color: var(--good); font-weight: 600; }
.seg a { display: inline-block; padding: 6px 11px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--surface2); color: var(--text); }
.seg.scroll { max-width: 100%; overflow-x: auto; }
.today-main { max-width: 760px; margin-left: auto; margin-right: auto; }
.welcome { border-color: var(--accent); }
/* sign-in screen, account, sync pill */
.pill { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; background: var(--surface2); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.bad { color: var(--warn); }
.tabs + .pill { margin-left: 10px; }
body.logged-out .tabs, body.logged-out .bottom, body.logged-out .pill { display: none !important; }
.auth { max-width: 380px; margin: 12vh auto 0; text-align: center; padding: 0 4px; }
.auth h1 { font-size: 34px; letter-spacing: -.02em; margin: 6px 0 8px; }
.auth-logo { color: var(--accent); }
.auth-tag { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.btn.google { width: 100%; justify-content: center; padding: 13px 16px; font-size: 16px; background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.google:hover { background: #f6f7f8; }
.acct-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface2); }
.avatar.ph { display: inline-block; }

/* gold polish */
.btn.primary, .mchip.on, .tabs a.cta { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); border-color: var(--gold-lo); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.tabs a.on { background: var(--surface2); color: var(--accent); }
.bottom a.on { color: var(--accent); }
.bottom a.plus svg { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); }
.brand { letter-spacing: .02em; }
.card { border-color: var(--line); }
.today-head h1 { letter-spacing: -.01em; }
.stat .v { color: var(--accent); }
.seg button.on, .seg a.on { color: var(--accent); }
.chip.pr { color: var(--accent); }
.sore-opts button.on, .supbtn.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); border-color: var(--gold-lo); color: var(--accent-ink); }
.chk input:checked + span { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); border-color: var(--gold-lo); color: var(--accent-ink); }
#rest-btn.running { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); border-color: var(--gold-lo); color: var(--accent-ink); }
.welcome { border-color: var(--gold-lo); }
