/* Travel page — deliberately NOT the house brutalist style: a dark,
   flight-tracker look built around the globe. Self-contained (does not
   load ../style.css). Bump ?v= on the <link> when this changes. */

:root {
  --bg: #05070d;
  --card: #0d1220;
  --card-hi: #131a2c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef1f7;
  --dim: #8a93a8;
  --faint: #566079;
  --blue: #7aa7ff;
  --amber: #ffb36b;
  --green: #5fd28f;
  --red: #ff7a7a;
  --radius: 18px;
  --chip: rgba(255, 255, 255, 0.08);
  --chip-hi: rgba(255, 255, 255, 0.14);
  --hero-glow: #0d1730;
  --tip-bg: rgba(13, 18, 32, 0.92);
  --dash: rgba(255, 255, 255, 0.14);
  --notes: #c9cfdc;
  --track: rgba(255, 255, 255, 0.07);
  --tick: rgba(255, 255, 255, 0.35);
  --sample-text: #ffd2a6;
  --ok-text: #bdeccf;
  --bad-text: #ffc9c9;
  --on-blue: #061026;
  --shadow: rgba(0, 0, 0, 0.6);
  --backdrop: rgba(2, 4, 10, 0.6);
  --port: #ffe2c2;
  --route: rgba(255, 179, 107, 0.78);
  --route-sel: #ffc48a;
  --route-arrow: #fff4e6;
  color-scheme: dark;
}
/* Light theme (toggle in the top bar; dark is the default). */
:root[data-theme="light"] {
  --bg: #eef2f7;
  --card: #ffffff;
  --card-hi: #f5f8fc;
  --line: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --dim: #4b5568;
  --faint: #8a94a6;
  --blue: #2f6fed;
  --amber: #e8801e;
  --green: #1f9d57;
  --red: #d64545;
  --chip: rgba(255, 255, 255, 0.78);
  --chip-hi: #ffffff;
  --hero-glow: #d7e4f8;
  --tip-bg: rgba(255, 255, 255, 0.96);
  --dash: rgba(15, 23, 42, 0.18);
  --notes: #334155;
  --track: rgba(15, 23, 42, 0.08);
  --tick: rgba(15, 23, 42, 0.3);
  --sample-text: #8a4a0c;
  --ok-text: #14683a;
  --bad-text: #a32828;
  --on-blue: #ffffff;
  --shadow: rgba(15, 23, 42, 0.18);
  --backdrop: rgba(15, 23, 42, 0.35);
  --port: #ffffff;
  --route: rgba(232, 128, 30, 0.92);
  --route-sel: #f07a12;
  --route-arrow: #6b3203;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* --- top bar --- */
.bar {
  position: absolute; z-index: 5; inset: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.back { color: var(--dim); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }
.lock {
  background: var(--chip); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; font-size: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lock:hover, .chip-btn:hover { background: var(--chip-hi); }
.bar-right { display: flex; gap: 8px; align-items: center; }
.chip-btn {
  width: 36px; height: 36px; border-radius: 999px; padding: 0; font-size: 16px; line-height: 1;
  background: var(--chip); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lock.unlocked::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 8px; vertical-align: 1px; }

/* --- hero / globe --- */
.hero {
  position: relative;
  height: min(78vh, 820px); min-height: 440px;
  background: radial-gradient(ellipse at 50% 55%, var(--hero-glow) 0%, var(--bg) 62%);
  overflow: hidden;
}
.globe { position: absolute; inset: 0; opacity: 0; transform: scale(0.92); transition: opacity 1.2s ease, transform 1.6s cubic-bezier(.2, .8, .2, 1); }
.globe.ready { opacity: 1; transform: none; }
.globe canvas { display: block; cursor: grab; }
.globe canvas.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.globe canvas:active { cursor: grabbing; }
.hero-text { position: absolute; left: 20px; bottom: 28px; pointer-events: none; max-width: 70%; }
.eyebrow { margin: 0; color: var(--amber); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-size: clamp(28px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; }
.globe-hint { position: absolute; right: 20px; bottom: 28px; margin: 0; color: var(--faint); font-size: 12px; pointer-events: none; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 90px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }

/* globe.gl hover tooltip */
.scene-tooltip {
  background: var(--tip-bg) !important; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px !important; font: 13px/1.4 system-ui, sans-serif !important;
  color: var(--text) !important; backdrop-filter: blur(8px);
}
.tip-route { font-weight: 700; font-size: 15px; letter-spacing: 0.02em; }
.tip-sub { color: var(--dim); }

/* --- content --- */
.wrap { max-width: 980px; margin: 0 auto; padding: 8px 20px 40px; position: relative; z-index: 2; }
.sample {
  margin: 0 0 20px; padding: 10px 14px; border-radius: 12px;
  background: rgba(255, 179, 107, 0.1); border: 1px solid rgba(255, 179, 107, 0.3);
  color: var(--sample-text); font-size: 14px;
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 36px 0 14px; }
.section-head:first-of-type { margin-top: 8px; }
h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }

.units, .years { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.units button, .years button { background: none; border: 0; border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--dim); }
.units button[aria-pressed="true"], .years button[aria-pressed="true"] { background: var(--card-hi); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--dim); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2px; }
.stat .value small { font-size: 15px; font-weight: 600; color: var(--dim); margin-left: 3px; }
.stat .sub { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.stat.wide { grid-column: span 2; }
@media (max-width: 420px) { .stat.wide { grid-column: span 1; } }

/* public route list */
.routes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.routes li button {
  width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.routes li button:hover, .routes li button.active { background: var(--card-hi); border-color: rgba(122, 167, 255, 0.4); }
.route-codes { font-weight: 700; letter-spacing: 0.04em; }
.route-codes span { color: var(--faint); font-weight: 400; margin: 0 6px; }
.route-meta { color: var(--dim); font-size: 13px; text-align: right; }
.locked-note { color: var(--faint); font-size: 14px; margin: 18px 0 0; }
.link { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

/* flight log cards */
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.log-more { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.log-more:empty { display: none; }
.log-more button {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 22px; font-size: 14px; font-weight: 600;
}
.log-more button:hover { background: var(--card-hi); border-color: rgba(122, 167, 255, 0.4); }
.log-more span { color: var(--faint); font-size: 12.5px; }
.year-head { color: var(--faint); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; margin: 14px 0 -2px 4px; }
.flight {
  width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  transition: background 0.15s, border-color 0.15s;
}
.flight:hover, .flight.active { background: var(--card-hi); border-color: rgba(122, 167, 255, 0.4); }
.f-top { display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 13px; }
.f-top strong { color: var(--text); font-weight: 600; }
.f-route { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin: 10px 0 8px; }
.f-end .code { font-size: 32px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.f-end .city { color: var(--dim); font-size: 13px; margin-top: 3px; }
.f-end .time { font-size: 15px; font-weight: 600; margin-top: 2px; }
.f-end.to { text-align: right; }
.f-path { position: relative; height: 22px; }
.f-path::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--dash); }
.f-path::after { content: "✈"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); color: var(--amber); background: var(--card); padding: 0 6px; font-size: 15px; }
.flight:hover .f-path::after, .flight.active .f-path::after { background: var(--card-hi); }
.f-dur { text-align: center; color: var(--dim); font-size: 12.5px; margin-top: -2px; }
.f-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--dim); font-size: 13px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.f-meta b { color: var(--faint); font-weight: 500; margin-right: 4px; }
.f-notes { margin: 10px 0 0; color: var(--notes); font-size: 14px; font-style: italic; }
@media (max-width: 480px) {
  .hero { height: 62vh; min-height: 380px; }
  .f-end .code { font-size: 26px; }
  .globe-hint { display: none; }
}

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 20px 20px max(28px, env(safe-area-inset-bottom)); }

/* sign-in dialog */
dialog {
  border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(400px, calc(100vw - 32px));
  background: var(--card); color: var(--text); box-shadow: 0 30px 80px var(--shadow);
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); }
dialog form { padding: 22px; }
dialog h2 { margin-bottom: 6px; }
dialog p { color: var(--dim); font-size: 14px; margin: 0 0 14px; }
dialog input[type="password"] {
  width: 100%; font: inherit; padding: 11px 14px; border-radius: 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
dialog input[type="password"]:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.remember { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 14px; margin: 12px 0 0; }
.error { color: var(--red) !important; min-height: 1.5em; margin: 8px 0 0 !important; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.primary, .ghost { border-radius: 999px; padding: 8px 18px; border: 1px solid var(--line); }
.primary { background: var(--blue); color: var(--on-blue); border-color: transparent; font-weight: 600; }
.primary:disabled { opacity: 0.6; cursor: progress; }
.ghost { background: none; }

/* --- Medallion status (signed in) --- */
.mqd-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.mqd-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.mqd-total { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.mqd-total small { font-size: 16px; color: var(--dim); font-weight: 600; margin-left: 6px; }
.mqd-tier { font-size: 15px; font-weight: 600; }
.mqd-tier.made { color: var(--amber); }
.mqd-need { color: var(--dim); font-size: 14px; }
.meter { position: relative; height: 12px; border-radius: 999px; background: var(--track); margin: 18px 0 30px; }
.meter .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--amber)); }
.meter .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--tick); transform: translateX(-1px); }
.meter .tick span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.meter .tick span b { font-weight: inherit; }
.meter .tick:last-child span { left: auto; right: 0; transform: none; }
.meter .tick.reached { background: var(--amber); }
.meter .tick.reached span { color: var(--text); }
.mqd-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-top: 4px; }
.mqd-part { border-top: 1px solid var(--line); padding-top: 10px; }
.mqd-part .k { color: var(--dim); font-size: 13px; }
.mqd-part .k i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.mqd-part .v { font-size: 20px; font-weight: 700; }
.mqd-part .s { color: var(--faint); font-size: 12.5px; }
.sw-flight { background: var(--blue); } .sw-card { background: var(--amber); } .sw-head { background: var(--green); }
.check { margin-top: 14px; padding: 10px 14px; border-radius: 12px; font-size: 14px; border: 1px solid var(--line); color: var(--dim); }
.check.ok { border-color: rgba(95,210,143,0.35); background: rgba(95,210,143,0.08); color: var(--ok-text); }
.check.bad { border-color: rgba(255,122,122,0.4); background: rgba(255,122,122,0.08); color: var(--bad-text); }
.note { color: var(--faint); font-size: 13px; margin: 10px 0 0; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 130px; margin-top: 18px; }
.month { display: flex; flex-direction: column; height: 100%; min-width: 0; }
.month .stack { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.month .seg { flex: none; }
.month .stack .seg:first-child { border-radius: 4px 4px 0 0; }
.month .stack .seg:only-child, .month .stack .seg:last-child:not(:first-child) { border-radius: 0; }
.month .stack .seg:only-child { border-radius: 4px 4px 0 0; }
.month .lbl { text-align: center; font-size: 11px; color: var(--faint); margin-top: 5px; }
.month .amt { text-align: center; font-size: 10.5px; color: var(--dim); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .month .amt { display: none; }
  .mqd-total { font-size: 32px; }
  .meter .tick span b { display: none; }
  .mqd-part .v { font-size: 17px; }
}
.mqd-sub { margin: 22px 0 8px; font-size: 15px; }
table.mqd { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.mqd th { text-align: right; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.mqd td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.mqd th:first-child, table.mqd td:first-child { text-align: left; padding-left: 0; }
table.mqd td.bad { color: var(--red); } table.mqd td.ok { color: var(--green); }
details.ledger { margin-top: 14px; }
details.ledger summary { cursor: pointer; color: var(--blue); font-size: 14px; }
.table-scroll { overflow-x: auto; }

/* --- map tools (zoom, 2D/3D, North America, reset) --- */
.map-tools {
  position: absolute; z-index: 4; right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
}
.map-tools button {
  width: 40px; height: 40px; border-radius: 12px; padding: 0;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
  background: var(--chip); border: 1px solid var(--line); color: var(--text);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.map-tools button:hover { background: var(--chip-hi); }
.map-tools .mode, .map-tools .na { font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.map-tools .mode { margin-bottom: 6px; }
.map-tools .na { margin-top: 6px; }

/* --- 2D flat map --- */
.flat { position: absolute; inset: 0; }
.flat[hidden], .globe[hidden] { display: none; }
.flat svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
.flat svg:active { cursor: grabbing; }
.f-route path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.f-hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.f-line { stroke: var(--route); stroke-width: 1.8; pointer-events: none; }
.f-arrow { fill: var(--route-arrow); pointer-events: none; }
.f-route.sel .f-line { stroke: var(--route-sel); stroke-width: 3; }
.f-route.dim { opacity: 0.16; }
.f-port circle { fill: var(--port); stroke: rgba(0, 0, 0, 0.35); vector-effect: non-scaling-stroke; pointer-events: none; }
.f-port text { fill: var(--port); font-weight: 600; paint-order: stroke; stroke: rgba(0, 0, 0, 0.55); stroke-width: 3px; vector-effect: non-scaling-stroke; pointer-events: none; font-family: system-ui, sans-serif; }
.f-port.sel circle { fill: var(--amber); }
.f-port .f-pulse { fill: none; stroke: var(--amber); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: f-pulse 1.4s ease-out infinite; }
@keyframes f-pulse { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
@media (max-width: 480px) {
  .map-tools { right: 10px; }
  .map-tools button { width: 36px; height: 36px; }
}
:root[data-theme="light"] .f-line { stroke-width: 2.2; }

/* --- route popup (2D: #map-pop; 3D: globe.gl's .scene-tooltip) --- */
.map-pop {
  position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none;
  max-width: 340px; padding: 10px 12px; border-radius: 12px;
  background: var(--tip-bg); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; line-height: 1.4; box-shadow: 0 12px 32px var(--shadow);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.map-pop[hidden] { display: none; }
.scene-tooltip { max-width: 340px; }
.pop-trip { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 7px; }
.pop-date { color: var(--dim); font-size: 12px; }
.pop-path { font-weight: 700; letter-spacing: 0.03em; margin: 1px 0; }
.pop-path .hot { color: var(--amber); }
.pop-path .arr { color: var(--faint); font-weight: 400; margin: 0 4px; }
.pop-more { margin-top: 6px; }
.pop-leg { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-leg b { color: var(--text); font-weight: 600; }
.pop-leg.hot b { color: var(--amber); }
.pop-foot { font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.pop-price { color: var(--text); font-weight: 700; }
.pop-lock { margin-top: 6px; font-style: italic; }

/* --- filters (signed in) --- */
.filters { display: grid; gap: 10px; margin: 0 0 8px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filters[hidden] { display: none; }
.f-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.f-label { color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; width: 64px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 13px; color: var(--dim); }
.chips button:hover { background: var(--card-hi); color: var(--text); }
.chips button[aria-pressed="true"] { background: var(--amber); border-color: transparent; color: #1a1206; font-weight: 600; }
.chips button small { opacity: 0.7; font-size: 11px; margin-left: 2px; }
.f-summary { color: var(--dim); font-size: 13px; margin-left: auto; }
@media (max-width: 480px) { .f-label { width: 100%; } .f-summary { margin-left: 0; } }
