:root {
  /* Light tokens are the base; dark applies for data-theme="dark", or for the system choice when it prefers dark. */
  color-scheme: light;
  --bg: #f3f5fb;
  --panel: #ffffffe6;
  --line: #0b10201f;
  --text: #141a33;
  --muted: #5a6385;
  --accent: #4361ee;
  --accent-2: #e0459b;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --glass: #0b10200a;
  --glass-2: #0b102014;
  --toolbar: #f3f5fbf2;
  --scrim: #0b102066;
  --aurora: .3;
  --bg-grad: linear-gradient(180deg, #dff1ff 0%, #eef6ff 38%, #fbf3ff 100%);
  --glow-1: #6cc4ff; --glow-2: #ffd34d; --glow-3: #ff8fcf;
  --ball: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%232f6fd6' stroke-width='1.6'%3E%3Crect x='22' y='5' width='56' height='90' rx='8'/%3E%3Crect x='29' y='14' width='42' height='34' rx='3'/%3E%3Cpath d='M29 58h42M29 68h30M29 78h36'/%3E%3C/svg%3E"); --ball-a: .06;
  --shine-a: #4361ee; --shine-b: #141a33; --shine-c: #e0459b;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --G: #45a83f; --R: #e8502a; --W: #2f8fde; --L: #f2c81a; --P: #9a4fc4;
  --F: #c4672d; --D: #24384a; --M: #8b9aa8; --N: #c29a2e; --C: #eceef2;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1020; --panel: #131a30cc; --line: #ffffff1a; --text: #eef1ff; --muted: #9aa3c7;
    --accent: #6d8bff; --accent-2: #ff6fd8; --surface: #111832f2; --surface-2: #151d3af5;
    --glass: #ffffff0d; --glass-2: #ffffff1f; --toolbar: #0b1020f0; --scrim: #050814b3; --aurora: .34;
    --shine-a: #8fb0ff; --shine-b: #fff; --shine-c: #ff9de6;
    --bg-grad: radial-gradient(120% 80% at 50% -10%, #2a1640 0%, #0f1530 45%, #080c1c 100%);
    --glow-1: #e3350d; --glow-2: #3b5bff; --glow-3: #ffcb05;
    --ball: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffffff' stroke-width='1.6'%3E%3Crect x='22' y='5' width='56' height='90' rx='8'/%3E%3Crect x='29' y='14' width='42' height='34' rx='3'/%3E%3Cpath d='M29 58h42M29 68h30M29 78h36'/%3E%3C/svg%3E"); --ball-a: .05;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020; --panel: #131a30cc; --line: #ffffff1a; --text: #eef1ff; --muted: #9aa3c7;
  --accent: #6d8bff; --accent-2: #ff6fd8; --surface: #111832f2; --surface-2: #151d3af5;
  --glass: #ffffff0d; --glass-2: #ffffff1f; --toolbar: #0b1020f0; --scrim: #050814b3; --aurora: .34;
  --shine-a: #8fb0ff; --shine-b: #fff; --shine-c: #ff9de6;
  --bg-grad: radial-gradient(120% 80% at 50% -10%, #2a1640 0%, #0f1530 45%, #080c1c 100%);
  --glow-1: #e3350d; --glow-2: #3b5bff; --glow-3: #ffcb05;
  --ball: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23ffffff' stroke-width='1.6'%3E%3Crect x='22' y='5' width='56' height='90' rx='8'/%3E%3Crect x='29' y='14' width='42' height='34' rx='3'/%3E%3Cpath d='M29 58h42M29 68h30M29 78h36'/%3E%3C/svg%3E"); --ball-a: .05;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  transition: background-color .3s, color .3s;
  font: 16px/1.6 "IBM Plex Sans Thai", system-ui, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3, .eyebrow { font-family: Kanit, "IBM Plex Sans Thai", sans-serif; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- background: Pokémon-style sky (transform/opacity only, no blur) ----------
   Layers, back to front: the fixed layer's gradient (sky by day, Pokédex night by night; not body + background-attachment:fixed, which repaints on scroll) → three soft "booster pack" glows that drift →
   two big, faint card outlines in opposite corners (an earlier tiled pattern + confetti read as busy).
   Only the glows move: animating full-screen layers cost a frame per frame (p95 33 ms) without a GPU. */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg-grad); }
.aurora i {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent);
  opacity: var(--aurora); translate: 0 0; will-change: translate;
}
.aurora i:nth-child(1) { --c: var(--glow-1); top: -30vmax; left: -20vmax; }
.aurora i:nth-child(2) { --c: var(--glow-2); top: 5vmax; right: -30vmax; }
.aurora i:nth-child(3) { --c: var(--glow-3); bottom: -35vmax; left: 15vmax; }
.aurora::before, .aurora::after { content: ""; position: absolute; aspect-ratio: 1; background: var(--ball) center / contain no-repeat; opacity: var(--ball-a); }
/* two big, faint card outlines in opposite corners: a card-game cue without a busy pattern or anyone's trademark */
.aurora::before { width: max(70vmax, 640px); top: max(-22vmax, -260px); right: max(-18vmax, -220px); rotate: -18deg; }
.aurora::after { width: max(46vmax, 420px); bottom: max(-16vmax, -200px); left: max(-14vmax, -170px); rotate: 24deg; }
@media (prefers-reduced-motion: no-preference) {
  .aurora i { animation: drift 22s var(--ease) infinite alternate; }
  .aurora i:nth-child(2) { animation-duration: 28s; animation-delay: -6s; }
  .aurora i:nth-child(3) { animation-duration: 34s; animation-delay: -12s; }
}
@keyframes drift { to { translate: 8vmax 6vmax; } }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 24px;
  max-width: 1200px; margin: 0 auto; padding: 24px 24px 24px;
}
.eyebrow { margin: 0; color: var(--accent); letter-spacing: .08em; font-weight: 500; font-size: .9rem; }
h1 { margin: .2em 0 .3em; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.15; font-weight: 700; }
.shine {
  background: linear-gradient(100deg, var(--shine-a) 20%, var(--shine-b) 40%, var(--shine-c) 60%, var(--shine-a) 80%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .shine { animation: sweep 3s linear 2; }
}
@keyframes sweep { to { background-position: 300% 0; } }
.lede { color: var(--muted); max-width: 36ch; margin: 0; }
.lede span { color: var(--text); font-weight: 600; }

.fan { --s: 1; position: relative; height: 340px; perspective: 1200px; }
.fan img {
  position: absolute; left: 50%; top: 50%; width: 170px; aspect-ratio: 367 / 512;
  border-radius: 10px; box-shadow: 0 18px 40px #0008;
  translate: calc(-50% + var(--x) * var(--s)) -50%; rotate: var(--r); scale: 1;
  transition: translate .6s var(--ease), rotate .6s var(--ease), scale .6s var(--ease);
}
@media (prefers-reduced-motion: no-preference) {
  .fan img { animation: deal .9s var(--ease) backwards, bob 5s ease-in-out infinite alternate; animation-delay: var(--d), calc(var(--d) + .9s); }
  .fan:hover img { translate: calc(-50% + var(--x) * var(--s) * 1.35) -54%; }
  .fan img:hover { scale: 1.08; z-index: 9; }
}
.hero.off .fan img { animation-play-state: paused; }
@keyframes deal { from { translate: -50% 40%; rotate: 0deg; opacity: 0; } }
@keyframes bob { to { translate: calc(-50% + var(--x) * var(--s)) calc(-50% - 10px); } }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px max(24px, (100% - 1152px) / 2) 20px;
  background: linear-gradient(var(--toolbar) 70%, transparent);
}
.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px;
  transition: border-color .2s;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 0; outline: none; }
