@font-face { font-family: 'Bai Jamjuree'; src: url(/fonts/bai-400.woff) format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Bai Jamjuree'; src: url(/fonts/bai-600.woff) format('woff'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Bebas Neue'; src: url(/fonts/bebas.woff) format('woff'); font-weight: 400; font-display: swap; }

:root {
  --ink: #141414;
  --paper: #ffffff;
  --bg: #f3f2ed;
  --line: #dcd9cf;
  --muted: #5e5b54;
  --y: #ffe10e;          /* the yellow bar in the Steadikoon logo */
  --y-soft: #fff5b3;
  --r: 14px;
  --display: 'Bebas Neue', 'Bai Jamjuree', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 'Bai Jamjuree', system-ui, -apple-system, sans-serif;
}
button, input { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.top { background: var(--paper); border-bottom: 1px solid var(--line); padding: 14px 0 26px; text-align: center; }
.top .wrap { position: relative; }
.logo { display: block; width: 150px; height: auto; margin: 22px auto 8px; }
h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(42px, 12vw, 58px); line-height: .95; letter-spacing: .01em;
  margin: 6px 0 10px;
}
:lang(th) h1 { font-weight: 600; font-size: clamp(34px, 9.5vw, 46px); line-height: 1.15; }
.range { margin: 0 0 12px; }
.range span {
  display: inline-block; background: var(--y); padding: 2px 16px 0;
  font-family: var(--display); font-size: 26px; letter-spacing: .04em;
  transform: skewX(-12deg);
}
:lang(th) .range span { font-weight: 600; font-size: 20px; padding: 3px 14px; }
.lead { margin: 0 auto; max-width: 30em; color: var(--muted); }

