/* ไปต่อ (PaiTor) — shared tokens */
:root {
  --ink: #131a33;        /* page ground: tournament-night navy */
  --deep: #0d1327;       /* header / footer band */
  --panel: #1b2448;      /* raised surface */
  --panel-2: #222d57;    /* hover / nested surface */
  --line: #2e3a68;       /* rules and borders */
  --paper: #f4f1e8;      /* primary text, warm like a printed pairing sheet */
  --muted: #a9b0cc;      /* secondary text */
  --gold: #f5b83d;       /* sleeve gold: wins, primary actions */
  --gold-ink: #241802;   /* text on gold */
  --sky: #8db8ff;        /* live / current round */
  --loss: #4a5582;       /* losses, spent hearts */
  --warn: #ff9e73;       /* drops, disputes */
  --warn-bg: #3a2018;
  --warn-ink: #2a0e00;
  --warn-text: #ffd4bf;
  --warn-line: #8a4a30;
  --text-2: #d7d9e4;     /* body copy one step below paper */
  --placeholder: #7d86a8;
  --gold-hover: #ffc85a;
  --now-bg: #1a2a52;
  --shadow: rgba(4, 7, 20, .7);
  --scrim: rgba(5, 8, 20, .72);
  color-scheme: dark;

  --font-display: 'Bai Jamjuree', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai', system-ui, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 28px;
}

/* light mode: the "printed pairing sheet" look, also best on shop projectors */
:root[data-theme="light"] {
  --ink: #f3f4f8;
  --deep: #ffffff;
  --panel: #ffffff;
  --panel-2: #e8ebf5;
  --line: #d5d9e6;
  --paper: #141b33;
  --muted: #59617f;
  --gold: #2747d9;       /* wins and primary actions turn cobalt */
  --gold-ink: #ffffff;
  --gold-hover: #1f3bb8;
  --sky: #9a5b00;        /* current round: dark amber that stays readable */
  --now-bg: #fff3dc;
  --loss: #b7bdd0;
  --warn: #d93a5b;
  --warn-ink: #ffffff;
  --warn-bg: #fde8ed;
  --warn-text: #8f1f37;
  --warn-line: #e8a3b2;
  --text-2: #2f3756;
  --placeholder: #8a91aa;
  --shadow: rgba(20, 27, 51, .14);
  --scrim: rgba(20, 27, 51, .45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.25; /* Thai marks need room above and below */
  margin: 0;
  font-weight: 700;
  text-wrap: balance; /* no single word stranded on the last line */
}
p, li, label { text-wrap: pretty; }

p { margin: 0; }

a { color: var(--gold); }
a:hover { color: var(--gold-hover); }

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 16px/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-gold:hover { background: var(--gold-hover); color: var(--gold-ink); }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel); color: var(--paper); }
.btn-warn { background: var(--warn); color: var(--warn-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field {
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--paper);
  font: 400 16px var(--font-body);
}
.field::placeholder { color: var(--placeholder); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* path nodes: the brand's one visual motif */
.path { display: flex; align-items: flex-start; }
.path-step { display: flex; align-items: flex-start; flex: 1 1 0; min-width: 0; }
.path-step:first-child { flex: 0 0 auto; }
.path-link { flex: 1; height: 3px; margin-top: 17px; border-radius: 3px; background: var(--line); min-width: 8px; }
.path-link.won { background: var(--gold); }
.path-node-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.path-node {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--line);
  font: 700 14px var(--font-display);
  color: var(--muted);
  background: transparent;
}
.path-node.w { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.path-node.l { background: var(--loss); border-color: var(--loss); color: var(--paper); }
.path-node.d { background: var(--panel-2); border-color: var(--muted); color: var(--paper); }
.path-node.now { border-color: var(--sky); color: var(--sky); background: var(--now-bg); }
.path-node.goal { width: 46px; height: 46px; border-color: var(--gold); color: var(--gold); }
.path-node.goal.reached { background: var(--gold); color: var(--gold-ink); }
.path-node.goal.out { border-color: var(--loss); color: var(--loss); }
.path-step:last-child .path-link { margin-top: 21px; }
.path-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.path-label.now { color: var(--sky); }

.hearts { display: flex; gap: 4px; }
.heart { width: 30px; height: 30px; }

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

/* theme switch */
.theme-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font: 500 14px var(--font-body); cursor: pointer;
}
.theme-btn:hover { color: var(--paper); background: var(--panel-2); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-btn .moon { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: inline; }
:root[data-theme="light"] .path-node.l { color: var(--paper); }

/* language switch: two-segment TH / EN */
.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
}
.lang-switch button {
  min-height: 34px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 0;
  background: transparent; color: var(--muted); font: 600 14px var(--font-body); cursor: pointer;
}
.lang-switch button:hover { color: var(--paper); }
.lang-switch button[aria-pressed="true"] { background: var(--panel-2); color: var(--paper); box-shadow: inset 0 -2px 0 var(--gold); }

/* shared small pieces */
.eyebrow { color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.tag {
  display: inline-block; vertical-align: middle; font: 600 12px/1.6 var(--font-body);
  color: var(--sky); border: 1px solid currentColor; border-radius: 999px; padding: 0 8px; margin-left: 4px;
}
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.logo-ic { width: 20px; height: 20px; object-fit: contain; border-radius: 4px; }
.opt { color: var(--muted); font-weight: 400; font-size: .9em; }
