/* ==========================================================================
   SPNI-X — ระบบออกแบบ (Design tokens + components)
   ธีมมืดแบบแพลตฟอร์มข้อมูล: พื้นกรมท่าเข้ม #0B0F1A การ์ด #1F2937 มุม 16px
   สีหลักน้ำเงิน → ม่วง ตัวอักษร Inter + Anuphan (ไทย) ตัวเลข JetBrains Mono
   ========================================================================== */

:root {
  --bg: #0B0F1A;
  --bg-alt: #111827;
  --surface: #111827;         /* แถว ช่องกรอก และกล่องที่อยู่ในการ์ด */
  --paper: #1F2937;           /* การ์ด */
  --elevated: #374151;
  --sand: rgba(255, 255, 255, 0.05);   /* พื้นตอนชี้ */
  --sand-2: #243042;          /* พื้นภาพปกที่ยังไม่มีรูป */
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --field-line: #6B7280;      /* ขอบช่องกรอก (คอนทราสต์ ≥ 3:1 บนการ์ด) */

  --ink: #F9FAFB;
  --ink-2: #D1D5DB;
  --muted: #9CA3AF;
  --faint: #6B7280;

  --primary: #3B82F6;
  --primary-2: #2563EB;
  --violet: #8B5CF6;
  --grad-btn: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  --grad-btn-hover: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  --grad-text: linear-gradient(90deg, #60A5FA 0%, #8B5CF6 100%);
  --grad-brand: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);

  --accent: #3B82F6;
  --accent-text: #60A5FA;     /* น้ำเงินสว่างสำหรับตัวอักษรบนพื้นมืด */
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-line: rgba(59, 130, 246, 0.45);

  --ok: #4ADE80;
  --ok-solid: #22C55E;
  --ok-soft: rgba(34, 197, 94, 0.12);
  --warn: #FBBF24;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --danger: #F87171;
  --danger-solid: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --live: #DC2626;

  --dark: #030712;
  --on-dark: #F9FAFB;
  --on-dark-muted: #9CA3AF;

  --font-sans: "Inter", "Anuphan", "Leelawadee UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-xs: 4px;
  --r-sm: 8px;
  --r: 10px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-pill: 999px;

  --ring: 0 0 0 1px var(--line);
  --shadow-pill: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 40px -24px rgba(0, 0, 0, 0.7);
  --shadow-shot: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 60px -24px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 0 1px rgba(59, 130, 246, 0.45), 0 22px 44px -22px rgba(37, 99, 235, 0.55);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --container: 1216px;
  --nav-h: 64px;

  --z-nav: 40;
  --z-menu: 60;
  --z-modal: 100;
  --z-toast: 1000;

  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }
img, svg, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(59, 130, 246, 0.35); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 6px;
}

.i { width: 20px; height: 20px; flex: none; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

#thumb-file:focus-visible + div > label { outline: 2px solid var(--accent-text); outline-offset: 3px; }

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: var(--z-toast);
  padding: 10px 16px; border-radius: var(--r);
  background: var(--primary-2); color: #fff; font-weight: 600;
  transform: translateY(-150%); transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}
@media (min-width: 768px) {
  .container { width: min(100% - 64px, var(--container)); }
}

/* ---------- Typography ---------- */

/* ภาษาไทยไม่มีช่องว่างระหว่างคำ: ห้ามบีบความกว้างหัวข้อด้วย ch — ขึ้นบรรทัดด้วย <br> และใช้ .nw กันคำประสมขาด */
.nw { white-space: nowrap; }

.grad {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding-block: 0.12em;      /* กันสระบน/วรรณยุกต์ถูกตัด */
}

.badge, .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent-line);
  background: var(--paper);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.eyebrow { font-size: 13px; padding: 3px 12px; }
.badge-success { border-color: rgba(34, 197, 94, 0.55); color: var(--ok); }
.badge .dot, .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.badge:not(.badge-success) .dot { display: none; }
.badge-success .dot { animation: ok-pulse 2s ease-out infinite; }
@keyframes ok-pulse {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}
.eyebrow.no-rule::before { display: none; }

.accent-text { color: var(--accent-text); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.section-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.lead {
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  color: var(--muted);
  line-height: 1.7;
  max-width: 60ch;
}

.muted { color: var(--muted); }

/* ---------- Buttons ---------- */

.btn {
  --h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h);
  padding: 0 26px;
  border: 0;
  border-radius: var(--r);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.2s var(--ease), transform 0.12s var(--ease), opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-btn);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 12px 28px -14px rgba(37, 99, 235, 0.8);
}
.btn-primary:hover:not([disabled]) { background: var(--grad-btn-hover); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 16px 32px -12px rgba(59, 130, 246, 0.75); }

/* ปุ่มรอง: พื้นโปร่ง ขอบบาง */
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover:not([disabled]) { background: var(--sand); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }

.btn-quiet { background: transparent; color: var(--muted); padding: 0 12px; }
.btn-quiet:hover:not([disabled]) { color: var(--ink); background: var(--sand); }

.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.45); }
.btn-danger:hover:not([disabled]) { background: var(--danger-soft); }

