:root { --fg:#f3e9c8; --bg:#000c; --line:#fff6; --accent:#f3e9c8; --amber:#ffb347; --btn:#222; --btnline:#666; --on:#f3e9c8; --onfg:#111; }
body.night { --fg:#e66; --bg:#000d; --line:#a336; --accent:#e66; --amber:#d84; --btn:#1a0505; --btnline:#733; --on:#600; --onfg:#fbb; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; height:100%; background:#000; color:var(--fg); font:15px system-ui, -apple-system, sans-serif; overflow:hidden; overscroll-behavior:none; touch-action:manipulation; }
#video { position:fixed; inset:0; width:100vw; height:100vh; height:100dvh; object-fit:cover; background:#000; }
#overlay { position:fixed; inset:0; width:100vw; height:100vh; height:100dvh; touch-action:none; }
button { font:inherit; color:inherit; }
.btn { min-height:48px; padding:8px 14px; border-radius:12px; background:var(--btn); border:1px solid var(--btnline); color:var(--fg); }
.btn.big { min-height:56px; font-size:18px; padding:10px 28px; }
.btn.on { background:var(--on); color:var(--onfg); }
.btn:disabled { opacity:.4; }

#top { position:fixed; top:0; left:0; right:0; padding:calc(8px + env(safe-area-inset-top)) 10px 14px; display:flex; gap:6px; align-items:center; background:linear-gradient(#000a,#0000); font-size:12px; z-index:5; }
#top .spacer { flex:1; }
.chip { padding:5px 10px; border-radius:16px; border:1px solid var(--line); background:#0007; font-size:13px; min-height:34px; color:var(--fg); }
.chip.on { background:#f3e9c8; color:#111; border-color:#f3e9c8; }
.chip.sun.on { background:#ffb347; color:#111; }
body.night .chip.on { background:var(--on); color:var(--onfg); border-color:#a33; }
.warnmark { color:var(--amber); }
.chip.sun.on .warnmark { color:#7a2a00; }
.status { background:none; border:0; font-size:12px; padding:6px 2px; color:var(--fg); }
.status.amber { color:var(--amber); font-weight:600; }
.icon { background:#0007; border:1px solid var(--line); border-radius:50%; width:36px; height:36px; font-size:18px; padding:0; }
#battery { font-size:12px; min-width:34px; text-align:right; }
#battery.low { color:var(--amber); font-weight:600; }

#banner { position:fixed; top:calc(52px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%); background:#000b; border:1px solid var(--line); border-radius:10px; padding:5px 12px; font-size:13px; z-index:4; white-space:nowrap; max-width:96vw; }
#sunwarn { position:fixed; left:10px; right:10px; top:calc(88px + env(safe-area-inset-top)); background:#400d; border:1px solid #f66; padding:7px 10px; border-radius:8px; font-size:12px; color:#fcc; z-index:4; }
body.night #sunwarn { color:#e88; }
#diag { position:fixed; left:8px; top:calc(130px + env(safe-area-inset-top)); background:#000a; font:10px/1.35 ui-monospace, monospace; padding:6px 8px; border-radius:6px; z-index:4; white-space:pre; max-width:94vw; overflow:hidden; pointer-events:none; }
#manual { position:fixed; left:10px; right:10px; bottom:calc(var(--sheet-h, 150px) + 8px); background:#000b; border-radius:12px; padding:6px 12px; z-index:4; display:grid; gap:2px; font-size:13px; }
#manual label { display:grid; grid-template-columns:90px 1fr; align-items:center; gap:8px; }
#manual label span { grid-column:1; } #manual input { grid-column:2; width:100%; }

#sheet { position:fixed; left:0; right:0; bottom:0; background:var(--bg); border-radius:18px 18px 0 0; padding:0 14px calc(12px + env(safe-area-inset-bottom)); z-index:6; max-height:78vh; overflow-y:auto; }
.grab { display:block; width:100%; height:24px; background:none; border:0; padding:0; position:relative; }
.grab::after { content:""; position:absolute; left:50%; top:10px; width:44px; height:5px; margin-left:-22px; background:#888; border-radius:3px; }
#sheet h4 { margin:2px 0 4px; font-size:14px; color:var(--accent); font-weight:600; }
#sheet p { margin:3px 0; font-size:14px; line-height:1.35; }
#sheet .small { font-size:12px; opacity:.85; }
.row { display:flex; gap:8px; align-items:center; margin:8px 0 2px; }
.row .btn { flex:1; padding:8px 4px; font-size:14px; }
.row.wrap { flex-wrap:wrap; }
.row.chips .btn { flex:0 0 auto; min-height:44px; padding:6px 10px; font-size:13px; }
.row.chips { overflow-x:auto; padding-bottom:2px; }
input[type=range] { accent-color: var(--accent); }
#scrub { flex:1; height:36px; }
.detail { display:none; } #sheet.open .detail { display:block; }
.timeline-label { font-size:12px; opacity:.9; }
.grid3 { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:8px 0; }
.grid3 .btn { padding:6px 2px; font-size:14px; }
.result { margin:6px 0; font-size:14px; color:var(--accent); font-weight:600; }
.warnbox { background:#400d; border:1px solid #f66; border-radius:8px; padding:6px 8px; font-size:12px; color:#fcc; margin:6px 0; }

#settings { position:fixed; inset:0; background:#000f; z-index:20; overflow-y:auto; padding:calc(10px + env(safe-area-inset-top)) 14px 40px; }
#settings header { display:flex; justify-content:space-between; align-items:center; }
#settings h2 { margin:6px 0; font-size:20px; }
#settings h3 { margin:18px 0 6px; font-size:14px; color:var(--accent); text-transform:uppercase; letter-spacing:.04em; }
.srow { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 0; border-bottom:1px solid #333; }
.srow input[type=number], .srow input[type=text], .srow select { background:#111; color:var(--fg); border:1px solid var(--btnline); border-radius:8px; padding:8px; font-size:15px; width:110px; }
.srow input[type=checkbox] { width:24px; height:24px; accent-color: var(--accent); }
.note { font-size:12px; opacity:.85; margin:4px 0; line-height:1.4; }

#splash { position:fixed; inset:0; background:#000e; z-index:30; display:flex; align-items:center; justify-content:center; padding:20px; }
.splash-card { max-width:420px; text-align:left; }
.splash-card h1 { margin:0 0 6px; font-size:28px; color:var(--accent); }
.reasons { padding-left:20px; line-height:1.5; }
.safe { font-size:13px; color:var(--amber); }
#modal { position:fixed; inset:0; background:#000a; z-index:40; display:flex; align-items:center; justify-content:center; padding:20px; }
.modal-card { background:#111; border:1px solid var(--btnline); border-radius:16px; padding:16px; max-width:420px; width:100%; }
#modal-buttons { display:flex; gap:10px; margin-top:14px; } #modal-buttons .btn { flex:1; }
[hidden] { display:none !important; }

@media (orientation: landscape) and (max-height: 520px) {
  #sheet:not(.open) #r-head, #sheet:not(.open) #r-summary, #sheet:not(.open) #r-sunsum { display:none; }
  #sheet { max-height:88vh; padding-bottom:calc(6px + env(safe-area-inset-bottom)); }
  .grab { height:18px; } .grab::after { top:7px; }
  .btn { min-height:42px; padding:4px 10px; }
  .row { margin:4px 0; }
  #sunwarn { top:calc(56px + env(safe-area-inset-top)); }
  #banner { top:calc(8px + env(safe-area-inset-top)); }
  #diag { top:calc(52px + env(safe-area-inset-top)); }
}

.row .btn.grow { flex:1.2; } .row .btn.fixed76 { flex:0 0 76px; }
