:root {
  --bg: #ecebe8;
  --ink: #111214;
  --mute: #8b8d92;
  --line: #e7e5e1;
  --accent: #ff6a2b;
  --sheet: #ffffff;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#fade { position: fixed; inset: 0; background: #f4f3f0; opacity: 0; pointer-events: none; transition: opacity .32s ease; }
#fade.on { opacity: 1; }

#top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 12px; align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px; pointer-events: none; transition: color .4s; }
#top > * { pointer-events: auto; }
#top h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
#top p { margin: 2px 0 0; font-size: 10.5px; color: var(--mute); letter-spacing: .02em; }
body.dark #top { color: #fff; }
body.dark #top p { color: rgba(255,255,255,.6); }

.round { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 1px 6px rgba(0,0,0,.1); }
.round:active { transform: scale(.94); }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 480px; background: var(--sheet);
  border-radius: 22px 22px 0 0; padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.08); }
.sheet h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.sheet p { margin: 3px 0 0; font-size: 12px; color: var(--mute); }

.legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; color: #5d5f64; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.free { background: #b9c1cc; } .sw.taken { background: #e4e2de; } .sw.sel { background: var(--accent); }

.row { display: flex; justify-content: space-between; align-items: center; }
.clock { display: flex; align-items: baseline; gap: 8px; }
#clock { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
#phase { font-style: normal; font-size: 11px; color: var(--mute); }
#play { background: #f1f0ed; box-shadow: none; }
#headline { margin-top: 6px; }
#subline { display: flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #9cc0ea; flex: none; transition: background .3s; }

#timeline { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 6px 0 0; background: transparent; cursor: pointer; touch-action: none; }
#timeline::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
  background: var(--track, #d9d7d2); }
#timeline::-moz-range-track { height: 4px; border-radius: 2px;
  background: var(--track, #d9d7d2); }
#timeline::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 1px solid #d9d7d2; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
#timeline::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid #d9d7d2; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.ticks { display: flex; justify-content: space-between; font-size: 9px; color: #a9abb0; letter-spacing: .03em; margin-top: -2px; }

.chips { display: flex; gap: 6px; margin-top: 10px; background: #f1f0ed; border-radius: 12px; padding: 3px; }
.chips button { flex: 1; border: 0; background: transparent; padding: 7px 0; border-radius: 9px; font: inherit; font-size: 13px; color: #5d5f64; cursor: pointer; }
.chips button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.tags { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.tags::-webkit-scrollbar { display: none; }
.tags span { white-space: nowrap; flex: none; }
.tags span { font-size: 11px; padding: 4px 9px; border-radius: 20px; background: #f6f5f2; color: #5d5f64; }
.tags span.warn { background: #fff0e8; color: #c2470f; }

.cta { width: 100%; margin-top: 10px; border: 0; border-radius: 24px; height: 46px; background: var(--ink); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .25s, transform .1s; }
.cta small { font-weight: 400; opacity: .6; margin-left: 6px; font-size: 12px; }
.cta:active { transform: scale(.985); }
.cta.done { background: var(--accent); }

#shadeCtl { position: fixed; right: 12px; top: calc(74px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 10px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
#shadeTrack { position: relative; width: 30px; height: 120px; border-radius: 17px; background: rgba(255,255,255,.28);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); touch-action: none; cursor: ns-resize; overflow: hidden;
  border: 1px solid rgba(255,255,255,.4); }
#shadeFill { position: absolute; left: 0; right: 0; top: 0; height: 0; background: rgba(255,255,255,.75); }
#shadeKnob { position: absolute; left: 6px; right: 6px; top: 6px; height: 5px; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }

#hint, #toast { position: fixed; left: 50%; transform: translateX(-50%); font-size: 12px; padding: 7px 13px; border-radius: 20px;
  background: rgba(17,18,20,.78); color: #fff; pointer-events: none; white-space: nowrap; transition: opacity .4s; }
#hint { top: calc(72px + env(safe-area-inset-top)); }
#hint.off { opacity: 0; }
#toast { top: calc(72px + env(safe-area-inset-top)); opacity: 0; }
#toast.on { opacity: 1; }

@media (min-width: 800px) {
  .sheet { left: 20px; right: auto; bottom: 20px; width: 380px; border-radius: 22px; }
}

.link { margin-left: auto; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

#entry { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background: rgba(236,235,232,.72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); overflow-y: auto; }
#entry .card { width: 100%; max-width: 380px; background: #fff; color: var(--ink); border-radius: 24px; padding: 24px 22px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.14); }
#entry .eyebrow { margin: 0 0 10px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
#entry h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
#entry p { margin: 6px 0 0; font-size: 13px; color: var(--mute); }
#entryForm { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 18px; }
#flightNo { grid-column: 1 / -1; }
#flightDate { min-width: 0; height: 46px; border-radius: 14px; border: 1.5px solid var(--line); background: #faf9f7; color: var(--ink); padding: 0 12px; font: inherit; font-size: 14px; outline: none; }
#flightDate:focus { border-color: var(--ink); }
#entryForm button:disabled { opacity: .6; cursor: default; }
#flightNo { flex: 1; min-width: 0; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: #faf9f7; color: var(--ink);
  padding: 0 14px; font-size: 20px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; outline: none; }
#flightNo::placeholder { color: #c5c6c9; }
#flightNo:focus { border-color: var(--ink); }
#entryForm button { height: 46px; padding: 0 22px; border: 0; border-radius: 14px; background: var(--ink); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; }
#entry #entryErr { color: #c2470f; min-height: 18px; font-size: 12px; }
#entry .label { margin-top: 10px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
#samples { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#samples button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: #f6f5f2; color: var(--ink);
  border-radius: 12px; padding: 11px 14px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
#samples button:hover { background: #efeeea; }
#samples b { font-weight: 600; }
#samples span { flex: 1; color: #5d5f64; }
#samples em { font-style: normal; font-size: 12px; color: var(--mute); }
#entry .note { margin-top: 14px; font-size: 11px; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
