:root {
  --bg: #0b1026;
  --bg-2: #141b3d;
  --card: #1a2250;
  --line: #2c3670;
  --text: #f4f1ea;
  --muted: #a4abd0;
  --gold: #ffd166;
  --pink: #ff8fab;
  --green: #06d6a0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #26306e 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }

main#app { max-width: 760px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
section { margin-top: 32px; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 32px 24px; }
.login-card h1 { font-size: 1.9rem; }
.login-card p { color: var(--muted); margin: 8px 0 20px; }
.rings { font-size: 2rem; margin-bottom: 8px; }
form { display: grid; gap: 10px; }
input, button { font: inherit; border-radius: 14px; padding: 14px 16px; border: 1px solid var(--line); }
input { background: var(--bg); color: var(--text); text-align: center; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button { background: var(--gold); color: #2a1e00; font-weight: 700; border-color: transparent; cursor: pointer; }
button:disabled { opacity: .6; }
.error { color: var(--pink); min-height: 1.4em; margin: 12px 0 0 !important; }

/* Hero */
.hero { text-align: center; padding: 36px 0 8px; }
.eyebrow { color: var(--gold); letter-spacing: .12em; text-transform: uppercase; font-size: .75rem; margin: 0 0 6px; }
.hero h1 { font-size: clamp(2rem, 8vw, 3rem); }
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 18px; font-variant-numeric: tabular-nums; }
.countdown div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 0; width: 70px; }
.countdown b { display: block; font-size: 1.6rem; line-height: 1.1; }
.countdown span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.countdown .done { width: auto; padding: 14px 22px; font-size: 1.2rem; }

/* Mapa */
.map-wrap { margin-top: 24px; background: linear-gradient(180deg, #101843, #0d1335); border: 1px solid var(--line); border-radius: 24px; padding: 8px; }
#map { display: block; width: 100%; height: auto; }
.land { fill: #222c63; stroke: #3b4790; stroke-width: 1.5; stroke-linejoin: round; }
.route { fill: none; stroke: #5562b3; stroke-width: 1.5; stroke-dasharray: 4 6; }
.route.live { stroke: var(--gold); stroke-dasharray: none; opacity: .5; }
.airport circle { fill: var(--text); }
.airport text, .plane text { fill: var(--text); font-size: calc(27px * var(--s, 1)); font-weight: 600; paint-order: stroke; stroke: #0d1335; stroke-width: calc(6px * var(--s, 1)); }
.land.usa { fill: #1a2352; stroke: #2f3a7c; }
.airport.dest circle { fill: var(--pink); }
.pulse { fill: none; stroke: var(--pink); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
.plane path { stroke: #0d1335; stroke-width: 1; }
.plane.boarding path { animation: blink 1.2s ease-in-out infinite; }
.map-note { text-align: center; color: var(--muted); font-size: .9rem; margin: 4px 0 8px; }

@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
@keyframes blink { 50% { opacity: .35; } }

/* Personas */
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .9rem; }
.person::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); opacity: .45; }
.person.here { color: var(--text); border-color: var(--c); }
.person.here::before { opacity: 1; }
.person.here::after { content: "✓"; color: var(--green); font-weight: 700; }
.person.flying { color: var(--text); }
.person.flying::after { content: "✈︎"; color: var(--gold); }

/* Filtros */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin: 0 -16px 8px; padding-inline: 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; min-height: 40px; border-radius: 999px; background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Tarjetas */
.day { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 10px; }
.card.landed { opacity: .6; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.pill { flex: none; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #2c3670; color: var(--text); }
.pill.air { background: var(--gold); color: #2a1e00; }
.pill.boarding { background: var(--pink); color: #3a0716; }
.pill.landed { background: var(--green); color: #00271c; }
.leg { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
.leg b { font-size: 1.5rem; line-height: 1.1; }
.leg small { display: block; color: var(--muted); font-size: .8rem; }
.leg .end { text-align: right; }
.track { position: relative; min-width: 48px; height: 2px; background: var(--line); border-radius: 2px; }
.track i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 2px; }
.track span { position: absolute; top: 50%; translate: -50% -50%; font-size: 1rem; }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: .92rem; }
.tag { padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #101533; background: var(--c); }
.empty { color: var(--muted); }

footer { color: var(--muted); font-size: .78rem; text-align: center; margin-top: 36px; }

@media (prefers-reduced-motion: reduce) { .pulse, .plane.boarding path { animation: none; } }

/* Agregar vuelo */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.add { padding: 9px 14px; font-size: .9rem; border-radius: 999px; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.remove { margin-top: 12px; padding: 6px 12px; font-size: .8rem; border-radius: 999px; }
dialog { width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 24px; padding: 22px 20px; }
dialog::backdrop { background: rgba(5, 8, 24, .75); }
dialog form { gap: 14px; }
dialog h2 { margin: 0; }
.hint { color: var(--muted); font-size: .88rem; margin: -8px 0 0; }
label { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); min-width: 0; }
label input, select { text-align: left; width: 100%; min-width: 0; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type="date"], input[type="time"] { color-scheme: dark; }

/* Búsqueda de vuelo y estado real */
#add-manual { display: grid; gap: 14px; }
.results { display: grid; gap: 8px; }
.results:empty { display: none; }
.result { text-align: left; background: var(--bg); color: var(--text); border: 1px solid var(--gold); font-weight: 500; line-height: 1.35; }
.result small { display: block; color: var(--muted); font-weight: 400; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-weight: 400; font-size: .85rem; padding: 4px; }
.pill.canceled { background: #ff5d73; color: #2b0008; }
.live { color: var(--green); font-size: .78rem; margin-top: 8px; }
.leg s { color: var(--muted); font-size: .8rem; font-weight: 400; margin-right: 4px; }

/* Expediente clasificado */
footer .link { display: block; margin: 10px auto 0; }
.login-card .link { margin-top: 14px; }
#secret { font-family: "Courier New", Courier, monospace; }
.secret { display: grid; gap: 14px; }
.secret h2 { font-family: inherit; font-size: 1.15rem; }
.stamp { justify-self: start; margin: 0; padding: 2px 10px; border: 2px solid var(--pink); color: var(--pink); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: .75rem; rotate: -4deg; }
.scan { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .88rem; }
.scan li { animation: appear .35s ease-out both; }
.scan b { color: var(--green); }
.scan small { display: block; color: var(--muted); margin-top: 2px; }
.verdict { border-top: 1px dashed var(--line); padding-top: 12px; font-size: .9rem; animation: appear .35s ease-out both; }
.verdict p { margin: 0 0 10px; }
.verdict summary { cursor: pointer; color: var(--gold); }
.verdict ul { padding-left: 18px; color: var(--muted); }
@keyframes appear { from { opacity: 0; translate: 0 6px; } }
@media (prefers-reduced-motion: reduce) { .scan li, .verdict { animation: none; } }
