/* ---------- โทนสีและตัวอักษร ---------- */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #151922;
  --muted: #5d6677;
  --line: #dce1e9;
  --brand: #2447d6;
  --brand-hover: #1b38b3;
  --brand-soft: #e8edff;
  --sub: #ffd43b;            /* เหลืองซับไตเติล */
  --stage: #0f141c;
  --danger: #c8323f;
  --danger-soft: #fdecee;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
  --radius: 14px;
  --radius-s: 9px;
  --display: "Kanit", "Noto Sans Thai", system-ui, sans-serif;
  --body: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --surface: #161b24; --surface-2: #1b212c; --ink: #e8ecf2; --muted: #98a2b3;
    --line: #2a3140; --brand: #6f8bff; --brand-hover: #8aa0ff; --brand-soft: #1c2440;
    --danger: #ff6b78; --danger-soft: #3a1a20; --ok: #4cc47e; --ok-soft: #13301f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --surface: #161b24; --surface-2: #1b212c; --ink: #e8ecf2; --muted: #98a2b3;
  --line: #2a3140; --brand: #6f8bff; --brand-hover: #8aa0ff; --brand-soft: #1c2440;
  --danger: #ff6b78; --danger-soft: #3a1a20; --ok: #4cc47e; --ok-soft: #13301f; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--body); }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- ส่วนหัว ---------- */
.nav { display: flex; align-items: center; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font: 600 19px var(--display); color: var(--ink); text-decoration: none; }
.logo-mark { width: 34px; height: 24px; border-radius: 6px; background: var(--stage); position: relative; flex: none; }
.logo-mark::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 6px; height: 4px; border-radius: 2px; background: var(--sub); }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-links a:not(.btn) { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.nav-links a:not(.btn):hover { color: var(--ink); }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 15px var(--body);
  border: 1px solid transparent; border-radius: var(--radius-s); padding: 10px 18px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-quiet { background: transparent; color: var(--muted); padding: 8px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn-lg { padding: 13px 24px; font-size: 17px; border-radius: 11px; }
.btn-google { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-google svg { width: 18px; height: 18px; }

/* ---------- ช่องกรอก ---------- */
textarea, input[type=text], input[type=email], select {
  width: 100%; font: 15px/1.6 var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; }
textarea:focus, input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: .75; }
label.field { display: block; font-weight: 600; margin-bottom: 6px; }
.help { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
code, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .92em; }

/* ---------- เวที (เฟรมวิดีโอ + ซับ) ---------- */
.stage { position: relative; background: var(--stage); border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.sub-line { position: absolute; left: 4%; right: 4%; bottom: 7%; text-align: center; pointer-events: none;
  line-height: 1.35; paint-order: stroke fill; -webkit-paint-order: stroke fill; }

/* ---------- ข้อความแจ้งเตือน ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(92vw, 440px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: 15px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: toast-in .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- ส่วนท้าย ---------- */
.footer { max-width: 1180px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-wrap: wrap; gap: 8px 20px;
  color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }
.footer .spacer { flex: 1; }

/* ---------- หน้าเอกสาร (ข้อกำหนด/นโยบาย) ---------- */
.doc { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }
.doc h1 { font-size: 32px; margin-bottom: 8px; }
.doc h2 { font-size: 21px; margin: 32px 0 8px; }
.doc p, .doc li { color: var(--ink); margin-bottom: 10px; }
.doc .updated { color: var(--muted); margin-bottom: 24px; }
