/* POPNIX Flood - public canal water-level page (prefix-free, scoped under body.ww).
   Design read: civic live-data landing for Bangkok residents; "canal by day / canal by night" language that
   follows the device theme; native CSS + a hand-built SVG canal whose water level is driven by live data.
   Dials: variance 7 / motion 7 / density 5. One accent (canal blue); rise/fall/warn/crit are semantic states.
   Every loop animation is disabled under prefers-reduced-motion. Stack kept from popnix_portal
   (Bootstrap 5 reboot + modal, FC Vision, FontAwesome Pro Light). */

:root {
    color-scheme: light dark;
    --font: 'fc-vision', system-ui, -apple-system, "Segoe UI", "Sarabun", sans-serif;
    --ease: cubic-bezier(.32, .72, 0, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --r-shell: 28px; --r-core: 22px; --r-sm: 14px;
    --z-dock: 40; --z-menu: 45; --z-nav: 50; --z-frame: 55; --z-grain: 60;

    /* light: "canal by day" */
    --bg: #eef3f5; --bg-2: #e3ecf0; --core: #fbfdfe; --shell: rgba(18, 52, 70, .045);
    --line: rgba(18, 52, 70, .09); --line-2: rgba(18, 52, 70, .17);
    --glass: rgba(251, 253, 254, .72); --glass-line: rgba(255, 255, 255, .7); --shadow-c: rgba(22, 66, 88, .28);
    --text: #20394a; --strong: #0b1c27; --muted: #5a7384; --faint: #8ba1ad;
    --accent: #1f6f99; --accent-ink: #ffffff; --accent-soft: rgba(31, 111, 153, .11);
    --rise: #c4523a; --fall: #1b8a67; --flat: #748994; --warn: #b07418; --crit: #cc3d3b; --ok: #268f83; --off: #a3b3bb;
    --shadow: 0 1px 1px rgba(22, 66, 88, .04), 0 14px 34px -18px rgba(22, 66, 88, .32);
    --inset: inset 0 1px 0 rgba(255, 255, 255, .95);
    --grain-op: .045;
    /* art */
    --sky-top: #8fc6e3; --sky-bot: #e4f1f6; --orb: #fff6d8; --orb-glow: rgba(255, 232, 170, .65);
    --far: #b4cfdb; --mid: #86aabb; --tree: #6f97a8; --win: #d9eaf1; --win-off: #a9c5d2; --win-op: .5;
    --wall: #a2b8c2; --wall-dark: #84a0ad; --coping: #c3d4db; --seam: rgba(40, 70, 86, .14);
    --water-top: #3f95ba; --water-deep: #1b5d7e; --wave-2: #62abc9; --crest: rgba(255, 255, 255, .55);
    --boat: #25495b; --gauge: #f5f8f9; --tick: #cf443d; --temple: #7da2b3; --temple-rim: rgba(176, 116, 24, .55);
    --roof: #b98a72; --glint: #ffffff; --glint-op: .6; --bird: #5f8799; --flag-r: #a51931; --flag-w: #f4f5f8; --flag-b: #2d2a4a;
    --stars-op: 0; --lamp-op: 0; --reflect-op: 0; --art-ink: #0b1c27; --art-halo: rgba(238, 243, 245, .85);
}
@media (prefers-color-scheme: dark) {
    :root {
        /* dark: "canal by night" */
        --bg: #071219; --bg-2: #0a1822; --core: #0c1c26; --shell: rgba(150, 205, 232, .04);
        --line: rgba(150, 205, 232, .09); --line-2: rgba(150, 205, 232, .17);
        --glass: rgba(9, 22, 31, .66); --glass-line: rgba(150, 205, 232, .13); --shadow-c: rgba(0, 8, 14, .8);
        --text: #c9dae3; --strong: #f0f6f9; --muted: #7f98a6; --faint: #56707e;
        --accent: #7cc4e8; --accent-ink: #06202c; --accent-soft: rgba(124, 196, 232, .13);
        --rise: #f08f79; --fall: #58c79d; --flat: #8aa0ab; --warn: #e3b55a; --crit: #f06a66; --ok: #4dbfad; --off: #46606d;
        --shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 20px 44px -22px rgba(0, 10, 18, .9);
        --inset: inset 0 1px 0 rgba(255, 255, 255, .055);
        --grain-op: .06;
        --sky-top: #040b11; --sky-bot: #103041; --orb: #e7f1f5; --orb-glow: rgba(170, 215, 238, .22);
        --far: #0e2331; --mid: #0a1a24; --tree: #081720; --win: #ffcf7a; --win-off: #0e2130; --win-op: .75;
        --wall: #1a2f3c; --wall-dark: #0f212c; --coping: #24404f; --seam: rgba(150, 205, 232, .07);
        --water-top: #1b5b7a; --water-deep: #051d2a; --wave-2: #276f90; --crest: rgba(170, 225, 250, .45);
        --boat: #03101a; --gauge: #d3e0e5; --tick: #d9463f; --temple: #22333e; --temple-rim: rgba(227, 181, 90, .85);
        --roof: #2a3238; --glint: #ffd98a; --glint-op: .85; --bird: #3b5a6b; --flag-r: #b8283f; --flag-w: #e4e2da; --flag-b: #3b3f78;
        --stars-op: 1; --lamp-op: 1; --reflect-op: .7; --art-ink: #f0f6f9; --art-halo: rgba(7, 18, 25, .8);
    }
    .ww .btn-close { filter: invert(1) grayscale(1) brightness(2); }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y proximity; -webkit-text-size-adjust: 100%; }
.sec { scroll-margin-top: 12px; }
body.ww {
    margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font);
    font-size: 1.0625rem; line-height: 1.6; font-weight: 400; font-variant-numeric: tabular-nums;
    overflow-x: hidden; padding-bottom: 116px;
}
/* reset ใต้ :where(.ww) = specificity เท่า tag เปล่า: rule ที่เป็น class เดี่ยว (.hero-sub, .ac-diff ...) ตั้ง margin ทับได้ (เดิม .ww p ชนะ margin ของทุก <p class> เงียบ ๆ) */
:where(.ww) h1, :where(.ww) h2, :where(.ww) h3 { color: var(--strong); font-weight: 700; margin: 0; text-wrap: balance; }
:where(.ww) p { margin: 0; }
.ww a { color: var(--accent); }
.ww button { font: inherit; }
.ww :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.c-rise { color: var(--rise); } .c-fall { color: var(--fall); }
.skip { position: fixed; left: 16px; top: -64px; z-index: 100; background: var(--accent); color: var(--accent-ink) !important; padding: 10px 18px; border-radius: 999px; text-decoration: none; transition: top .4s var(--ease); }
.skip:focus { top: 16px; }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-grain); opacity: var(--grain-op);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.past-frame { position: fixed; inset: 8px; border-radius: 30px; border: 1.5px solid var(--accent); pointer-events: none; z-index: var(--z-frame); opacity: 0; transform: scale(1.012); transition: opacity .6s var(--ease), transform .6s var(--ease); }
html.is-past .past-frame { opacity: .75; transform: none; }

/* ---------- reveal + skeleton ---------- */
.js .rv { opacity: 0; transform: translateY(28px); filter: blur(6px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), filter .9s var(--ease-out); transition-delay: var(--d, 0s); }
.js .rv.in { opacity: 1; transform: none; filter: none; }
.is-loading [data-sk] { color: transparent !important; border-radius: 10px; background: linear-gradient(90deg, var(--line) 0%, var(--line-2) 50%, var(--line) 100%); background-size: 220% 100%; animation: sk 1.5s var(--ease) infinite; }
@keyframes sk { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ---------- floating island nav ---------- */
.nav { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: var(--z-nav); display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; margin: 0; list-style: none;
    padding: 6px 6px 6px 12px; border-radius: 999px; width: max-content; max-width: calc(100% - 24px);
    background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--inset), 0 12px 30px -16px var(--shadow-c);
    -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--strong) !important; text-decoration: none; font-weight: 600; white-space: nowrap; margin-right: 10px; }
