:root {
  --bg: #05070f;
  --panel: rgba(11, 17, 32, 0.74);
  --panel-solid: #0a0f1e;
  --stroke: rgba(120, 160, 220, 0.16);
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --text: #e8eefc;
  --muted: #8aa0c6;
  --live: #34d399;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}

#globe { position: fixed; inset: 0; z-index: 0; }
#vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 78% 30%, rgba(56,189,248,0.10), transparent 60%),
    radial-gradient(80% 90% at 0% 100%, rgba(3,6,16,0.85), transparent 55%),
    linear-gradient(180deg, rgba(3,6,16,0.55), transparent 22%);
}

/* ---- top bar ---- */
#topbar {
  position: fixed; z-index: 4; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: linear-gradient(180deg, rgba(3,6,16,0.72), transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: radial-gradient(120% 120% at 30% 20%, rgba(56,189,248,0.16), #0b1120);
  border: 1px solid rgba(56,189,248,0.3); box-shadow: 0 6px 24px rgba(56,189,248,0.22);
}
.brand-mark svg { display: block; }
.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: 4px; font-weight: 800; }
.brand-text p { margin: 1px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.top-controls { display: flex; align-items: center; gap: 10px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  height: 36px; padding: 0 13px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--panel); color: var(--muted); border: 1px solid var(--stroke);
  backdrop-filter: blur(12px); transition: all 0.15s;
}
.pill-btn .i { font-size: 15px; line-height: 1; }
.pill-btn.active { color: #04121f; background: linear-gradient(140deg, var(--accent), var(--accent-2)); border-color: transparent; }
.pill-btn.active .i { animation: spin 3.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.seg-toggle {
  display: inline-flex; align-items: center; height: 36px; padding: 0 3px; border-radius: 10px; gap: 2px;
  background: var(--panel); border: 1px solid var(--stroke); backdrop-filter: blur(12px);
}
.seg-toggle .seg {
  display: inline-flex; align-items: center; height: 28px; background: transparent; border: none; cursor: pointer; color: var(--muted);
  font-size: 13px; font-weight: 700; padding: 0 11px; border-radius: 8px; letter-spacing: 0.5px;
}
.seg-toggle .seg.on { color: #04121f; background: linear-gradient(140deg, var(--accent), var(--accent-2)); }

/* circular avatar (photo over a colored initials fallback) */
.avatar { position: relative; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; color: #fff; font-weight: 800; }
.avatar .ini { font-size: 0.42em; letter-spacing: 0.5px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: 26px; }
.avatar.lg { width: 56px; height: 56px; font-size: 56px; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* custom searchable person dropdown */
.celeb-dd { position: relative; }
.celeb-dd-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 5px;
  background: var(--panel); color: var(--text); border: 1px solid var(--stroke); border-radius: 10px;
  cursor: pointer; font-size: 14px; font-weight: 600; backdrop-filter: blur(12px); max-width: 52vw;
}
.celeb-dd-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.celeb-dd-btn .chev { color: var(--muted); font-size: 11px; }
.celeb-dd-panel {
  position: absolute; top: 44px; right: 0; width: 320px; max-width: 86vw; max-height: 60vh;
  display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--stroke);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,0.6); overflow: hidden; z-index: 20;
}
#celebSearch {
  margin: 10px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04); color: var(--text); font-size: 14px; outline: none;
}
#celebSearch:focus { border-color: rgba(56,189,248,0.5); }
.celeb-results { list-style: none; margin: 0; padding: 0 6px 8px; overflow-y: auto; }
.celeb-results::-webkit-scrollbar { width: 6px; }
.celeb-results::-webkit-scrollbar-thumb { background: rgba(120,160,220,0.25); border-radius: 3px; }
.celeb-results li {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer;
}
.celeb-results li:hover, .celeb-results li.hi { background: rgba(56,189,248,0.1); }
.celeb-results .cr-name { font-weight: 600; font-size: 14px; }
.celeb-results .cr-role { font-size: 11px; color: var(--muted); }
.celeb-results .cat-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; flex: none; }
.celeb-results .cr-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

.celeb-head-top { display: flex; align-items: center; gap: 14px; }
.celeb-head-name { min-width: 0; }

/* search lives in the panel (both desktop + mobile); header dropdown removed */
#celebDDBtn { display: none; }
#celebDD { position: absolute; }
.mobile-search-btn {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-end;
  position: sticky; top: 0; z-index: 6;
  padding: 7px 13px; border-radius: 10px; cursor: pointer;
  background: var(--panel); color: var(--accent); border: 1px solid var(--stroke);
  font-size: 13px; font-weight: 600; backdrop-filter: blur(12px); transition: border-color 0.15s;
}
.mobile-search-btn:hover { border-color: rgba(56,189,248,0.5); background: rgba(56,189,248,0.08); }
#celebDDPanel { position: fixed; top: 86px; left: 20px; width: 372px; max-width: 86vw; max-height: 70vh; z-index: 50; }

/* ---- panel ---- */
#panel {
  position: fixed; z-index: 3; top: 86px; left: 20px; bottom: 54px; width: 372px; max-width: calc(100vw - 40px);
  display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--stroke);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5); overflow: hidden;
}
.sheet-handle { display: none; }

.live-badge {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--live); background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.35);
}
.live-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(52,211,153,0.6);} 70%{box-shadow:0 0 0 9px rgba(52,211,153,0);} 100%{box-shadow:0 0 0 0 rgba(52,211,153,0);} }

