/* แอปด่าน: ใช้กลางคืน มือเปียก แดดจ้า → ตัวใหญ่ ปุ่มใหญ่ คอนทราสต์สูง */
:root {
  --bg: #111418; --panel: #1b2027; --line: #2c333d; --text: #f2f4f7; --muted: #9aa4b2;
  --ok: #1fbf6a; --warn: #f5b301; --bad: #ff4d4f; --accent: #3d8bfd;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.35 system-ui, "Noto Sans Thai", sans-serif; }
/* พื้นหลังมืดไล่เฉด + ภูเขาจางมุมล่าง ให้เข้ากับโลโก้ (ไม่รบกวนการอ่าน) */
body { background: radial-gradient(120% 60% at 50% -10%, #1d232b 0%, var(--bg) 60%) fixed, var(--bg); min-height: 100vh; }
body { padding: 0 12px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
button, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 52px; }
button:active { transform: scale(.98); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.big { min-height: 64px; font-size: 20px; width: 100%; }
button:disabled { opacity: .4; }
input { width: 100%; background: #0c0f12; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 4px; }
label { display: block; margin: 12px 0; color: var(--muted); }
h1 { font-size: 24px; margin: 16px 0 4px; } h2 { font-size: 16px; color: var(--muted); margin: 18px 0 6px; }
.hint { color: var(--muted); font-size: 15px; } .msg { min-height: 1.4em; color: var(--warn); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

#bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  margin: 0 -12px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(180deg, #07090b 0%, #0d1014 100%); border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
#bar .brand { width: 40px; height: auto; flex: none; }
#bar .who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#bar .pill { flex: none; }

.update { width: calc(100% + 24px); margin: 0 -12px; border-radius: 0; background: #12366e; border-color: var(--accent); font-size: 16px; min-height: 44px; }

/* หน้าตั้งค่า: โลโก้ใหญ่ */
.hero { text-align: center; padding: 22px 0 4px; }
.hero img { width: min(52vw, 200px); height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.5)); }
.hero-sub { margin-top: 8px; color: var(--muted); font-size: 14px; letter-spacing: .5px; text-transform: uppercase; }
#setup h1, #pick h1 { text-align: center; }
#setup .hint, #pick .hint { text-align: center; } #bar .who span { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { min-height: 40px; padding: 6px 12px; border-radius: 999px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: #0f3b23; border-color: var(--ok); } .pill.warn { background: #3d3000; border-color: var(--warn); } .pill.bad { background: #4a1415; border-color: var(--bad); }

.result { margin-top: 12px; border-radius: 16px; padding: 16px; text-align: center; border: 3px solid var(--line); background: var(--panel); }
.result .bib { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: 1px; }
.result .name { font-size: 22px; margin-top: 6px; } .result .meta { color: var(--muted); font-size: 15px; margin-top: 4px; min-height: 1.3em; }
.result.idle .bib { font-size: 32px; color: var(--muted); }
.result.ok { border-color: var(--ok); background: #0f2a1b; } .result.warn { border-color: var(--warn); background: #2e2600; } .result.bad { border-color: var(--bad); background: #3a1213; }

.cam { margin-top: 12px; } video { width: 100%; max-height: 42vh; object-fit: cover; border-radius: 12px; background: #000; }

.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: grid; grid-template-columns: 4.2em 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.recent b { font-size: 20px; } .recent .t { color: var(--muted); font-size: 14px; text-align: right; }
.st-pending::after { content: " ⏳"; } .st-synced::after { content: " ✓"; color: var(--ok); } .st-rejected::after { content: " ⚠️"; }

.list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.list button, .list li { width: 100%; text-align: left; }
.tools { margin-top: 20px; } .tools button { width: 100%; margin-top: 8px; }

dialog { width: min(96vw, 460px); background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
dialog::backdrop { background: rgba(0,0,0,.7); }
.kp-display { text-align: center; padding: 8px; } .kp-display span { display: block; font-size: 56px; font-weight: 800; min-height: 1.1em; letter-spacing: 2px; }
.kp-display small { display: block; font-size: 20px; min-height: 1.4em; color: var(--muted); }
.kp-display small.found { color: var(--ok); } .kp-display small.missing { color: var(--warn); }
.kp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .kp-grid button { min-height: 68px; font-size: 28px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); } .check input { width: 28px; height: 28px; margin: 0; }
#searchList li button { min-height: 56px; }
