:root {
  --pitch: #0f3d2e;
  --pitch-deep: #0a2c21;
  --chalk: #eef4ec;
  --card: #ffffff;
  --ink: #17231d;
  --muted: #55665c;
  --line: #d3dfd5;
  --gold: #f5b71f;
  --dad: #1d4e9e;
  --kid: #c92f63;
  --stamp: #c8281e;
  --display: 'Chakra Petch', 'IBM Plex Sans Thai Looped', sans-serif;
  --body: 'IBM Plex Sans Thai Looped', 'Leelawadee UI', 'Thonburi', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 400 18px/1.6 var(--body);
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- top bar ---------- */
.top {
  background: var(--pitch);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.top h1 { margin: 0; font: 600 22px/1.3 var(--display); }
.top-actions { display: flex; gap: 8px; flex: none; }
.pill {
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-weight: 500;
  font-size: 16px;
}

main { max-width: 520px; margin: 0 auto; padding: 0 16px; }

/* ---------- the duel scoreboard ---------- */
.board {
  margin: 0 -16px;
  padding: 18px 16px 22px;
  background: var(--pitch);
  color: #fff;
  text-align: center;
  border-bottom: 6px solid var(--gold);
}
.board-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}
.board-side { display: grid; gap: 4px; justify-items: center; }
.board-name {
  font: 600 20px/1.3 var(--display);
  padding: 2px 14px;
  border-radius: 6px;
}
.board-name.dad { background: var(--dad); }
.board-name.kid { background: var(--kid); }
.board-num {
  font: 700 76px/1 var(--display);
  color: var(--gold);
  background: var(--pitch-deep);
  border-radius: 10px;
  min-width: 112px;
  padding: 12px 8px;
  font-variant-numeric: tabular-nums;
}
.board-colon { font: 700 44px/1 var(--display); color: rgba(255, 255, 255, 0.5); padding-top: 34px; }
.board-you { font-size: 15px; color: rgba(255, 255, 255, 0.75); min-height: 24px; }
.board-rules { margin: 14px auto 0; max-width: 34ch; text-wrap: balance; font-size: 16px; color: rgba(255, 255, 255, 0.85); }

/* ---------- sections ---------- */
h2.sec { font: 600 22px/1.3 var(--display); margin: 28px 0 4px; }
h3.day { font: 500 17px/1.4 var(--body); color: var(--muted); margin: 16px 0 8px; }
.note { color: var(--muted); font-size: 16px; margin: 8px 0; }
.empty {
  margin: 20px 0;
  padding: 20px;
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}

/* ---------- match ---------- */
.match {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 0 0 12px;
}
.match.live { border-color: var(--stamp); }
.match-when { display: flex; justify-content: space-between; font-size: 16px; color: var(--muted); margin-bottom: 8px; }
.match-when .now { color: var(--stamp); font-weight: 600; }
.team { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; min-height: 56px; }
.team + .team { border-top: 1px solid var(--line); }
.team img { width: 36px; height: 36px; object-fit: contain; }
.team-name { font-weight: 600; font-size: 19px; line-height: 1.3; }
.score { font: 700 30px/1 var(--display); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.score.mine { color: var(--muted); }
.score.blank { color: var(--line); }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--pitch);
  background: #fff;
  color: var(--pitch);
  font: 700 28px/1 var(--display);
}
.stepper button:active { background: var(--pitch); color: #fff; }
.stepper output { font: 700 34px/1 var(--display); min-width: 40px; text-align: center; }

.match-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 10px;
  border: 2px solid var(--pitch);
  background: var(--pitch);
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  flex: 1;
}
.btn.quiet { background: #fff; color: var(--pitch); }
.btn.small { flex: none; min-height: 44px; padding: 0 14px; font-size: 16px; }
.btn[disabled] { opacity: 0.55; }

.picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 16px;
  border: 1.5px solid;
}
.chip.dad { color: var(--dad); border-color: var(--dad); }
.chip.kid { color: var(--kid); border-color: var(--kid); }
.chip.none { color: var(--muted); border-color: var(--line); }
.chip b { font: 700 17px/1 var(--display); }
.chip .pts { background: currentColor; border-radius: 6px; padding: 3px 7px; }
.chip .pts span { color: #fff; font: 700 15px/1 var(--display); }

.error { margin: 12px 0; padding: 12px 14px; border-radius: 10px; background: #fdecea; color: #8a1c14; font-size: 16px; }

/* ---------- lottery ---------- */
.draw {
  margin: 0 -16px;
  padding: 20px 16px 24px;
  background: var(--pitch);
  color: #fff;
  text-align: center;
  border-bottom: 6px solid var(--gold);
}
.draw-label { font-size: 17px; color: rgba(255, 255, 255, 0.85); }
.draw-date { font: 600 26px/1.3 var(--display); margin: 2px 0 10px; }
.draw-count { display: inline-block; font: 700 40px/1.2 var(--display); color: var(--gold); background: var(--pitch-deep); border-radius: 10px; padding: 10px 22px; }

.add { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 10px; }
.add label { display: block; font-size: 16px; color: var(--muted); margin-bottom: 4px; }
.add input, .add select {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--pitch);
  border-radius: 10px;
  background: #fff;
  padding: 0 14px;
  margin-bottom: 12px;
}
.add input { font: 700 32px/1 var(--display); letter-spacing: 0.22em; text-align: center; }
.add input::placeholder { color: var(--line); }
.add .btn { width: 100%; }

.ticket {
  position: relative;
  background:
    repeating-linear-gradient(135deg, rgba(201, 47, 99, 0.07) 0 2px, transparent 2px 9px),
    #fff6f9;
  border: 1.5px solid #e9b9c9;
  border-radius: 10px;
  padding: 14px;
  margin: 0 0 12px;
}
.ticket.win { border-color: var(--stamp); border-width: 2.5px; }
.ticket-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.digits { display: flex; gap: 5px; }
.digits span {
  width: 38px; height: 48px;
  display: grid; place-items: center;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  font: 700 28px/1 var(--display);
}
.digits.small span { width: 30px; height: 40px; font-size: 22px; }
.digits .hit { background: var(--gold); }
.ticket-status { margin-top: 10px; font-size: 17px; color: var(--muted); }
.ticket.win .ticket-status { color: var(--stamp); font-weight: 600; font-size: 19px; }
.stamp {
  display: inline-block;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  border-radius: 8px;
  padding: 0 10px;
  font: 700 20px/1.6 var(--display);
  transform: rotate(-4deg);
  margin-right: 8px;
}

.results { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 14px; margin-top: 10px; }
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.result-line + .result-line { border-top: 1px solid var(--line); }
.result-name { font-weight: 600; }
.result-prize { display: block; font-weight: 400; font-size: 15px; color: var(--muted); }
.result-nums { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  background: #fff;
  border-top: 1.5px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  min-height: 72px;
  border: 0;
  background: none;
  font: 600 21px/1.2 var(--display);
  color: var(--muted);
  border-top: 5px solid transparent;
}
.tab[aria-current='page'] { color: var(--pitch); border-top-color: var(--gold); }

/* ---------- who are you ---------- */
.sheet { position: fixed; inset: 0; background: rgba(10, 44, 33, 0.9); display: grid; place-items: center; padding: 20px; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-box { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 24px; display: grid; gap: 14px; }
.sheet-box h2 { margin: 0 0 4px; font: 600 24px/1.3 var(--display); text-align: center; }
.who-choice { min-height: 76px; border: 0; border-radius: 12px; color: #fff; font: 600 26px/1.2 var(--display); }
.who-choice.dad { background: var(--dad); }
.who-choice.kid { background: var(--kid); }

@media (max-width: 360px) {
  .board-num { font-size: 60px; min-width: 92px; }
  .digits span { width: 32px; height: 44px; font-size: 24px; }
  .stepper button { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: no-preference) {
  .stamp { animation: stamp 0.35s ease-out both; }
  @keyframes stamp { from { transform: rotate(-4deg) scale(1.8); opacity: 0; } }
}

/* ---------- notes ---------- */
.notes { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.notes .note { margin: 4px 0 10px; }
.msg { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; border-left: 5px solid; background: var(--chalk); line-height: 1.5; overflow-wrap: anywhere; }
.msg.dad { border-color: var(--dad); }
.msg.kid { border-color: var(--kid); }
.msg.dad b { color: var(--dad); }
.msg.kid b { color: var(--kid); }
.msg time { display: block; font-size: 14px; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.quick-btn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--pitch); background: #fff; color: var(--pitch); font-size: 16px; }
.quick-btn:active { background: var(--pitch); color: #fff; }
.note-form { display: flex; gap: 8px; }
.note-form input { flex: 1; min-width: 0; min-height: 48px; border: 2px solid var(--pitch); border-radius: 10px; padding: 0 12px; background: #fff; }

/* ---------- fold-out tables ---------- */
.fold { background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; margin: 24px 0 12px; }
.fold summary { min-height: 56px; padding: 14px; font: 600 20px/1.4 var(--display); cursor: pointer; }
.league { width: 100%; border-collapse: collapse; font-size: 17px; }
.league th { font-weight: 500; font-size: 15px; color: var(--muted); text-align: center; padding: 6px 4px; }
.league td { padding: 9px 4px; border-top: 1px solid var(--line); }
.league td:first-child, .league th:first-child { padding-left: 14px; }
.league td:last-child, .league th:last-child { padding-right: 14px; }
.league .tname { text-align: left; }
.league td.tname { font-weight: 500; }
.league td.tname img { width: 24px; height: 24px; object-fit: contain; vertical-align: -5px; margin-right: 8px; }
.league .num { text-align: center; font-variant-numeric: tabular-nums; }
.league .pts-col { font: 700 19px/1 var(--display); }
.league .big { font: 700 21px/1 var(--display); letter-spacing: 0.06em; }
.league .gold { background: #fff4d1; }

/* ---------- news ---------- */
.news { list-style: none; margin: 8px 0 0; padding: 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; }
.news li + li { border-top: 1px solid var(--line); }
.news a { display: block; padding: 14px; color: inherit; text-decoration: none; }
.news a:active { background: var(--chalk); }
.news-title { display: block; font-weight: 600; font-size: 19px; line-height: 1.5; }
.news-meta { display: block; margin-top: 4px; font-size: 15px; color: var(--muted); }

/* ---------- what to eat ---------- */
.cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.cat { min-height: 46px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--pitch); background: #fff; color: var(--pitch); font-weight: 500; }
.cat.on { background: var(--pitch); color: #fff; }
.plate {
  display: grid; place-content: center; text-align: center;
  min-height: 190px; padding: 20px;
  background: var(--pitch); color: #fff;
  border-radius: 16px; border-bottom: 6px solid var(--gold);
}
.plate-name { margin: 0; font: 700 34px/1.35 var(--display); color: var(--gold); text-wrap: balance; }
.plate-sub { margin: 6px 0 0; font-size: 18px; color: rgba(255, 255, 255, 0.85); }
.btn.spin { width: 100%; min-height: 64px; margin-top: 14px; font-size: 22px; }
.order { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.order .btn { display: grid; place-items: center; text-align: center; text-decoration: none; padding: 8px 10px; font-size: 17px; line-height: 1.3; }
.btn.grab { background: #00873f; border-color: #00873f; }
.btn.lineman { background: #06893a; border-color: #06893a; }

/* four tabs */
.tabs { grid-template-columns: repeat(4, 1fr); }
.tab { font-size: 17px; padding: 0 2px; }

/* ---------- home ---------- */
.hello { margin: 0 -16px 16px; padding: 18px 16px 22px; background: var(--pitch); color: #fff; border-bottom: 6px solid var(--gold); display: flex; align-items: center; gap: 14px; }
.cup { width: 56px; height: 56px; flex: none; fill: var(--gold); stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.hello p { margin: 0; }
.hello-hi { font: 700 30px/1.3 var(--display); }
.hello-date { font-size: 17px; color: rgba(255, 255, 255, 0.85); }

.card {
  display: grid; gap: 4px; width: 100%; text-align: left;
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-left: 8px solid var(--pitch);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 12px;
}
button.card:active { background: var(--chalk); }
.card-label { font-size: 16px; color: var(--muted); }
.card-big { font: 700 30px/1.3 var(--display); }
.card-msg { font-weight: 600; font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; }
.card-msg.dad b { color: var(--dad); }
.card-msg.kid b { color: var(--kid); }
.card-sub { font-size: 15px; color: var(--muted); }
.card-action { font-weight: 600; font-size: 18px; color: var(--pitch); }
.card-action.quiet { font-weight: 400; color: var(--muted); }
.card.todo { border-left-color: var(--gold); background: #fffaf0; }
.card.todo .card-action { color: #8a5a00; }
.card.lotto { border-left-color: var(--kid); }
.card.lotto.won { border-color: var(--stamp); }
.card.lotto.won .card-action { color: var(--stamp); }
.card.eat { border-left-color: var(--gold); }
.duel-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.duel-row b { font: 700 44px/1.1 var(--display); min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.duel-row i { font: 700 30px/1 var(--display); color: var(--muted); font-style: normal; }
.duel-side { font: 600 18px/1.5 var(--display); color: #fff; padding: 2px 12px; border-radius: 6px; }
.duel-side.dad { background: var(--dad); }
.duel-side.kid { background: var(--kid); }
.next-teams { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 20px; min-height: 40px; }
.next-teams img { width: 32px; height: 32px; object-fit: contain; }

/* ---------- five tabs with pictures ---------- */
.tabs { grid-template-columns: repeat(5, 1fr); }
.tab { display: grid; justify-items: center; align-content: center; gap: 2px; font-size: 14px; min-height: 68px; }
.tab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current='page'] { background: #f3f8f1; }
.tab[aria-current='page'] svg { stroke-width: 2.3; }

/* ---------- top bar with three buttons ---------- */
.top h1 { font-size: 20px; }
.top-actions { gap: 6px; }
.pill { padding: 0 12px; min-width: 44px; }

/* ---------- confirmations ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; font-weight: 600; padding: 12px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 5; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- larger text ---------- */
body.big main, body.big .tabs, body.big .top, body.big #toast { zoom: 1.15; }
.ticket-row { flex-wrap: wrap; }

.plate-name.hint { font: 500 22px/1.5 var(--body); color: rgba(255, 255, 255, 0.9); }