.brand img { border-radius: 9px; }
.brand b { color: var(--accent); font-weight: 600; }
.nav-links { display: flex; gap: 2px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: .95rem; transition: color .35s var(--ease), background-color .35s var(--ease); }
.nav-links a:hover { color: var(--strong); }
.nav-links a.on { color: var(--strong); background: var(--accent-soft); }
.nav-links a.nav-3d { color: var(--accent); }
a.mf-btn { text-decoration: none; }
.burger { display: none; position: relative; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--shell); cursor: pointer; }
.burger span { position: absolute; left: 13px; right: 13px; height: 1.5px; border-radius: 2px; background: var(--strong); transition: transform .5s var(--ease); }
.burger span:first-child { transform: translateY(-4px); } .burger span:last-child { transform: translateY(4px); }
html.menu-open .burger span:first-child { transform: rotate(45deg); } html.menu-open .burger span:last-child { transform: rotate(-45deg); }
.menu { position: fixed; inset: 0; z-index: var(--z-menu); display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 100px 28px 140px;
    background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(26px); backdrop-filter: blur(26px);
    opacity: 0; visibility: hidden; transition: opacity .45s var(--ease), visibility 0s linear .45s; }
html.menu-open .menu { opacity: 1; visibility: visible; transition: opacity .45s var(--ease); }
.menu a { font-size: 2.2rem; font-weight: 600; color: var(--strong); text-decoration: none; padding: 4px 0; opacity: 0; transform: translateY(34px);
    transition: transform .8s var(--ease), opacity .8s var(--ease); transition-delay: calc(var(--i) * 60ms + 60ms); }
html.menu-open .menu a { opacity: 1; transform: none; }
html.menu-open { overflow: hidden; }

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: min(100dvh, 960px); display: flex; align-items: center; }
.art-wrap { position: absolute; inset: 0; z-index: -2; }
.art { display: block; width: 100%; height: 100%; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 80%, transparent) 24%, color-mix(in srgb, var(--bg) 30%, transparent) 44%, transparent 60%); }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 110px; z-index: -1; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--bg)); }
.hero-inner { width: 100%; max-width: 1240px; margin: 0 auto; padding: 112px 32px 26vh; }
.hero-copy { max-width: 600px; }
.live { display: inline-flex; align-items: center; gap: 10px; padding: 6px 15px 6px 11px; margin-bottom: 22px; border-radius: 999px; font-size: .93rem; color: var(--text);
    background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fall); box-shadow: 0 0 0 0 color-mix(in srgb, var(--fall) 60%, transparent); animation: livePulse 2.4s var(--ease) infinite; }
.live.stale .dot { background: var(--warn); animation: none; }
html.is-past .live .dot { background: var(--accent); animation: none; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
/* ตัวหนังสือไทยหลายบรรทัดต้อง line-height ≥ 1.4: สระ/วรรณยุกต์ซ้อนบน (ี้ 1.08em) + สระล่าง (ุ ฎ 0.28em) ของ FC Vision ต้องการ 1.37 ไม่งั้นทับกันข้ามบรรทัด */
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1.4; letter-spacing: -.012em; }   /* hero กระชับ (ผู้ใช้ขอ 2026-09-30): 2 บรรทัดบนจอกว้าง */
.hero h1 .nw, #heroNoun { white-space: nowrap; }   /* ไทยไม่มีช่องว่าง เบราว์เซอร์ตัด "วัน|นี้" "ยอด|น้ำ" ได้ (keep-all ใช้กับไทยไม่ได้) */
.hero h1 .state { display: inline-block; color: var(--state-c, var(--strong)); padding-bottom: .06em;
    text-decoration: underline wavy color-mix(in srgb, var(--state-c, var(--accent)) 55%, transparent); text-decoration-thickness: 2.5px; text-underline-offset: .06em; text-decoration-skip-ink: none;
    transition: color .6s var(--ease); }
.state.rise { --state-c: var(--rise); } .state.fall { --state-c: var(--fall); } .state.flat { --state-c: var(--accent); }
.state.swap { animation: swapIn .9s var(--ease) both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(.45em); filter: blur(4px); } }
.hero-sub { margin-top: 14px; font-size: clamp(1.05rem, 1.55vw, 1.25rem); line-height: 1.55; max-width: 36ch; color: var(--text); }
.hero-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 24px; margin-top: 18px; }
.btn-island { display: inline-flex; align-items: center; gap: 14px; padding: 7px 7px 7px 24px; border-radius: 999px; background: var(--accent); color: var(--accent-ink) !important;
    font-weight: 600; text-decoration: none; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 14px 30px -14px color-mix(in srgb, var(--accent) 80%, transparent);
    transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.btn-island .ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent-ink) 14%, transparent); transition: transform .5s var(--ease); }
.btn-island:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 18px 36px -14px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn-island:hover .ico { transform: translate(2px, 1px) scale(1.07); }
.btn-island:active { transform: scale(.98); }
.link { color: var(--strong) !important; text-decoration: none; padding-bottom: 2px; border-bottom: 1px solid var(--line-2); transition: border-color .35s var(--ease); }
.link:hover { border-color: var(--accent); }