.btn-live { background: var(--live); color: #fff; box-shadow: 0 12px 28px -14px rgba(220, 38, 38, 0.8); }
.btn-live:hover:not([disabled]) { background: #B91C1C; }

.btn-light { background: #fff; color: #0B0F1A; }
.btn-light:hover:not([disabled]) { background: #E5E7EB; }
.btn-outline-light { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.btn-outline-light:hover:not([disabled]) { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6); }

.btn-sm { --h: 40px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  border: 0;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--sand); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 15px;
}
.link-arrow .i { transition: transform 0.2s var(--ease); }
.link-arrow:hover .i { transform: translateX(3px); }

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-name b {
  font-weight: 700;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Forms ---------- */

.field { display: grid; gap: 7px; }
.field + .field { margin-top: 18px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.label .req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid var(--field-line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.input[aria-invalid="true"] { border-color: var(--danger-solid); }
.input[readonly] { background: var(--bg); }
.select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}
.select option { background: var(--paper); color: var(--ink); }
input[type="file"].input { padding: 8px 12px; font-size: 14px; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 50px; }
.input-wrap .icon-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }
.input-icon { position: relative; }
.input-icon > .i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.input-icon .input { padding-left: 42px; }

.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.field-error { font-size: 13px; color: var(--danger); }

.form-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: var(--r);
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.6;
}
.form-alert .i { margin-top: 2px; }
.form-alert.ok { border-color: rgba(34, 197, 94, 0.4); background: var(--ok-soft); color: var(--ok); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }

/* ตัวเลือกแบบปุ่มคู่ (radio) */
.choice {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.choice label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked + label { background: var(--elevated); color: var(--ink); font-weight: 600; }
.choice input:focus-visible + label { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* ---------- Cards / chips ---------- */

.card {
  background: var(--paper);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.75;
  white-space: nowrap;
}
.chip-accent { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.chip-ok { border-color: rgba(34, 197, 94, 0.4); color: var(--ok); background: var(--ok-soft); }
.chip-warn { border-color: rgba(245, 158, 11, 0.4); color: var(--warn); background: var(--warn-soft); }
.chip-danger { border-color: rgba(239, 68, 68, 0.4); color: var(--danger); background: var(--danger-soft); }
.chip-muted { color: var(--muted); background: transparent; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-solid); }

.icon-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.2);
}

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  width: min(380px, calc(100% - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-shot);
  font-size: 14px;
  line-height: 1.6;
  animation: toast-in 0.25s var(--ease);
}
.toast .i { margin-top: 1px; color: var(--ok); }
.toast.error .i { color: var(--danger); }
.toast.leaving { animation: toast-out 0.18s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Dialog ---------- */

dialog.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-shot);
  overflow: auto;
}
dialog.modal::backdrop { background: rgba(3, 7, 18, 0.72); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: modal-in 0.22s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 18px 0 24px; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 16px 24px 6px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 18px 24px 22px; }
/* รายการ ชื่อ: ค่า ในหน้าต่าง (ข้อมูลสมาชิก LINE OA) */
.kv { display: grid; gap: 8px; margin: 0; font-size: 14px; }
.kv div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* ==========================================================================
   หน้าแรก
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--nav-h);
  background: rgba(11, 15, 26, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color 0.25s var(--ease);
}
.nav.scrolled { background: rgba(11, 15, 26, 0.95); }
.nav-inner { height: 100%; display: flex; align-items: center; gap: 16px; }
.nav-links { display: none; align-items: center; gap: 4px; margin-inline: auto; }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border-radius: var(--r-sm); font-size: 15px; color: var(--muted);
  transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }
.nav-actions { display: none; align-items: center; gap: 6px; }
.nav-login {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px;
  border-radius: var(--r-sm); color: var(--muted); font-weight: 500; font-size: 15px;
}
.nav-login:hover { color: var(--ink); }
.nav-toggle { display: inline-grid; margin-left: auto; }
@media (min-width: 900px) {
  .nav-links, .nav-actions { display: inline-flex; }
  .nav-toggle { display: none; }
}

.mobile-menu {
  position: fixed;
  inset: var(--nav-h) 0 auto;
  z-index: var(--z-menu);
  padding: 8px 16px 22px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.8);
  display: grid;
  gap: 2px;
  /* มือถือแนวนอน: เมนูยาวกว่าจอ → เลื่อนในเมนูได้ */
  max-height: calc(100vh - var(--nav-h));
  max-height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-menu a:not(.btn) { display: flex; align-items: center; min-height: 48px; padding: 0 12px; border-radius: var(--r); font-size: 17px; color: var(--ink-2); }
