:root {
  --navy: #0a1a33; --deep: #12284a; --card: #16305a; --line: #2a4672;
  --gold: #c9a04a; --gold-2: #e0bd6e; --light: #d3dcea; --muted: #93a4be;
  --green: #3fb984; --red: #e05252; --white: #ffffff;
  --font: "Sarabun", "Noto Sans Thai", "Leelawadee UI", "Thonburi", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--white); line-height: 1.5;
  background: radial-gradient(120% 80% at 80% 0%, #1b3b6b 0%, var(--navy) 55%) fixed, var(--navy);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2 { font-weight: 600; margin: 0; line-height: 1.25; }
.kicker { color: var(--gold); font-weight: 600; letter-spacing: .04em; margin: 0 0 .2em; font-size: .85rem; }
.sub { color: var(--light); margin: .25em 0 0; font-size: .95rem; }
.card { background: rgba(22, 48, 90, .82); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.lbl { display: block; font-weight: 600; margin: 18px 0 8px; font-size: 1rem; }
.lbl:first-child { margin-top: 0; }
.opt { color: var(--muted); font-weight: 400; }
textarea, input[type=text], input:not([type]), input[type=password] {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--navy); background: var(--white);
  border: 2px solid transparent; border-radius: 12px; padding: 12px 14px; outline: none;
}
textarea { resize: vertical; min-height: 128px; line-height: 1.55; }
textarea:focus, input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 160, 74, .25); }
.row-between { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: .85rem; }
.btn-gold, .btn-ghost {
  font: inherit; font-weight: 600; border-radius: 12px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-gold { width: 100%; margin-top: 22px; padding: 14px; font-size: 1.1rem; color: var(--navy); background: var(--gold); border: 0; }
.btn-gold:hover { background: var(--gold-2); }
.btn-gold:disabled { opacity: .6; cursor: progress; }
.btn-ghost { padding: 9px 14px; font-size: .95rem; color: var(--white); background: transparent; border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-2); }
.btn-ghost.danger:hover { border-color: var(--red); color: var(--red); }
.msg { min-height: 1.4em; margin: 12px 0 0; font-size: .95rem; color: var(--light); }
.msg.err { color: #ff9b9b; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .92rem; color: var(--light); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.chip.on { color: var(--navy); background: var(--gold); border-color: var(--gold); font-weight: 600; }
.badge { display: inline-block; min-width: 1.8em; padding: 0 .45em; border-radius: 999px; background: var(--gold); color: var(--navy); font-size: .7em; text-align: center; vertical-align: middle; }
.badge.warn { background: #e8a93b; }
.badge:empty { display: none; }

/* ---------- หน้าส่งคำถาม (มือถือ) ---------- */
.ask-wrap { max-width: 560px; margin: 0 auto; padding: 24px 18px 40px; }
.ask-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.ask-head .logo { width: 58px; height: 58px; flex: none; }
.ask-head h1 { font-size: 1.55rem; }
.done { text-align: center; padding: 32px 20px; }
.tick { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--green); color: var(--white); font-size: 2rem; line-height: 64px; font-weight: 600; }
.done p { color: var(--light); }
.done .btn-ghost { margin-top: 8px; padding: 12px 22px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 26px; }
.privacy { color: var(--muted); font-size: .82rem; margin: 10px 0 0; text-align: center; }

/* ---------- จอแสดงผล (16:9) ---------- */
body.screen { height: 100vh; overflow: hidden; cursor: default; }
body.screen.idle { cursor: none; }
.scr { display: grid; grid-template-columns: 1fr 27vw; gap: 2.4vw; height: 100vh; padding: 3vw 3.2vw 2.6vw; }
.scr-main { display: flex; flex-direction: column; min-height: 0; }
.scr-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.6vw; }
.scr-head .kicker { font-size: 1.05vw; }
.scr-head h1 { font-size: 2.6vw; }
.live { display: flex; align-items: center; gap: .5vw; color: var(--light); font-size: 1vw; font-weight: 600; letter-spacing: .08em; }
.dot { width: .8vw; height: .8vw; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 0 .35vw rgba(63, 185, 132, .25); animation: pulse 2s infinite; }
.dot.off { background: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 .6vw rgba(63, 185, 132, .05); } }
.closed { margin-bottom: 1vw; padding: .7vw 1.2vw; border-radius: .8vw; background: rgba(224, 82, 82, .18); border: 1px solid var(--red); color: #ffc9c9; font-size: 1.15vw; font-weight: 600; }
.feat { position: relative; margin-bottom: 1.3vw; padding: 1.5vw 1.8vw 1.4vw; border-radius: 1.1vw; background: linear-gradient(135deg, rgba(201, 160, 74, .22), rgba(22, 48, 90, .9) 60%); border: .16vw solid var(--gold); }
.feat-lbl { margin: 0 0 .5vw; color: var(--gold); font-weight: 600; font-size: 1.05vw; letter-spacing: .08em; }
.feat-text { margin: 0; font-size: 2.3vw; line-height: 1.4; font-weight: 600; white-space: pre-line; }
.meta { margin: .6vw 0 0; color: var(--muted); font-size: 1vw; }
.meta .to { color: var(--gold-2); }
.qlist { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: .9vw;
  -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
.q { flex: none; padding: 1.05vw 1.4vw; border-radius: .9vw; background: rgba(22, 48, 90, .85); border: 1px solid var(--line); }
.q-text { margin: 0; font-size: 1.6vw; line-height: 1.45; white-space: pre-line; }
.q.answered { opacity: .5; }
.q.answered .q-text { font-size: 1.3vw; }
.q.new { animation: arrive 1.6s ease-out; }
@keyframes arrive { 0% { opacity: 0; transform: translateY(-.8vw); border-color: var(--gold); box-shadow: 0 0 0 .3vw rgba(201, 160, 74, .45); } 60% { opacity: 1; transform: none; border-color: var(--gold); } }
.empty { color: var(--light); font-size: 1.5vw; margin-top: 2vw; }
.scr-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4vw; min-height: 0; }
.qr-card { width: 100%; background: var(--white); color: var(--navy); border-radius: 1.4vw; padding: 1.8vw 1.8vw 1.4vw; text-align: center; box-shadow: 0 1.2vw 3vw rgba(0, 0, 0, .35); }
.qr svg { display: block; width: 100%; height: auto; }
.qr-cta { margin: 1.1vw 0 0; font-size: 1.75vw; font-weight: 600; }
.qr-url { margin: .2vw 0 0; font-size: 1.2vw; color: #2a4672; font-weight: 500; word-break: break-all; }
.side-note { margin: 0; color: var(--light); font-size: 1.05vw; text-align: center; }
.side-logo { width: 5.2vw; height: auto; opacity: .95; }
.fs-btn { position: fixed; right: 1vw; bottom: 1vw; width: 2.6vw; height: 2.6vw; min-width: 34px; min-height: 34px; font-size: 1.3vw; color: var(--light); background: rgba(10, 26, 51, .6); border: 1px solid var(--line); border-radius: .6vw; cursor: pointer; opacity: .35; }
.fs-btn:hover { opacity: 1; }
body.idle .fs-btn { opacity: 0; }

/* ---------- ผู้ดูแล ---------- */
.adm { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login .logo { width: 64px; height: 64px; }
.login h1 { font-size: 1.4rem; margin: 8px 0 14px; }
.login .lbl { text-align: left; }
.adm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.adm-head h1 { font-size: 1.6rem; }
.adm-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; }
.switch input { width: 18px; height: 18px; accent-color: var(--gold); }
.tabs { display: flex; gap: 8px; margin: 4px 0 14px; flex-wrap: wrap; }
.alist { display: flex; flex-direction: column; gap: 10px; }
.aq { display: grid; grid-template-columns: 1fr auto; gap: 12px 16px; align-items: start; padding: 14px 16px; border-radius: 14px; background: rgba(22, 48, 90, .85); border: 1px solid var(--line); }
.aq.pending { border-color: #e8a93b; }
.aq.featured { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 160, 74, .35); }
.aq.hiddenq { opacity: .65; }
.aq-text { margin: 0; font-size: 1.08rem; white-space: pre-line; }
.aq .meta { font-size: .85rem; margin-top: 6px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--light); }
.tag.on { background: var(--green); border-color: var(--green); color: var(--navy); }
.tag.hl { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.tag.wait { background: #e8a93b; border-color: #e8a93b; color: var(--navy); }
.aq-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 330px; }
.aq-btns .btn-ghost { padding: 6px 11px; font-size: .88rem; }
.aq-btns .primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.none { color: var(--muted); padding: 30px 0; text-align: center; }
@media (max-width: 720px) { .aq { grid-template-columns: 1fr; } .aq-btns { justify-content: flex-start; max-width: none; } }
