/* Takato website — flat design. Tokens first; dark theme by media query or [data-theme]. */
:root {
  --bg: #f6f7fb;
  --bg-alt: #eef1f8;
  --surface: #ffffff;
  --ink: #12151f;
  --ink-2: #2b3142;
  --muted: #5b6275;
  --line: #e2e6ef;
  --doc: #2f5bff;
  --doc-ink: #1f45e0;
  --doc-soft: #e5ebff;
  --sheet: #0f9d58;
  --sheet-ink: #0b7d46;
  --sheet-soft: #d9f4e6;
  --coral: #ff6b4a;
  --coral-soft: #ffe6df;
  --sun: #ffc53d;
  --sun-soft: #fff3d1;
  --on-color: #ffffff;
  --paper: #ffffff;
  --radius: 18px;
  --radius-sm: 10px;
  --font: "Noto Sans Thai", "Leelawadee UI", "Thonburi", "Tahoma", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0f17; --bg-alt: #111522; --surface: #161b28; --ink: #eef1f8; --ink-2: #d2d8e6;
    --muted: #9aa3b8; --line: #252c3d; --doc: #5b7cff; --doc-ink: #8ea4ff; --doc-soft: #1b2448;
    --sheet: #25b66d; --sheet-ink: #5fd896; --sheet-soft: #10301f; --coral-soft: #3a1f19;
    --sun-soft: #3a3016; --paper: #1d2333; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0f17; --bg-alt: #111522; --surface: #161b28; --ink: #eef1f8; --ink-2: #d2d8e6;
  --muted: #9aa3b8; --line: #252c3d; --doc: #5b7cff; --doc-ink: #8ea4ff; --doc-soft: #1b2448;
  --sheet: #25b66d; --sheet-ink: #5fd896; --sheet-soft: #10301f; --coral-soft: #3a1f19;
  --sun-soft: #3a3016; --paper: #1d2333; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.75; overflow-x: hidden; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--doc-ink); text-decoration-thickness: .08em; text-underline-offset: .2em; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 800; }
h3, .h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--doc); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.narrow { max-width: 860px; }
.center { text-align: center; }
.center .cta, .cta.center { justify-content: center; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .3s, background .3s; }
.top.scrolled { border-bottom-color: var(--line); background: var(--surface); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.brand b { color: var(--doc); font-weight: 800; margin-left: 2px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a:not(.btn) { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: .98rem; transition: background .2s, color .2s; }
.nav a:not(.btn):hover { background: var(--bg-alt); color: var(--ink); }
.nav a[aria-current="page"]:not(.btn) { color: var(--doc-ink); background: var(--doc-soft); }
.theme-btn { border: 0; background: transparent; color: var(--ink-2); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.theme-btn:hover { background: var(--bg-alt); }
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}
.menu-btn { display: none; border: 0; background: var(--bg-alt); width: 44px; height: 44px; border-radius: 12px; cursor: pointer; padding: 12px 11px; flex-direction: column; justify-content: space-between; }
.menu-btn span { display: block; height: 2.5px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .nav { position: fixed; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 12px 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); transform: translateY(-12px); opacity: 0; visibility: hidden; transition: all .3s var(--ease); }
  .nav.open { transform: none; opacity: 1; visibility: visible; }
  .nav a:not(.btn) { padding: 12px 14px; }
  .nav .btn { margin-top: 6px; justify-content: center; }
  .theme-btn { align-self: flex-start; }
  .menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
}

/* ---------- Buttons, badges ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 14px; font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .2s var(--ease), background .2s, box-shadow .2s; line-height: 1.3; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 9px 16px; font-size: .95rem; border-radius: 12px; }
.btn-lg { padding: 16px 26px; font-size: 1.05rem; }
.btn-doc { background: var(--doc); color: var(--on-color); box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--doc) 45%, transparent); }
.btn-doc:hover { background: var(--doc-ink); }
.btn-sheet { background: var(--sheet); color: var(--on-color); box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--sheet) 45%, transparent); }
.btn-sheet:hover { background: var(--sheet-ink); }
:root[data-theme="dark"] .btn-doc:hover { background: #4a6cff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-light { background: #fff; color: #12151f; }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--doc-soft); color: var(--doc-ink); font-weight: 700; font-size: .9rem; margin-bottom: 18px; }
.badge.green { background: var(--sheet-soft); color: var(--sheet-ink); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--coral); position: relative; display: inline-block; flex: none; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--coral); animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 680px; }
.center .lead, .sec-head .lead { margin-left: auto; margin-right: auto; }
.fine { font-size: .92rem; color: var(--muted); }
.hl { color: var(--doc); position: relative; white-space: nowrap; }
.hl::after { content: ""; position: absolute; left: 0; right: 0; bottom: .08em; height: .22em; background: var(--sun); z-index: -1; border-radius: 4px; transform-origin: left; animation: underline 1s .5s var(--ease) both; }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 48px 0 72px; overflow: hidden; isolation: isolate; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero-grid > *, .prod-grid > *, .demo-grid > *, .flow-grid > *, .dl-grid > *, .two-col > *, .feat-grid > * { min-width: 0; }
.hero-copy { position: relative; z-index: 2; }
.h1-sub { display: block; font-size: .5em; font-weight: 700; color: var(--muted); margin-top: .35em; letter-spacing: 0; }
.crumbs { font-size: .9rem; color: var(--muted); display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.center .crumbs { justify-content: center; }
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero { padding-top: 28px; }
}

.shapes { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.shapes i { position: absolute; display: block; border-radius: 50%; }
.shapes .s1 { width: 340px; height: 340px; background: var(--doc-soft); top: -120px; right: -80px; animation: drift 14s ease-in-out infinite alternate; }
.shapes .s2 { width: 160px; height: 160px; background: var(--sheet-soft); bottom: 20px; left: -60px; border-radius: 36px; animation: drift 11s ease-in-out infinite alternate-reverse; }
.shapes .s3 { width: 70px; height: 70px; background: var(--sun-soft); top: 40%; left: 46%; animation: drift 9s ease-in-out infinite alternate; }
.shapes .s4 { width: 26px; height: 26px; border: 6px solid var(--coral); background: transparent; bottom: 10%; left: 42%; animation: spin 18s linear infinite; border-radius: 8px; }
@keyframes drift { to { transform: translate(30px, 24px) rotate(12deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

.stage { position: relative; min-height: 470px; }
.stage.single { min-height: 0; padding: 20px 0; }
.stage .win-doc { position: relative; width: 88%; z-index: 1; animation: float 7s ease-in-out infinite; }
.stage .win-sheet { position: absolute; width: 66%; right: 0; bottom: -64px; z-index: 2; animation: float 7s ease-in-out -3.5s infinite; }
.stage.single .win { position: relative; width: 100%; right: auto; bottom: auto; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.float-chip { position: absolute; z-index: 3; padding: 8px 14px; border-radius: 12px; font-weight: 700; font-size: .9rem; background: var(--surface); border: 2px solid var(--line); color: var(--ink); white-space: nowrap; animation: float 6s ease-in-out infinite; }
.float-chip.c1 { top: -6px; right: 4%; color: var(--sheet-ink); border-color: var(--sheet); animation-delay: -1s; }
.float-chip.c2 { top: 46%; left: -18px; color: var(--coral); border-color: var(--coral); animation-delay: -2.5s; }
.float-chip.c3 { bottom: -18px; left: 10%; color: var(--doc-ink); border-color: var(--doc); animation-delay: -4s; }
.stage.single .float-chip.c3 { bottom: -4px; }
@media (max-width: 960px) {
  .stage { min-height: 0; max-width: 640px; }
  .stage .win-doc { width: 100%; }
  .stage .win-sheet { position: relative; width: 88%; margin: -28px 0 0 auto; bottom: 0; }
  .float-chip.c2 { display: none; }
}
@media (max-width: 600px) { .stage .win-sheet { width: 96%; } }

/* ---------- App window mockups ---------- */
.win { margin: 0; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 13.5px; line-height: 1.6; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--bg-alt); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.win-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--coral); flex: none; }
.win-bar i:nth-child(2) { background: var(--sun); }
.win-bar i:nth-child(3) { background: var(--sheet); }
.win-bar span { margin-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ribbon { display: flex; gap: 2px; padding: 6px 10px 0; background: var(--doc); color: rgba(255,255,255,.85); font-size: 12.5px; overflow: hidden; white-space: nowrap; }
.ribbon b, .ribbon span { padding: 4px 10px; border-radius: 8px 8px 0 0; font-weight: 500; }
.ribbon b { background: var(--surface); color: var(--doc-ink); font-weight: 700; }
.tools { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow: hidden; }
.tools i, .tools em { font-style: normal; display: grid; place-items: center; min-width: 24px; height: 24px; border-radius: 6px; background: var(--bg-alt); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.tools .t-i { font-style: italic; } .tools .t-u { text-decoration: underline; }
.tools em { padding: 0 8px; font-weight: 500; white-space: nowrap; }
.tools .sep { min-width: 1px; width: 1px; background: var(--line); }
.tools .al { background: linear-gradient(var(--ink-2) 0 0) 5px 7px / 14px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 5px 11px / 9px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 5px 15px / 14px 2px no-repeat, var(--bg-alt); }
.tools .al.c { background: linear-gradient(var(--ink-2) 0 0) 5px 7px / 14px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 7.5px 11px / 9px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 5px 15px / 14px 2px no-repeat, var(--bg-alt); }
.tools .al.r { background: linear-gradient(var(--ink-2) 0 0) 5px 7px / 14px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 10px 11px / 9px 2px no-repeat, linear-gradient(var(--ink-2) 0 0) 5px 15px / 14px 2px no-repeat, var(--bg-alt); }
.paper { margin: 14px 18px; padding: 20px 22px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; min-height: 196px; }
.p-title { font-weight: 800; font-size: 17px; margin: 0 0 6px; color: var(--ink); }
.p-text { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; line-height: 1.85; min-height: 5.6em; }
.p-text .caret { display: inline-block; width: 2px; height: 1.15em; background: var(--doc); vertical-align: -.2em; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.p-line { height: 8px; border-radius: 4px; background: var(--bg-alt); margin: 8px 0; }
.p-line.s { width: 60%; }
.win-status { display: flex; gap: 14px; padding: 6px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.win-status .ok { color: var(--sheet-ink); margin-left: auto; font-weight: 600; }
.fx { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.fx .nm, .mini-fx .nm { padding: 1px 8px; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; font-size: 12px; color: var(--ink-2); min-width: 44px; text-align: center; }
.fx-i { font-style: italic; font-weight: 700; color: var(--sheet-ink); font-family: Georgia, serif; }
.fx code { color: var(--ink); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.grid th, .grid td { border: 1px solid var(--line); padding: 4px 8px; height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid thead th, .grid tbody th { background: var(--bg-alt); color: var(--muted); font-weight: 500; font-size: 11.5px; text-align: center; }
.grid thead th:first-child, .grid tbody th { width: 32px; }
.grid thead th:nth-child(2) { width: 42%; }
.grid td.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.h { font-weight: 700; background: var(--sheet-soft); color: var(--sheet-ink); }
.grid td.tot { font-weight: 800; border: 2px solid var(--sheet); }
.grid td.baht { color: var(--sheet-ink); font-weight: 700; background: var(--sun-soft); }
.grid td.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { background: var(--sun); } 100% { background: transparent; } }
.win-sheet .win-bar { background: var(--sheet-soft); }

/* ---------- Stats ---------- */
.stats { padding: 8px 0 40px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stats-grid > div { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.stats-grid b { display: block; font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 800; color: var(--doc); font-variant-numeric: tabular-nums; line-height: 1.3; }
.stats-grid > div:nth-child(2) b { color: var(--sheet); }
.stats-grid > div:nth-child(3) b { color: var(--coral); }
.stats-grid > div:nth-child(4) b { color: #c98a00; }
:root[data-theme="dark"] .stats-grid > div:nth-child(4) b { color: var(--sun); }
.stats-grid span { color: var(--muted); font-size: .95rem; }
@media (max-width: 760px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sections ---------- */
.sec { padding: 84px 0; position: relative; }
.sec.alt { background: var(--bg-alt); }
.sec-head { text-align: center; max-width: 820px; margin: 0 auto 44px; }
.eyebrow { display: inline-block; font-weight: 700; color: var(--doc-ink); background: var(--doc-soft); padding: 4px 12px; border-radius: 8px; font-size: .9rem; margin-bottom: 14px; }
@media (max-width: 600px) { .sec { padding: 60px 0; } }

.prod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.prod { background: var(--surface); border: 2px solid var(--line); border-radius: 24px; padding: 32px; position: relative; overflow: hidden; transition: transform .3s var(--ease), border-color .3s; }
.prod::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; top: -110px; right: -90px; background: var(--doc-soft); transition: transform .5s var(--ease); }
.prod-sheet::before { background: var(--sheet-soft); }
.prod:hover { transform: translateY(-6px); border-color: var(--doc); }
.prod-sheet:hover { border-color: var(--sheet); }
.prod:hover::before { transform: scale(1.25); }
.prod > * { position: relative; }
.prod img { margin-bottom: 18px; }
.prod h3 { font-size: 1.7rem; margin: 0; }
.prod-sub { color: var(--muted); margin-bottom: 16px; }
.prod-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 760px) { .prod-grid { grid-template-columns: 1fr; } .prod { padding: 24px; } }

.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { position: relative; padding-left: 30px; margin: 8px 0; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .45em; width: 18px; height: 18px; border-radius: 6px; background: var(--sheet-soft); }
.ticks li::after { content: ""; position: absolute; left: 5px; top: calc(.45em + 4px); width: 8px; height: 5px; border-left: 2.5px solid var(--sheet); border-bottom: 2.5px solid var(--sheet); transform: rotate(-45deg); }

.feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.feat-grid.three { grid-template-columns: repeat(3, 1fr); }
.feat { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 24px; transition: transform .3s var(--ease), border-color .3s; }
.feat:hover { transform: translateY(-4px); border-color: var(--ink-2); }
.feat p { color: var(--muted); margin: 0; font-size: .97rem; }
.ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; transition: transform .4s var(--ease); }
.feat:hover .ico { transform: rotate(-8deg) scale(1.08); }
.ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.i-blue { background: var(--doc-soft); color: var(--doc); }
.i-green { background: var(--sheet-soft); color: var(--sheet); }
.i-coral { background: var(--coral-soft); color: var(--coral); }
.i-sun { background: var(--sun-soft); color: #b37800; }
:root[data-theme="dark"] .i-sun { color: var(--sun); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { color: var(--sun); } }
@media (max-width: 1060px) { .feat-grid { grid-template-columns: repeat(2, 1fr); } .feat-grid.three { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feat-grid, .feat-grid.three { grid-template-columns: 1fr; } }

/* ---------- Demos ---------- */
.tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.tabs button { font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all .2s; }
.tabs button:hover { border-color: var(--doc); }
.tabs button[aria-selected="true"] { background: var(--doc); border-color: var(--doc); color: #fff; }
.tab-panels { max-width: 860px; margin: 0 auto; }
[role="tabpanel"]:not([hidden]) { animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.demo-grid.two { grid-template-columns: 1fr 1fr; margin-top: 20px; }
@media (max-width: 1060px) { .demo-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .demo-grid.two { grid-template-columns: 1fr; } }
.demo-card { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 24px; }
.demo-head p { color: var(--muted); font-size: .96rem; }
.demo-in { width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: vertical; transition: border-color .2s; }
.demo-in:focus { outline: none; border-color: var(--doc); }
.demo-out { margin-top: 14px; min-height: 2em; }
.demo-out.big { font-size: 1.3rem; font-weight: 700; color: var(--sheet-ink); word-break: break-word; }
.demo-note { color: var(--muted); font-size: .92rem; margin: 12px 0 0; }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.words span { padding: 3px 10px; border-radius: 8px; background: var(--doc-soft); color: var(--doc-ink); font-weight: 500; animation: pop .35s var(--ease) both; }
.words span.u { background: var(--coral-soft); color: var(--coral); }
.words span.o { background: var(--bg-alt); color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
.wrapcmp { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
@media (max-width: 600px) { .wrapcmp { grid-template-columns: 1fr; } }
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; margin-bottom: 6px; }
.tag-bad { background: var(--coral-soft); color: var(--coral); }
.tag-good { background: var(--sheet-soft); color: var(--sheet-ink); }
.wrapbox { width: 170px; max-width: 100%; margin: 0; padding: 10px 12px; background: var(--paper); border: 2px dashed var(--line); border-radius: 10px; font-size: 1rem; line-height: 1.8; transition: width .15s; }
.wrapbox.bad { word-break: break-all; }
.wrapbox.good { word-break: normal; overflow-wrap: normal; }
.wrapbox .w { white-space: nowrap; }
.range { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); font-size: .92rem; }
.range input { flex: 1; max-width: 260px; accent-color: var(--doc); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; color: var(--muted); font-size: .92rem; }
.chips button { font: inherit; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.chips button:hover { border-color: var(--doc); color: var(--doc-ink); }
.fxrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fxrow code { font-size: 1.05rem; color: var(--ink-2); }
.fxrow .demo-in.num { width: 170px; flex: 1 1 140px; font-family: var(--mono); }
.dates { display: grid; gap: 8px; margin: 14px 0 0; }
.dates div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 10px; flex-wrap: wrap; }
.dates dt { color: var(--muted); font-size: .9rem; font-family: var(--mono); }
.dates dd { margin: 0; font-weight: 700; color: var(--sheet-ink); }
.wasm-state { text-align: center; color: var(--muted); font-size: .88rem; margin: 18px 0 0; }
.wasm-state.ok { color: var(--sheet-ink); }

.demo-card.wide { max-width: 980px; margin: 0 auto; }
.mini-fx { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mini-fx .demo-in { padding: 8px 12px; font-family: var(--mono); font-size: .95rem; }
.mini-scroll { overflow-x: auto; border-radius: 10px; border: 2px solid var(--line); }
.mini { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .95rem; table-layout: fixed; }
.mini thead th:nth-child(2) { width: 30%; } .mini thead th:nth-child(3) { width: 16%; } .mini thead th:nth-child(4) { width: 20%; }
.mini th, .mini td { border: 1px solid var(--line); height: 38px; padding: 0 10px; }
.mini th { background: var(--bg-alt); color: var(--muted); font-weight: 500; font-size: .85rem; }
.mini thead th:first-child { width: 44px; }
.mini td { cursor: cell; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; background: var(--paper); transition: background .3s; }
.mini td.wrap { white-space: normal; line-height: 1.5; padding: 6px 10px; }
.mini td.n { text-align: right; font-variant-numeric: tabular-nums; }
.mini td.e { color: var(--coral); font-weight: 700; }
.mini td.f { color: var(--sheet-ink); font-weight: 600; }
.mini tbody tr:first-child td, .mini tbody tr:nth-child(6) td:first-child { font-weight: 700; }
.mini td.sel { outline: 2.5px solid var(--sheet); outline-offset: -2px; }
.mini td.changed { animation: flash 1s var(--ease); }

/* ---------- Origin flow ---------- */
.flow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 860px) { .flow-grid { grid-template-columns: 1fr; } }
.flow { background: var(--surface); border: 2px solid var(--line); border-radius: 24px; padding: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.flow .ticks { flex-basis: 100%; margin-top: 14px; }
.node { padding: 8px 16px; border-radius: 12px; font-weight: 800; white-space: nowrap; }
.node.src { background: var(--bg-alt); color: var(--ink-2); }
.node.plus { background: var(--sun-soft); color: #9a6700; font-weight: 700; }
:root[data-theme="dark"] .node.plus { color: var(--sun); }
.node.dst.doc { background: var(--doc); color: #fff; }
.node.dst.sheet { background: var(--sheet); color: #fff; }
.arrow { width: 34px; height: 2px; background: var(--line); position: relative; overflow: hidden; border-radius: 2px; }
.arrow i { position: absolute; inset: 0; width: 40%; background: var(--doc); animation: flow 1.6s linear infinite; }
@keyframes flow { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- Roadmap ---------- */
.road { list-style: none; padding: 0; margin: 0; position: relative; }
.road::before { content: ""; position: absolute; left: 15px; top: 10px; bottom: 10px; width: 3px; background: var(--line); border-radius: 2px; }
.road li { position: relative; padding: 0 0 26px 52px; display: flex; flex-direction: column; }
.road li::before { content: ""; position: absolute; left: 4px; top: 4px; width: 25px; height: 25px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); box-sizing: border-box; }
.road li.done::before { background: var(--sheet); border-color: var(--sheet); }
.road li.now::before { background: var(--coral); border-color: var(--coral); box-shadow: 0 0 0 6px var(--coral-soft); animation: beat 2s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: 0 0 0 11px var(--coral-soft); } }
.road b { font-size: 1.08rem; }
.road span { color: var(--muted); font-size: .92rem; }
.road li.now span { color: var(--coral); font-weight: 700; }

/* ---------- FAQ ---------- */
.faqs { display: grid; gap: 12px; }
.faq { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; transition: border-color .2s; }
.faq[open] { border-color: var(--doc); }
.faq summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary h3 { margin: 0; font-size: 1.06rem; }
.faq-i { width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--doc-soft); position: relative; transition: transform .3s var(--ease); }
.faq-i::before, .faq-i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 13px; height: 2.5px; background: var(--doc); border-radius: 2px; }
.faq-i::after { transform: rotate(90deg); transition: transform .3s var(--ease); }
.faq[open] .faq-i { transform: rotate(180deg); }
.faq[open] .faq-i::after { transform: rotate(0); }
.faq-a { padding: 0 22px 6px; color: var(--muted); }
.faq[open] .faq-a { animation: rise .35s var(--ease); }

/* ---------- Bands, specs, download ---------- */
.band { background: var(--doc); color: #fff; padding: 64px 0; position: relative; overflow: hidden; }
.band.green { background: var(--sheet); }
.band::before, .band::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.band::before { width: 300px; height: 300px; right: -80px; top: -120px; animation: drift 12s ease-in-out infinite alternate; }
.band::after { width: 140px; height: 140px; left: 6%; bottom: -70px; animation: drift 9s ease-in-out infinite alternate-reverse; }
.band-in { text-align: center; position: relative; z-index: 1; }
.band p { color: rgba(255,255,255,.85); font-size: 1.1rem; }
.band .cta { justify-content: center; }
.spec { width: 100%; border-collapse: collapse; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.spec th, .spec td { padding: 14px 20px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 0; }
.spec th { width: 34%; color: var(--muted); font-weight: 500; }
@media (max-width: 600px) { .spec th, .spec td { display: block; width: auto; padding: 8px 16px; } .spec th { padding-top: 14px; border: 0; } }
.dl-hero { padding-bottom: 60px; overflow: hidden; isolation: isolate; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; }
@media (max-width: 860px) { .dl-grid { grid-template-columns: 1fr; } }
.dl { background: var(--surface); border: 2px solid var(--line); border-radius: 24px; padding: 32px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.dl.doc { border-top: 6px solid var(--doc); }
.dl.sheet { border-top: 6px solid var(--sheet); }
.dl img { margin-bottom: 12px; }
.dl h2 { margin: 0; font-size: 1.6rem; }
.dl > p { color: var(--muted); }
.dl[data-state="soon"] .btn { opacity: .55; pointer-events: none; }
.dl[data-state="soon"] .btn::after { content: " (เร็ว ๆ นี้)"; }
.meta { width: 100%; margin: 24px 0 0; text-align: left; display: grid; gap: 8px; }
.meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 10px; flex-wrap: wrap; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 700; }
.meta .sha { flex-direction: column; }
.meta .sha dd { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.meta code { font-size: .78rem; word-break: break-all; flex: 1; color: var(--ink-2); }
.copy { font: inherit; font-size: .85rem; padding: 4px 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: none; }
.copy.done { border-color: var(--sheet); color: var(--sheet-ink); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.steps li { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 26px; counter-increment: s; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--doc); color: #fff; font-weight: 800; font-size: 1.2rem; margin-bottom: 14px; }
.steps b { font-size: 1.15rem; }
.steps p { color: var(--muted); margin: 6px 0 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.code { background: #12151f; color: #d7f5e5; padding: 16px 18px; border-radius: 12px; overflow-x: auto; font-size: .88rem; line-height: 1.7; }
.nf { padding-top: 100px; overflow: hidden; isolation: isolate; }
.nf-code { font-size: clamp(5rem, 18vw, 9rem); font-weight: 800; line-height: 1; color: var(--doc); margin: 0 0 10px; animation: float 5s ease-in-out infinite; }

/* ---------- Footer ---------- */
.foot { background: var(--surface); border-top: 1px solid var(--line); padding: 56px 0 28px; font-size: .95rem; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; }
.foot-grid h2 { font-size: 1rem; margin-bottom: 10px; }
.foot-grid nav a { display: block; color: var(--muted); text-decoration: none; padding: 4px 0; }
.foot-grid nav a:hover { color: var(--doc-ink); }
.foot-brand p { color: var(--muted); margin: 12px 0 0; max-width: 360px; }
.status-line { display: flex; align-items: center; gap: 10px; }
.foot-legal { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.7; }
.foot-legal p { margin: 0 0 6px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }

/* ---------- Reveal on scroll (only when JS runs) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0s); }
.js [data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
