/* หน้าแขก · ธีมมืดหรู ดำ-ทอง (คู่กับจอใหญ่) — เน้นตัวอักษรใหญ่ ตัดกับพื้นชัด ผู้ใหญ่อ่านง่าย */
:root {
  --bg: #0E0B09;
  --bg2: #17110E;
  --surface: #1D1612;
  --surface2: #261D18;
  --line: rgba(217, 184, 111, .26);
  --line-soft: rgba(239, 230, 214, .12);
  --gold: #D9B86F;
  --gold-hi: #F1D9A0;
  --gold-lo: #B8945A;
  --champ: #F3E6C8;
  --text: #F1E9DC;
  --muted: #B3A493;
  --paper: #FBF7EF;
  --ink: #241B16;
  --danger: #F08A7E;
  --radius: 18px;
  --serif: 'Noto Serif Thai', Georgia, serif;
  --sans: 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; color: var(--text); font: 400 18px/1.55 var(--sans);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(217,184,111,.14), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(184,148,90,.08), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2 { margin: 0; }
h2 { font: 600 20px/1.4 var(--sans); margin-bottom: 8px; color: var(--champ); }
small { color: var(--muted); font-size: 0.82em; }
b { color: var(--champ); }

.screen { max-width: 560px; margin: 0 auto; padding: 20px 16px 24px; }
.hero { text-align: center; padding: 32px 8px 22px; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-weight: 600; font-size: 15px; letter-spacing: .04em; }
.title { font: 700 32px/1.35 var(--serif);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title.small { font-size: 25px; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.soft { background: rgba(217,184,111,.08); border-color: var(--line); }
.notes ul { margin: 0; padding-left: 20px; }
.notes li { margin: 8px 0; }
.notes li::marker { color: var(--gold); }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.err { color: var(--danger); font-size: 15px; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn { border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600; background: var(--surface2); color: var(--text); min-height: 48px; }
.btn.primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #1A120E; box-shadow: 0 6px 18px -8px rgba(217,184,111,.55); }
.btn.primary:active { filter: brightness(.92); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn.light { background: var(--champ); color: var(--ink); }
.btn.big { width: 100%; font-size: 20px; min-height: 58px; margin-top: 6px; }
.btn:disabled { opacity: .45; box-shadow: none; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; color: var(--text); }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 15px; min-height: 38px; }
.chip.ghost { background: transparent; }
.chip.on { background: var(--gold); color: #1A120E; border-color: var(--gold); }

/* แก๊ง */
.gang-picker { display: grid; gap: 16px; }
.gang h3 { margin: 0 0 8px; font: 600 16px/1.3 var(--sans); display: flex; align-items: center; gap: 8px; color: var(--champ); }
.gang h3::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.gang .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; }
.opt span { display: inline-block; padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--line-soft); background: var(--surface2); font-size: 16px; color: var(--text); }
.opt input:checked + span { background: var(--c); border-color: var(--c); color: #fff; font-weight: 600; box-shadow: 0 0 0 2px rgba(255,255,255,.18) inset; }
.opt input:checked + span::before { content: '✓ '; }
.opt input:focus-visible + span { outline: 3px solid var(--gold); }

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; color: var(--champ); }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--line-soft); border-radius: 12px; background: var(--bg2); color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: #7D7062; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,184,111,.18); }
.field textarea { resize: vertical; }
.counter { display: block; text-align: right; margin-top: 4px; }
.counter.over { color: var(--danger); }

/* การ์ดภารกิจแบบตั๋ว: ทองแชมเปญ ตัวอักษรเข้ม */
.ticket {
  position: relative; color: var(--ink); border-radius: 22px; overflow: hidden; margin-bottom: 14px;
  background: linear-gradient(135deg, #F4E1AE 0%, var(--gold) 55%, #C69E5C 100%);
  box-shadow: 0 14px 30px -16px rgba(217,184,111,.6), 0 0 0 1px rgba(255,255,255,.15) inset;
}
.ticket-main { padding: 20px 20px 18px; border-bottom: 2px dashed rgba(36,27,22,.28); }
.ticket::before, .ticket::after {
  content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); top: calc(100% - 82px);
}
.ticket::before { left: -11px; } .ticket::after { right: -11px; }
.ticket-label { margin: 0 0 6px; font-size: 14px; letter-spacing: .06em; color: rgba(36,27,22,.7); font-weight: 600; }
.ticket-text { margin: 0; font: 700 23px/1.4 var(--serif); min-height: 2.8em; color: var(--ink); }
.ticket-actions { display: flex; gap: 8px; align-items: center; padding: 12px 14px; }
.ticket-actions .btn.primary { background: var(--ink); color: var(--gold-hi); box-shadow: none; }
.ticket-actions .btn.ghost { border-color: rgba(36,27,22,.35); color: var(--ink); }
.ticket-actions .icon-btn { color: var(--ink); margin-left: auto; }

.invite p { margin: 0 0 10px; font-weight: 600; color: var(--champ); }
.levels { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.levels .chip { white-space: nowrap; }

.send-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.send-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 10px; font-size: 20px; font-weight: 600; color: var(--champ);
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 110px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 10px 24px -18px rgba(0,0,0,.8);
}
.send-btn:active { background: var(--surface2); }
.send-btn .i { font-size: 30px; color: var(--gold); }
.send-btn:disabled { opacity: .4; }
.extras .btn { flex: 1; }
.outbox { text-align: center; color: var(--muted); font-size: 15px; }

/* แถบเตือน */
.banner {
  position: sticky; top: 0; z-index: 30; text-align: center; padding: 12px 16px; font-size: 16px; font-weight: 600;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: #1A120E;
}

/* ฟีด */
.bars { display: grid; gap: 7px; margin-bottom: 14px; }
.bar { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 8px; font-size: 14px; }
.bar .track { height: 8px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--c); border-radius: 999px; transition: width .6s; box-shadow: 0 0 8px var(--c); }
.bar .n { text-align: right; color: var(--muted); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; scrollbar-width: none; }
.filters .chip { white-space: nowrap; }
.feed { columns: 2; column-gap: 12px; }
.polaroid {
  break-inside: avoid; background: var(--paper); color: var(--ink); padding: 8px 8px 10px; margin-bottom: 12px; border-radius: 6px;
  box-shadow: 0 10px 22px -12px rgba(0,0,0,.9), 0 0 0 1px rgba(217,184,111,.15); border: 0; width: 100%; text-align: left; display: block;
}
.polaroid img { width: 100%; display: block; border-radius: 3px; background: #2a221d; min-height: 120px; }
.polaroid img.loaded { min-height: 0; }
.polaroid .cap { font-size: 14px; margin: 8px 2px 0; line-height: 1.4; }
.polaroid .who { font-size: 13px; color: #7C6E62; margin: 4px 2px 0; display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.note-card { background: linear-gradient(160deg, var(--surface2), var(--surface)); color: var(--champ); padding: 16px 14px; box-shadow: 0 0 0 1px var(--line), 0 10px 22px -12px rgba(0,0,0,.9); }
.note-card .cap { font: 600 17px/1.5 var(--serif); margin: 0; color: var(--champ); }
.note-card .who { color: var(--muted); }

/* ของฉัน */
.mine { display: grid; gap: 12px; }
.mine-item { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px; }
.mine-item img, .mine-item .ph { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; background: var(--surface2); display: grid; place-items: center; font-size: 26px; color: var(--gold); }
.mine-item p { margin: 0; font-size: 15px; }
.tag { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--text); margin-top: 4px; }
.tag.wait { background: rgba(217,184,111,.2); color: var(--gold-hi); } .tag.off { background: rgba(255,255,255,.05); color: var(--muted); }

/* แท็บล่าง */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(14, 11, 9, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; background: transparent; padding: 14px 0; font-size: 17px; font-weight: 600; color: var(--muted); min-height: 60px; }
.tabs button.on { color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }

/* แผ่นล่าง */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg2); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg2); padding: 10px 0; z-index: 1; }
.sheet-head h2 { margin: 0; font: 700 22px/1.3 var(--serif); color: var(--gold); }
.c-mission { background: rgba(217,184,111,.14); border: 1px solid var(--line); color: var(--gold-hi); border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; font-weight: 500; }
.picker { display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 12px; background: var(--surface); color: var(--champ); position: relative; }
.picker input { position: absolute; inset: 0; opacity: 0; }
.previews { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.previews .pv { position: relative; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.previews .pv button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--gold); color: #1A120E; font-size: 13px; font-weight: 700; }
.vis { border: 0; padding: 0; margin: 16px 0 8px; display: grid; gap: 8px; }
.vis legend { font-weight: 600; margin-bottom: 8px; padding: 0; color: var(--champ); }
.vis label { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1.5px solid var(--line-soft); border-radius: 14px; padding: 12px 14px; }
.vis label:has(input:checked) { border-color: var(--gold); background: rgba(217,184,111,.1); }
.vis input { margin-top: 5px; width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.vis span { display: flex; flex-direction: column; }
.check { display: flex; gap: 12px; align-items: center; padding: 10px 2px; }
.check input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; }

.shot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shot { border: 1px solid var(--line); background: var(--surface); color: var(--champ); border-radius: 14px; padding: 12px 6px; min-height: 96px; font-size: 15px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.shot .num { font: 700 14px var(--serif); color: var(--gold); }

/* เต็มจอ (โชว์ภารกิจ / หัวข้อคุย) */
.zoom { position: fixed; inset: 0; z-index: 60; color: var(--champ); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 24px; text-align: center; gap: 24px;
  background: radial-gradient(ellipse at 50% 40%, #2A1F18, #0A0807 70%); }
.zoom-label { margin: 0; letter-spacing: .08em; color: var(--gold); }
.zoom-text { margin: 0; font: 700 clamp(32px, 9vw, 56px)/1.4 var(--serif);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.zoom .btn.light { background: var(--gold); color: #1A120E; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 3, .96); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 16px 24px; gap: 14px; }
.lightbox figure { margin: 0; max-width: 560px; width: 100%; }
.lightbox img { width: 100%; max-height: 62vh; object-fit: contain; display: block; border-radius: 4px; }
.lightbox figcaption p { margin: 10px 0 0; }
.lightbox .meta { color: var(--muted); font-size: 15px; }
.lb-close { position: absolute; top: 10px; right: 10px; color: var(--text); }
.light-outline { color: var(--text); border-color: var(--line); }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; background: var(--surface2); color: var(--champ); border: 1px solid var(--gold); padding: 12px 20px; border-radius: 999px; font-size: 16px; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.6); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