/* ---------- art: canal ---------- */
.orb { fill: var(--orb); }
.star { fill: #fff; opacity: calc(var(--stars-op) * .8); animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: calc(var(--stars-op) * .15); } }
.far { fill: var(--far); } .far .fw { fill: var(--win); opacity: calc(var(--win-op) * .55); }
.temple { fill: var(--temple); stroke: var(--temple-rim); stroke-width: 1.1; stroke-linejoin: round; } .temple-glow { opacity: calc(var(--lamp-op) * .55); }
.temple .roof { fill: var(--roof); } .temple .face { fill: var(--temple); stroke-width: .9; }
.temple .t-lit { fill: var(--win); stroke: none; opacity: var(--win-op); animation: candle 5s ease-in-out infinite alternate; }
@keyframes candle { 50% { opacity: calc(var(--win-op) * .7); } }
.temple .t-gold { fill: none; stroke: var(--temple-rim); stroke-width: 1.4; }
.glint { opacity: var(--glint-op); transform: translateX(-80px) skewX(-18deg); animation: glint 12s var(--ease) infinite 2s; }
@keyframes glint { 0% { transform: translateX(-80px) skewX(-18deg); } 32%, 100% { transform: translateX(420px) skewX(-18deg); } }
.flag .pole { fill: var(--temple); } .flag .s-r { fill: var(--flag-r); } .flag .s-w { fill: var(--flag-w); } .flag .s-b { fill: var(--flag-b); }
.flag .cloth { transform-box: fill-box; transform-origin: 0 50%; animation: flagWave 2.4s ease-in-out infinite alternate; }
@keyframes flagWave { from { transform: skewY(-5deg) scaleX(.92); } to { transform: skewY(4deg) scaleX(1); } }
.flock { animation: flock 64s linear infinite; }
@keyframes flock { from { transform: translate(-80px, 30px); } to { transform: translate(1320px, -40px); } }
.bird { fill: none; stroke: var(--bird); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 80%; animation: flap .42s ease-in-out infinite alternate; }
@keyframes flap { to { transform: scaleY(-.45); } } .mid { fill: var(--mid); } .trees { fill: var(--tree); } .rail { fill: var(--coping); }
.mid .win { fill: var(--win-off); } .mid .win.lit { fill: var(--win); opacity: var(--win-op); }
.flk { animation: flicker 7s steps(1) infinite; } @keyframes flicker { 0%, 100% { opacity: var(--win-op); } 43% { opacity: .1; } 47% { opacity: var(--win-op); } 71% { opacity: .15; } }
.coping { fill: var(--coping); }
.seams line { stroke: var(--seam); stroke-width: 1.2; }
.stain { fill: var(--water-deep); opacity: .22; transition: transform 2s var(--ease); }
.ln { stroke-width: 2; stroke-dasharray: 10 8; transition: transform 2s var(--ease); }
.ln-warn { stroke: var(--warn); opacity: .75; } .ln-crit { stroke: var(--crit); opacity: .85; }
.lamps .post { fill: var(--mid); } .lamps .bulb { fill: #ffe2a8; opacity: max(var(--lamp-op), .25); } .lamps .glow { opacity: var(--lamp-op); }
.gauge .g-back { fill: var(--gauge); } .gauge .g-tick { fill: var(--tick); }
.water { transition: transform 2s var(--ease); }
.wave { will-change: transform; } .w1 { animation: waveX 11s linear infinite; } .w2 { animation: waveX 17s linear infinite reverse; }
@keyframes waveX { to { transform: translateX(-1200px); } }
#w1 path:first-child { fill: url(#gWater); opacity: .96; } #w2 path { fill: var(--wave-2); opacity: .8; }
.crest { fill: none; stroke: var(--crest); stroke-width: 1.6; }
.reflect { opacity: var(--reflect-op); }
.rfl { animation: shimmer 3.2s ease-in-out infinite; } .rfl .shim { fill: #ffe2a8; opacity: .55; }
@keyframes shimmer { 50% { transform: scaleX(.55); opacity: .7; } }
.boat { fill: var(--boat); stroke: var(--boat); stroke-width: 2; stroke-linejoin: round; }
.drift { transform: translate(230px, -24px); animation: drift 46s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(40px, -24px); } }
.bob { transform-box: fill-box; transform-origin: 50% 80%; animation: bob 4.2s ease-in-out infinite; }
@keyframes bob { 25% { transform: translateY(2px) rotate(1.6deg); } 75% { transform: translateY(-2px) rotate(-1.4deg); } }
.readout { transition: transform 2s var(--ease); }
.readout text, .marks text { paint-order: stroke; stroke: var(--art-halo); stroke-width: 5px; stroke-linejoin: round; font-family: var(--font); }
.ro-num { font-size: 50px; font-weight: 700; fill: var(--art-ink); letter-spacing: -.01em; }
.ro-cap { font-size: 16px; fill: var(--art-ink); opacity: .85; }
.marks .mk { transition: transform 2s var(--ease); }
.marks text { font-size: 15px; font-weight: 600; }
.marks .mk-warn text { fill: var(--warn); } .marks .mk-crit text { fill: var(--crit); } .marks .mk-maxd text, .marks .mk-bank text { fill: var(--art-ink); opacity: .85; }
.marks line.mk { stroke-width: 2.5; } line.mk-warn { stroke: var(--warn); } line.mk-crit { stroke: var(--crit); } line.mk-maxd, line.mk-bank { stroke: var(--art-ink); opacity: .6; }
.rain { opacity: 0; transition: opacity 1.4s var(--ease); } .rain.on { opacity: .55; } .rain.heavy { opacity: .85; }
.rain .drop { stroke: var(--crest); stroke-width: 1.3; stroke-linecap: round; animation: fall 0.9s linear infinite; }
@keyframes fall { from { transform: translate(0, -120px); } to { transform: translate(-70px, 900px); } }
.art.paused * { animation-play-state: paused !important; }

/* ---------- intro (html.intro ใส่ใน <head> เฉพาะเมื่อไม่ได้ตั้งลดการเคลื่อนไหว, water.js ถอดออกหลัง 6 วิ) ----------
   ฉากค่อย ๆ ซูมออก ดวงจันทร์/อาทิตย์ลอยขึ้น ตึกโผล่จากหลังเขื่อนไล่จากวัดออกไป วัดยกขึ้นพร้อมแสงทอง ไฟเสา/หน้าต่างทยอยติด
   ส่วนน้ำ (.art.surge) เริ่มเมื่อข้อมูลมาถึง: น้ำพุ่งจากท้องคลองเด้งเลยระดับจริง ละอองกระเซ็น ขีดไม้วัดสว่างตามน้ำ เส้นเกณฑ์ลากตาม ป้ายเลื่อนเข้า */
.spray circle { fill: #eaf7ff; opacity: 0; } .spray .ripple { fill: none; stroke: #eaf7ff; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.intro .art { animation: fadeIn 1s ease-out both; }
.intro .art-wrap { transform-origin: 58% 72%; animation: dolly 4s cubic-bezier(.16, 1, .3, 1) both; }
.intro .orb, .intro .orb-glow { animation: orbRise 2.4s cubic-bezier(.16, 1, .3, 1) .1s both; }
.intro .stars { animation: fadeIn 1.8s .4s both; }
.intro .bld { animation: bldUp 1.15s cubic-bezier(.2, .95, .25, 1.06) both; animation-delay: var(--rd, 0s); }
.intro .far .fw, .intro .mid .win.lit { animation: winOn .35s steps(1, end) both; animation-delay: var(--wd, 1.5s); }
.intro #temple, .intro .flag { animation: templeUp 1.4s cubic-bezier(.2, .95, .25, 1.04) .75s both; }
.intro .temple-glow { transform-box: fill-box; transform-origin: center; animation: glowBloom 2.2s cubic-bezier(.16, 1, .3, 1) 1.3s both; }
.intro .glint { animation-delay: 1.9s; }
.intro .trees { animation: treesUp 1.1s cubic-bezier(.2, .95, .25, 1.05) .6s both; }
.intro .lamps { animation: lampOn 1.2s 1.5s both; }
.intro .hero-copy > * { animation: copyIn 1.1s var(--ease-out) both; }
.intro .hero-copy > :nth-child(1) { animation-delay: .2s; } .intro .hero-copy > :nth-child(2) { animation-delay: .34s; } .intro .hero-copy > :nth-child(3) { animation-delay: .52s; }
.intro .hero-copy > :nth-child(4) { animation-delay: .64s; } .intro .hero-copy > :nth-child(n+5) { animation-delay: .76s; }
.art.snap .marks .mk, .art.snap .ln, .art.snap .stain { transition: none !important; }
.art.surge .water, .art.surge .readout { transition: none; }
.art.surge .readout text { animation: fadeIn .7s .3s both; }
.art.surge .spray circle { animation: spray 1.35s cubic-bezier(.15, .7, .4, 1) both; animation-delay: calc(1.05s + var(--sd, 0s)); }
.art.surge .crest { animation: crestFlash 1.6s .95s both; }
.art.surge .spray .ripple { animation: ripple 1.6s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(1.2s + var(--sd, 0s)); }
.art.surge .g-tick { animation: tickOn .55s ease-out both; animation-delay: var(--td, 0s); }
.art.surge .ln-draw { transform-box: fill-box; transform-origin: 0 50%; animation: lineDraw 1.1s cubic-bezier(.65, 0, .35, 1) 1.45s both; }
.art.surge .ln-draw + .ln-draw { animation-delay: 1.62s; }
.art.surge .mk-in { animation: markIn .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(1.7s + var(--i, 0) * .12s); }
.art.surge .stain { animation: fadeIn 1s 2.3s both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes dolly { from { transform: scale(1.13); } }
@keyframes orbRise { from { transform: translateY(110px); opacity: 0; } }
@keyframes bldUp { from { transform: translateY(var(--bh, 200px)); } }
@keyframes winOn { from { opacity: 0; } }
@keyframes templeUp { from { transform: translateY(90px); } }
@keyframes glowBloom { from { transform: scale(.4); opacity: 0; } }
@keyframes treesUp { from { transform: translateY(70px); } }
@keyframes lampOn { 0% { opacity: 0; } 16% { opacity: 1; } 24% { opacity: .1; } 38% { opacity: 1; } 46% { opacity: .35; } 60%, 100% { opacity: 1; } }
@keyframes copyIn { from { opacity: 0; transform: translateY(28px); filter: blur(8px); } }
@keyframes spray { 0% { opacity: 0; transform: translate(0, 0); } 10% { opacity: .95; } 48% { transform: translate(calc(var(--dx) * .6), var(--dy)); } 100% { opacity: 0; transform: translate(var(--dx), 26px); } }
@keyframes crestFlash { 0% { stroke-width: 1.6; } 30% { stroke-width: 5; stroke: #fff; } 100% { stroke-width: 1.6; } }
@keyframes tickOn { 0% { opacity: .12; } 40% { opacity: 1; fill: #fff; } 100% { opacity: 1; } }
@keyframes lineDraw { from { transform: scaleX(0); } }
@keyframes ripple { 0% { opacity: .9; transform: scale(.2); } 100% { opacity: 0; transform: scale(3.4); } }
@keyframes markIn { from { opacity: 0; transform: translateX(46px); } }

/* ---------- sections ---------- */
.sec { max-width: 1240px; margin: 0 auto; padding: 88px 32px 96px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 28px; }
.sec-head h2 { font-size: clamp(1.75rem, 3.3vw, 2.6rem); line-height: 1.4; letter-spacing: -.01em; }
.sec-head h2 small { display: block; margin-top: 6px; font-size: 1rem; font-weight: 400; letter-spacing: 0; color: var(--muted); max-width: 60ch; }
.seg-row { display: flex; align-items: center; gap: 12px; }
.seg-lbl { color: var(--muted); font-size: .95rem; }
.seg { position: relative; isolation: isolate; display: inline-flex; padding: 4px; border-radius: 999px; background: var(--shell); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .ind { position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--w, 0); transform: translateX(var(--x, 0)); z-index: -1; border-radius: 999px;
    background: var(--core); box-shadow: 0 0 0 1px var(--line), var(--inset), 0 4px 12px -6px var(--shadow-c); transition: transform .55s var(--ease), width .55s var(--ease); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 7px 15px; min-height: 38px; border-radius: 999px; font-size: .95rem; white-space: nowrap; cursor: pointer; transition: color .35s var(--ease); }
.seg button:hover, .seg button.on { color: var(--strong); }
.note { margin: -8px 0 20px; padding: 11px 16px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); font-size: .98rem; max-width: 75ch; }
.err { max-width: 1176px; margin: 24px auto 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: 18px; color: var(--text);
    background: color-mix(in srgb, var(--crit) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--crit) 35%, transparent); }
.err i { color: var(--crit); font-size: 1.2rem; }
.err button { margin-left: auto; border: 0; border-radius: 999px; padding: 7px 16px; background: var(--crit); color: #fff; cursor: pointer; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--muted); padding: 20px; }
.empty i { font-size: 2rem; color: var(--accent); opacity: .7; }
.empty p { max-width: 36ch; }

/* ---------- double-bezel surfaces ---------- */
.shell { display: block; width: 100%; padding: 6px; border-radius: var(--r-shell); background: var(--shell); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit; text-align: left; }
.core { display: block; position: relative; overflow: hidden; height: 100%; padding: 24px; border-radius: var(--r-core); background: var(--core); box-shadow: var(--inset); }
button.shell { cursor: pointer; transition: transform .6s var(--ease), box-shadow .6s var(--ease), border-color .4s var(--ease); }
button.shell:hover { transform: translateY(-3px); }
button.shell:active { transform: translateY(0) scale(.985); }
button.shell.on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.spot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0; transition: opacity .4s var(--ease);
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 80%, transparent), transparent 65%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.spot:hover::after { opacity: 1; }
.shell { position: relative; }

/* ---------- bento ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: minmax(158px, auto); gap: 14px; }
.b-flow { grid-column: 1 / 8; grid-row: 1 / 3; } .b-crit { grid-column: 8 / 13; grid-row: 1; } .b-warn { grid-column: 8 / 13; grid-row: 2; }
.b-off { grid-column: 1 / 6; grid-row: 3; } .b-daily { grid-column: 6 / 13; grid-row: 3; }
.k { display: block; color: var(--muted); font-size: .98rem; position: relative; }
.k span { color: var(--faint); }
.n { display: block; font-size: clamp(2.8rem, 4.6vw, 3.8rem); line-height: 1.05; font-weight: 700; color: var(--strong); margin-top: 8px; position: relative; letter-spacing: -.02em; }
.u { display: block; color: var(--muted); font-size: .92rem; position: relative; }
.cell .core { display: flex; flex-direction: column; justify-content: flex-end; min-height: 158px; }
.cell-ico { position: absolute; top: 22px; right: 22px; font-size: 1.6rem; color: var(--muted); }
.tone-crit { background: radial-gradient(120% 110% at 100% 0%, color-mix(in srgb, var(--crit) 17%, transparent), transparent 62%), var(--core); }
.tone-warn { background: radial-gradient(120% 110% at 100% 0%, color-mix(in srgb, var(--warn) 16%, transparent), transparent 62%), var(--core); }
.tone-warn .cell-ico { color: var(--warn); }
.sonar { position: absolute; right: -24px; top: -24px; width: 190px; height: 190px; overflow: visible; }
.sonar circle { fill: none; stroke: var(--crit); stroke-width: 1.4; opacity: 0; transform-box: fill-box; transform-origin: center; }
.sonar .core-dot { fill: var(--crit); stroke: none; opacity: .9; }
.b-crit.alive .sonar circle:not(.core-dot) { animation: sonar 3.6s var(--ease-out) infinite; }
.b-crit.alive .sonar circle:nth-child(2) { animation-delay: 1.2s; } .b-crit.alive .sonar circle:nth-child(3) { animation-delay: 2.4s; }
@keyframes sonar { from { transform: scale(.3); opacity: .8; } to { transform: scale(2.6); opacity: 0; } }
.b-flow .core { display: flex; flex-direction: column; padding: 28px; min-height: 330px; }
.flow-art { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--flow-c, var(--accent)); opacity: .2; pointer-events: none; }
.flow-art path { fill: none; stroke: currentColor; stroke-width: 2; }
.fl { animation: waveX var(--flow-dur, 22s) linear infinite; }
.flow-nums { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: auto; padding-top: 26px; }
.fn { border: 0; background: transparent; padding: 10px 12px 8px; margin: -10px -12px -8px; border-radius: 16px; text-align: left; cursor: pointer; transition: background-color .35s var(--ease), transform .5s var(--ease); }
.fn:hover { background: var(--shell); } .fn:active { transform: scale(.97); }
.fn.on { background: var(--accent-soft); }
.fn b { display: block; font-size: clamp(2.5rem, 5vw, 4.4rem); line-height: 1.05; font-weight: 700; letter-spacing: -.02em; }
.fn span { display: block; color: var(--muted); }
.fn.rise b { color: var(--rise); } .fn.fall b { color: var(--fall); } .fn.flat b { color: var(--strong); }
.split-bar { position: relative; display: flex; gap: 4px; height: 10px; margin-top: 22px; }
.split-bar i { flex: var(--g, 1) 1 0; min-width: 4px; border-radius: 6px; transition: flex-grow 1.2s var(--ease); }
.r-up { background: var(--rise); } .r-down { background: var(--fall); } .r-flat { background: var(--flat); opacity: .45; }
.flow-avg { position: relative; margin-top: 14px; color: var(--muted); font-size: .98rem; }
.flow-avg b { color: var(--strong); font-weight: 600; }
.daily { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.daily b { display: block; font-size: 2.4rem; line-height: 1.1; font-weight: 700; }
.daily span { color: var(--muted); font-size: .92rem; }
.b-daily .core { display: flex; flex-direction: column; justify-content: flex-end; }

/* ---------- map ---------- */
.map-full { position: relative; isolation: isolate; height: 100dvh; min-height: 560px; overflow: hidden; background: var(--bg-2); scroll-snap-align: start; scroll-margin-top: 0; }
.map-full:fullscreen { height: 100vh; min-height: 0; }
#leafmap { position: absolute; inset: 0; background: var(--bg-2); font-family: var(--font); }
#leafmap .leaflet-bottom { bottom: 96px; }
.mf-panel { position: absolute; z-index: 1100; padding: 14px 16px; border-radius: 22px; background: var(--glass); border: 1px solid var(--glass-line);
    box-shadow: var(--inset), 0 18px 40px -20px var(--shadow-c); -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); }
.mf-top { position: absolute; z-index: 1100; top: 84px; left: 24px; right: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }
.mf-top > * { pointer-events: auto; }
.mf-title { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; padding: 12px 12px 12px 20px; }
.mf-title h2 { font-size: 1.35rem; line-height: 1.2; }
.mf-title h2 small { display: block; font-size: .88rem; font-weight: 400; color: var(--muted); }
.mf-actions { display: flex; gap: 8px; }
.mf-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--glass-line); background: var(--glass); color: var(--strong); cursor: pointer;
    box-shadow: var(--inset), 0 12px 28px -16px var(--shadow-c); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transition: transform .4s var(--ease), background-color .3s var(--ease); }
.mf-btn:active { transform: scale(.96); }
.mf-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
#fsBtn { width: 46px; padding: 0; justify-content: center; }
.map-full .movers { top: 152px; right: 24px; width: 330px; max-height: calc(100% - 152px - 200px); overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; transform-origin: top right;
    transition: opacity .35s var(--ease), transform .45s var(--ease), visibility 0s linear 0s; }
.map-full .movers.closed { opacity: 0; transform: translateY(-8px) scale(.97); visibility: hidden; transition: opacity .3s var(--ease), transform .4s var(--ease), visibility 0s linear .4s; }
.mf-legends { left: 24px; bottom: 104px; max-width: min(640px, calc(100% - 48px)); display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.mf-legends .legend { margin: 0; }
.mf-leg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* คำอธิบายบนแผนที่ย่อเป็นค่าเริ่มต้นทุกขนาดจอ (ผู้ใช้แจ้ง 2026-09-30 ว่ากินพื้นที่): เห็นแถวสีจุดวัด + ปุ่มชั้นข้อมูล แถวอื่นของทุกโมดูลซ่อนจนกดเปิด */
.mf-legends:not(.open) > .legend { display: none !important; }
.mf-legends.open { max-height: min(56vh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.mf-more { display: inline-flex; flex: none; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--core); color: var(--strong); border-radius: 999px; padding: 5px 12px; font-size: .86rem; cursor: pointer; }
.mf-more[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
#leafmap .leaflet-tile-pane { filter: saturate(.55) contrast(.96) brightness(1.02); }
@media (prefers-color-scheme: dark) { #leafmap .leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(.78) contrast(.92) saturate(.5); } }
#leafmap .leaflet-control-attribution { background: var(--glass); color: var(--muted); font-size: .72rem; border-top-left-radius: 10px; }
#leafmap .leaflet-control-attribution a { color: var(--accent); }
#leafmap .leaflet-bar { border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
#leafmap .leaflet-bar a { background: var(--glass); color: var(--strong); border-color: var(--line); width: 36px; height: 36px; line-height: 36px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#leafmap .leaflet-tooltip { background: var(--core); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px; font-size: .9rem; line-height: 1.4; box-shadow: var(--shadow); }
#leafmap .leaflet-tooltip b { display: block; color: var(--strong); } #leafmap .leaflet-tooltip::before { display: none; }
.rd-dot { transition: fill .6s var(--ease), fill-opacity .4s var(--ease); cursor: pointer; }
.rd-ping { transform-box: fill-box; transform-origin: center; animation: ping 2.6s var(--ease-out) infinite; pointer-events: none; }
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(4.2); opacity: 0; } }
.map-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1100; display: none; align-items: center; gap: 8px; border: 1px solid var(--glass-line); border-radius: 999px;
    padding: 8px 16px; background: var(--glass); color: var(--strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; transition: opacity .4s var(--ease); }
.map-hint.show { display: inline-flex; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 4px 0; font-size: .92rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }
.movers h3 { font-size: 1rem; font-weight: 600; margin: 2px 0 6px; display: flex; align-items: center; gap: 8px; }
.movers h3:not(:first-child) { margin-top: 18px; }
.mv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 12px; margin: 0 -12px; border-radius: 14px; cursor: pointer; transition: background-color .35s var(--ease); }
.mv:hover, .mv:focus-visible { background: var(--shell); }
.mv .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--strong); }
.mv .v { font-weight: 600; }
.mv .bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; transform-origin: left center; transform: scaleX(0); transition: transform 1.2s var(--ease); }
.mv.up .v { color: var(--rise); } .mv.up .bar { background: var(--rise); } .mv.down .v { color: var(--fall); } .mv.down .bar { background: var(--fall); }
.mv-empty { color: var(--muted); padding: 8px 0; }

/* ---------- trend chart ---------- */
.chart-core { padding: 20px 18px 14px; }
.chart-box { position: relative; height: 340px; }
.chart-box.sm { height: 280px; }

/* ---------- tide band ---------- */
.tide { overflow: hidden; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 22%, var(--bg-2) 78%, var(--bg) 100%); }
.tide-plot { position: relative; height: 250px; margin-top: 8px; }
.tide-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tide-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: var(--len, 0); stroke-dashoffset: var(--len, 0); transition: stroke-dashoffset 2.2s var(--ease); }
.tide-plot.in .tide-line { stroke-dashoffset: 0; }
.tm { position: absolute; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.tm i { display: block; width: 11px; height: 11px; margin: 0 auto; border-radius: 50%; background: var(--core); border: 2px solid var(--accent); }
.tm span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .9rem; color: var(--muted); }
.tm b { color: var(--strong); font-weight: 600; font-size: 1.05rem; }
.tm.hi span { bottom: 18px; } .tm.lo span { top: 18px; }
.tm.edge-l span { left: -6px; transform: none; } .tm.edge-r span { left: auto; right: -6px; transform: none; }
.tide-now.flip span { left: auto; right: 10px; }
.tide-now { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed color-mix(in srgb, var(--accent) 60%, transparent); pointer-events: none; }
.tide-now i { position: absolute; left: -8px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); transform: translateY(-50%); }
.tide-now span { position: absolute; top: -6px; left: 10px; white-space: nowrap; font-size: .88rem; color: var(--accent); font-weight: 600; }
.tide-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: .85rem; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- station list ---------- */
.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; margin-bottom: 18px; }
.search { display: flex; flex-direction: column; gap: 6px; flex: 1 1 260px; max-width: 360px; margin: 0; }
.search > span, .sort-m > span { font-size: .88rem; color: var(--muted); }
.search-box { position: relative; display: block; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input, .sort-m select { width: 100%; min-height: 46px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--core); color: var(--strong); font: inherit; padding: 8px 16px 8px 42px; box-shadow: var(--inset); transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.search input::placeholder { color: var(--faint); }
.search input:focus, .sort-m select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line-2); background: transparent; color: var(--text); border-radius: 999px; padding: 7px 15px; min-height: 40px; cursor: pointer; white-space: nowrap; transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .4s var(--ease); }
.chips button:hover { border-color: var(--accent); } .chips button:active { transform: scale(.97); }
.chips button.on { background: var(--strong); border-color: var(--strong); color: var(--bg); }
.sort-m { display: none; flex-direction: column; gap: 6px; margin: 0; }
.sort-m select { padding-left: 16px; }
.count { margin-left: auto; color: var(--muted); font-size: .92rem; padding-bottom: 10px; }
.st-table { border-radius: var(--r-shell); background: var(--shell); border: 1px solid var(--line); padding: 6px; box-shadow: var(--shadow); }
.st-head, .st { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.1fr) 90px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; }
.st-head { padding: 12px 20px 10px; }
.st-head button, .st-head span { border: 0; background: none; padding: 0; color: var(--muted); font-size: .88rem; text-align: left; cursor: pointer; white-space: nowrap; }
.st-head span { cursor: default; }
.st-head .num { text-align: right; }
.st-head button.sorted { color: var(--strong); } .st-head button.sorted::after { content: " \2193"; } .st-head button.sorted.asc::after { content: " \2191"; }
.st-list { list-style: none; margin: 0; padding: 0; background: var(--core); border-radius: var(--r-core); box-shadow: var(--inset); overflow: hidden; }
.st { padding: 14px 20px; cursor: pointer; border-top: 1px solid var(--line); transition: background-color .3s var(--ease); }
.st:first-child { border-top: 0; }
.st:hover, .st:focus-visible { background: var(--accent-soft); outline: none; }
.st.is-off { opacity: .55; }
.js .st.enter { animation: rowIn .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }
.st small { display: block; color: var(--muted); font-size: .84rem; line-height: 1.35; }
.st-lvl, .st-d, .st-max, .st-time { text-align: right; }
.st-lvl b { font-size: 1.2rem; color: var(--strong); font-weight: 600; }
.st-d { font-weight: 600; white-space: nowrap; } .st-d.up { color: var(--rise); } .st-d.down { color: var(--fall); } .st-d.flat, .st-d.none { color: var(--flat); }
.st-max, .st-time { color: var(--text); }
.chip { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 6px; font-size: .78rem; font-weight: 600; vertical-align: 2px; }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.crit { background: color-mix(in srgb, var(--crit) 18%, transparent); color: var(--crit); }
.chip.off, .chip.unk { background: var(--shell); color: var(--muted); }
.spark { display: block; width: 88px; height: 26px; overflow: visible; }
.spark path { fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sk-row { height: 66px; cursor: default; background: linear-gradient(90deg, transparent 0%, var(--line) 50%, transparent 100%); background-size: 220% 100%; animation: sk 1.5s var(--ease) infinite; }
.st-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
/* ปุ่มหลักของแถว/รายการ (คีย์บอร์ด + screen reader): หน้าตาเหมือนข้อความเดิม focus แสดงทั้งแถว */
.st-open, .mv button.nm { border: 0; background: none; padding: 0; font: inherit; color: var(--strong); text-align: left; cursor: pointer; max-width: 100%; }
.st-open { font-weight: 600; } .st-open:focus-visible, .mv button.nm:focus-visible { outline: none; }
.st:focus-within, .mv:focus-within { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
/* ตารางค่าของกราฟ */
.chart-table { margin-top: 10px; font-size: .88rem; color: var(--text); }
.chart-table summary { cursor: pointer; color: var(--muted); width: max-content; }
.chart-table .ct-wrap { max-height: 260px; overflow: auto; margin-top: 8px; }
.chart-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table caption { caption-side: top; text-align: left; color: var(--muted); padding-bottom: 4px; }
.chart-table th, .chart-table td { padding: 4px 8px; border-top: 1px solid var(--line); text-align: right; font-weight: 400; }
.chart-table th[scope="row"], .chart-table thead th:first-child { text-align: left; }
.st-empty button { margin-top: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--strong); border-radius: 999px; padding: 8px 18px; cursor: pointer; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 40px 32px 30px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 40px; align-items: start; color: var(--muted); font-size: .95rem; }
.foot-in p { max-width: 72ch; }
.foot-thanks { grid-column: 2; margin: 4px 0 0 !important; padding: 16px 20px; border-radius: 18px; background: var(--shell); border: 1px solid var(--line); color: var(--text); line-height: 1.7; }
.foot-thanks b { display: block; color: var(--strong); font-weight: 600; margin-bottom: 4px; }
.foot-thanks b i { color: var(--accent); margin-right: 4px; }
.foot-thanks span { display: block; margin-top: 8px; color: var(--muted); font-style: italic; }
.foot-links { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot-links a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); padding: 2px 0; }
.foot-links a:hover, .foot-links a:focus-visible { color: var(--accent); border-color: var(--accent); }
/* ที่ตั้งระบบ (เจ้าของสั่ง 2026-10-01): โลโก้ NT สีจริงตอนกลางวัน กลางคืนตัวอักษรขาว ขีดเหลืองคงเดิม (nt-datacenter-dark.webp ผ่าน <picture>); จอกว้างโลโก้อยู่คอลัมน์เดียวกับโลโก้ POPNIX ข้อความตรงคอลัมน์ขวา (subgrid) */
.foot-host { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-columns: subgrid; align-items: center; margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.foot-host img { display: block; width: auto; height: 46px; }
.foot-host p { color: var(--text); line-height: 1.5; text-wrap: balance; }
.foot-host .nw { white-space: nowrap; }   /* ไทยไม่มีช่องว่าง: กันตัดกลางคำประสม (ระดับ|ชาติ ศูนย์|ข้อมูล ดำเนิน|งาน ต่อ|เนื่อง) ตรวจทุกความกว้าง 240-720px */

/* ---------- time-machine dock ---------- */
.dock { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--z-dock); width: min(820px, calc(100% - 24px)); }
.dock-bar { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 7px; border-radius: 999px;
    background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--inset), 0 20px 44px -18px var(--shadow-c);
    -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%); transition: border-color .5s var(--ease); }