.mobile-menu a:not(.btn):hover { background: var(--sand); color: var(--ink); }
.mobile-menu a[aria-current="page"]:not(.btn) { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.mobile-menu .btn { margin-top: 10px; }

/* Hero: โลโก้ + หัวข้อกลางหน้า ตามด้วยหน้าจอโปรแกรมจริงขนาดใหญ่ (แท็บสลับ 4 โปรแกรม) บนพื้นแสงน้ำเงิน/ม่วง และเส้นกริดจาง ๆ */
.hero { position: relative; overflow: hidden; padding: 40px 0 72px; }
@media (min-width: 1024px) { .hero { padding: 52px 0 96px; } }
.hero::before, .hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.hero::before {
  background:
    radial-gradient(760px circle at 50% 0%, rgba(59, 130, 246, 0.22), transparent 62%),
    radial-gradient(620px circle at 88% 62%, rgba(139, 92, 246, 0.14), transparent 62%),
    radial-gradient(560px circle at 8% 58%, rgba(37, 99, 235, 0.12), transparent 62%);
}
.hero::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 50% at 50% 18%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 50% at 50% 18%, #000 20%, transparent 75%);
}
.hero > .container { position: relative; z-index: 1; }
.hero-copy { display: grid; justify-items: center; text-align: center; }
.hero-logo {
  width: clamp(210px, 26vw, 340px);
  height: auto;
  filter: drop-shadow(0 16px 36px rgba(37, 99, 235, 0.35));
}
.hero h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 6.4vw, 3.3rem);
  line-height: 1.24;
  letter-spacing: -0.02em;
}
.hero .lead { margin: 18px auto 0; font-size: clamp(1.02rem, 1.4vw, 1.15rem); max-width: 40em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-copy .hero-actions { justify-content: center; }
.hero-note { margin-top: 14px; font-size: 14px; color: var(--muted); }
@media (max-width: 479px) {
  .hero-actions .btn { flex: 1 1 100%; }
}

/* หน้าจอโปรแกรมจริงใน hero: การ์ดเลื่อนวนต่อเนื่องเต็มความกว้างจอ (สูงสุด 1680px) จางที่ขอบซ้าย/ขวา
   main.js สร้างชุดสำเนาให้พอดีจอ ตั้งความเร็วคงที่ และสลับเป็นโหมดเลื่อนดูเอง (.is-manual) เมื่อหยุด */
.showcase { position: relative; isolation: isolate; margin-top: 56px; }
.showcase::before {
  content: "";
  position: absolute;
  inset: 6% 8% 22%;
  z-index: -1;
  background:
    radial-gradient(closest-side at 35% 50%, rgba(59, 130, 246, 0.3), transparent),
    radial-gradient(closest-side at 68% 55%, rgba(139, 92, 246, 0.24), transparent);
  filter: blur(56px);
  pointer-events: none;
}
/* ไอคอนจริงของโปรแกรม (128px พื้นโปร่งใส จากไฟล์ .ico ของแต่ละโปรแกรม) วางบนแผ่นสีกรมท่าให้ทั้ง 4 ตัวดูเป็นชุดเดียวกัน */
.app-icon {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 3px;
  object-fit: contain;
  border-radius: 11px;
  background: radial-gradient(circle at 30% 20%, #1E3A6E, #0B1530 72%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 16px -6px rgba(0, 0, 0, 0.7);
}

.marquee {
  --mq-card: 440px;
  --mq-gap: 24px;
  --mq-fade: 9%;
  --mq-mask: linear-gradient(90deg, transparent, #000 var(--mq-fade), #000 calc(100% - var(--mq-fade)), transparent);
  margin-inline: calc(50% - min(50vw, 840px));
  overflow: hidden;
  scroll-padding-inline: var(--mq-fade);
  -webkit-mask-image: var(--mq-mask);
  mask-image: var(--mq-mask);
}
@media (min-width: 1440px) { .marquee { --mq-card: 460px; } }
@media (max-width: 1023px) { .marquee { --mq-card: 380px; --mq-gap: 20px; } }
@media (max-width: 639px) { .marquee { --mq-card: 264px; --mq-gap: 14px; --mq-fade: 5%; } }
.marquee-track { display: flex; gap: var(--mq-gap); width: max-content; padding: 8px var(--mq-fade) 6px; }
.marquee-group {
  display: flex;
  flex: none;
  gap: var(--mq-gap);
  animation: marquee var(--mq-duration, 46s) linear var(--mq-delay, 0s) infinite;
}
@keyframes marquee { to { transform: translateX(calc(-100% - var(--mq-gap))); } }
.marquee:hover .marquee-group, .marquee.is-offscreen .marquee-group { animation-play-state: paused; }
/* หยุดอยู่ / ไม่มี JS: เลื่อนดูเองได้ด้วยนิ้ว ล้อเมาส์ หรือแถบเลื่อน */
.marquee.is-manual, .no-js .marquee {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.marquee.is-manual .marquee-group, .no-js .marquee-group { animation: none; }
.marquee-group > li { flex: none; width: var(--mq-card); }

.mq-card { display: block; border-radius: 20px; }
.mq-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 11 / 8;
  overflow: hidden;
  border-radius: 18px;
  background: var(--mq-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 24px 48px -30px rgba(0, 0, 0, 0.9);
}
/* แสงมุมบนและกริดจาง ๆ บนพื้นสีของแต่ละโปรแกรม */
.mq-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.3), transparent 55%),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 28px 28px;
}
.mq-tile img {
  position: relative;
  width: 84%;
  height: auto;
  aspect-ratio: 1600 / 850;
  object-fit: cover;
  object-position: top center;
  border-radius: 8px;
  background: #E8EEF6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 22px 40px -14px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s var(--ease);
}
.mq-card:hover .mq-tile img, .mq-card:focus-visible .mq-tile img { transform: translateY(-4px) scale(1.02); }
.mq-bank { --mq-bg: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%); }
.mq-phone { --mq-bg: linear-gradient(135deg, #38BDF8 0%, #2563EB 100%); }
.mq-link { --mq-bg: linear-gradient(135deg, #A855F7 0%, #EC4899 100%); }
.mq-cctv { --mq-bg: linear-gradient(135deg, #34D399 0%, #0D9488 100%); }
.mq-meta { display: flex; align-items: center; gap: 12px; padding: 14px 4px 4px; }
.mq-meta .app-icon { width: 40px; height: 40px; border-radius: 10px; }
.mq-text { display: grid; min-width: 0; }
.mq-text b { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--ink); transition: color 0.2s; }
.mq-text small { font-size: 14px; line-height: 1.5; color: var(--muted); }
.mq-card:hover .mq-text b { color: var(--accent-text); }
@media (max-width: 639px) {
  .showcase { margin-top: 44px; }
  .mq-tile { border-radius: 14px; }
  .mq-tile img { border-radius: 6px; }
  .mq-meta { gap: 10px; padding-top: 12px; }
  .mq-meta .app-icon { width: 36px; height: 36px; }
  .mq-text b { font-size: 16px; }
  .mq-text small { font-size: 13px; }
}

.marquee-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.marquee-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--sand);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background-color 0.2s, color 0.2s;
}
.marquee-toggle:hover { background: rgba(255, 255, 255, 0.09); color: var(--ink); }

/* แถบตัวเลขใต้ภาพ */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 40px;
  border-radius: 16px;
  background: rgba(17, 24, 39, 0.6);
  box-shadow: inset 0 0 0 1px var(--line);
}
.hero-stats li { padding: 20px 14px; text-align: center; }
.hero-stats li + li { box-shadow: inset 1px 0 0 var(--line); }
.hero-stats b { display: block; font-size: 26px; line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-stats span { display: block; margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }
@media (max-width: 639px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; }
  .hero-stats li { padding: 16px 10px; }
  .hero-stats li:nth-child(odd) { box-shadow: none; }
  .hero-stats li:nth-child(n + 3) { box-shadow: inset 0 1px 0 var(--line); }
  .hero-stats li:nth-child(4) { box-shadow: inset 0 1px 0 var(--line), inset 1px 0 0 var(--line); }
  .hero-stats b { font-size: 22px; }
  .hero-stats span { font-size: 13px; }
}

/* หน้าจอโปรแกรมจริงในแต่ละส่วน + การ์ดผลวิเคราะห์ซ้อนด้านหน้า */
.app-shot {
  margin: 0;
  padding: 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 30px 60px -28px rgba(0, 0, 0, 0.85);
}
.app-shot img { width: 100%; height: auto; border-radius: 11px; background: #E8EEF6; }
.doc-float { z-index: 1; width: 88%; margin: -64px 0 0 auto; }
.program.flip .doc-float { margin-left: 0; margin-right: auto; }
@media (max-width: 767px) {
  .doc-float, .program.flip .doc-float { width: calc(100% - 16px); margin: -28px 0 0 auto; }
}

/* Sections */
.section { padding: 96px 0; position: relative; }
.section.alt, .program.alt { background: var(--bg-alt); }
.section-head { display: grid; gap: 14px; max-width: 760px; margin-bottom: 48px; }
.section-head.center { margin-inline: auto; text-align: center; justify-items: center; }
.section-head.center .lead { margin-inline: auto; }
@media (max-width: 767px) {
  .section { padding: 72px 0; }
  .section-head { margin-bottom: 32px; }
}

/* หัวข้อขั้นตอน (ใช้ในหน้าคลังวิดีโอ .part-head .step) */
.step { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--accent-text); }
.step b {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--grad-brand); color: #fff; font-family: var(--font-mono); font-size: 14px;
}

/* คลิปวิธีใช้งาน 4 โปรแกรมบนหน้าแรก: ภาพปก ชื่อ ความยาว จาก /api/showcase (main.js) — ตัววิดีโอดูได้เฉพาะสมาชิก */
.clip-grid { display: grid; gap: 20px; }
@media (min-width: 640px) { .clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .clip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.clip-grid > li { display: flex; }
.clip-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.clip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.clip-cover { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--sand-2); }
.clip-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.clip-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 7, 18, 0.25), transparent 35%, transparent 60%, rgba(3, 7, 18, 0.55));
  pointer-events: none;
}
.clip-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0B0F1A;
  box-shadow: 0 10px 30px -8px rgba(59, 130, 246, 0.7);
  transition: transform 0.2s var(--ease);
}
.clip-play .i { width: 20px; height: 20px; margin-left: 3px; }
.clip-card:hover .clip-play { transform: scale(1.08); }
.clip-time {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(3, 7, 18, 0.82);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.clip-lock {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(3, 7, 18, 0.78);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.clip-body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.clip-prog { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; color: var(--accent-text); }
.clip-prog .app-icon { width: 28px; height: 28px; padding: 2px; border-radius: 8px; }
.clip-title { font-size: 16.5px; font-weight: 600; line-height: 1.45; color: var(--ink); }
.clip-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.clip-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; font-size: 14px; font-weight: 600; color: var(--accent-text); }
.clip-card:hover .clip-cta { color: var(--ink); }
/* เข้าสู่ระบบอยู่แล้ว (main.js ตรวจ /api/me) → ไม่ต้องบอกว่าต้องเข้าสู่ระบบ */
.clip-cta .when-member, .is-member .clip-cta .when-guest, .is-member .clip-lock { display: none; }
.is-member .clip-cta .when-member { display: inline; }
.learn-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; margin-top: 36px; text-align: center; }