.celeb-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.celeb-head .role { margin-top: 3px; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.celeb-head .blurb { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.dataspan {
  margin-top: 10px; padding: 8px 11px; border-radius: 10px; font-size: 11.5px; line-height: 1.5;
  color: #b9c8e6; background: rgba(56,189,248,0.07); border: 1px solid var(--stroke);
}
.dataspan b { color: var(--text); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { padding: 12px; border-radius: 14px; background: linear-gradient(160deg, rgba(56,189,248,0.08), rgba(255,255,255,0.02)); border: 1px solid var(--stroke); }
.stat .n { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.stat .n small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-top: 2px; }

.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.count { color: var(--accent); font-weight: 700; }
.ghost-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--accent); border: 1px solid var(--stroke); border-radius: 9px; padding: 6px 11px; font-size: 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.ghost-btn svg { display: block; }
.ghost-btn:hover { background: rgba(56,189,248,0.1); }

.filter-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  color: var(--text); background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.4);
}
.filter-chip button { background: transparent; border: none; color: var(--accent); font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1; }

.flight-list { list-style: none; margin: 0; padding: 2px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.flight-list::-webkit-scrollbar { width: 6px; }
.flight-list::-webkit-scrollbar-thumb { background: rgba(120,160,220,0.25); border-radius: 3px; }
.flight-list .empty { color: var(--muted); font-size: 13px; padding: 14px 4px; text-align: center; }
.flight { padding: 11px 12px; border-radius: 13px; cursor: pointer; background: rgba(255,255,255,0.02); border: 1px solid transparent; transition: background 0.15s, border-color 0.15s; }
.flight:hover { background: rgba(56,189,248,0.07); }
.flight.active { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.55); }
.flight .route { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.flight .route .arrow { color: var(--accent); }
.flight .iata { color: var(--muted); font-weight: 600; font-size: 11px; }
.flight .meta { margin-top: 5px; display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.flight .label { margin-top: 4px; font-size: 12px; color: #b9c8e6; }
.flight .tag-live { color: var(--live); font-weight: 700; }
.flight .tag-reported { color: var(--muted); }

/* ---- calendar ---- */
.calendar { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; }
.cal-nav button { background: rgba(255,255,255,0.03); border: 1px solid var(--stroke); color: var(--text); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.cal-nav button:hover { background: rgba(56,189,248,0.12); }
.cal-nav button:disabled { opacity: 0.3; cursor: default; }
.cal-title { font-size: 14px; font-weight: 700; letter-spacing: 0.4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; touch-action: none; }
.cal-dow { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center;
  border-radius: 9px; font-size: 13px; color: #5f739a; border: 1px solid transparent; user-select: none;
}
.cal-day[data-date] { cursor: pointer; }
.cal-day[data-date]:hover { background: rgba(56,189,248,0.1); }
.cal-day.has { color: var(--text); background: rgba(255,255,255,0.04); }
.cal-day .fdot { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px rgba(56,189,248,0.8); }
.cal-day.sel { background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #04121f; border-color: transparent; }
.cal-day.sel .fdot { background: #04121f; box-shadow: none; }
.cal-day.inrange { background: rgba(56,189,248,0.22); color: var(--text); }
.cal-empty { aspect-ratio: 1 / 1; }
.cal-help { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.5; }

.disclaimer { font-size: 10px; line-height: 1.5; color: #5f739a; }
.disclaimer p { margin: 0 0 6px; }
.disclaimer a { color: var(--muted); }
.disclaimer .removal-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.disclaimer .removal-link:hover { text-decoration: underline; }

/* desktop: full-width footer bar across the page bottom; hide the in-sheet copy */
#sheetfooter { display: none; }
#deskfooter {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 3;
  padding: 9px 22px; text-align: center; color: #6b7ea6;
  background: linear-gradient(0deg, rgba(3,6,16,0.94), rgba(3,6,16,0.5));
  border-top: 1px solid var(--stroke); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
#deskfooter .removal-link { margin-left: 6px; }

.hint {
  position: fixed; z-index: 4; bottom: 56px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--muted); background: rgba(3,6,16,0.5); padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--stroke); backdrop-filter: blur(8px); pointer-events: none;
}
.hidden { display: none !important; }

/* ---- mobile: globe top, scrollable sheet bottom ---- */
@media (max-width: 760px) {
  #globe { position: fixed; top: 0; left: 0; right: 0; height: 48vh; bottom: auto; }
  #vignette { height: 48vh; bottom: auto; }
  #topbar { padding: 12px 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-text h1 { font-size: 15px; letter-spacing: 3px; }
  .brand-text p { display: none; }
  .pill-btn .t { display: none; }
  .pill-btn { padding: 0 10px; }
  .top-controls { gap: 7px; }
  .seg-toggle .seg { padding: 5px 8px; font-size: 12px; }
  .brand { gap: 9px; }

  #panel {
    top: 45vh; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%;
    border-radius: 22px 22px 0 0; padding: 8px 18px 20px; gap: 12px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    box-shadow: 0 -18px 50px rgba(0,0,0,0.6);
    transition: top 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #panel.expanded { top: 58px; }
  #panel.dragging { transition: none; }
  /* full-width grab zone at the top of the sheet; drag it to expand/collapse */
  .sheet-handle {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 22px; margin: -2px 0 4px; flex: none;
    touch-action: none; cursor: grab; position: sticky; top: 0; z-index: 7;
  }
  .sheet-handle::before { content: ''; width: 44px; height: 4px; border-radius: 3px; background: rgba(160,190,230,0.4); }
  #deskfooter { display: none; }
  #sheetfooter { display: block; }
  .flight-list, .calendar { overflow: visible; flex: none; }
  .flight-list { max-height: none; }
  .hint { display: none; }
  .stats { gap: 8px; }

  /* full-width overlay for the search panel on phones */
  #celebDDPanel { top: 12px; left: 12px; right: 12px; width: auto; max-width: none; max-height: 72vh; }
  .mobile-search-btn { margin-top: -2px; }
}