html.is-past .dock-bar { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.dock-more, .dock-play { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; font-size: 1.05rem; transition: transform .5s var(--ease), background-color .35s var(--ease); }
.dock-more { background: var(--shell); color: var(--strong); }
.dock-more[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.dock-play { background: var(--accent); color: var(--accent-ink); }
.dock-play.playing { background: var(--rise); color: #fff; }
.dock-more:active, .dock-play:active { transform: scale(.94); }
.dock-time { min-width: 0; line-height: 1.2; }
.dock-time small { display: block; font-size: .76rem; color: var(--muted); }
.dock-time b { display: block; color: var(--strong); font-weight: 600; white-space: nowrap; }
html.is-past .dock-time b { color: var(--accent); }
.dock-now { border: 1px solid var(--line-2); background: var(--core); color: var(--strong); border-radius: 999px; padding: 9px 16px; cursor: pointer; white-space: nowrap; transition: border-color .3s var(--ease); }
.dock-now:hover { border-color: var(--accent); }
#slider { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer; --p: 100%; }
#slider::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line-2) var(--p)); }
#slider::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
#slider::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--core); border: 2px solid var(--accent); box-shadow: 0 0 0 5px var(--accent-soft), 0 4px 12px var(--shadow-c); transition: transform .3s var(--ease); }
#slider:active::-webkit-slider-thumb { transform: scale(1.18); }
#slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--core); border: 2px solid var(--accent); }
.dock-pop { position: absolute; left: 0; bottom: calc(100% + 10px); width: min(380px, 100%); padding: 18px; border-radius: 24px; background: var(--glass); border: 1px solid var(--glass-line);
    box-shadow: var(--inset), 0 20px 44px -18px var(--shadow-c); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
    transform-origin: 24px 100%; animation: popIn .5s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.dp-title { font-weight: 600; color: var(--strong); margin-bottom: 10px !important; }
.dp-jumps { display: flex; gap: 6px; flex-wrap: wrap; }
.dp-jumps button { border: 1px solid var(--line-2); background: var(--core); color: var(--strong); border-radius: 999px; padding: 7px 14px; cursor: pointer; transition: border-color .3s var(--ease), transform .4s var(--ease); }
.dp-jumps button:hover { border-color: var(--accent); } .dp-jumps button:active { transform: scale(.97); }
.dp-pick { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.dp-pick span { font-size: .88rem; color: var(--muted); }
.dp-pick input { min-height: 44px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--core); color: var(--strong); padding: 6px 12px; font: inherit; }
.dp-hint { margin-top: 12px !important; font-size: .86rem; color: var(--muted); }

/* ---------- station sheet (modal) ---------- */
.sheet .modal-content { background: var(--core); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-shell); box-shadow: 0 30px 80px -30px var(--shadow-c); padding: 22px 24px 24px; }
.sheet .modal-dialog { max-width: 820px; }
.modal-backdrop.show { opacity: .5; }
.grab { display: none; width: 44px; height: 5px; border-radius: 5px; background: var(--line-2); margin: -8px auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sheet-head h3 { font-size: 1.55rem; line-height: 1.2; }
.sheet-head p { color: var(--muted); margin-top: 4px; }
.x { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--shell); color: var(--strong); cursor: pointer; font-size: 1.1rem; transition: transform .4s var(--ease); }
.x:active { transform: scale(.94); }
.sheet-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.sheet-stats div { padding: 12px 14px; border-radius: 16px; background: var(--shell); }
.sheet-stats small { display: block; color: var(--muted); font-size: .84rem; }
.sheet-stats b { font-size: 1.35rem; color: var(--strong); font-weight: 600; }
.sheet-stats .up b { color: var(--rise); } .sheet-stats .down b { color: var(--fall); }
.sheet-stats .lv-crit b { color: var(--crit); } .sheet-stats .lv-warn b { color: var(--warn); }
.sheet-note { margin: -8px 0 18px !important; color: var(--text); line-height: 1.6; }
.sheet-note .chip { margin: 0 6px 0 0; vertical-align: 1px; }
.sheet-note small { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.sheet-ctl { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 8px 4px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- ใกล้คุณ (GPS) ---------- */
.near-pill { --c: var(--accent); display: flex; width: fit-content; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 14px 6px 12px; font-size: .95rem; border-radius: 999px; color: var(--strong) !important; text-decoration: none; max-width: 100%;
    background: var(--glass); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--glass-line)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: transform .5s var(--ease); }
.near-pill > i:first-child { color: var(--c); } .near-pill > i:last-child { color: var(--muted); font-size: .85em; transition: transform .5s var(--ease); }
.near-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.near-pill:hover > i:last-child { transform: translate(2px, 2px); } .near-pill:active { transform: scale(.98); }
.near-pill[hidden] { display: none; }
.near-pill.lv-crit, .nr.lv-crit { --c: var(--crit); } .near-pill.lv-warn, .nr.lv-warn { --c: var(--warn); } .near-pill.lv-ok, .nr.lv-ok { --c: var(--ok); } .near-pill.lv-off, .nr.lv-off { --c: var(--off); } .near-pill.lv-unk, .nr.lv-unk { --c: var(--off); }
.nr.rd.lv-flood { --c: var(--crit); } .nr.rd.lv-slight { --c: var(--warn); } .nr.rd.lv-dry { --c: var(--ok); }
.near:not([data-state="on"]) { padding-top: 56px; padding-bottom: 16px; }
.near:not([data-state="on"]) .sec-head { margin-bottom: 18px; }
.near-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.near-acts[hidden] { display: none; }
.near-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--core); color: var(--strong);
    font-size: .95rem; cursor: pointer; transition: border-color .35s var(--ease), transform .4s var(--ease); }
.near-btn i { color: var(--accent); } .near-btn:hover { border-color: var(--accent); } .near-btn:active { transform: scale(.97); }
.near-btn.busy i { animation: nearBusy .9s var(--ease) infinite alternate; }
@keyframes nearBusy { to { opacity: .25; } }
.near-ask .core { display: flex; align-items: center; gap: 18px 22px; flex-wrap: wrap; padding: 18px 22px; }
.near-ask p { flex: 1 1 300px; margin: 0; color: var(--text); max-width: 64ch; line-height: 1.55; }
.near-ping { width: 58px; height: 58px; flex: none; overflow: visible; }
.near-ping circle { fill: none; stroke: var(--accent); stroke-width: 1.8; opacity: 0; transform-box: fill-box; transform-origin: center; }
.near-ping .c { fill: var(--accent); stroke: none; opacity: 1; }
.near[data-state="asking"] .near-ping circle:not(.c) { animation: sonar 2.4s var(--ease-out) infinite; }
.near[data-state="asking"] .near-ping circle:nth-child(2) { animation-delay: 1.2s; }
.near:not([data-state="asking"]) .near-ping circle:first-child { opacity: .45; transform: scale(1.7); }
.near-go[disabled] { opacity: .45; cursor: default; }
.near-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px 28px; align-items: start; }
.near-grid[hidden] { display: none; }
.near-radar { position: sticky; top: 96px; }
.near-radar .core { padding: 22px 24px 18px; }
.near-say { margin: 6px 0 0; font-size: clamp(1.35rem, 2.2vw, 1.75rem); line-height: 1.3; color: var(--strong); font-weight: 600; text-wrap: balance; }
.near-say b { margin-left: .3em; } .near-say b.rise { color: var(--rise); } .near-say b.fall { color: var(--fall); } .near-say b.flat { color: var(--accent); }
.near-say small { display: block; margin-top: 6px; font-size: .95rem; font-weight: 400; color: var(--muted); } .near-say small span { white-space: nowrap; }
.radar { display: block; width: 100%; max-width: 360px; margin: 14px auto 4px; overflow: visible; font-family: var(--font); }
.rd-grid circle { fill: none; stroke: var(--line-2); stroke-width: 1; } .rd-grid circle:first-of-type { fill: var(--shell); }
.rd-grid line { stroke: var(--line-2); stroke-dasharray: 2 5; }
.rd-lbl { font-size: 10px; fill: var(--faint); } .rd-n { font-size: 11px; fill: var(--muted); }
.rd-sweep { transform-origin: 160px 160px; animation: sweep 8s linear infinite; pointer-events: none; }
.rd-sweep path { fill: var(--accent); opacity: .09; } .rd-sweep line { stroke: var(--accent); stroke-width: 1.4; opacity: .5; }
@keyframes sweep { to { transform: rotate(360deg); } }
.rp { cursor: pointer; outline: none; } .rp circle { fill: var(--c); stroke: var(--core); stroke-width: 1.6; transition: transform .3s var(--ease); transform-box: fill-box; transform-origin: center; }
.rp.lv-ok { --c: var(--ok); } .rp.lv-warn { --c: var(--warn); } .rp.lv-crit { --c: var(--crit); } .rp.lv-off { --c: var(--off); } .rp.lv-unk { --c: var(--off); }
.rp:hover circle, .rp:focus-visible circle { transform: scale(1.3); } .rp:focus-visible circle { stroke: var(--strong); }
.rp .rp-ping { fill: none; stroke: var(--c); stroke-width: 1.4; animation: ping 2.6s var(--ease-out) infinite; }
.rp text { font-size: 8.5px; font-weight: 700; fill: #fff; pointer-events: none; }
.rq { stroke: var(--core); stroke-width: 1.2; cursor: pointer; }
.rq.rd-flood { fill: var(--crit); } .rq.rd-slight { fill: var(--warn); } .rq.rd-dry { fill: var(--ok); opacity: .7; } .rq.rd-off { fill: var(--off); opacity: .6; }
.rd-me { fill: var(--accent); stroke: var(--core); stroke-width: 3; }
.rd-me-ping { fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 2.4s var(--ease-out) infinite; }
.near-lists h3 { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; font-size: 1.05rem; font-weight: 600; color: var(--strong); }
.near-lists h3 i { color: var(--accent); } .near-lists h3:not(:first-child) { margin-top: 26px; }
.near-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nr { width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 18px; border: 1px solid var(--line);
    background: var(--core); color: inherit; text-align: left; cursor: pointer; box-shadow: var(--inset); transition: transform .5s var(--ease), border-color .35s var(--ease); }
.nr:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); transform: translateY(-2px); } .nr:active { transform: scale(.99); }
.nr-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; font-weight: 700; color: #fff; background: var(--c); }
.nr-n.sq { width: 20px; height: 20px; margin: 0 4px; border-radius: 6px; }
.nr-body { min-width: 0; }
.nr-body b, .nr-body small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nr-body b { color: var(--strong); font-weight: 600; } .nr-body small { color: var(--muted); font-size: .86rem; }
.nr-val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; }
.nr-val b { font-size: 1.15rem; color: var(--strong); font-weight: 600; font-variant-numeric: tabular-nums; } .nr-val b small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.nr-meta { display: inline-flex; align-items: center; gap: 8px; } .nr-val .chip { margin: 0; }
.nr-tr { font-size: .8rem; font-variant-numeric: tabular-nums; } .nr-tr.up { color: var(--rise); } .nr-tr.down { color: var(--fall); } .nr-tr.flat { color: var(--flat); }
.nr-empty { padding: 14px 16px; border-radius: 18px; background: var(--shell); color: var(--muted); font-size: .95rem; }
.chip.rd-flood { background: color-mix(in srgb, var(--crit) 18%, transparent); color: var(--crit); } .chip.rd-slight { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.rd-dry { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); } .chip.rd-off { background: var(--shell); color: var(--muted); }
#leafmap .leaflet-interactive.me-dot { fill: var(--accent); stroke: var(--core); }
#leafmap .me-pulse { stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 2.4s var(--ease-out) infinite; pointer-events: none; }
#leafmap .me-ring { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 7; fill: var(--accent); fill-opacity: .05; }
#leafmap .leaflet-tooltip.me-tip { padding: 4px 11px; font-weight: 600; color: var(--accent); }
@media (max-width: 900px) {
    .near-grid { grid-template-columns: minmax(0, 1fr); } .near-radar { position: relative; top: auto; }
    .near-acts { width: 100%; } .near-btn { flex: 1 1 auto; }
}
@media (max-width: 640px) {
    .near-btn { padding: 0 12px; font-size: .9rem; }
    .near-radar .core { padding: 18px 16px 14px; }
    .nr { padding: 10px 12px 10px 10px; gap: 10px; }
    .near-ask .core { padding: 16px; gap: 14px; } .near:not([data-state="asking"]) .near-ping { display: none; }
}