/* การ์ดความสามารถ (ใช้ทั้งสารบัญ 4 โปรแกรม และมาตรฐานระบบ) */
.feature-grid { display: grid; gap: 24px; }
@media (min-width: 680px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .feature-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) and (max-width: 1179px) { .feature-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.feature-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
a.feature-card:hover, .feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.feature-card .icon-tile { width: 48px; height: 48px; margin-bottom: 12px; }
.feature-card .icon-tile .i { width: 22px; height: 22px; }
.feature-card .app-icon { width: 52px; height: 52px; border-radius: 13px; margin-bottom: 12px; }
.feature-card h3 { font-size: 1.2rem; line-height: 1.4; }
.feature-card p { color: var(--muted); }
.feature-card .ver { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); font-weight: 400; }
.feature-card .link-arrow { margin-top: auto; padding-top: 14px; font-size: 14px; }

/* ตารางเปรียบเทียบ */
.table-card { margin-top: 32px; padding: 24px 24px 8px; }
.table-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.table-card-head h3 { font-size: 1.25rem; }
.table-card-head p { font-size: 14px; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 14px; font-weight: 600; color: var(--muted);
  padding: 14px 16px 12px 0; border-bottom: 1px solid var(--line);
}
.data-table td { padding: 18px 16px 18px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 15px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.prog-cell { display: flex; align-items: center; gap: 12px; }
.prog-cell .app-icon { width: 36px; height: 36px; border-radius: 9px; }
.data-table .prog b { display: block; color: var(--ink); font-weight: 600; white-space: nowrap; }
.data-table .prog span { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.data-table .to { color: var(--accent-text); font-family: var(--font-mono); font-size: 14px; }
.data-table .action { text-align: right; padding-right: 0; }
@media (max-width: 899px) {
  .table-card { padding: 20px 18px 6px; }
  .data-table thead { display: none; }
  .data-table tr { display: grid; gap: 10px; padding: 18px 0; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { padding: 0; border: 0; }
  .data-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12.5px; color: var(--muted); }
  .data-table .action { text-align: left; }
}

/* รายละเอียดแต่ละโปรแกรม */
.program { padding: 96px 0; border-top: 1px solid var(--line); }
@media (max-width: 767px) { .program { padding: 72px 0; } }
.program-grid { display: grid; gap: 40px; align-items: start; }
@media (min-width: 1024px) {
  .program-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 64px; }
  .program.flip .program-visual { order: -1; }
  .program-visual { position: sticky; top: calc(var(--nav-h) + 28px); }
}
.program-head { display: grid; gap: 12px; }
.program-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); line-height: 1.25; letter-spacing: -0.015em; }
.program-head .tagline { width: fit-content; font-size: clamp(1.15rem, 1.8vw, 1.35rem); font-weight: 600; line-height: 1.45; }
.program-stats { display: grid; gap: 12px; margin-top: 28px; }
@media (min-width: 520px) { .program-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.program-stats div { padding: 16px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-card); }
.program-stats b { display: block; font-family: var(--font-mono); font-size: 1.35rem; font-weight: 700; line-height: 1.3; color: var(--ink); }
.program-stats span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 519px) {
  .program-stats div { display: flex; align-items: baseline; gap: 14px; }
  .program-stats b { flex: none; min-width: 88px; }
  .program-stats span { margin: 0; }
}
.feature-list { display: grid; gap: 12px; margin-top: 28px; }
@media (min-width: 640px) {
  .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-list li:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.feature-list li { padding: 18px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-card); }