.lang { position: absolute; top: 0; right: 16px; display: flex; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.lang button { border: 0; background: none; padding: 4px 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- cards + form ---------- */
main { padding-top: 18px; padding-bottom: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 16px; margin-bottom: 14px; }
.step { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.step-h { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; padding: 0; margin-bottom: 8px; }
.step-h.small { font-size: 15px; color: var(--muted); }
.num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--y);
  display: grid; place-items: center; font-family: var(--display); font-size: 18px; padding-top: 2px;
}
.hint { margin: -4px 0 10px; color: var(--muted); font-size: 14px; }

input[type="text"], input:not([type]) {
  width: 100%; padding: 12px 14px; font-size: 17px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
}
input:focus { outline: none; border-color: var(--ink); }

.chips { display: grid; gap: 8px; }
.dates { grid-template-columns: repeat(4, 1fr); }
.acts { grid-template-columns: 1fr 1fr; }
@media (max-width: 350px) { .acts { grid-template-columns: 1fr; } }

.chip {
  position: relative; display: block; cursor: pointer; user-select: none; -webkit-user-select: none;
  background: var(--paper); border: 2px solid var(--line); border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.on::after {
  content: '✓'; position: absolute; top: 3px; right: 7px;
  color: var(--y); font-weight: 600; font-size: 14px;
}

.dates .chip { text-align: center; padding: 8px 2px 6px; }
.chip .wd { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip .dn { display: block; font-family: var(--display); font-size: 32px; line-height: 1; padding-top: 3px; }
.chip .mo { display: block; font-size: 12px; color: var(--muted); }
.chip.on .wd, .chip.on .mo { color: #cfcfcf; }
.chip.on .dn { color: var(--y); }

.acts .chip { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px 11px; font-weight: 600; font-size: 15px; line-height: 1.2; }
.acts .em { font-size: 24px; line-height: 1; }
.acts .an { white-space: nowrap; }

.add-act { display: flex; gap: 8px; margin-top: 10px; }
.add-act input { flex: 1; min-width: 0; font-size: 16px; padding: 10px 12px; border-style: dashed; }
.add-act input:focus { border-style: solid; }
.add-btn {
  flex: none; cursor: pointer; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--ink); color: var(--paper); font-weight: 600; padding: 0 18px;
}
.add-btn:active { transform: translateY(1px); }
.hint.addh { margin: 6px 0 0; font-size: 13px; }
.chip .tag { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.chip.on .tag { color: #cfcfcf; }

.link {
  background: none; border: 0; padding: 8px 0 0; cursor: pointer;
  font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
}
.link.quiet { display: block; margin: 12px auto 0; color: var(--muted); font-weight: 400; }

.mine { margin: 0 0 10px; padding: 10px 12px; background: var(--y-soft); border-radius: 10px; font-size: 15px; }
.msg { margin: 0 0 10px; color: #b3261e; font-weight: 600; min-height: 0; }
.msg:empty { display: none; }

.btn {
  display: block; width: 100%; cursor: pointer;
  background: var(--y); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
  font-family: var(--display); font-size: 26px; letter-spacing: .04em; padding: 12px 10px 9px;
  -webkit-tap-highlight-color: transparent;
}
:lang(th) .btn { font-weight: 600; font-size: 20px; padding: 12px 10px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn.ghost { background: var(--paper); margin: 6px 0 22px; }

/* ---------- results ---------- */
.results { margin-top: 30px; }
.res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 36px; line-height: 1; margin: 0; letter-spacing: .02em; }
:lang(th) h2 { font-weight: 600; font-size: 26px; }
h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.count { color: var(--muted); font-weight: 600; }

.plan { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.plan .eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #bdbdbd; }
.plan .big { font-family: var(--display); color: var(--y); font-size: 52px; line-height: 1; margin: 6px 0 2px; letter-spacing: .02em; }
:lang(th) .plan .big { font-weight: 600; font-size: 38px; line-height: 1.15; }
.plan .sub { margin: 0 0 4px; }
.plan .sub b { color: var(--y); }
.plan .muted { color: #bdbdbd; font-size: 14px; margin: 0; }
.plan .slots { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid #3a3a3a; }
.plan .slots li { display: grid; grid-template-columns: 82px 1fr auto; gap: 8px; align-items: baseline; padding: 5px 0; }
.plan .slot { color: #bdbdbd; font-size: 14px; }
.plan .what { font-weight: 600; }
.plan .n { color: #bdbdbd; font-size: 14px; white-space: nowrap; }
.plan .alt { margin: 14px 0 0; font-size: 14px; color: #bdbdbd; }
.plan .empty { margin: 0; font-size: 17px; }

.grid-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 14px; width: 100%; table-layout: fixed; }
.grid th, .grid td { padding: 7px 2px; text-align: center; border-bottom: 1px solid #eeebe3; }
.grid thead th { font-weight: 600; vertical-align: bottom; }
.grid thead th small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.grid thead th b { display: block; font-family: var(--display); font-size: 21px; font-weight: 400; line-height: 1; }
.grid .who {
  position: sticky; left: 0; z-index: 1; background: var(--paper);
  text-align: left; padding-right: 8px; width: 30%;
  font-weight: 600; overflow-wrap: anywhere;
}
.grid .who small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.3; }

.grid .best { background: var(--y-soft); }
.grid thead .best { background: var(--y); border-radius: 8px 8px 0 0; }
.grid tfoot td, .grid tfoot th { font-weight: 600; border-bottom: 0; padding-top: 9px; }
.grid tfoot .best { border-radius: 0 0 8px 8px; }
.grid tr.me .who { text-decoration: underline; text-decoration-color: var(--y); text-decoration-thickness: 4px; text-underline-offset: 2px; }
.tick { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: var(--ink); color: var(--y); font-size: 12px; font-weight: 600; }
.del { border: 0; background: none; color: #b3261e; font-size: 15px; cursor: pointer; padding: 0 4px 0 0; }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eeebe3; }
.rank li:last-child { border-bottom: 0; }
.rank .em { font-size: 22px; grid-row: span 2; }
.rank .nm { font-weight: 600; }
.rank .ct { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank .bar { grid-column: 2 / 4; height: 8px; border-radius: 4px; background: #ece9df; overflow: hidden; }
.rank .bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.rank li.lead-pick .bar i { background: var(--y); box-shadow: inset 0 0 0 1.5px var(--ink); }
.rank .names { grid-column: 2 / 4; font-size: 13px; color: var(--muted); line-height: 1.35; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 40px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px;
  font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 10;
}

@media (prefers-reduced-motion: reduce) { .chip:active, .btn:active { transform: none; } }