/* ---------- ทุกจุดวัด: เรียงตามระยะ + แบ่งหน้า ---------- */
.dist-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text);
    cursor: pointer; white-space: nowrap; transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), transform .4s var(--ease); }
.dist-btn i { color: var(--accent); } .dist-btn:hover { border-color: var(--accent); } .dist-btn:active { transform: scale(.97); }
.dist-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--strong); }
.dist-btn[hidden] { display: none; }
@media (max-width: 640px) { .dist-btn { display: none; } }   /* มือถือใช้ตัวเลือก "ใกล้ฉันก่อน" ใน #sortSel แทน */
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pager[hidden] { display: none; }
.pager button { min-width: 42px; height: 42px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--core); color: var(--text); font: inherit; font-variant-numeric: tabular-nums;
    cursor: pointer; transition: border-color .3s var(--ease), background-color .3s var(--ease), transform .4s var(--ease); }
.pager button:hover:not([disabled]) { border-color: var(--accent); } .pager button:active:not([disabled]) { transform: scale(.95); }
.pager .pg-n.on { background: var(--strong); border-color: var(--strong); color: var(--bg); cursor: default; }
.pager button[disabled] { opacity: .35; cursor: default; }
.pager .pg-gap { color: var(--faint); padding: 0 2px; }
.mf-btn.busy i { animation: nearBusy .9s var(--ease) infinite alternate; }
.mf-actions .mf-btn { white-space: nowrap; }
@media (max-width: 1180px) { .mf-actions .mf-btn:not(#meBtn) { width: 46px; padding: 0; justify-content: center; } .mf-actions .mf-btn:not(#meBtn) span { display: none; } }
.mf-note { position: absolute; z-index: 1100; top: 150px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100vw - 24px)); margin: 0; padding: 10px 16px; border-radius: 16px;
    background: var(--glass); border: 1px solid var(--glass-line); color: var(--strong); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); text-align: center; font-size: .95rem; }
