/* Play Box API v0.3 — เว็บสเปกสำหรับทีม backend · สีเขียวสมุนไพรชุดเดียวกับ PDF · สว่าง/มืดตามเครื่อง */
:root {
  --paper: #f5f7f6; --sheet: #ffffff; --ink: #17242b; --muted: #5a6a71; --line: #dbe3e0; --line2: #e9eeec;
  --herb: #2f6b4f; --herb-ink: #ffffff; --herb-soft: #e3efe8; --saffron: #94570a; --saffron-soft: #fbf0dc;
  --red: #b3261e; --red-soft: #fbe5e3; --blue: #1f5f99; --blue-soft: #e3eef9; --code-bg: #eef3f1; --code-ink: #1d3a2e;
  --body: "IBM Plex Sans Thai", "Leelawadee UI", "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --nav-w: 268px; --top-h: 52px; --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1714; --sheet: #151f1b; --ink: #e3ebe7; --muted: #9db0a8; --line: #2b3b35; --line2: #22302b;
    --herb: #7fc4a0; --herb-ink: #0f1714; --herb-soft: #1c3329; --saffron: #f0b25a; --saffron-soft: #33280f;
    --red: #ff8a80; --red-soft: #3a1c1a; --blue: #8cc2f2; --blue-soft: #16283a; --code-bg: #1a2621; --code-ink: #cfe3d8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1714; --sheet: #151f1b; --ink: #e3ebe7; --muted: #9db0a8; --line: #2b3b35; --line2: #22302b;
  --herb: #7fc4a0; --herb-ink: #0f1714; --herb-soft: #1c3329; --saffron: #f0b25a; --saffron-soft: #33280f;
  --red: #ff8a80; --red-soft: #3a1c1a; --blue: #8cc2f2; --blue-soft: #16283a; --code-bg: #1a2621; --code-ink: #cfe3d8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--body); overflow-x: hidden; }
a { color: var(--herb); text-underline-offset: 2px; }
code, pre, kbd, textarea, select, input { font-family: var(--mono); }
code { font-size: .88em; background: var(--code-bg); color: var(--code-ink); padding: .08em .35em; border-radius: 4px; overflow-wrap: anywhere; }
a code { color: inherit; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; font-weight: 600; }
h2 { font-size: 1.55rem; margin: 0 0 .4rem; display: flex; align-items: center; gap: .5rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 .6rem; }
h4 { font-size: .98rem; margin: 1.1rem 0 .45rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.hd { font-weight: 400; font-size: .82rem; color: var(--muted); }
.small { font-size: .86rem; }
.muted { color: var(--muted); }
.lead { color: var(--muted); max-width: 72ch; margin: .2rem 0 1rem; }
.count { font-size: .8rem; background: var(--herb-soft); color: var(--herb); border-radius: 99px; padding: .1rem .6rem; font-weight: 600; }
button, .btn {
  font: 500 .88rem/1.2 var(--body); color: var(--ink); background: var(--sheet); border: 1px solid var(--line);
  border-radius: 8px; padding: .5rem .85rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem;
}
button:hover, .btn:hover { border-color: var(--herb); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--herb); outline-offset: 2px; }
button.primary, .btn { background: var(--herb); color: var(--herb-ink); border-color: var(--herb); }
.btn.ghost { background: transparent; color: var(--herb); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  font-size: .86rem; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; min-width: 0;
}
input:disabled { opacity: .55; }
label { font-size: .84rem; color: var(--muted); display: flex; flex-direction: column; gap: .25rem; }

/* ---- layout */
.topbar { display: none; }
.layout { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 16px 28px; background: var(--sheet);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--herb); color: var(--herb-ink); display: grid; place-items: center; font-size: .95rem; }
.ver { color: var(--herb); font-weight: 600; }
.for { margin: .25rem 0 .9rem; font-size: .82rem; color: var(--muted); }
#q { width: 100%; font-family: var(--body); margin-bottom: .8rem; }
.toc { list-style: none; margin: 0; padding: 0; }
.toc > li > a { display: block; padding: .38rem .6rem; border-radius: 7px; color: var(--ink); text-decoration: none; font-weight: 500; }
.toc a:hover { background: var(--line2); }
.toc a.on { background: var(--herb-soft); color: var(--herb); }
.toc .eps { list-style: none; margin: .1rem 0 .3rem; padding: 0 0 0 .4rem; }
.toc .eps a { display: flex; align-items: center; gap: .4rem; padding: .17rem .5rem; font: .76rem/1.45 var(--mono); color: var(--muted); text-decoration: none; border-radius: 6px; overflow-wrap: anywhere; }
.toc .eps a .m { font-size: .58rem; min-width: 2.7em; padding: .05rem .2rem; }
.toc .eps li[hidden] { display: none; }
.foot { margin-top: 1.4rem; font-size: .76rem; color: var(--muted); }
main { padding: 30px clamp(20px, 4vw, 48px) 120px; max-width: 1080px; min-width: 0; }
.sec { padding-top: 26px; margin-top: 26px; border-top: 1px solid var(--line); }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); margin: .4rem 0; }
.hero .links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

