:root {
  --night: #0b1628;
  --night-2: #12223b;
  --panel: rgba(18, 34, 59, 0.86);
  --line: #2a4166;
  --text: #e9eef7;
  --muted: #93a4bf;
  --amber: #ffb347;
  --green: #3ddc84;
  --red: #ff5a5f;
  --xmas: #e23d3d;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -10%, #1d3a66 0%, transparent 60%),
    linear-gradient(var(--night), var(--night-2));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 16px);
  overflow-x: hidden;
}

/* ---------- falling snow ---------- */
.snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 120px 80px, #fff8, transparent),
    radial-gradient(2.5px 2.5px at 200px 150px, #fffa, transparent),
    radial-gradient(1.5px 1.5px at 280px 40px, #fff7, transparent),
    radial-gradient(2px 2px at 340px 200px, #fff9, transparent);
  background-size: 360px 240px;
  animation: snow 14s linear infinite;
}
@keyframes snow { to { background-position: 40px 240px, -30px 240px, 20px 240px, -10px 240px, 30px 240px; } }

/* ---------- hero ---------- */
.hero, main, footer { position: relative; z-index: 1; width: 100%; max-width: 520px; }

.hero { text-align: center; padding: 28px 0 8px; }

.atis {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  color: var(--green); margin: 0 0 10px;
}

h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); margin: 0 0 18px; line-height: 1.1; }
h1 .plane { display: inline-block; color: var(--amber); transform: rotate(-20deg); }
h1 .year { color: var(--xmas); }

.strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #0a1424; font-family: var(--mono);
}
.strip div { padding: 10px 6px; }
.strip div + div { border-left: 1px dashed var(--line); }
.strip dt { font-size: 0.65rem; color: var(--muted); letter-spacing: 0.15em; }
.strip dd { margin: 4px 0 0; font-size: 1.05rem; color: var(--amber); font-weight: 700; }

.wx {
  margin: 14px 0 0; padding: 10px 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: #0a1424;
  font-family: var(--mono); font-size: 0.9rem; line-height: 1.45;
}
.wx-line { margin: 0; color: var(--text); word-break: break-word; }
.wx-line + .wx-line { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.wx-tag { color: var(--green); font-weight: 700; margin-right: 4px; }
.wx-line b { color: var(--xmas); }

/* ---------- panels ---------- */
.panel {
  margin-top: 20px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 50px #0007; backdrop-filter: blur(6px);
}
.panel h2 { margin: 0 0 6px; font-size: 1.25rem; }
.panel p { margin: 0 0 14px; color: var(--muted); }

.field { display: block; margin-bottom: 16px; }
.field span {
  display: block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
input, select {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--text);
  background: #0a1424; border: 1px solid var(--line); border-radius: 10px; padding: 13px 12px;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--amber) 50%), linear-gradient(135deg, var(--amber) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
#code { font-family: var(--mono); letter-spacing: 0.2em; text-transform: uppercase; }
input:focus, select:focus { outline: 2px solid var(--amber); outline-offset: 1px; }

.error { color: var(--red) !important; }

/* ---------- file picker ---------- */
.picker {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 12px; margin-bottom: 14px; cursor: pointer; text-align: center;
  border: 2px dashed var(--amber); border-radius: 14px; background: #ffb3470d;
}
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.picker-icon { font-size: 2rem; }
.picker-text { font-weight: 700; font-size: 1.05rem; }
.picker-hint { font-size: 0.8rem; color: var(--muted); }
.picker:focus-within { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- queue ---------- */
.queue { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.queue li {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 12px; background: #0a1424; border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.9rem;
}
.queue .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .state { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.queue .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: #1b2c47; overflow: hidden; }
.queue .bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 0.2s; }
.queue li.done .bar i { background: var(--green); }
.queue li.done .state { color: var(--green); }
.queue li.failed .bar i { background: var(--red); width: 100%; }
.queue li.failed .state { color: var(--red); }

/* ---------- buttons ---------- */
.btn {
  width: 100%; font: inherit; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.04em;
  padding: 15px; border: 0; border-radius: 12px; cursor: pointer;
  color: #1a1100; background: var(--amber);
  display: inline-flex; justify-content: center; align-items: center; gap: 10px;
  text-transform: uppercase;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-go { background: var(--green); color: #002611; }
.btn .light { width: 10px; height: 10px; border-radius: 50%; background: #002611; box-shadow: 0 0 0 2px #0026114d; }
.btn-go.busy .light { animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { background: var(--red); } }

.keep-open { color: var(--amber) !important; font-size: 0.9rem; text-align: center; }

.summary { margin: 14px 0 0 !important; text-align: center; color: var(--green) !important; font-weight: 700; }

/* ---------- runway lights ---------- */
.runway {
  position: relative; z-index: 1; width: 100%; max-width: 520px;
  display: flex; justify-content: space-between; padding: 28px 8px 10px;
}
.runway i {
  width: 8px; height: 8px; border-radius: 50%; background: #fff3c4;
  box-shadow: 0 0 10px 3px #ffd56a99; animation: rabbit 2s infinite;
}
.runway i:nth-child(odd) { background: #ff6b6b; box-shadow: 0 0 10px 3px #ff6b6b88; }
.runway i:nth-child(even) { background: #6bff9a; box-shadow: 0 0 10px 3px #6bff9a88; }
.runway i:nth-child(1) { animation-delay: 0s; } .runway i:nth-child(2) { animation-delay: .2s; }
.runway i:nth-child(3) { animation-delay: .4s; } .runway i:nth-child(4) { animation-delay: .6s; }
.runway i:nth-child(5) { animation-delay: .8s; } .runway i:nth-child(6) { animation-delay: 1s; }
.runway i:nth-child(7) { animation-delay: 1.2s; } .runway i:nth-child(8) { animation-delay: 1.4s; }
.runway i:nth-child(9) { animation-delay: 1.6s; } .runway i:nth-child(10) { animation-delay: 1.8s; }
@keyframes rabbit { 0%, 100% { opacity: 0.35; } 10% { opacity: 1; } }

footer { text-align: center; font-size: 0.8rem; color: var(--muted); padding-bottom: 8px; }
footer a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .snow, .runway i, .btn-go.busy .light { animation: none; }
}
