/* INBLACK theme — follows exp.inblackm.com: white ground, red gradient CTA, Inter + Noto Sans Thai, 800 headings. */
:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f7f5f5; --ink: #111827; --ink-strong: #101820; --muted: #5f6673; --line: #f3f4f6; --line-2: #e5e7eb;
  --brand-1: #df1715; --brand-2: #b90000; --accent: #c90304; --tint: #fef2f2;
  --grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  --shadow-cta: 0 8px 22px rgba(177, 0, 0, .18); --shadow-card: 0 6px 24px rgba(17, 24, 39, .06); --shadow-pop: 0 24px 60px rgba(17, 24, 39, .12);
  --buy: #ffffff; --buy-bg: #c90304; --wait: #8a4b00; --wait-bg: #fff4e5; --wait-line: #f5c77e; --skip: #374151; --skip-bg: #f3f4f6;
  --ok: #166534; --ok-bg: #ecfdf3; --bad: #b90000; --warn-bg: #fff4e5;
  --font: Inter, "Noto Sans Thai", "Leelawadee UI", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #151b23; --surface-2: #11161d; --ink: #e5e7eb; --ink-strong: #ffffff; --muted: #9ca3af; --line: #232b36; --line-2: #2f3946;
    --accent: #f87171; --tint: #2a1416;
    --shadow-card: 0 6px 24px rgba(0, 0, 0, .35); --shadow-pop: 0 24px 60px rgba(0, 0, 0, .5);
    --buy: #ffffff; --buy-bg: #c90304; --wait: #fcd34d; --wait-bg: #33260f; --wait-line: #6b4f12; --skip: #d1d5db; --skip-bg: #232b36;
    --ok: #86efac; --ok-bg: #11291b; --bad: #fca5a5; --warn-bg: #33260f;
  }
  .band { border: 1px solid var(--line-2); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
a:hover { color: var(--brand-2); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* header pill */
header.top { padding: 16px 16px 0; position: sticky; top: 0; z-index: 10; }
header.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 10px 14px 10px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card); }
header.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink-strong); line-height: 1; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--grad); display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 7px; flex: none; }
.logo i { background: #fff; }
.logo i:nth-child(even) { background: rgba(255, 255, 255, .35); }
.brand-name { display: flex; flex-direction: column; }
.brand-name b { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand-name small { font-weight: 700; font-size: 10px; letter-spacing: .22em; color: var(--accent); margin-top: 3px; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
header.top nav a { padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; }
header.top nav a:hover { background: var(--surface-2); color: var(--accent); }
header.top nav a[aria-current="page"] { color: var(--accent); background: var(--tint); font-weight: 700; }

main.wrap { padding-top: 32px; padding-bottom: 64px; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 10px; color: var(--ink-strong); }
h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin: 44px 0 14px; color: var(--ink-strong); }
.hl { color: var(--accent); }
.eyebrow { display: block; font-size: 13px; font-weight: 700; letter-spacing: .14em; color: var(--accent); margin-top: 44px; }
.eyebrow + h2 { margin-top: 4px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.term { font-family: var(--mono), var(--font); color: var(--ink); }
.term::after { content: ""; display: inline-block; width: .55em; height: 1.1em; background: var(--ink-strong); vertical-align: -.2em; margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term::after { animation: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 16px; font-weight: 700; text-decoration: none; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-cta); }
.btn.primary:hover { color: #fff; filter: brightness(1.05); }
.btn.ghost { background: var(--surface); color: var(--ink-strong); border: 1px solid var(--line-2); font-weight: 600; }

/* hero (index) */
.hero { position: relative; overflow: hidden; padding: 40px 0 88px; }
.hero::before { content: ""; position: absolute; left: -10%; right: -10%; bottom: -300px; height: 420px; border-radius: 50% 50% 0 0; background: var(--grad); }
.hero .wrap { position: relative; display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.hero-copy { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.hero-copy h1, .hero-copy p { margin: 0; }
.chip { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 13px; font-weight: 700; }
.chip::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.pixels { position: absolute; right: 0; top: -28px; display: grid; grid-template-columns: repeat(6, 16px); gap: 6px; opacity: .9; }
.pixels i { height: 16px; }
.pixels i:nth-child(3n+1) { background: #fde2e2; } .pixels i:nth-child(5n+2) { background: #fca5a5; } .pixels i:nth-child(7n) { background: var(--accent); }
.tally { position: relative; z-index: 1; flex: 1 1 340px; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-pop); padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.tally .cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tally .cell { border-radius: 16px; padding: 14px 12px; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; font-weight: 700; }
.tally .cell b { font-size: 34px; font-weight: 800; line-height: 1; }
.cell.buy { background: var(--grad); color: #fff; }
.cell.wait { background: var(--wait-bg); color: var(--wait); border: 1px solid var(--wait-line); }
.cell.skip { background: var(--skip-bg); color: var(--skip); }

/* cards + grid */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-top: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-card); }
.card.game { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; padding: 0 0 16px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card.game > :not(img) { margin: 0 16px; }
.card.game:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.card.game img { width: 100%; aspect-ratio: 231 / 87; object-fit: cover; background: var(--ink-strong); display: block; }
.card.game strong { font-size: 15px; line-height: 1.35; }
.price { font-size: 22px; font-weight: 800; color: var(--ink-strong); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.badge { display: inline-block; flex: none; padding: 3px 11px; border-radius: 999px; font-weight: 700; font-size: .8rem; border: 1px solid transparent; }
.badge.buy { color: var(--buy); background: var(--buy-bg); }
.badge.wait { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-line); }
.badge.skip { color: var(--skip); background: var(--skip-bg); }
.score { font-variant-numeric: tabular-nums; font-weight: 800; }
.bar { height: 8px; background: var(--skip-bg); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 999px; }

/* formula band */
.band { margin-top: 48px; border-radius: 28px; background: #101820; color: #fff; padding: 32px; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.band h2 { color: #fff; margin: 4px 0 8px; }
.band .eyebrow { color: #fca5a5; margin: 0; }
.band p { color: #d1d5db; margin: 0; }
.band a { color: #fca5a5; }
.band > div:first-child { flex: 1 1 300px; min-width: 0; }
.weights { flex: 2 1 480px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.weights div { border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.weights b { font-size: 28px; font-weight: 800; color: #f87171; }
.weights span { color: #9ca3af; font-size: 13px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 700; background: var(--surface-2); }
td.num, th.num { text-align: right; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.table-scroll tr:last-child td { border-bottom: 0; }
code, .src { font-family: var(--mono); font-size: .78rem; word-break: break-all; }
.src { color: var(--muted); }
.src a { color: var(--accent); }
.note { background: var(--warn-bg); color: var(--ink); border-radius: 14px; padding: 12px 14px; font-size: .9rem; }
.ok { color: var(--ok); background: var(--ok-bg); font-weight: 700; padding: 2px 10px; border-radius: 999px; font-size: .8rem; white-space: nowrap; }
.bad { color: var(--bad); font-weight: 700; }
.line-chart { margin-bottom: 10px; }
.line-svg { display: block; width: 100%; height: 140px; overflow: visible; }
.line-main { fill: none; stroke: var(--brand-2, #b90000); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.line-dot { stroke: var(--brand-2, #b90000); stroke-width: 9; stroke-linecap: round; }
.line-ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 4; opacity: .6; }
.line-low { stroke: var(--ok); stroke-width: 1; stroke-dasharray: 2 4; opacity: .8; }
.line-labels { position: relative; height: 4.6em; margin-top: 6px; font-size: .82rem; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.line-labels span { position: absolute; top: 0; white-space: nowrap; }
.line-labels strong { color: var(--ink); }
details.card summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
details.card[open] summary { margin-bottom: 12px; }
footer { margin-top: auto; background: var(--surface-2); color: var(--muted); font-size: .85rem; padding: 28px 0 36px; }
@media (max-width: 640px) {
  header.top { position: static; }
  header.top nav { margin-left: 0; width: 100%; }
  .pixels { display: none; }
  .band { padding: 24px; }
}