.fnum {
  display: inline-block; margin-bottom: 8px; padding: 1px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); font-family: var(--font-mono); font-size: 12px; font-weight: 500;
}
.feature-list h4 { font-size: 16px; font-weight: 600; line-height: 1.45; }
.feature-list p { margin-top: 4px; font-size: 14.5px; color: var(--muted); line-height: 1.6; }
.format-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* "หน้าจอ" ของแต่ละโปรแกรม */
.shot, .doc {
  position: relative;
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-shot);
  overflow: hidden;
  text-align: left;
  font-size: 13px;
  color: var(--ink-2);
}
.card .doc { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.shot-bar, .doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.shot-bar b, .doc-head b { font-size: 14px; font-weight: 600; color: var(--ink); }
.shot-bar span, .doc-head span { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.shot-body { padding: 12px 18px 16px; }
.doc > :not(.doc-head):not(.stamp):not(.frame-shot) { margin-left: 18px; margin-right: 18px; }
.doc > svg, .doc > .doc-table { width: calc(100% - 36px); }   /* width 100% + ขอบซ้ายขวาจะล้นการ์ด */
.doc > :last-child { margin-bottom: 16px; }
.doc > .stamp { margin: 0; }
.doc-sub { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.doc-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.doc-table tr:last-child td { border-bottom: 0; }
.doc-table .num, .doc-table th.num { text-align: right; font-family: var(--font-mono); }
.doc-table tr.flag td { background: rgba(239, 68, 68, 0.1); color: var(--ink); }
.doc-table tr.flag td:first-child { box-shadow: inset 2px 0 0 var(--danger-solid); }
.doc-table tr.flag .num.out { color: var(--danger); }
@media (max-width: 519px) {
  .doc-table .opt { display: none; }
  .doc-table th, .doc-table td { padding-inline: 4px; }
}
.doc-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.doc-foot b { font-family: var(--font-mono); color: var(--danger); }
.doc-rows { display: grid; }
.doc-rows li {
  display: grid; grid-template-columns: minmax(44px, auto) minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.doc-rows li:last-child { border-bottom: 0; }
.doc-rows .t { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.doc-rows b { font-weight: 500; color: var(--ink); font-size: 13.5px; }
.doc-rows .tag { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.doc-rows li.hit b, .doc-rows li.hit .tag { color: var(--accent-text); }
.doc-rows li.alert b, .doc-rows li.alert .tag { color: var(--danger); }
.shot svg, .doc svg { width: 100%; height: auto; }
.doc .map { margin-top: 12px; margin-bottom: 6px; border-radius: 10px; overflow: hidden; }
.frame-shot { overflow: hidden; background: #0F172A; border-bottom: 1px solid var(--line); }
.stamp {
  position: absolute;
  right: 18px;
  bottom: 44px;
  padding: 2px 10px;
  border: 2px solid var(--danger-solid);
  border-radius: var(--r-xs);
  color: var(--danger);
  font-weight: 700;
  font-size: 15px;
  transform: rotate(-8deg);
  background: rgba(11, 15, 26, 0.85);
}
.stamp.stamp-top { top: 56px; bottom: auto; }
@media (max-width: 519px) { .doc:has(.stamp-top) .doc-sub { padding-right: 100px; } }

/* คำถามที่พบบ่อย */
.faq { max-width: 820px; margin-inline: auto; display: grid; gap: 12px; }
.faq details { border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-card); transition: box-shadow 0.2s var(--ease); }
.faq details[open] { box-shadow: 0 0 0 1px var(--accent-line); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 16px 22px; cursor: pointer; list-style: none;
  font-size: 17px; font-weight: 600; color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; content: "+" / ""; flex: none; display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text);
  font-family: var(--font-mono); font-size: 18px; line-height: 1; transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 22px 20px; color: var(--muted); max-width: 66ch; }

/* ปิดท้าย */
.cta-card {
  position: relative;
  overflow: hidden;
  padding: 72px 24px;
  border-radius: 24px;
  text-align: center;
  background:
    radial-gradient(560px circle at 18% 0%, rgba(59, 130, 246, 0.28), transparent 62%),
    radial-gradient(520px circle at 82% 100%, rgba(139, 92, 246, 0.26), transparent 62%),
    var(--paper);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.cta-card h2 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); line-height: 1.3; letter-spacing: -0.015em; }
.cta-card p { margin: 16px auto 0; max-width: 54ch; color: var(--ink-2); }
.cta-card .hero-actions { justify-content: center; }
@media (max-width: 479px) { .cta-card { padding: 52px 18px; } }

.footer { padding: 64px 0 32px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; gap: 32px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr)); } }
.footer p { color: var(--muted); font-size: 14px; max-width: 36ch; margin-top: 14px; }
.footer .footer-h { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }
.footer-links { display: grid; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--muted); font-size: 14.5px; width: fit-content; }
.footer-links a:hover { color: var(--ink); }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}

/* หน้าเกี่ยวกับผู้พัฒนา (/about): การ์ดภาพตัดพื้นหลังบนพื้นแสงน้ำเงิน/ม่วง + ภาพรางวัล */
.about-hero .hero-copy .badge { margin-bottom: 4px; }
.about-hero h1 { margin-top: 10px; }
/* จอเดียวคอลัมน์ไม่ให้การ์ดใหญ่เกินขนาดบนจอคอม · 640–859px 2 คอลัมน์ (การ์ดที่ 3 อยู่กลาง) · 860px ขึ้นไป 3 คอลัมน์ */
.team-grid { display: grid; gap: 24px; max-width: 400px; margin: 52px auto 0; }
@media (min-width: 640px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .team-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 12px); }
}
@media (min-width: 860px) {
  .team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .team-grid > :last-child:nth-child(odd) { grid-column: auto; width: auto; }
}
/* การ์ดไม่ได้เป็นลิงก์ จึงไม่มีเอฟเฟกต์ตอนชี้เมาส์ */
.team-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.team-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background:
    radial-gradient(70% 58% at 50% 34%, rgba(59, 130, 246, 0.5), transparent 70%),
    radial-gradient(55% 45% at 88% 92%, rgba(139, 92, 246, 0.42), transparent 70%),
    radial-gradient(45% 40% at 8% 90%, rgba(37, 99, 235, 0.3), transparent 70%),
    linear-gradient(180deg, #14213D, #0B0F1A);
}
/* เส้นกริดจาง ๆ ด้านหลังคน */
.team-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, #000 30%, transparent 80%);
}
.team-photo img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}
.team-info { display: grid; gap: 2px; justify-items: center; padding: 18px 20px 22px; text-align: center; border-top: 1px solid var(--line); }
.team-no { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.08em; color: var(--accent-text); }
.team-name { font-size: clamp(1.15rem, 1.7vw, 1.32rem); line-height: 1.45; }
.team-role { font-size: 14px; color: var(--muted); }

.award-figure {
  margin: 0;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow-shot);
}
.award-figure img { width: 100%; height: auto; border-radius: 14px; background: var(--sand-2); }
@media (max-width: 639px) {
  .award-figure { padding: 6px; border-radius: 16px; }
  .award-figure img { border-radius: 10px; }
}
.award-list { display: grid; gap: 10px; margin-top: 18px; }
/* จอกว้างอ่านชื่อรางวัลจากภาพได้ → ซ่อนจากตา แต่โปรแกรมอ่านหน้าจอยังอ่านรายการนี้ (ภาพมี alt สั้น ไม่อ่านซ้ำ) */
@media (min-width: 640px) {
  .award-list {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}
.award-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}
.award-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FDE68A, #D97706 60%, #92400E);
  color: #1C1003;
  font-family: var(--font-mono);
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
}
.award-item b { display: block; font-weight: 600; line-height: 1.45; color: var(--ink); }
.award-item b + span { display: block; font-size: 13.5px; color: var(--muted); }