/* ---- cards / grid */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin: 12px 0; min-width: 0; }
.card > h3:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.grid2 > .card { margin: 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem .9rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
ol.auth { margin: 0; padding-left: 1.2rem; font-size: .9rem; }
ol.auth li { margin: .3rem 0; }
ul.rules li, .card ul li { margin: .25rem 0; }
.note { background: var(--herb-soft); border-radius: 8px; padding: .55rem .9rem; margin: .7rem 0; font-size: .9rem; }
.note ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.hint { background: var(--saffron-soft); color: var(--ink); border-radius: 8px; padding: .5rem .8rem; font-size: .86rem; }

/* ---- tables */
.tw { overflow-x: auto; margin: .4rem 0 .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; vertical-align: top; padding: .42rem .6rem; border-bottom: 1px solid var(--line2); }
th { background: var(--line2); font-weight: 600; font-size: .8rem; color: var(--muted); white-space: nowrap; }
tbody tr:last-child > td { border-bottom: 0; }
table.fields td:first-child { white-space: nowrap; }
table.fields td.ty { min-width: 9rem; max-width: 18rem; font-size: .8rem; }
table.fields td.rq { text-align: center; color: var(--herb); font-weight: 600; width: 3.2rem; }
table.fields th:nth-child(3) { width: 3.2rem; }
tr.nest > td { padding: 0 .4rem .4rem 1.2rem; background: var(--paper); }
tr.nest details > summary { font-size: .8rem; color: var(--muted); padding: .35rem .2rem; cursor: pointer; }
tr.nest .tw { margin: 0 0 .3rem; }
tr.hit > td { background: var(--saffron-soft) !important; }
table.index td:nth-child(2) { white-space: nowrap; }
table.decide td:first-child { text-align: center; font-weight: 600; }
table.compact { font-size: .82rem; }
.errtab td:first-child { white-space: nowrap; }
.errtab tr:target > td { background: var(--saffron-soft); }

/* ---- badges */
.m { display: inline-block; font: 600 .7rem/1.5 var(--mono); padding: .08rem .38rem; border-radius: 5px; text-align: center; letter-spacing: .02em; }
.m-post { background: var(--herb-soft); color: var(--herb); }
.m-get { background: var(--blue-soft); color: var(--blue); }
.st { display: inline-block; font: 600 .74rem/1.45 var(--mono); padding: .05rem .4rem; border-radius: 5px; }
.st-2 { background: var(--herb-soft); color: var(--herb); }
.st-4 { background: var(--saffron-soft); color: var(--saffron); }
.st-5, .st-0 { background: var(--red-soft); color: var(--red); }
.st-3, .st-1 { background: var(--line2); color: var(--muted); }
.sc { display: inline-block; font: 600 .74rem/1.5 var(--mono); padding: .02rem .4rem; border-radius: 5px; background: var(--line2); color: var(--ink); white-space: nowrap; cursor: default; }
.sc-app { background: var(--blue-soft); color: var(--blue); }
.tag { font-size: .7rem; padding: .05rem .45rem; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.tag-online { color: var(--saffron); }
a.ec { text-decoration: none; }
a.ec code, .st + code, td .st ~ code { white-space: nowrap; overflow-wrap: normal; }
table.decide td:nth-child(2) { min-width: 15rem; }
table.decide td:nth-child(3) { min-width: 12rem; }

/* ---- flow timeline */
.jnav { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }
.jnav a { font-size: .82rem; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; background: var(--sheet); }
.journey { margin-top: 1.3rem; }
.journey h3 { display: flex; align-items: center; gap: .55rem; margin: 0 0 .5rem; }
.jn { width: 26px; height: 26px; border-radius: 50%; background: var(--herb); color: var(--herb-ink); display: grid; place-items: center; font-size: .85rem; flex: none; }
ol.steps { list-style: none; margin: 0 0 0 12px; padding: 0 0 0 20px; border-left: 2px solid var(--line); }
li.step { position: relative; display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: .3rem 1rem; padding: .55rem .2rem .7rem; border-bottom: 1px dashed var(--line2); }
li.step::before { content: ""; position: absolute; left: -27px; top: .95rem; width: 12px; height: 12px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--herb); }
li.step.quiet::before { border-color: var(--line); }
li.step:last-child { border-bottom: 0; }
.who p { margin: .15rem 0 0; font-size: .88rem; color: var(--muted); }
.who b { font-size: .92rem; }
.none { margin: .2rem 0; font-size: .84rem; color: var(--muted); font-style: italic; }
ul.calls { list-style: none; margin: 0; padding: 0; }
ul.calls li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; padding: .2rem 0; font-size: .88rem; }
ul.calls .note { flex-basis: 100%; background: none; padding: 0 0 0 .1rem; margin: -.1rem 0 .15rem; color: var(--muted); font-size: .82rem; }
ul.calls .arr { color: var(--muted); }
button.try { font-size: .74rem; padding: .18rem .55rem; border-radius: 6px; color: var(--herb); }
button.try.primary { color: var(--herb-ink); font-size: .82rem; padding: .4rem .8rem; }
.queue ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* ---- endpoints */
article.ep { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px 12px; margin: 16px 0; min-width: 0; }
article.ep > header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
article.ep > header .m { font-size: .8rem; padding: .15rem .5rem; }
article.ep .path { font-size: 1.02rem; font-weight: 600; background: none; padding: 0; }
article.ep .sum { margin: .5rem 0; }
article.ep[hidden], .appx[hidden] { display: none; }
dl.meta { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: .3rem 0 .4rem; font-size: .84rem; }
dl.meta div { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
.sf { font: .78rem var(--mono); color: var(--muted); }
ul.errs { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
ul.errs li { padding: .15rem 0; }
.act { margin: .8rem 0 .2rem; }
.rules ul { padding-left: 1.1rem; margin: .2rem 0; font-size: .9rem; }
details.mini, details.appx { margin: .5rem 0; }
details.mini > summary, details.appx > summary { cursor: pointer; font-size: .88rem; font-weight: 500; padding: .3rem 0; }
details.appx { border-top: 1px solid var(--line2); padding-top: .3rem; }
details.appx > summary code { font-weight: 600; }

/* ---- code blocks */
details.ex { margin: .45rem 0; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); }
details.ex > summary { cursor: pointer; padding: .42rem .7rem; font-size: .86rem; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
details.ex > summary::-webkit-details-marker { display: none; }
details.ex > summary::before { content: "▸"; color: var(--muted); font-size: .8rem; transition: transform .15s; }
details.ex[open] > summary::before { transform: rotate(90deg); }
.fn { font: .76rem var(--mono); color: var(--muted); }
.lc { font-size: .74rem; color: var(--muted); margin-left: auto; }
.pre { position: relative; border-top: 1px solid var(--line); }
.pre .tools { position: absolute; top: 6px; right: 8px; display: flex; gap: .3rem; z-index: 1; }
.pre .tools button { font-size: .72rem; padding: .2rem .5rem; background: var(--sheet); }
pre { margin: 0; padding: .8rem .9rem; overflow: auto; max-height: 440px; background: var(--code-bg); color: var(--code-ink); font-size: .8rem; line-height: 1.5; border-radius: 0 0 8px 8px; tab-size: 2; }
pre code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }

/* ---- downloads */
ul.dl { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
ul.dl li { background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: .65rem .85rem; }
.sz { font-size: .76rem; color: var(--muted); }

/* ---- test console */
.target .tgt { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; margin-bottom: .7rem; }
label.radio, label.chk { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); font-size: .9rem; cursor: pointer; }
#t-base { flex: 1 1 260px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: .4rem 0 .8rem; }
.sum-badge { font-size: .86rem; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .55rem .7rem; margin: .5rem 0; }
.row label { flex: 0 1 auto; }
#f-ep, #f-ex { width: 100%; max-width: 100%; }
#free .row.pick label { flex: 1 1 220px; min-width: 0; }
.row label { min-width: 0; max-width: 100%; }
textarea#f-body { width: 100%; min-height: 220px; font-size: .8rem; line-height: 1.5; background: var(--code-bg); color: var(--code-ink); resize: vertical; }
details.vars { margin: .4rem 0 .6rem; font-size: .88rem; }
details.vars > summary { cursor: pointer; padding: .2rem 0; }
.scn { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); margin: 10px 0; }
.scn > .scn-h { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; padding: .7rem .9rem; }
.scn-h .t { font-weight: 600; }
.scn-h .chips { display: flex; flex-wrap: wrap; gap: .25rem; }
.scn-h .who-card { margin-left: auto; }
.scn-h .who-card:empty { display: none; }
.scn-h .res { margin-left: auto; font-size: .84rem; font-weight: 600; text-align: right; }
.scn-h .who-card:not(:empty) + .res { margin-left: 0; }
.scn-note { margin: 0; padding: 0 .9rem .6rem; font-size: .84rem; color: var(--muted); }
.steps-wrap > summary { cursor: pointer; padding: 0 .9rem .5rem; }
.steps-out { border-top: 1px solid var(--line2); }
.so { border-bottom: 1px solid var(--line2); }
.so:last-child { border-bottom: 0; }
.so > summary { display: grid; grid-template-columns: minmax(3.6rem, max-content) 3.6rem minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .42rem .9rem; cursor: pointer; font-size: .86rem; list-style: none; }
.so > summary::-webkit-details-marker { display: none; }
.so .rq-line { min-width: 0; display: flex; flex-wrap: wrap; gap: .2rem .45rem; align-items: center; }
.so .rq-line .ttl { color: var(--ink); }
.so .rq-line code { font-size: .78rem; }
.so .tm { font: .76rem var(--mono); color: var(--muted); white-space: nowrap; }
.so .body { padding: .1rem .9rem .8rem; }
.so .body h5 { margin: .5rem 0 .25rem; font-size: .78rem; color: var(--muted); font-weight: 600; }
.so .body pre { border-radius: 6px; max-height: 320px; }
.so .why { color: var(--red); font-size: .84rem; margin: .3rem 0; }
.pf { font: 700 .72rem/1.5 var(--mono); padding: .06rem .4rem; border-radius: 5px; text-align: center; }
.pf-pass { background: var(--herb-soft); color: var(--herb); }
.pf-fail { background: var(--red-soft); color: var(--red); }
.pf-skip, .pf-wait { background: var(--line2); color: var(--muted); }
.pf-run { background: var(--saffron-soft); color: var(--saffron); }
.ask { margin: .4rem .9rem .8rem; padding: .7rem .8rem; border: 1px solid var(--saffron); border-radius: 8px; background: var(--saffron-soft); }
.ask label { color: var(--ink); }
.ask input { width: 100%; }
.out { margin-top: .6rem; }
.out .line { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .86rem; margin-bottom: .4rem; }
#ib-out { max-height: 620px; overflow-y: auto; }
#ib-link { min-width: 16rem; }
.app-box h5 { margin: .7rem 0 .25rem; font-size: .82rem; color: var(--muted); }
.app-box p { margin: .2rem 0; }
ul.app-cards { list-style: none; margin: 0; padding: 0; }
ul.app-cards li { border: 1px solid var(--line2); border-radius: 8px; padding: .4rem .7rem; margin: .3rem 0; font-size: .88rem; }
.stars { color: var(--saffron); letter-spacing: .05em; }
button.app-view { font-size: .8rem; padding: .35rem .7rem; color: var(--blue); }
.ib-item { border: 1px solid var(--line2); border-radius: 8px; margin: .35rem 0; }
.ib-item > summary { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding: .38rem .7rem; cursor: pointer; font-size: .84rem; }
.ib-item .body { padding: 0 .7rem .6rem; }
.ib-item pre { border-radius: 6px; max-height: 260px; }
[data-mock][disabled] { opacity: .45; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: .5rem 1rem; border-radius: 8px; font-size: .86rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---- phone / tablet */
@media (max-width: 900px) {
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 30; height: var(--top-h); align-items: center; justify-content: space-between;
    padding: 0 16px; background: var(--sheet); border-bottom: 1px solid var(--line);
  }
  html { scroll-padding-top: calc(var(--top-h) + 12px); }
  .layout { display: block; }
  .side {
    position: fixed; z-index: 25; top: var(--top-h); left: 0; right: 0; height: auto; max-height: calc(100vh - var(--top-h));
    border-right: 0; border-bottom: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    transform: translateY(-110%); visibility: hidden; transition: transform .2s, visibility .2s; padding: 14px 16px 20px;
  }
  .side.open { transform: none; visibility: visible; }
  .side > .brand, .side .for { display: none; }
  main { padding: 18px 16px 100px; }
  .grid2, .grid3, ul.dl { grid-template-columns: minmax(0, 1fr); }
  li.step { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  .so > summary { grid-template-columns: 3.4rem minmax(0, 1fr) auto; }
  .so > summary .sc { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
}
/* ตารางช่องข้อมูล / ข้อผิดพลาด บนมือถือ: เรียงเป็นบล็อก (ชื่อ + ต้องมี → ชนิด → ความหมาย) แทนคอลัมน์แคบ */
@media (max-width: 640px) {
  table.fields thead, table.errtab thead { display: none; }
  table.fields, table.fields > tbody, table.errtab, table.errtab > tbody { display: block; }
  table.fields > tbody > tr, table.errtab > tbody > tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .5rem; padding: .5rem .65rem; border-bottom: 1px solid var(--line2); }
  table.fields > tbody > tr > td, table.errtab > tbody > tr > td { display: block; border: 0; padding: 0; min-width: 0; max-width: none; width: auto; }
  table.fields td.ty { order: 3; flex-basis: 100%; color: var(--muted); }
  table.fields > tbody > tr > td:nth-child(4) { order: 4; flex-basis: 100%; }
  table.fields td.rq { text-align: left; font-size: .76rem; }
  table.fields td.rq:not(:empty)::after { content: " ต้องมี"; }
  table.fields > tbody > tr.nest { padding: 0 0 .35rem .5rem; background: var(--paper); }
  table.fields > tbody > tr.nest > td { flex-basis: 100%; background: none; }
  table.errtab > tbody > tr > td:nth-child(n+3) { flex-basis: 100%; }
  table.errtab > tbody > tr > td:nth-child(4) { color: var(--muted); }
  .tw > table:not(.fields):not(.errtab) { min-width: 560px; }
  .tw { -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* ================= v0.4: flow 3 ขั้น · จังหวะ snapshot · ตารางจุด · การ์ดคนไข้ ================= */
ol.flow3 { list-style: none; margin: .6rem 0 1.2rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: f; }
ol.flow3 li { position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; min-width: 0; }
ol.flow3 li:not(:last-child)::after { content: "→"; position: absolute; z-index: 1; right: -7px; top: 50%; transform: translate(50%, -50%); width: 26px; height: 26px; border-radius: 50%;
  background: var(--herb); color: var(--herb-ink); display: grid; place-items: center; font-size: .9rem; font-weight: 600; }
ol.flow3 .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--herb); color: var(--herb-ink); font-weight: 600; margin-right: .45rem; }
ol.flow3 b { font-size: 1rem; }
ol.flow3 p { margin: .45rem 0 .5rem; font-size: .88rem; color: var(--muted); }
.timing .tl { position: relative; height: 34px; margin: 2rem 4% 1rem 2%; border-radius: 6px; background: var(--line2); }
.timing .tl.short { margin-top: .8rem; margin-bottom: 2rem; }
.timing .tl-key { margin: .2rem 0 .6rem; }
.timing .k-snap { color: var(--herb); font-weight: 600; }
.timing .k-miss { color: var(--red); font-weight: 600; }
.timing .tl-bar { height: 100%; border-radius: 6px; background: var(--herb-soft); border: 1px solid var(--herb); display: flex; align-items: center; padding-left: .6rem; font-size: .8rem; color: var(--herb); box-sizing: border-box; }
.timing .tl.short .tl-bar { background: var(--saffron-soft); border-color: var(--saffron); color: var(--saffron); }
.timing .tl-mark { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px dashed var(--muted); font-style: normal; }
.timing .tl-mark.snap { border-left: 2px solid var(--herb); }
.timing .tl-mark.miss { border-left: 2px solid var(--red); }
.timing .tl-mark b { position: absolute; top: -1.45rem; left: 0; transform: translateX(-50%); font-size: .78rem; white-space: nowrap; }
.timing .tl-mark em { position: absolute; bottom: -1.5rem; left: 0; transform: translateX(-50%); font-size: .74rem; font-style: normal; color: var(--muted); white-space: nowrap; font-family: var(--mono); }
.timing .tl-mark.miss em { color: var(--red); }
table.jt td:nth-child(n+3), table.jt th:nth-child(n+3) { text-align: center; width: 4.2rem; color: var(--herb); font-weight: 600; }
table.compact td:first-child, table.jt td:first-child { white-space: nowrap; }
.pcard { display: inline-flex; align-items: center; gap: .8rem; background: var(--sheet); border: 2px solid var(--herb); border-radius: 14px; padding: .6rem 1rem .6rem .6rem; margin: .4rem 0; max-width: 100%; }
.pcard img, .pcard .ph { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; background: var(--herb-soft); }
.pcard .ph { display: grid; place-items: center; color: var(--herb); }
.pcard b { display: block; font-size: 1.05rem; }
.pcard small { color: var(--muted); }
.pcard.gone { border-color: var(--red); opacity: .8; }
.pcard.mini { padding: .25rem .6rem .25rem .25rem; border-width: 1px; border-radius: 10px; gap: .45rem; margin: 0; }
.pcard.mini img, .pcard.mini .ph { width: 28px; height: 28px; border-radius: 7px; }
.pcard.mini b { font-size: .82rem; display: inline; }
.pats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: .4rem; }
.pats .pat { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.pats .pat .row { margin: 0; }
.vars { margin: .3rem 0 .2rem; }
@media (max-width: 900px) {
  ol.flow3 { grid-template-columns: minmax(0, 1fr); }
  ol.flow3 li:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -7px; transform: translate(50%, 50%); }
}