.mf-note[hidden] { display: none; }
@media (max-width: 900px) { .mf-note { top: auto; bottom: 216px; } }
/* มือถือ: ปุ่มแผนที่ 4 ปุ่มเรียงแนวตั้งชิดขวา (แนวนอนไม่พอกับหัวข้อบนจอ 360px) ปุ่มซูมเลื่อนลงไปต่อท้าย */
@media (max-width: 640px) {
    .mf-actions { flex-direction: column; gap: 6px; }
    .mf-actions .mf-btn, .mf-actions .mf-btn:not(#meBtn) { width: 42px; min-height: 42px; }
    .map-full #leafmap .leaflet-top { top: 276px; }
}

/* iOS Safari ซูมทั้งหน้าค้างไว้เมื่อแตะช่องพิมพ์/ตัวเลือกที่ตัวอักษรเล็กกว่า 16px (ช่องค้นหากล้อง/ถนน/จุดวัด 14px, เลือกเขต 15px) แล้วหน้าต่างกล้องที่เปิดต่อถูกตัดขอบทั้งสองข้าง
   (ผู้ใช้แจ้ง 2026-09-30) -> จอสัมผัสใช้อย่างน้อย 16px ห้ามแก้ด้วย maximum-scale เพราะ Android จะซูมด้วยนิ้วไม่ได้ */
@media (pointer: coarse) { .ww .search input, .ww .area-sel select, .ww .sh-url { font-size: 16px; } }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
    .nav-links a { padding: 7px 10px; }
    .st-head, .st { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) 80px minmax(0, 1fr) minmax(0, 1fr); }
    .st-head > :nth-child(6), .st-time { display: none; }
}
@media (max-width: 900px) {
    .nav { left: 12px; right: 12px; transform: none; width: auto; justify-content: space-between; }
    .nav-links { display: none; } .burger { display: block; }
    .hero { flex-direction: column; align-items: stretch; min-height: 100dvh; }
    .hero::before { display: none; }
    .hero-inner { order: 0; padding: 96px 20px 0; }
    .art-wrap { order: 1; position: relative; inset: auto; z-index: 0; flex: 1 1 auto; min-height: 300px; margin-top: -40px;
        -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26%); mask-image: linear-gradient(to bottom, transparent 0, #000 26%); }
    .art-wrap .art { position: absolute; inset: 0; }
    .ro-num { font-size: 64px; } .ro-cap { font-size: 21px; transform: translateY(-22px); } .marks text { font-size: 20px; }
    .sec { padding: 64px 20px 72px; }
    .bento { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; gap: 10px; }
    .b-flow { grid-column: 1 / -1; grid-row: auto; } .b-crit, .b-warn, .b-off, .b-daily { grid-column: auto; grid-row: auto; }
    .mf-top { top: 80px; left: 12px; right: 12px; }
    .mf-title { padding: 10px 10px 10px 14px; gap: 8px 12px; }
    .mf-title h2 { font-size: 1.1rem; }
    .map-full .movers { top: auto; bottom: 112px; left: 12px; right: 12px; width: auto; max-height: 46%; transform-origin: bottom center; }
    .map-full .movers.closed { transform: translateY(12px) scale(.98); }
    .mf-legends { left: 12px; right: 12px; bottom: 112px; max-width: none; padding: 10px 14px; }
    .map-full:has(.movers:not(.closed)) .mf-legends { visibility: hidden; }
    .mf-legends { font-size: .88rem; gap: 6px; }
    .map-full .leaflet-top { top: 146px; }
    .foot-in { grid-template-columns: 1fr; padding: 32px 20px 24px; }
    .foot-thanks, .foot-links { grid-column: 1; }
    .foot-host { display: flex; gap: 18px; }
    .foot-host picture { flex: none; }
    .foot-host p { padding-left: 18px; border-left: 1px solid var(--line-2); }
    .err { margin: 20px 16px 0; }
}
@media (max-width: 640px) {
    body.ww { font-size: 1rem; padding-bottom: 150px; }
    .foot-host { flex-direction: column; align-items: flex-start; gap: 14px; }   /* ข้อความยาว: โลโก้อยู่บน ข้อความเต็มความกว้าง */
    .foot-host p { padding-left: 0; border-left: 0; }
    #leafmap .leaflet-bottom { bottom: 118px; }
    .mf-legends, .map-full .movers { bottom: 126px; }
    .mf-btn span { display: none; } .mf-btn { width: 46px; padding: 0; justify-content: center; }
    .mf-title .seg button { padding: 6px 10px; font-size: .88rem; min-height: 34px; }
    .hero h1 { font-size: clamp(2.1rem, 9.6vw, 2.8rem); }
    .hero-sub { font-size: 1.05rem; }
    .hero-cta { gap: 12px 20px; margin-top: 24px; }
    .sec-head { align-items: flex-start; flex-direction: column; }
    .seg-row { width: 100%; } .seg-lbl { display: none; }
    .seg-row .seg, #rngSeg, #hSeg { width: 100%; } .seg-row .seg button, #rngSeg button, #hSeg button { flex: 1 1 0; padding: 7px 4px; }
    .seg button { padding: 7px 12px; }
    .core { padding: 18px; }
    .b-flow .core { padding: 20px; min-height: 0; }
    .flow-nums { gap: 6px; padding-top: 18px; }
    .fn b { font-size: 2.3rem; }
    .cell .core { min-height: 140px; }
    .n { font-size: 2.5rem; }
    .cell-ico { top: 16px; right: 16px; font-size: 1.35rem; }
    .sonar { width: 130px; height: 130px; right: -40px; top: -40px; }
    .cell .k { padding-right: 30px; }
    .b-daily { grid-column: 1 / -1; }
    .b-off { grid-column: 1 / -1; order: 5; }
    .daily b { font-size: 2rem; }
    .filter { gap: 12px; }
    .search { max-width: none; flex-basis: 100%; }
    .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 2px 20px; scrollbar-width: none; scroll-snap-type: x proximity; width: calc(100% + 40px); }
    .chips::-webkit-scrollbar { display: none; }
    .chips button { scroll-snap-align: start; }
    .sort-m { display: flex; flex: 1; }
    .count { padding-bottom: 12px; }
    .st-head { display: none; }
    .st-table { padding: 4px; border-radius: 24px; }
    .st { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name d" "lvl spark"; gap: 6px 14px; padding: 14px 16px; }
    .st-name { grid-area: name; } .st-d { grid-area: d; } .st-lvl { grid-area: lvl; text-align: left; } .st-spark { grid-area: spark; justify-self: end; }
    .st-lvl b { font-size: 1.1rem; } .st-lvl small { display: inline; margin-left: 6px; }
    .st-max, .st-time { display: none; }
    .tide-plot { height: 210px; } .tm span { font-size: .8rem; } .tm b { font-size: .95rem; }
    .dock { width: calc(100% - 16px); bottom: max(8px, env(safe-area-inset-bottom)); }
    .dock-bar { grid-template-columns: auto minmax(0, 1fr) auto auto; row-gap: 2px; border-radius: 26px; padding: 8px 8px 4px; }
    .dock-bar #slider { grid-column: 1 / -1; grid-row: 2; padding: 0 6px; }
    .dock-now { padding: 8px 12px; font-size: .9rem; }
    .dock-pop { width: 100%; }
    .past-frame { inset: 4px; border-radius: 22px; }
    /* bottom sheet */
    .sheet .modal-dialog { margin: 0; max-width: none; min-height: 100%; align-items: flex-end; }
    .modal.fade.sheet .modal-dialog { transform: translateY(100%); transition: transform .55s var(--ease); }
    .modal.show.sheet .modal-dialog { transform: none; }
    .sheet .modal-content { border-radius: 28px 28px 0 0; border-bottom: 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; }
    .grab { display: block; }
    .sheet-stats { grid-template-columns: 1fr 1fr; }
    .chart-box.sm { height: 240px; }
    .chart-box { height: 280px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .map-full .movers, .map-full .movers.closed { transition: none; }
    .star, .flk, .w1, .w2, .rfl, .drift, .bob, .fl, .rain .drop, .live .dot, .temple .t-lit, .flag .cloth, .bird, .near-ping circle, .near-btn.busy i, .rp .rp-ping, .rd-me-ping, #leafmap .me-pulse, .mf-btn.busy i, .rd-ping, .sonar circle, .is-loading [data-sk], .sk-row, .state.swap, .js .st.enter { animation: none !important; }
    .rain, .glint-wrap, .flock, .rd-sweep, .spray { display: none; }
    .js .rv { opacity: 1; transform: none; filter: none; transition: none; }
    .water, .readout, .marks .mk, .ln, .stain, .tide-line, .mv .bar, .split-bar i { transition: none; }
    .tide-line { stroke-dashoffset: 0; }
}