/* ปรากฏเมื่อเลื่อนถึง */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ==========================================================================
   หน้าเข้าสู่ระบบ
   ========================================================================== */

.auth { min-height: 100dvh; display: grid; }
@media (min-width: 1024px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-aside {
  position: relative;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 48px 40px;
  background:
    radial-gradient(520px circle at 20% 15%, rgba(59, 130, 246, 0.2), transparent 62%),
    radial-gradient(480px circle at 85% 85%, rgba(139, 92, 246, 0.18), transparent 62%),
    var(--bg-alt);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
@media (min-width: 1024px) { .auth-aside { display: flex; } }
.auth-aside .desk { position: relative; min-height: 380px; width: min(100%, 460px); margin: 0 auto; }
.auth-aside .desk .doc { position: absolute; }
.auth-aside .desk .d1 { width: 78%; left: 0; top: 0; transform: rotate(-3deg); }
.auth-aside .desk .d2 { width: 70%; right: 0; top: 34%; transform: rotate(3deg); z-index: 2; }
.auth-aside .desk .d3 { width: 46%; left: 8%; bottom: 0; transform: rotate(-1.5deg); z-index: 3; }
.auth-quote { max-width: 40ch; }
.auth-quote p:first-child { font-size: 1.6rem; font-weight: 700; line-height: 1.35; color: var(--ink); letter-spacing: -0.01em; }
.auth-quote p.muted { margin-top: 8px; font-size: 14px; }

.auth-main { display: flex; flex-direction: column; padding: 18px 16px 26px; }
@media (min-width: 768px) { .auth-main { padding: 24px 44px; } }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
@media (min-width: 1024px) { .auth-brand-mobile { visibility: hidden; } }
.auth-card-wrap { flex: 1; display: grid; place-items: center; padding: 28px 0; }
.auth-card { width: min(100%, 400px); }
.auth-card h1 { font-size: clamp(2rem, 3.4vw, 2.6rem); line-height: 1.25; margin-top: 16px; letter-spacing: -0.015em; }
.auth-card .lead { margin-top: 8px; font-size: 15px; }
.auth-card form { margin-top: 26px; }
.auth-card .form-alert { margin-bottom: 16px; }
.auth-help { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.auth-foot { font-size: 13px; color: var(--muted); text-align: center; }

/* ยืนยันรหัส OTP จาก LINE */
.otp-account { margin-top: 10px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.otp-input {
  min-height: 56px;
  padding-left: calc(14px + 0.5em); /* ชดเชยระยะห่างตัวอักษรท้ายสุด ให้ตัวเลขอยู่กลาง */
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.otp-input::placeholder { letter-spacing: normal; }
.otp-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.otp-actions .btn-quiet { padding: 0 10px; margin-left: -10px; }
.otp-actions #otp-resend { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   แอป (คลังวิดีโอ / หน้าไลฟ์ / ผู้ดูแล)
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 26, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.app-header .container { height: 100%; display: flex; align-items: center; gap: 12px; }
.app-header .brand-tag {
  display: none; padding: 1px 9px; border-radius: var(--r-pill); border: 1px solid var(--accent-line);
  background: var(--accent-soft); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--accent-text);
}
@media (min-width: 640px) { .app-header .brand-tag { display: inline-block; } }
.app-header .search { flex: 1; max-width: 400px; margin-left: auto; }
.app-header .search .input { min-height: 40px; font-size: 15px; }
@media (max-width: 639px) {
  .app-header .search { display: none; }
  .app-header .search + .user-menu { margin-left: auto; }
}
@media (max-width: 479px) { .app-header .btn-text { display: none; } }

.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 3px 10px 3px 3px;
  border: 0; border-radius: var(--r-pill); background: var(--paper); box-shadow: var(--shadow-pill);
}
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-brand); color: #fff; font-weight: 600; font-size: 14px;
}
.user-btn .name { font-size: 14px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 479px) { .user-btn .name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-menu);
  min-width: 240px; padding: 6px; border-radius: 14px; background: var(--paper);
  box-shadow: var(--shadow-shot); animation: modal-in 0.16s var(--ease);
}
.menu-pop .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-pop .who b { display: block; font-weight: 600; }
.menu-pop .who span { font-size: 13px; color: var(--muted); }
.menu-pop .who span + span { display: block; margin-top: 2px; }
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--ink-2); font-size: 15px; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--sand); color: var(--ink); }
.menu-pop .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu-pop .danger:hover { color: var(--danger); background: var(--danger-soft); }

.app-main { padding: 32px 0 80px; }

/* หัวข้อส่วนในแอป (01 · ไลฟ์ / 02 · คลิป) */
.part-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px;
  padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--line);
}
.part-head .step { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-text); letter-spacing: 0.04em; font-weight: 500; }
.part-head h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); line-height: 1.3; margin-top: 4px; letter-spacing: -0.01em; }
.part-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.part + .part { margin-top: 56px; }

.welcome {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 26px 28px;
  background:
    radial-gradient(420px circle at 0% 0%, rgba(59, 130, 246, 0.18), transparent 65%),
    var(--paper);
}
.welcome h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.3; letter-spacing: -0.01em; margin-top: 10px; }
.welcome p { color: var(--muted); margin-top: 4px; }
.welcome-stats { display: flex; gap: 28px; }
.welcome-stats b { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.welcome-stats span { font-size: 13px; color: var(--muted); }
@media (max-width: 639px) { .welcome { padding: 20px 18px; } }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 0;
  border-radius: var(--r-pill); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink-2); font-size: 14px; transition: background-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.filter-btn:hover { background: var(--sand); }
