@font-face { font-family: "Kanit"; font-style: normal; font-weight: 300; font-display: block; src: url("kanit-thai-300.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 300; font-display: block; src: url("kanit-latin-300.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 400; font-display: block; src: url("kanit-thai-400.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 400; font-display: block; src: url("kanit-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 500; font-display: block; src: url("kanit-thai-500.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 500; font-display: block; src: url("kanit-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 600; font-display: block; src: url("kanit-thai-600.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 600; font-display: block; src: url("kanit-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 700; font-display: block; src: url("kanit-thai-700.woff2") format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Kanit"; font-style: normal; font-weight: 700; font-display: block; src: url("kanit-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  color-scheme: dark;
  --bg: #0b0e15; --panel: #11151f; --raised: #171c29; --line: #232a3a;
  --text: #e8ecf4; --muted: #8f9ab0; --accent: #00c3ff; --accent-soft: rgba(0, 195, 255, .12);
  --code: #0f131d; --header: rgba(11, 14, 21, .88);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff; --panel: #f6f8fb; --raised: #eef2f7; --line: #dde3ec;
  --text: #17202e; --muted: #5b6678; --accent: #0083ad; --accent-soft: rgba(0, 131, 173, .1);
  --code: #f3f5f9; --header: rgba(255, 255, 255, .9);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; scrollbar-gutter: stable; } /* กันหน้าขยับเมื่อบางหน้าไม่มีแถบเลื่อน */
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17.5px/1.75 "Kanit", "Leelawadee UI", system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--header); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 20px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand em { font-style: normal; color: var(--accent); }
:root[data-theme="light"] .brand img { filter: drop-shadow(0 0 2px rgba(0, 40, 70, .55)); }
.search { display: flex; align-items: center; gap: 10px; width: min(440px, 40vw); margin: 0 auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--muted); }
.search:hover { border-color: var(--accent); }
.search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; }
kbd { font: 13px ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.menu { display: none; }
.lang { width: auto; min-width: 38px; padding: 0 10px; color: var(--text); font-size: 15px; font-weight: 600; }
.lang:hover { text-decoration: none; border-color: var(--accent); }
.discord, .button { display: inline-block; padding: 7px 16px; border-radius: 10px; background: #5865f2; color: #fff; font-weight: 600; }
.discord:hover, .button:hover { text-decoration: none; filter: brightness(1.1); }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr) 260px; max-width: 1500px; margin: 0 auto; }
.sidebar, .toc { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 24px 16px; }
.sidebar { border-right: 1px solid var(--line); }
.group h4, .toc h4 { margin: 18px 10px 8px; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.group:first-child h4, .toc h4 { margin-top: 0; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 7px 12px; border-radius: 9px; color: var(--muted); }
.sidebar a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc a { display: block; padding: 4px 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 15.5px; }
.toc a.level3 { padding-left: 24px; }
.toc a.active, .toc a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.toc h4 { margin-left: 0; }

main { min-width: 0; width: 100%; max-width: 860px; margin: 0 auto; padding: 32px 40px 64px; }
.crumb { color: var(--muted); font-size: 15px; }
.crumb span { margin: 0 6px; }
h1 { margin: 14px 0 4px; font-size: 36px; line-height: 1.35; font-weight: 700; }
.subtitle { margin: 0 0 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 18.5px; }
article h2 { margin: 36px 0 10px; font-size: 25px; font-weight: 700; }
article h3 { margin: 24px 0 8px; font-size: 20.5px; font-weight: 600; }
article li { margin: 4px 0; }
article code { font-family: ui-monospace, Consolas, "Leelawadee UI", monospace; font-size: .9em; background: var(--code); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
pre { position: relative; margin: 14px 0; padding: 16px 84px 16px 18px; overflow-x: auto; background: var(--code); border: 1px solid var(--line); border-radius: 12px; }
pre code { border: 0; padding: 0; background: none; }
.copy { position: absolute; top: 10px; right: 10px; padding: 2px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
.copy:hover { border-color: var(--accent); }

.admonition { margin: 16px 0; padding: 12px 18px; border-left: 4px solid var(--accent); border-radius: 10px; background: var(--panel); }
.admonition p { margin: 4px 0; }
.admonition-title { font-weight: 600; }
.admonition.warning { border-color: #f5a524; background: rgba(245, 165, 36, .1); }
.admonition.tip { border-color: #2ecc71; background: rgba(46, 204, 113, .09); }

.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
th { background: var(--panel); font-weight: 600; }
td.price { color: var(--accent); font-weight: 700; white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; font-weight: 600; }
.card span { color: var(--muted); font-size: 15.5px; }

.maps { list-style: none; padding: 0; }
.maps li { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.status { font-size: 13px; font-weight: 700; padding: 1px 10px; border-radius: 99px; white-space: nowrap; }
.status.on { color: #2ecc71; background: rgba(46, 204, 113, .13); }
.status.off { color: #ff6b6b; background: rgba(255, 107, 107, .13); }

.pager { display: flex; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { flex: 1; padding: 12px 18px; border: 1px solid var(--line); border-radius: 12px; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--muted); }
.pager b { font-weight: 600; }
.pager .next { text-align: right; margin-left: auto; }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px; background: rgba(0, 0, 0, .6); }
.modal[hidden] { display: none; }
.box { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.box input { width: 100%; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: none; }
#results { overflow-y: auto; padding: 8px; }
#results a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); }
#results a:hover, #results a.selected { background: var(--accent-soft); text-decoration: none; }
#results small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results p { margin: 8px 12px; color: var(--muted); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 800px) {
  header { gap: 6px; padding: 0 10px; }
  .icon-button { width: 34px; height: 36px; }
  .lang { min-width: 34px; padding: 0 6px; }
  .discord { padding: 6px 10px; }
  .search { overflow: hidden; }
  .menu { display: grid; }
  .brand span:not(.logo) { display: none; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; z-index: 15; width: 280px; background: var(--bg); transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .sidebar.open { transform: none; visibility: visible; }
  main { padding: 24px 18px 48px; }
  h1 { font-size: 29px; }
  body { font-size: 17px; }
  .pager { flex-direction: column; }
}

/* อนิเมชั่น: เนื้อหาเลื่อนขึ้นตอนเปิดหน้า, หัวข้อที่กดไปเรืองแสง, เมนูและการ์ดขยับเบาๆ */
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes flash {
  0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); }
  100% { background: transparent; box-shadow: 0 0 0 8px transparent; }
}
/* เปลี่ยนหน้า: หัวเว็บกับเมนูอยู่นิ่ง ขยับเฉพาะเนื้อหา (เบราว์เซอร์ที่ไม่รองรับใช้ .no-vt แทน) */
@view-transition { navigation: auto; }
header { view-transition-name: site-header; }
.sidebar { view-transition-name: site-sidebar; }
main { view-transition-name: page; }
::view-transition-group(*) { animation: none; }
::view-transition-old(site-header), ::view-transition-old(site-sidebar) { display: none; }
::view-transition-new(site-header), ::view-transition-new(site-sidebar) { animation: none; }
::view-transition-old(root), ::view-transition-old(page), ::view-transition-old(site-toc) { display: none; }
::view-transition-new(root), ::view-transition-new(site-toc) { animation: none; }
::view-transition-new(page) { animation: page-switch .16s ease-out both; }
@keyframes page-switch { from { opacity: .35; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.no-vt main { animation: page-switch .16s ease-out both; }
.modal { animation: fade-in .16s ease-out; }
.modal .box { animation: pop-in .2s ease-out; }
article h2.flash, article h3.flash { border-radius: 6px; animation: flash 1.3s ease-out; }
.sidebar a, .toc a, .pager a, .card, .icon-button, .search, .discord, .button, .copy {
  transition: color .18s, background-color .18s, border-color .18s, transform .18s, filter .18s;
}
.sidebar a:hover { transform: translateX(4px); }
.card:hover, .pager a:hover { transform: translateY(-3px); }
.discord:hover, .button:hover, .icon-button:hover { transform: translateY(-1px); }

h1 .emoji { margin-right: 12px; }
article h2 .emoji { margin-right: 8px; }
.panel { margin: 16px 0; padding: 18px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.admonition.info { border-color: #3b82f6; background: rgba(59, 130, 246, .1); }
.admonition.info .admonition-title::before { content: "i"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 10px; border-radius: 50%; background: #3b82f6; color: #fff; font-size: 12px; font-weight: 700; }

.shot { margin: 14px 0 22px; }
.shot img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; }
.shot-missing { margin: 14px 0 22px; padding: 26px 18px; text-align: center; border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); }
.shot-missing b { display: block; color: var(--accent); font: 600 15px ui-monospace, Consolas, monospace; }
.shot-missing span { color: var(--muted); font-size: 15px; }

.video { margin: 14px 0; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #000; }
.video iframe { width: 100%; height: 100%; border: 0; }

/* กล่องโค้ดหน้าตาแบบ VS Code: มืดเสมอ ไม่ว่าเว็บจะธีมไหน */
.code { position: relative; margin: 14px 0; overflow: hidden; border: 1px solid #333; border-radius: 12px; background: #1e1e1e; color: #d4d4d4; }
.code-bar { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 10px 6px 14px; background: #2b2b2c; border-bottom: 1px solid #191919; }
.dots { display: flex; gap: 7px; }
.dots b { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dots b:nth-child(2) { background: #febc2e; }
.dots b:nth-child(3) { background: #28c840; }
.code-name { font: 14px ui-monospace, Consolas, monospace; color: #b8b8b8; }
.code .copy { position: static; margin-left: auto; color: #e4e4e4; background: #3a3a3c; border-color: #4a4a4d; }
.code pre { margin: 0; padding: 12px 18px 14px 0; border: 0; border-radius: 0; background: none; font: 15.5px/1.7 "Cascadia Code", Consolas, "Leelawadee UI", monospace; counter-reset: line; }
article .code code { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
.code .line::before { counter-increment: line; content: counter(line); display: inline-block; width: 44px; margin-right: 18px; text-align: right; color: #6e7681; user-select: none; }
.code i { font-style: normal; }
.code .kw { color: #569cd6; } .code .cf { color: #c586c0; } .code .st { color: #ce9178; } .code .nu { color: #b5cea8; }
.code .cm { color: #6a9955; } .code .fn { color: #dcdcaa; } .code .vr { color: #9cdcfe; } .code .bi { color: #4ec9b0; }
.code .br0 { color: #ffd700; } .code .br1 { color: #da70d6; } .code .br2 { color: #179fff; }

.code pre { scrollbar-color: #555 transparent; }
:root:not([data-season="classic"]) .code-bar { padding-top: 12px; } /* เว้นที่ให้หิมะ/เมือกที่เกาะขอบบน */

/* ตัวหนา: ตัวปกติใช้ 400 แล้ว ตัวเน้นต้องหนาขึ้นตาม */
b, strong { font-weight: 600; }
h1, h2, h3, h4 { text-wrap: balance; }

@media (max-width: 480px) { .search span { display: none; } .search { justify-content: center; padding: 7px 0; } } /* จอเล็ก: ช่องค้นหาเหลือไอคอน */

/* ขีดสีฟ้าในสารบัญเป็นชิ้นเดียวที่สไลด์ แทนการเปลี่ยนสีขอบทีละข้อ */
.toc a.active, .toc a:hover { border-color: var(--line); }
.toc-bar { position: absolute; top: 0; left: 16px; width: 2px; height: 0; border-radius: 2px; background: var(--accent);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1), height .28s; }