select, .seg, .toggle {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
select { padding: 9px 14px; max-width: 220px; }
.seg { display: flex; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .25s var(--ease); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; }
.types { display: flex; gap: 6px; flex-wrap: wrap; }
.types button {
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  background: none; opacity: .62; filter: saturate(.6); scale: 1; transition: opacity .2s, scale .2s var(--ease), border-color .2s;
}
.types button:hover { opacity: 1; filter: none; scale: 1.1; }
.types button[aria-pressed="true"] { opacity: 1; filter: none; border-color: var(--text); }
.types .e { width: 100%; height: 100%; font-size: .8rem; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 7px 14px; cursor: pointer; font-size: .9rem; }
.toggle input { accent-color: var(--accent); }

/* ---------- energy icon ---------- */
.e {
  display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%;
  vertical-align: -.25em; font: 700 .72em/1 Kanit, sans-serif; color: #fff;
  /* flat disc with a darker rim, like the in-game energy symbols */
  background: var(--c); box-shadow: inset 0 0 0 .09em color-mix(in srgb, var(--c) 60%, #000);
}
.e svg { width: 68%; height: 68%; fill: currentColor; stroke: none; }
/* glyph details (leaf vein, knuckles, dragon eye…) are drawn in the disc colour via inline style="…var(--c)" in the sprite:
   CSS selectors can't reach inside <use>, but custom properties inherit into it */
.e-G { --c: var(--G); } .e-R { --c: var(--R); } .e-W { --c: var(--W); } .e-L { --c: var(--L); color: #241a00; }
.e-P { --c: var(--P); } .e-F { --c: var(--F); } .e-D { --c: var(--D); } .e-M { --c: var(--M); }
.e-N { --c: var(--N); color: #2b2100; } .e-C { --c: var(--C); color: #222; }

/* ---------- grid ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 24px 48px; }
.result { color: var(--muted); font-size: .9rem; margin: 4px 0 14px; }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px;
}
.grid li { content-visibility: auto; contain-intrinsic-size: auto 150px auto 240px; }
.card {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
}
.card .tilt { border-radius: 8px; }
.card .meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: .82rem; }
.card .meta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta span { color: var(--muted); flex: none; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .grid li { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes rise { from { opacity: 0; translate: 0 30px; scale: .94; } }

/* ---------- tilt + holo (shared by grid and detail) ---------- */
.tilt {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%; --o: 0;
  position: relative; aspect-ratio: 367 / 512; overflow: hidden; background: var(--glass);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  translate: 0 0; scale: 1;
  transition: transform .5s var(--ease), translate .3s var(--ease), box-shadow .3s;
  box-shadow: 0 6px 18px #0006;
}
.tilt img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.tilt img.ok { opacity: 1; }

.glare {
  position: absolute; inset: 0; pointer-events: none; opacity: var(--o); transition: opacity .3s; mix-blend-mode: overlay;
  background: radial-gradient(circle at var(--mx) var(--my), #fffc, #fff0 55%);
}
.holo .glare {
  mix-blend-mode: color-dodge;
  background:
    radial-gradient(circle at var(--mx) var(--my), #fff9, #fff0 45%),
    repeating-linear-gradient(115deg, #ff008033 0 6%, #ffd30033 12%, #00ff9933 18%, #00c8ff33 24%, #a000ff33 30%) var(--mx) var(--my) / 300% 300%;
}
.card:hover .tilt, .card:focus-visible .tilt { translate: 0 -6px; box-shadow: 0 16px 34px #0006, 0 0 0 1px var(--line); }
.tilt.active { transition: transform .08s linear, translate .3s var(--ease), box-shadow .3s; --o: 1; }

/* ---------- detail dialog ---------- */
dialog {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border: 1px solid var(--line);
  border-radius: 22px; background: var(--surface); color: var(--text); overflow: auto;
  display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: 32px; align-items: start;
}
dialog:not([open]) { display: none; }
dialog::backdrop { background: var(--scrim); }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: pop .45s var(--ease); }
  dialog[open]::backdrop { animation: fade .3s; }
}
@keyframes pop { from { opacity: 0; scale: .96; translate: 0 12px; } }
@keyframes fade { from { opacity: 0; } }
.close {
  position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.close:hover { background: var(--glass-2); }
.d-card { position: sticky; top: 0; }
.d-card .tilt { border-radius: 16px; box-shadow: 0 24px 60px #000c; view-transition-name: hero-card; }
.d-info h2 { margin: 0 40px 4px 0; font-size: 2rem; line-height: 1.2; }
.d-info .sub { color: var(--muted); margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--glass-2); font-size: .85rem; color: var(--text); }
.hp { font: 700 1.6rem Kanit, sans-serif; margin-left: auto; }
.hp small { font-size: .75rem; color: var(--muted); margin-right: 4px; }
.block { border-top: 1px solid var(--line); padding: 14px 0; }
.block-head { display: flex; align-items: center; gap: 10px; }
.block-head .cost { display: flex; gap: 2px; }
.block-head h3 { margin: 0; font-size: 1.15rem; font-weight: 500; }
.block-head h3 small { display: block; font: 400 .78rem "IBM Plex Sans Thai", sans-serif; color: var(--muted); }
.block-head .dmg { margin-left: auto; font: 700 1.4rem Kanit, sans-serif; }
.tag { font: 600 .72rem Kanit, sans-serif; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; background: #e0403a; color: #fff; }
.block p { margin: 8px 0 0; }
.en { color: var(--muted); font-size: .88rem; }
.hide-en .en { display: none; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: .9rem; }
.stats b { color: var(--text); font-weight: 500; margin-left: 6px; }
.d-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 18px; font-size: .82rem; color: var(--muted); }
.d-foot label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

::view-transition-group(hero-card) { animation-duration: .45s; animation-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

.more { height: 1px; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }
footer { max-width: 1200px; margin: 0 auto; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
footer p { margin: 0 0 8px; }
/* FAQ: visible answers for people and search/answer engines (same text as the FAQPage JSON-LD in <head>) */
.faq { margin: 0 0 20px; display: grid; gap: 6px; }
.faq h2 { margin: 0 0 4px; font-size: 1rem; color: var(--text); }
.faq summary { cursor: pointer; color: var(--text); font-weight: 500; }
.faq details p { margin: 6px 0 4px 16px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 32px 16px 8px; text-align: center; }
  .lede { margin: 0 auto; }
  .fan { --s: .62; height: 220px; }
  .fan img { width: 112px; }
  .toolbar { position: static; padding: 8px 16px 12px; gap: 8px; }
  .search { flex-basis: 100%; }
  select { flex: 1; min-width: 0; }
  .types { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; }
  .types button { flex: none; }
  .toggle { font-size: .82rem; }
  main, footer { padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
  dialog { grid-template-columns: 1fr; padding: 60px 16px 20px; gap: 16px; }
  .d-card { position: static; max-width: 260px; margin: 0 auto; width: 100%; }
}

/* ---------- more filters ---------- */
.more-filters { position: relative; }
.more-filters summary {
  list-style: none; cursor: pointer; padding: 7px 14px; border-radius: 999px; font-size: .9rem;
  background: var(--panel); border: 1px solid var(--line); display: flex; gap: 8px; align-items: center;
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters summary::after { content: ""; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; rotate: 45deg; translate: 0 -2px; transition: rotate .25s var(--ease); }
.more-filters[open] summary::after { rotate: -135deg; translate: 0 2px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-2); color: #fff; font: 600 .75rem/20px Kanit, sans-serif; text-align: center; }
.panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 6; width: min(320px, calc(100vw - 32px));
  display: grid; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 20px 50px #0005;
}
@media (prefers-reduced-motion: no-preference) {
  .more-filters[open] .panel { animation: pop .3s var(--ease); }
}
.panel label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.panel select { max-width: none; width: 100%; border-radius: 10px; color: var(--text); }
.panel fieldset { border: 0; padding: 0; margin: 0; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.panel legend { padding: 0; margin-bottom: 4px; }
.panel input[type="number"] { width: 100%; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); color: var(--text); }
.panel .check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.panel .check input { accent-color: var(--accent); }
.link { justify-self: start; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: .85rem; }

/* ---------- versions in detail ---------- */
.d-info { min-width: 0; } /* lets the versions row scroll instead of widening the dialog */
.versions { border-top: 1px solid var(--line); padding: 14px 0 0; margin-top: 14px; }
.versions h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 500; }
.versions h3 small { color: var(--muted); font: 400 .8rem "IBM Plex Sans Thai", sans-serif; margin-left: 6px; }
.versions ul { list-style: none; margin: 0; padding: 0 0 6px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; }
.versions li { flex: none; scroll-snap-align: start; }
.ver { width: 76px; padding: 0; border: 0; background: none; cursor: pointer; text-align: center; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.ver img { display: block; width: 100%; aspect-ratio: 367 / 512; object-fit: cover; border-radius: 6px; margin-bottom: 4px; outline: 2px solid transparent; outline-offset: 2px; translate: 0 0; transition: translate .25s var(--ease), outline-color .2s; }
.ver:hover img { translate: 0 -3px; }
.ver[aria-current] { color: var(--text); }
.ver[aria-current] img { outline-color: var(--accent); }

@media (max-width: 760px) {
  #sort { flex: 1; min-width: 0; }
  .more-filters { width: 100%; }
  .more-filters summary { width: fit-content; }
  .panel { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
}

/* ---------- top bar: brand, tabs, feedback, theme ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding: 16px 24px 0;
}
.brand { font: 700 1.25rem Kanit, sans-serif; color: var(--text); text-decoration: none; letter-spacing: .01em; }
.brand b { color: var(--accent); }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; transition: background .25s var(--ease), color .25s; }
.tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: .9rem; }
.pill svg, .theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill:hover { border-color: var(--accent); }
.theme { display: flex; padding: 3px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.theme button { display: grid; place-items: center; width: 32px; height: 30px; border: 0; border-radius: 999px; background: none; cursor: pointer; color: var(--muted); transition: background .2s, color .2s; }
.theme button[aria-checked="true"] { background: var(--glass-2); color: var(--text); }

/* ---------- deck mode ---------- */
.deck-hint { display: none; margin: -8px 0 14px; font-size: .85rem; color: var(--muted); }
.picking .deck-hint { display: block; }
.grid li { position: relative; }
.info, .qty { display: none; }
.picking .info {
  display: grid; place-items: center; position: absolute; bottom: 40px; right: 6px; z-index: 2;
  width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: #000a; color: #fff; font: 700 .85rem Kanit, sans-serif;
}
.picking .qty:not(:empty) {
  display: block; position: absolute; top: 6px; left: 6px; z-index: 2; padding: 2px 9px; border-radius: 999px;
  background: var(--accent); color: #fff; font: 700 .85rem Kanit, sans-serif; box-shadow: 0 2px 8px #0006;
}
@media (prefers-reduced-motion: no-preference) {
  .picking .qty:not(:empty) { animation: bump .3s var(--ease); }
}
@keyframes bump { 50% { scale: 1.25; } }

.layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.picking .layout { grid-template-columns: 1fr 340px; }
.deck {
  /* sits below the sticky filter toolbar (~130px tall on desktop) */
  position: sticky; top: 136px; max-height: calc(100dvh - 152px); display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); overflow: hidden;
}
/* display:flex above would otherwise override the hidden attribute */
[hidden] { display: none !important; } /* author display rules (flex, grid…) must never un-hide an element */
.deck-bar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border: 0; background: none; font: 600 1rem Kanit, sans-serif; cursor: default; text-align: left; }
.deck-bar b { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--glass-2); }
.deck-bar b.full { background: #2ea043; color: #fff; }
.chev { display: none; }
.deck-body { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; overflow: auto; }
.deck-name { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); }
.energy-pick { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); }
.energy-pick small { font-size: .78rem; }
#deck-energy { display: flex; gap: 6px; flex-wrap: wrap; }
#deck-energy button { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: none; cursor: pointer; opacity: .35; transition: opacity .2s, border-color .2s; }
#deck-energy button[aria-pressed="true"] { opacity: 1; border-color: var(--text); }
#deck-energy button.auto[aria-pressed="true"] { border-style: dashed; }
#deck-energy .e { width: 100%; height: 100%; }
.deck-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.deck-list li { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 10px; background: var(--glass); }
.deck-list img { width: 34px; aspect-ratio: 367 / 512; object-fit: cover; border-radius: 4px; }
.deck-list .nm { flex: 1; min-width: 0; font-size: .88rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-list .nm small { display: block; color: var(--muted); font-size: .74rem; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1rem; line-height: 1; }
.stepper b { min-width: 1.2em; text-align: center; }
.deck-empty { margin: 0; font-size: .85rem; color: var(--muted); }
.deck-issues { margin: 0; padding-left: 18px; font-size: .82rem; color: #e5534b; }
.deck-actions { display: grid; gap: 8px; }
.primary, .ghost { padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: 500; }
.primary { border: 0; background: var(--accent); color: #fff; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { border: 1px solid var(--line); background: none; }
.ghost.danger { color: #e5534b; }

/* ---------- sheet dialogs (QR, feedback) ---------- */
.sheet { display: block; width: min(460px, calc(100vw - 32px)); grid-template-columns: none; }
.sheet:not([open]) { display: none; }
.sheet h2 { margin: 0 40px 14px 0; font-size: 1.35rem; }
.qr-box { background: #fff; border-radius: 14px; padding: 8px; max-width: 320px; margin: 0 auto 14px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.steps { margin: 0 0 10px; padding-left: 20px; font-size: .9rem; display: grid; gap: 4px; }
.note { font-size: .8rem; color: var(--muted); margin: 8px 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row > * { flex: 1 1 auto; }
.field { display: grid; gap: 4px; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.field select, .field textarea { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); color: var(--text); resize: vertical; font: inherit; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; }
.check input { accent-color: var(--accent); }
.shot { margin: 10px 0 0; }
.shot img { display: block; width: 100%; max-height: 220px; object-fit: contain; object-position: left top; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); }
.shot img:not([src]) { height: 120px; }
.shot figcaption { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .9rem; box-shadow: 0 10px 30px #0005;
  translate: -50% 20px; opacity: 0; pointer-events: none; transition: translate .3s var(--ease), opacity .3s;
}
.toast.show { translate: -50% 0; opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }

@media (max-width: 760px) {
  .topbar { padding: 12px 16px 0; gap: 10px; }
  .pill span { display: none; }
  /* 7 tabs don't fit a phone: the bar scrolls sideways instead of overflowing the page. */
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 1 0 auto; padding: 6px 10px; white-space: nowrap; }
  .picking .layout { grid-template-columns: 1fr; }
  /* Deck becomes a bottom sheet: a bar that expands. */
  .deck { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; z-index: 20; max-height: 75dvh; box-shadow: 0 -10px 40px #0006; }
  .deck-bar { cursor: pointer; }
  .chev { display: block; width: 8px; height: 8px; border: solid var(--muted); border-width: 2px 2px 0 0; rotate: -45deg; transition: rotate .25s var(--ease); }
  .deck.open .chev { rotate: 135deg; }
  .deck:not(.open) .deck-body { display: none; }
  .picking main { padding-bottom: 90px; }
  .toast { bottom: 90px; }
}
.attach { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.attach .ghost { padding: 8px 12px; font-size: .9rem; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.row.secondary { margin-top: 8px; }
.row.secondary .ghost { padding: 8px 10px; font-size: .88rem; }
footer .link { font-size: inherit; }

/* ---------- logo: two cards, the front one in Thai flag colours ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.logo { width: 30px; height: 30px; flex: none; rotate: 0deg; transition: rotate .6s var(--ease); filter: drop-shadow(0 2px 6px #0004); }
@media (prefers-reduced-motion: no-preference) {
  .brand:hover .logo { rotate: -12deg; }
}

/* ---------- sets gallery ---------- */
.sets { padding-bottom: 24px; }
.series { font-size: 1.1rem; margin: 18px 0 12px; color: var(--muted); font-weight: 500; }
.set-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.set-card {
  width: 100%; display: grid; gap: 4px; justify-items: center; padding: 16px 12px 14px; cursor: pointer; text-align: center;
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel);
  translate: 0 0; transition: translate .3s var(--ease), border-color .2s, box-shadow .3s;
}
.set-card:hover, .set-card:focus-visible { translate: 0 -4px; border-color: var(--accent); box-shadow: 0 14px 30px #0004; }
.set-card b { font-weight: 600; margin-top: 8px; line-height: 1.3; }
.set-card small { color: var(--muted); font-size: .78rem; }
/* 1–3 pack images fanned out; they spread a little more on hover */
.packs { position: relative; display: block; width: 100%; height: 170px; }
.packs img {
  position: absolute; left: 50%; bottom: 0; height: 100%; aspect-ratio: 334 / 644; object-fit: contain;
  translate: calc(-50% + var(--x, 0px)) 0; rotate: var(--r, 0deg); transform-origin: 50% 100%;
  filter: drop-shadow(0 8px 14px #0006); transition: translate .4s var(--ease), rotate .4s var(--ease);
}
.packs.n2 img:nth-child(1) { --x: -22px; --r: -8deg; } .packs.n2 img:nth-child(2) { --x: 22px; --r: 8deg; }
.packs.n3 img:nth-child(1) { --x: -38px; --r: -12deg; } .packs.n3 img:nth-child(2) { z-index: 1; } .packs.n3 img:nth-child(3) { --x: 38px; --r: 12deg; }
@media (prefers-reduced-motion: no-preference) {
  .set-card:hover .packs.n2 img:nth-child(1) { --x: -32px; --r: -12deg; } .set-card:hover .packs.n2 img:nth-child(2) { --x: 32px; --r: 12deg; }
  .set-card:hover .packs.n3 img:nth-child(1) { --x: -52px; --r: -16deg; } .set-card:hover .packs.n3 img:nth-child(3) { --x: 52px; --r: 16deg; }
  .set-card:hover .packs.n1 img { translate: -50% -6px; }
}

/* ---------- coming soon ---------- */
.soon-pill {
  margin-top: 16px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: .9rem;
}
.soon-pill b { padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 500; }
.soon-pill span { color: var(--muted); }
.soon-pill:hover { border-color: var(--accent); }
.soon-card {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 18px 22px;
  border: 1px solid var(--accent); border-radius: 18px; background: var(--panel);
}
.soon-card h3 { margin: 2px 0 6px; font-size: 1.4rem; }
.soon-card p { margin: 0 0 6px; }
.soon-card .small { font-size: .8rem; }
.countdown { font-family: Kanit, sans-serif; font-size: 1.15rem; color: var(--accent); }
/* sealed-pack placeholder until the real pack art exists; the sheen is a translated gradient (transform only) */
.soon-pack {
  position: relative; overflow: hidden; display: grid; place-items: center; width: 86px; aspect-ratio: 334 / 644; border-radius: 10px;
  background: linear-gradient(160deg, #6b4bd8, #e0459b 55%, #f2a33a); box-shadow: 0 10px 22px #0005; rotate: -6deg;
}
.soon-pack b { font: 600 2.4rem Kanit, sans-serif; color: #fff9; }
.soon-pack::after {
  content: ""; position: absolute; inset: -20% -60%; background: linear-gradient(100deg, transparent 40%, #fff6 50%, transparent 60%);
  translate: -60% 0;
}
@media (prefers-reduced-motion: no-preference) {
  .soon-pack::after { animation: sheen 3.2s var(--ease) infinite; }
  .soon-pack { animation: soon-bob 4s ease-in-out infinite; }
}
@keyframes sheen { 60%, 100% { translate: 60% 0; } }
@keyframes soon-bob { 50% { translate: 0 -6px; } }
@media (max-width: 560px) { .soon-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.ai {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; vertical-align: 2px; cursor: help; text-decoration: none;
  font: 600 .65rem/1.5 system-ui, sans-serif; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line);
}

/* ---------- banner above a chosen set ---------- */
.set-banner { margin-bottom: 18px; padding: 14px 18px 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.banner-body { display: flex; gap: 22px; align-items: center; }
.set-banner .packs { width: 150px; height: 150px; flex: none; }
.set-banner h2 { margin: 2px 0; font-size: 1.6rem; line-height: 1.2; }
.set-banner .muted { margin: 0; color: var(--muted); font-size: .9rem; }
.pack-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pack-chips button {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); font-size: .88rem;
}
.pack-chips button:first-child { padding-left: 12px; }
.pack-chips img { height: 28px; border-radius: 4px; }
.pack-chips button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 760px) {
  .set-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .packs { height: 130px; }
  .banner-body { gap: 14px; }
  .set-banner .packs { width: 96px; height: 110px; }
  .set-banner h2 { font-size: 1.25rem; }
}

/* ---------- popularity ---------- */
.pop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -4px 0 14px; font-size: .88rem; color: var(--muted); }
.pop-num b { color: var(--text); font-weight: 600; }
.reacts { display: flex; gap: 6px; margin-left: auto; }
.react {
  display: inline-flex; align-items: center; gap: 4px; min-width: 40px; height: 32px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); font-size: .95rem; scale: 1; transition: background .2s, border-color .2s, scale .15s;
}
.react b { font-size: .78rem; font-weight: 600; color: var(--muted); }
.react b:empty { display: none; }
.react:hover { border-color: var(--accent); }
.react:active { scale: .92; }
.react[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.react[aria-pressed="true"] b { color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .react.bump span { animation: react-bump .45s var(--ease); }
}
@keyframes react-bump { 40% { scale: 1.5; rotate: -12deg; } 70% { scale: .9; } }
@media (max-width: 760px) { .reacts { margin-left: 0; width: 100%; } }

/* ---------- trade ---------- */
.trade-target { width: 100%; }
.trade-target button { flex: 1; }
.list-h { margin: 6px 0 0; font-size: .95rem; font-weight: 600; }
.list-h small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.sheet.wide { width: min(640px, calc(100vw - 32px)); }
.trade-pages { display: grid; gap: 12px; max-height: 60dvh; overflow: auto; }
.trade-pages img { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.picking .qty:not(:empty) { white-space: nowrap; }

/* ---------- meta tab ---------- */
.page-view .toolbar, .page-view .results { display: none; }
.meta-tab { grid-column: 1 / -1; display: grid; gap: 20px; padding: 24px 0 32px; position: relative; z-index: 1; }
.meta-tab[hidden] { display: none; }
.meta-tab > * { min-width: 0; } /* long option names in a <select> must not widen the page */
.meta-tab h2 { margin: 2px 0 4px; }
.meta-cards { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.meta-box { padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.meta-box h3 { margin: 0 0 10px; font-size: 1.05rem; }
#meta-predict .arch { margin: 0; font-weight: 600; }
#meta-predict .big { margin: 4px 0; font: 600 3rem/1.1 Kanit, sans-serif; color: var(--accent); }
#meta-predict p.muted { margin: 0; font-size: .85rem; }
.meta-report fieldset { border: 0; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meta-report legend { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.meta-report input { min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.meta-result { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.meta-result button { padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: translate .2s var(--ease); }
.meta-result button:hover { translate: 0 -2px; }
.meta-result button[value="win"] { background: #2ea043; color: #fff; border-color: transparent; }
.meta-result button[value="loss"] { background: #e0459b; color: #fff; border-color: transparent; }
.meta-result button:disabled { opacity: .5; cursor: wait; }
.meta-table table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.meta-table th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.meta-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.meta-table td:nth-child(n+2), .meta-table th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.meta-table tr.mine td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.meta-table .link { text-align: left; font-size: inherit; text-decoration: none; color: var(--text); font-weight: 500; }
.meta-table .bar { display: inline-block; width: 60px; height: 6px; margin-right: 8px; border-radius: 3px; background: var(--line); vertical-align: middle; overflow: hidden; }
.meta-table .bar::after { content: ""; display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--v)); }
.meta-table .vs ul:not(.sample-list) { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 4px 20px; }
.meta-table .vs ul:not(.sample-list) b { white-space: nowrap; }
.meta-table .vs ul:not(.sample-list) li { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.meta-table .vs .up { color: #2ea043; } .meta-table .vs .down { color: #e0459b; }
@media (max-width: 760px) {
  .meta-cards { grid-template-columns: 1fr; }
  .meta-tab { padding-top: 64px; }
  .meta-table .bar { display: none; }
}

/* ---------- news tab ---------- */
.news-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.news-filter button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.news-filter button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.news-list > li.empty, .news-list > li.muted { grid-column: 1 / -1; }
.news-list a {
  height: 100%; display: flex; flex-direction: column; gap: 6px; padding: 0 0 16px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  color: var(--text); text-decoration: none; transition: translate .25s var(--ease), border-color .2s, box-shadow .3s;
}
.news-list a > :not(.news-img) { margin: 0 16px; }
.news-list a:hover, .news-list a:focus-visible { translate: 0 -4px; border-color: var(--accent); box-shadow: 0 14px 30px #0003; }
/* picture strip: the article photo fills it; without one, a tile with the source name */
.news-img {
  position: relative; display: grid; place-items: center; height: 150px; margin-bottom: 4px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c, var(--accent)) 75%, #000), color-mix(in srgb, var(--c, var(--accent)) 35%, var(--panel)));
}
.news-img.photo { background: var(--line); }
.news-img.photo img { width: 100%; height: 100%; object-fit: cover; }
.news-img.tile { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 70%, #000), color-mix(in srgb, var(--accent) 30%, var(--panel))); }
.news-img.tile.official { --accent: #3b5bdb; }
.news-img.tile.community { --accent: #e0459b; }
.news-img.tile b { padding: 0 16px; font: 600 1.35rem/1.2 Kanit, sans-serif; color: #fff; text-align: center; opacity: .9; }
.news-list b { font-weight: 500; line-height: 1.4; }
.news-list small { color: var(--muted); font-size: .8rem; }
.news-meta { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.news-kind { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); }
.news-kind.official { background: var(--accent); border-color: var(--accent); color: #fff; }
.news-kind.community { border-color: #e0459b; color: #e0459b; }

/* price the user sets per card in the trade lists */
.deck-list .price {
  width: 56px; flex: none; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: .8rem; text-align: right;
}
.deck-list .price:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.deck-list .nm { flex: 1 1 0; }
.deck-list .qty-in {
  width: 34px; padding: 3px 0; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text);
  font: inherit; font-weight: 700; text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.deck-list .qty-in::-webkit-inner-spin-button, .deck-list .qty-in::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.deck-list .qty-in:hover, .deck-list .qty-in:focus { border-color: var(--line); background: var(--surface); outline: none; }
/* numeric prices get a ฿ hint, matching the "50 ฿" in the text and images */
.price-wrap { position: relative; flex: none; display: flex; }
.price-wrap.baht::after { content: "฿"; position: absolute; right: 7px; top: 50%; translate: 0 -50%; font-size: .75rem; color: var(--muted); pointer-events: none; }
.price-wrap.baht .price { padding-right: 18px; }
@media (pointer: coarse) {
  .stepper button { width: 36px; height: 36px; }
}

.meta-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.meta-head .muted a { color: var(--accent); }
.meta-table .arch { display: flex; align-items: center; gap: 10px; }
.meta-table .arch-art { flex: none; width: 30px; aspect-ratio: 367 / 512; border-radius: 4px; object-fit: cover; object-position: top; background: var(--line); }
.meta-table .sig { margin: 0 0 8px; font-size: .82rem; color: var(--muted); }
#meta-predict .arch small { font-weight: 400; font-size: .8rem; }

/* tournament list inside an opened meta row */
.sample { margin: 4px 0 14px; padding: 12px; border-radius: 14px; background: var(--glass); }
.sample-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.sample-head p { margin: 0; font-size: .85rem; color: var(--muted); }
.sample-head b { color: var(--text); }
.sample-actions { display: flex; gap: 8px; }
.sample-actions button { padding: 8px 14px; border-radius: 10px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.sample-actions .primary { border: 0; background: var(--accent); color: #fff; }
.sample-actions .ghost { border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.sample-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.sample-list li { position: relative; }
.sample-list img { width: 100%; aspect-ratio: 367 / 512; border-radius: 6px; display: block; background: var(--line); }
.sample-list b { position: absolute; right: 4px; bottom: 4px; padding: 0 6px; border-radius: 8px; background: #000b; color: #fff; font-size: .75rem; }
.meta-table .vs td { text-align: left; }

/* import from the game */
.file-btn { display: grid; place-items: center; cursor: pointer; }
.import-video { display: block; width: 100%; max-height: 280px; margin-top: 12px; border-radius: 12px; background: #000; object-fit: cover; }
.import-video[hidden] { display: none; }
#meta-predict .import-btn { margin-top: 10px; padding: 10px 16px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
#meta-predict .link { margin-top: 8px; }

/* ---------- real-card prices tab ---------- */
.pr-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pr-controls select, .pr-controls input { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; min-width: 0; }
.pr-controls select { flex: 1 1 260px; max-width: 420px; }
.pr-controls input { flex: 1 1 200px; }
.pr-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin-bottom: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.pr-note p { margin: 0; flex: 1 1 320px; font-size: .9rem; }
.pr-note .sasom { text-decoration: none; white-space: nowrap; }
.pr-sealed, .pr-cards { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.pr-sealed { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pr-cards { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.pr-sealed a, .pr-cards a { height: 100%; display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-decoration: none; transition: translate .25s var(--ease), border-color .2s; }
.pr-sealed a:hover, .pr-cards a:hover { translate: 0 -3px; border-color: var(--accent); }
.pr-sealed img { width: 64px; height: 64px; object-fit: contain; flex: none; border-radius: 8px; background: #fff; }
.pr-cards a { flex-direction: column; }
.pr-cards img { width: 100%; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 8px; background: var(--line); }
.pr-name { flex: 1; display: grid; gap: 2px; font-size: .88rem; line-height: 1.35; }
.pr-name small, .pr-price small { color: var(--muted); font-size: .75rem; }
.pr-price { display: grid; justify-items: end; align-content: start; white-space: nowrap; }
.pr-cards .pr-price { justify-items: start; }
.pr-price b { font: 600 1.05rem Kanit, sans-serif; color: var(--accent); }
.pr-more { display: block; margin: 0 auto 20px; }
.series small { font-size: .8rem; font-weight: 400; }
.pr-noimg { display: block; width: 64px; aspect-ratio: 1; border-radius: 8px; background: var(--line); flex: none; }
.pr-cards .pr-noimg { width: 100%; aspect-ratio: 5 / 7; }
#pr-src[hidden] { display: none; }

/* ---------- guide (/guide) ---------- */
.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: 0; z-index: 2; padding: 8px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.guide-toc a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: .85rem; text-decoration: none; transition: background .2s, color .2s; }
.guide-toc a[aria-current] { background: var(--accent); border-color: transparent; color: #fff; }
.guide-sec { scroll-margin-top: 70px; }
.guide-sec h3 { display: flex; align-items: center; gap: 10px; }
.guide-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 15%, transparent); font-size: 1.2rem; }
.guide-sec > p { margin: 0 0 10px; color: var(--muted); }
.guide-steps { counter-reset: s; list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.guide-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; line-height: 1.55; }
.guide-steps li::before { content: counter(s); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 .85rem Kanit, sans-serif; }
.guide-tips { margin: 0 0 14px; padding: 10px 14px 10px 30px; border-radius: 12px; background: color-mix(in srgb, var(--accent-2) 8%, transparent); font-size: .9rem; display: grid; gap: 4px; }
.guide-tips li::marker { content: "💡 "; }
@media (prefers-reduced-motion: no-preference) {
  .guide-sec { opacity: 0; translate: 0 24px; transition: opacity .5s var(--ease), translate .5s var(--ease); transition-delay: calc(var(--d) * 80ms); }
  .guide-sec.in { opacity: 1; translate: none; }
  .guide-sec .guide-steps li { opacity: 0; translate: -10px 0; transition: opacity .4s, translate .4s var(--ease); transition-delay: calc(150ms + var(--k) * 70ms); }
  .guide-sec.in .guide-steps li { opacity: 1; translate: none; }
}
@media (max-width: 720px) {
  .guide-toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 8px 16px; }
  .guide-toc a { flex: none; }
}
/* graded view */
.pr-graded { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.pr-graded > li > a { display: grid; grid-template-columns: 72px 1fr; gap: 6px 14px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-decoration: none; transition: translate .25s var(--ease), border-color .2s; }
.pr-graded > li > a:hover { translate: 0 -3px; border-color: var(--accent); }
.pr-graded img { grid-row: span 2; width: 72px; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 6px; background: var(--line); }
.pr-grades { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pr-grades li { display: grid; padding: 4px 10px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); line-height: 1.25; }
.pr-grades span { font-size: .72rem; font-weight: 600; color: var(--muted); }
.pr-grades b { font: 600 .95rem Kanit, sans-serif; color: var(--accent); }
.pr-grades small { font-size: .7rem; color: var(--muted); }
.pr-price .pr-grade { color: var(--accent-2); }

/* ---------- coach marks (coach.js) ---------- */
.coach { position: fixed; inset: 0; z-index: 100; }
.coach-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 200vmax #050814a8, 0 0 0 3px var(--accent), 0 0 24px 6px color-mix(in srgb, var(--accent) 55%, transparent); pointer-events: none; }
.coach-tip { position: fixed; width: min(340px, calc(100vw - 32px)); padding: 16px 18px 14px; border-radius: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 18px 50px #0007; }
.coach-n { margin: 0 0 4px; font: 600 .75rem Kanit, sans-serif; color: var(--accent); letter-spacing: .04em; }
.coach-text { margin: 0 0 14px; line-height: 1.6; }
.coach-btns { display: flex; align-items: center; gap: 8px; }
.coach-btns .link { margin-right: auto; }
@media (prefers-reduced-motion: no-preference) {
  .coach.on .coach-spot { transition: top .35s var(--ease), left .35s var(--ease), width .35s var(--ease), height .35s var(--ease); }
  .coach.on .coach-tip { transition: top .35s var(--ease), left .35s var(--ease); }
  .coach { animation: coach-in .25s ease-out; }
  .coach-spot { animation: coach-pulse 1.8s ease-in-out infinite; }
}
@keyframes coach-in { from { opacity: 0; } }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 200vmax #050814a8, 0 0 0 3px var(--accent), 0 0 34px 12px color-mix(in srgb, var(--accent) 35%, transparent); } }
/* meta by element */
.meta-elems h3 { margin: 0 0 10px; font-size: 1.05rem; }
.meta-elems h3 small { font-weight: 400; font-size: .8rem; }
.elem-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin-bottom: 12px; gap: 2px; }
.elem-bar i { background: var(--c); min-width: 3px; transform-origin: left; }
.elem-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.elem-chips button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; transition: background .2s, border-color .2s, translate .2s var(--ease); }
.elem-chips button:first-child { padding-left: 12px; }
.elem-chips button:hover { translate: 0 -2px; }
.elem-chips button[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.elem-chips .e { width: 22px; height: 22px; }
.elem-chips b { color: var(--muted); font-weight: 500; }
.meta-table .arch-el { display: inline-flex; gap: 3px; margin-left: 2px; }
.meta-table .arch-el .e { width: 18px; height: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .elem-bar i { animation: grow-x .6s var(--ease) both; }
}
@keyframes grow-x { from { transform: scaleX(0); } }

/* Crawlable text the Worker adds to /c/ and /s/ pages, and the set links built by build-seo */
footer .ssr { margin: 0 0 20px; color: var(--text); }
footer .ssr h2, .sitenav h2 { margin: 0 0 6px; font-size: 1rem; color: var(--text); }
footer .ssr ul { margin: 0 0 8px; padding-left: 18px; }
footer .ssr li { margin: 2px 0; }
footer .ssr summary { cursor: pointer; }
.sitenav { margin: 0 0 20px; }
.sitenav ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sitenav a, footer .ssr a { overflow-wrap: anywhere; }

/* Thai species name next to the English card name in the card dialog */
.th-name { font-size: .6em; font-weight: 500; opacity: .7; margin-left: .3em; }