.filter-btn[aria-pressed="true"] { background: var(--primary-2); color: #fff; box-shadow: none; }
.filter-btn .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.filter-btn[aria-pressed="true"] .count { color: rgba(255, 255, 255, 0.8); }
.filter-btn .short { display: none; }
@media (max-width: 639px) {
  .filter-btn { padding: 0 12px; }
  .filter-btn .full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .filter-btn .short { display: inline; }
}
.mobile-search { display: none; margin: 0 0 14px; }
@media (max-width: 639px) { .mobile-search { display: block; } }

.lib-section { margin-top: 36px; }
.lib-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.lib-head h2, .lib-head h3 { font-size: 1.15rem; }
.lib-head .muted { font-size: 14px; }
.lib-head .icon-tile { width: 36px; height: 36px; border-radius: 10px; }

.video-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.video-card {
  display: flex; flex-direction: column; border: 0; border-radius: var(--r-md); background: var(--paper);
  box-shadow: var(--shadow-card); overflow: hidden; text-align: left; padding: 0; color: var(--ink);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--sand-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.video-card:hover .thumb img { transform: scale(1.03); }
.thumb .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.thumb .placeholder .i { width: 34px; height: 34px; }
.thumb .play-hover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(3, 7, 18, 0.35); opacity: 0; transition: opacity 0.2s var(--ease); }
.thumb .play-hover span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: #fff; color: #0B0F1A; box-shadow: 0 10px 30px -8px rgba(59, 130, 246, 0.7); }
.thumb .play-hover .i { margin-left: 3px; }
.video-card:hover .play-hover, .video-card:focus-visible .play-hover { opacity: 1; }
.thumb .duration { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 6px; background: rgba(3, 7, 18, 0.85); color: #fff; font-family: var(--font-mono); font-size: 12px; }
.thumb .watched { position: absolute; left: 8px; top: 8px; }
.thumb .progress-line { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.15); }
.thumb .progress-line span { display: block; height: 100%; background: var(--grad-brand); }
.video-card .body { display: grid; gap: 6px; padding: 14px 16px 16px; }
.video-card h3, .video-card h4 { font-size: 15.5px; font-weight: 600; line-height: 1.5; }
.video-card .desc { font-size: 14px; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.empty {
  display: grid; justify-items: center; gap: 10px; padding: 52px 24px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: var(--r-md); background: var(--surface); margin-top: 8px;
}
.empty .icon-tile { width: 52px; height: 52px; }
.empty .icon-tile .i { width: 24px; height: 24px; }
.empty h2, .empty h3 { font-size: 1.15rem; margin-top: 4px; }
.empty p { color: var(--muted); max-width: 46ch; }
.empty .btn { margin-top: 8px; }
.empty.compact { padding: 26px 20px; }

.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--surface), var(--paper), var(--surface));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  aspect-ratio: 16 / 13;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ดูวิดีโอ */
.watch { display: grid; gap: 28px; }
@media (min-width: 1100px) { .watch { grid-template-columns: minmax(0, 1fr) 330px; } }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-bottom: 10px; color: var(--muted); font-size: 15px; }
.back-link:hover { color: var(--ink); }
.player { position: relative; border-radius: var(--r-md); overflow: hidden; background: #000; box-shadow: var(--shadow-shot); }
.player video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.next-up {
  position: absolute; right: 14px; bottom: 64px; display: grid; gap: 10px; width: min(320px, calc(100% - 28px));
  padding: 16px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-shot); animation: modal-in 0.22s var(--ease);
}
.next-up .muted { font-size: 13px; }
.next-up b { font-weight: 600; line-height: 1.5; }
.next-up .actions { display: flex; gap: 8px; }
.watch-info { margin-top: 20px; }
.watch-info h1 { font-size: clamp(1.5rem, 2.8vw, 2rem); line-height: 1.35; letter-spacing: -0.01em; }
.watch-info .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.watch-info .desc { margin-top: 16px; padding: 16px 18px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-card); color: var(--ink-2); white-space: pre-line; }
.playlist { border-radius: var(--r-md); background: var(--paper); box-shadow: var(--shadow-card); overflow: hidden; align-self: start; }
@media (min-width: 1100px) { .playlist { position: sticky; top: 88px; max-height: calc(100dvh - 116px); display: flex; flex-direction: column; } }
.playlist-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.playlist-head h2 { font-size: 16px; }
.playlist-head p { font-size: 13px; color: var(--muted); }
.playlist ol { overflow: auto; padding: 6px; }
.pl-item { display: grid; grid-template-columns: 110px 1fr; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: var(--r); background: transparent; text-align: left; color: var(--ink); transition: background-color 0.15s; }
.pl-item:hover { background: var(--sand); }
.pl-item[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3); }
.pl-item .thumb { border-radius: var(--r-sm); }
.pl-item .thumb .placeholder .i { width: 22px; height: 22px; }
.pl-item .thumb .duration { right: 4px; bottom: 4px; font-size: 10px; padding: 0 5px; }
.pl-item b { display: block; font-size: 14px; font-weight: 500; line-height: 1.45; }
.pl-item span { font-size: 12px; color: var(--muted); }

/* ผู้ดูแล */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); margin: 26px 0; max-width: 100%; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0;
  border-radius: var(--r-sm); background: transparent; color: var(--muted); font-size: 15px;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--elevated); color: var(--ink); font-weight: 600; }
@media (max-width: 479px) { .tab { padding: 0 10px; font-size: 14px; white-space: nowrap; } }
@media (max-width: 359px) { .tab .i { display: none; } .tab { padding: 0 12px; } }

.admin-grid { display: grid; gap: 24px; align-items: start; }
@media (min-width: 1100px) { .admin-grid { grid-template-columns: 390px minmax(0, 1fr); } }
.panel { padding: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 18px; }
.panel-head p { font-size: 13px; color: var(--muted); }
/* กล่องหมายเหตุสีน้ำเงิน (เช่น สมาชิกเข้าด้วยบัญชี LINE OA) */
.panel-note {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 18px; padding: 11px 14px;
  border-radius: var(--r); border: 1px solid var(--accent-line); background: var(--accent-soft);
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
}
.panel-note .i { margin-top: 2px; color: var(--accent-text); }
@media (min-width: 1100px) { .admin-grid > .panel:first-child { position: sticky; top: 88px; } }

.dropzone {
  display: grid; justify-items: center; gap: 8px; padding: 24px 16px; border: 1.5px dashed var(--field-line);
  border-radius: 14px; background: var(--surface); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--accent-soft); }
.dropzone .icon-tile { width: 46px; height: 46px; }
.dropzone b { font-weight: 600; }
.dropzone span { font-size: 13px; color: var(--muted); }
.file-preview { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.file-preview .thumb { border-radius: var(--r-sm); }
.file-preview b { display: block; font-size: 14px; font-weight: 500; word-break: break-all; line-height: 1.4; }
.file-preview span { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 110px; }
.field-row .field + .field { margin-top: 0; }
.field-row + .field, .field + .field-row { margin-top: 18px; }
@media (max-width: 479px) { .field-row { grid-template-columns: 1fr !important; } }

.upload-progress { display: grid; gap: 8px; margin-top: 16px; }
.upload-progress .track { height: 6px; border-radius: 6px; background: var(--surface); overflow: hidden; }
.upload-progress .track span { display: block; height: 100%; width: 0; background: var(--grad-brand); transition: width 0.2s linear; }
.upload-progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); font-family: var(--font-mono); }

