@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  color-scheme: light dark;
  --bg: #fff8ee;
  --surface: #fffdf8;
  --surface-alt: #f7ecd9;
  --text: #16233a;
  --dim: #6d6353;
  --border: #e3d5bd;
  --accent: #0e7c6b;
  --accent-ink: #0a5c4f;
  --gold: #9a7414;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101827;
    --surface: #1a2436;
    --surface-alt: #232f47;
    --text: #f5eddc;
    --dim: #a89e8a;
    --border: #33405a;
    --accent: #3ec9b0;
    --accent-ink: #7fe0cd;
    --gold: #e3b341;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
main { max-width: 42rem; margin: 0 auto; padding: 0 1rem 2.5rem; }
.display { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; }
.logo { font-size: 2.25rem; line-height: 1; margin: 0; }
.h2 { font-size: 1.5rem; margin: 0.25rem 0; }
.h3 { font-size: 1.25rem; margin: 0; }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.75rem; }
.dim { color: var(--dim); }
.err { color: var(--accent-ink); font-size: 0.875rem; font-weight: 600; min-height: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding-top: 1.25rem; }
.who { text-align: right; }
.who p { margin: 0; }
.linklike { background: none; border: none; color: var(--accent-ink); text-decoration: underline; font-weight: 600; font-size: 0.75rem; cursor: pointer; min-height: 2rem; padding: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}
.ticket { border: 2px dashed var(--border); }
.ticket-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.kicker { color: var(--accent-ink); font-weight: 800; font-size: 0.75rem; letter-spacing: 0.08em; margin: 0; }
.bigcount { text-align: center; }
.bigcount .display { font-size: 3rem; line-height: 1; display: block; }
.bigcount .tiny { font-weight: 700; }
.quote { font-size: 1.35rem; font-style: italic; line-height: 1.35; margin: 1rem 0 0; }
.meta { margin-top: 1rem; }
.hero { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); margin-top: 1.5rem; background: #fdf6e9; }
.hero img { width: 100%; height: 11rem; object-fit: cover; object-position: center 55%; display: block; }
@media (min-width: 640px) { .hero img { height: 14rem; } .quote { font-size: 1.5rem; } }
.row { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }
@media (min-width: 640px) { .row { flex-direction: row; } }
input {
  flex: 1; min-height: 2.75rem; border-radius: 0.5rem; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); padding: 0.5rem 0.75rem; font-size: 1rem;
}
.btn {
  min-height: 2.75rem; border-radius: 0.5rem; border: none; padding: 0.5rem 1.25rem;
  font-weight: 700; font-size: 1rem; cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.dark { background: var(--text); color: var(--bg); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.full { width: 100%; }
.small-btn { min-height: 2.25rem; font-size: 0.875rem; padding: 0.375rem 0.75rem; }
.guessbox { border: 2px solid var(--accent); }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.urgent { color: var(--accent-ink); }
.sticky {
  position: sticky; top: 0.5rem; z-index: 40; margin-top: 1rem;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0.75rem 1rem; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between;
}
.sticky.low { border-color: var(--gold); }
.sticky.critical { border-color: var(--accent-ink); }
.sticky .display { font-size: 1.125rem; }
.alertbox { border: 2px solid var(--gold); border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-weight: 700; font-size: 0.875rem; margin-top: 0.5rem; }
.alertbox.critical { border-color: var(--accent-ink); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.chip {
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text);
  border-radius: 999px; padding: 0.375rem 0.75rem; font-size: 0.75rem; font-weight: 500; cursor: pointer; min-height: 2.25rem;
}
.chip:disabled { opacity: 0.5; cursor: default; }
summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--dim); min-height: 2.25rem; padding-top: 0.5rem; }
.pips { display: flex; gap: 0.375rem; margin-top: 0.5rem; }
.pip { height: 0.5rem; flex: 1; border-radius: 999px; background: var(--border); }
.pip.used { background: var(--accent); }
.hints { margin: 0.75rem 0; padding-left: 1.25rem; font-size: 0.875rem; }
.lastqa { margin-top: 0.75rem; background: var(--surface-alt); border: 2px solid var(--accent); border-radius: 0.5rem; padding: 0.6rem 0.75rem; }
.lastqa-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.lastqa-label { font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-right: 0.4rem; }
.lastqa p { margin: 0.25rem 0 0; }
.qa { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.qa li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; background: var(--surface-alt); border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; }
.stamp {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 2px solid currentColor; border-radius: 6px; padding: 1px 8px;
  font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; transform: rotate(-2deg);
}
.stamp.yes { color: var(--accent); }
.stamp.no { color: var(--accent-ink); }
.stamp.unknown { color: var(--dim); }
.stamp.hint { color: var(--gold); }
.sharebox { background: var(--surface-alt); border-radius: 0.5rem; padding: 1rem; margin-top: 1rem; }
.sharebox h4 { margin: 0.5rem 0; font-size: 0.875rem; }
.sharebox pre { white-space: pre-wrap; font-family: inherit; font-size: 0.875rem; margin: 0.5rem 0 0.75rem; }
.archive { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.arch { margin-top: 0; }
.italic { font-style: italic; }
footer { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1rem; line-height: 1.6; }
#install-bar { max-width: 42rem; margin: 0 auto; padding: 0.75rem 1rem 0; }
.tabbar {
  position: sticky; top: 0; z-index: 60; display: flex; gap: 0.5rem; overflow-x: auto;
  padding: 0.75rem 0 0.5rem; background: var(--bg);
}
.tabbtn {
  flex-shrink: 0; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; min-height: 2.5rem;
}
.tabbtn.active { border-color: var(--text); background: var(--text); color: var(--bg); }
.tabhint {
  border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface);
  padding: 0.75rem 1rem; font-size: 0.875rem; margin-top: 0.75rem;
}
.btnrow { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.passbox { border: 2px solid var(--accent); }
.passlist { margin: 0.75rem 0; padding-left: 1.25rem; font-size: 0.875rem; display: flex; flex-direction: column; gap: 0.375rem; }
.statgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-top: 1rem; }
@media (min-width: 640px) { .statgrid { grid-template-columns: repeat(4, 1fr); } }
.statcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; text-align: center; }
.leaguegrid { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 640px) { .leaguegrid { grid-template-columns: 1fr 1fr; } }
.leaguecard { margin-top: 0; text-align: left; cursor: pointer; width: 100%; font: inherit; color: inherit; }
.leaguecard.selected { border: 2px solid var(--accent); }