.admin-list { display: grid; gap: 10px; }
.admin-row {
  display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.admin-row:hover { border-color: var(--line-2); }
.admin-row .thumb { border-radius: var(--r-sm); }
.admin-row .thumb .placeholder .i { width: 24px; height: 24px; }
.admin-row h3 { font-size: 15px; line-height: 1.45; }
.admin-row .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.admin-row .meta .chip { font-size: 12px; padding: 0 9px; }
.admin-row .actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px; }
@media (max-width: 639px) {
  .admin-row { grid-template-columns: 96px minmax(0, 1fr); }
  .admin-row .actions { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 6px; }
}
.admin-row.live-row { grid-template-columns: 60px minmax(0, 1fr) auto; }
@media (max-width: 639px) { .admin-row.live-row { grid-template-columns: 52px minmax(0, 1fr); } }

.user-row {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.user-row .avatar { width: 42px; height: 42px; }
.user-row .avatar.member { background: var(--elevated); color: var(--ink); }
.user-row h3 { font-size: 15px; }
.user-row .sub { font-size: 13px; color: var(--muted); font-family: var(--font-mono); }
.user-row .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.user-row .meta .chip { font-size: 12px; padding: 0 9px; }
.user-row .actions { display: flex; gap: 2px; }
@media (max-width: 639px) {
  .user-row { grid-template-columns: 42px minmax(0, 1fr); }
  .user-row .actions { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 6px; }
}

.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.list-toolbar .select { width: auto; min-height: 40px; font-size: 14px; }

/* ==========================================================================
   ถ่ายทอดสด
   ========================================================================== */

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.5); }
  100% { box-shadow: 0 0 0 7px rgba(248, 113, 113, 0); }
}
.live-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 1px 10px; border-radius: 6px;
  background: var(--live); color: #fff; font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; line-height: 1.8;
}
.live-badge .live-dot { width: 6px; height: 6px; animation-name: live-pulse-light; }
@keyframes live-pulse-light {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
  100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}
.chip-live { border-color: rgba(239, 68, 68, 0.45); color: var(--danger); background: var(--danger-soft); }
.chip-live .live-dot { width: 6px; height: 6px; }

/* หน้าดูไลฟ์ */
.live-layout { display: grid; gap: 28px; }
@media (min-width: 1100px) { .live-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.live-stage { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--dark); box-shadow: var(--shadow-shot); }
.live-stage iframe, .live-stage video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.live-overlay {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--ink);
  background: radial-gradient(60% 80% at 50% 30%, rgba(59, 130, 246, 0.16), transparent 70%), var(--paper);
}
.live-overlay .inner { display: grid; justify-items: center; gap: 10px; max-width: 520px; }
.live-overlay .icon-tile { width: 52px; height: 52px; }
.live-overlay .icon-tile .i { width: 24px; height: 24px; }
.live-overlay .overlay-title { color: var(--ink); font-weight: 700; font-size: clamp(1.3rem, 2.6vw, 1.7rem); line-height: 1.35; }
.live-overlay p { color: var(--muted); font-size: 15px; }
.countdown { display: flex; gap: 10px; margin-top: 6px; }
.countdown div { min-width: 64px; padding: 10px 6px 8px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.countdown b { display: block; font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 12px; color: var(--muted); }
@media (max-width: 479px) {
  /* จอแคบ: สัดส่วน 16:9 เตี้ยเกินกว่าข้อความ + นับถอยหลัง จึงยอมให้สูงขึ้น (วิดีโอจะมีขอบดำบนล่าง) */
  .live-stage { aspect-ratio: auto; height: max(236px, calc((100vw - 32px) * 9 / 16)); }
  .live-overlay .icon-tile { display: none; }
  .countdown div { min-width: 52px; }
}

.side-card { padding: 20px; }
.side-card + .side-card { margin-top: 16px; }
.side-card h2 { font-size: 15px; margin-bottom: 12px; }
.share-box { display: flex; gap: 8px; }
.share-box .input { min-height: 40px; font-family: var(--font-mono); font-size: 13px; }
.mini-list { display: grid; gap: 4px; }
.mini-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 9px 10px; border-radius: var(--r); transition: background-color 0.15s; }
.mini-item:hover { background: var(--sand); }
.mini-item .when { grid-column: 2; font-size: 12px; color: var(--muted); }
.mini-item b { font-size: 14px; font-weight: 500; line-height: 1.45; }
.mini-item .icon-tile { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; }
.mini-item .icon-tile .i { width: 17px; height: 17px; }

/* ส่วนไลฟ์ในคลังวิดีโอ */
.live-now { display: grid; gap: 18px; align-items: center; padding: 18px 20px; margin-bottom: 14px; box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 20px 44px -24px rgba(220, 38, 38, 0.5); }
@media (min-width: 768px) { .live-now { grid-template-columns: 220px 1fr auto; } }
.live-now .thumb { border-radius: var(--r); }
.live-now h3 { font-size: 1.35rem; margin-top: 6px; line-height: 1.4; }
.live-now p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.upcoming { display: grid; gap: 10px; }
@media (min-width: 768px) { .upcoming { grid-template-columns: repeat(2, 1fr); } }
.upcoming a {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px;
  border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.upcoming a:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.date-tile { display: grid; place-items: center; height: 52px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); line-height: 1.1; }
.date-tile b { font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.date-tile span { font-size: 11px; color: var(--accent-text); }
.upcoming h3, .upcoming h4 { font-size: 15px; line-height: 1.45; }
.upcoming p { font-size: 13px; color: var(--muted); }
.sub-head { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 18px 0 10px; }

/* 404 */
.notfound {
  min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(520px circle at 50% 30%, rgba(59, 130, 246, 0.16), transparent 65%);
}
.notfound .code {
  font-size: clamp(5rem, 14vw, 8rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.notfound h1 { font-size: 1.7rem; margin-top: 12px; }
.notfound p { color: var(--muted); margin: 10px 0 26px; }
/* หน้าแจ้งระบบยืนยันตัวตนไม่พร้อมใช้งาน (unavailable.html) */
.notfound .notice { max-width: 34rem; }
.notfound .notice h1 { margin-top: 18px; line-height: 1.35; }
.notfound-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  /* แถบภาพหน้าจอโปรแกรมเลื่อนด้วยความเร็วปกติทุกเครื่อง (เจ้าของเว็บเลือก) ผู้ชมกดปุ่มหยุดได้ */
  .marquee .marquee-group {
    animation-duration: var(--mq-duration, 46s) !important;
    animation-iteration-count: infinite !important;
  }
}
