:root {
  --bg: #050810;
  --panel-bg: rgba(10, 16, 28, 0.82);
  --border: rgba(120, 160, 200, 0.18);
  --text: #e8eef5;
  --muted: #7b8ba0;
  --accent: #4fd1c5;
  --accent-dim: rgba(79, 209, 197, 0.35);
  --warn: #f6ad55;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#globe {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: grab;
  /* smooths the crossfade between wheel-event-driven opacity steps instead
     of visibly jumping between them */
  transition: opacity 0.15s linear;
}
#globe:active { cursor: grabbing; }

.ground-view {
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s linear;
}
#ground-map { width: 100%; height: 100%; }

.ground-exit {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.ground-exit.visible { opacity: 1; pointer-events: auto; }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  z-index: 10;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.markets-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  cursor: pointer;
  white-space: nowrap;
}
.markets-btn:hover { color: var(--accent); }
@media (max-width: 720px) {
  .markets-btn { display: none; }
}

.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-shadow: 0 0 20px rgba(79, 209, 197, 0.25);
}
.wordmark .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 2px var(--accent-dim);
  display: inline-block;
}

.search {
  display: flex;
  align-items: center;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  backdrop-filter: blur(10px);
  min-width: 240px;
}
.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 180px;
  font-family: inherit;
}
.search input::placeholder { color: var(--muted); }
.search button {
  background: var(--accent);
  color: #04211d;
  border: none;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search button:hover { filter: brightness(1.1); }

.suggestions {
  position: fixed;
  top: 104px;
  right: 28px;
  width: 260px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 10;
  overflow: hidden;
}
.suggestions.hidden { display: none; }
.suggestion {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.suggestion:last-child { border-bottom: none; }
.suggestion:hover { background: rgba(79, 209, 197, 0.08); }
.suggestion .s-name { color: var(--text); }
.suggestion .s-meta { color: var(--muted); font-size: 11px; margin-left: 6px; }

.markets-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(16px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.4);
  transform: translateX(0);
  transition: transform 0.25s ease;
}
.markets-drawer.hidden { transform: translateX(105%); }

.markets-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.markets-title { font-size: 15px; font-weight: 700; }
.markets-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.markets-head .panel-close { position: static; font-size: 20px; }

.markets-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 20px;
}
.market-card {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.market-card:hover { background: rgba(79, 209, 197, 0.06); }
.market-question {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 10px;
}
.market-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.market-outcome-label {
  font-size: 11px;
  color: var(--muted);
  width: 46px;
  flex-shrink: 0;
}
.market-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.market-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.market-bar-pct {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  width: 38px;
  text-align: right;
  flex-shrink: 0;
}
.market-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}
.market-location {
  display: inline-block;
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 8px;
}
.markets-empty, .markets-loading {
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.market-date-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px 0;
  flex-shrink: 0;
}
.market-date-tab {
  flex: 1;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
}
.market-date-tab:hover { color: var(--text); border-color: var(--accent-dim); }
.market-date-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #08211f;
}
@media (max-width: 640px) {
  .markets-drawer { width: 100vw; max-width: 100vw; }
}

.recent {
  position: fixed;
  bottom: 54px;
  right: 28px;
  width: 230px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 8;
  padding: 12px 0;
}
.recent.hidden { display: none; }
.recent-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 14px 8px;
}
.recent-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s ease;
}
.recent-toggle:hover { color: var(--text); }
.recent.collapsed .recent-list { display: none; }
.recent.collapsed .recent-toggle { transform: rotate(-90deg); }
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
}
.recent-item:hover { background: rgba(79, 209, 197, 0.08); }
.recent-item .r-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .r-time { color: var(--muted); font-size: 10px; flex-shrink: 0; }
@media (max-width: 640px) {
  .recent { display: none !important; }
}

.panel {
  position: fixed;
  left: 28px;
  bottom: 28px;
  width: 320px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  backdrop-filter: blur(14px);
  z-index: 10;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.panel.hidden { display: none; }

.panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.panel-close:hover { color: var(--text); }

.panel-loc { margin-bottom: 14px; padding-right: 20px; }
#panel-name { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12px; }

.street-btn {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.street-btn:hover { background: rgba(79, 209, 197, 0.1); border-color: var(--accent-dim); }

.providers {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.provider-card {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.provider-card:first-child { padding-top: 0; border-top: none; }

.provider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.provider-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.provider-status { font-size: 10px; }
.provider-status.warn { color: var(--warn); }

.provider-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.p-temp {
  font-size: 34px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.p-cond { display: flex; flex-direction: column; gap: 2px; }
.p-desc { text-transform: capitalize; font-size: 12px; }
.p-temp-small { font-size: 22px; }

.stale-badge {
  font-size: 9px;
  color: var(--warn);
  text-transform: none;
  letter-spacing: 0.02em;
}

.hko-warnings { margin-top: 10px; }
.hko-warning {
  font-size: 11px;
  line-height: 1.5;
  color: var(--warn);
  background: rgba(246, 173, 85, 0.1);
  border: 1px solid rgba(246, 173, 85, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
}
.hko-warning + .hko-warning { margin-top: 6px; }

.forecast-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-top: 4px;
}
.forecast-strip::-webkit-scrollbar { height: 4px; }
.forecast-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.fc-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  font-size: 10px;
  color: var(--muted);
}
.fc-item .fc-time { font-size: 9px; }
.fc-item .fc-temp { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }

.seventimer-strip { gap: 12px; }
.st-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}
.st-item .st-day { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); }
.st-item .st-desc { font-size: 10px; line-height: 1.3; min-height: 2.6em; }
.st-item .st-temp { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.st-item .st-wind { font-size: 9px; }

#tafmetar-card.hidden { display: none; }
#hko-card.hidden { display: none; }
.tafmetar-block { margin-top: 10px; }
.tafmetar-block:first-of-type { margin-top: 0; }
.tafmetar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.tafmetar-decoded {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}
.tafmetar-decoded.hidden { display: none; }
.tafmetar-raw {
  margin: 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.tafmetar-raw.hidden { display: none; }
.tafmetar-raw-toggle {
  display: block;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.tafmetar-raw-toggle:hover { color: var(--accent); }

.p-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}
.p-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  gap: 6px;
}
.p-label { color: var(--muted); }
.p-val { font-variant-numeric: tabular-nums; }

.hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
  z-index: 5;
  pointer-events: none;
}

/* AI market-analysis button — deliberately loud. User-triggered only, so it
   only needs to earn one click; the pulsing aura is the whole point, no
   prefers-reduced-motion guard on this site by design. */
.ai-analyze-btn {
  position: fixed;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #4fd1c5, #6a5cff, #ff6ac1, #4fd1c5);
  background-size: 300% 300%;
  animation: ai-btn-gradient 4s ease infinite;
  box-shadow: 0 4px 24px rgba(106, 92, 255, 0.5);
}
.ai-analyze-btn.hidden { display: none; }
.ai-analyze-btn:hover { transform: translateX(-50%) scale(1.05); }
.ai-analyze-btn:disabled { opacity: 0.7; cursor: default; transform: translateX(-50%); }
.ai-analyze-glow {
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  z-index: -1;
  background: inherit;
  background-size: inherit;
  animation: inherit;
  filter: blur(16px);
  opacity: 0.75;
}
.ai-analyze-label { position: relative; }
@keyframes ai-btn-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.ai-analyze-result {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  width: min(420px, calc(100vw - 40px));
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 34px 16px 18px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  font-size: 13px;
  line-height: 1.5;
}
.ai-analyze-result.hidden { display: none; }
#ai-analyze-text { white-space: pre-wrap; }
.ai-analyze-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.ai-analyze-close:hover { color: var(--text); }
@media (max-width: 640px) {
  .ai-analyze-btn { display: none; }
  .ai-analyze-result { display: none; }
}
@media (max-width: 640px) {
  .hint { display: none; }
  .search input { width: 120px; }
  .panel { left: 16px; right: 16px; bottom: 16px; width: auto; }
}

.toast {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--warn);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  z-index: 20;
  backdrop-filter: blur(10px);
}
.toast.hidden { display: none; }

.credit {
  position: fixed;
  bottom: 10px;
  right: 14px;
  font-size: 9px;
  color: rgba(123, 139, 160, 0.6);
  letter-spacing: 0.01em;
  z-index: 5;
  pointer-events: auto;
}
.credit a { color: rgba(123, 139, 160, 0.75); }
.credit a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .credit { display: none; }
}

.pulse {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
}

/* first-visit welcome flow — localStorage-gated, see app.js */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(6px);
  animation: welcome-fade-in 0.3s ease;
}
.welcome-overlay.hidden { display: none; }
@keyframes welcome-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.welcome-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 38px 30px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.65), 0 0 120px rgba(106, 92, 255, 0.12);
  animation: welcome-pop-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes welcome-pop-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.welcome-skip {
  position: absolute;
  top: 20px;
  right: 22px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.welcome-skip:hover { color: var(--text); }

.welcome-step.hidden { display: none; }
.welcome-icon {
  font-size: 56px;
  text-align: center;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 24px rgba(79, 209, 197, 0.45));
  animation: welcome-icon-float 3s ease-in-out infinite;
}
@keyframes welcome-icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.welcome-step h2 {
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #4fd1c5, #6a5cff 55%, #ff6ac1);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ai-btn-gradient 6s ease infinite;
}
.welcome-step p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}
.welcome-step p strong { color: var(--text); font-weight: 700; }
.welcome-step ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.welcome-step ul li {
  position: relative;
  padding: 0 0 14px 26px;
}
.welcome-step ul li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 13px;
}
.welcome-step ul strong { color: var(--text); font-weight: 700; }

.welcome-badge {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(106, 92, 255, 0.08);
  border: 1px solid rgba(106, 92, 255, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
}

.welcome-credits-intro { font-size: 14.5px; }
.welcome-credits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 10px 0 20px;
}
.welcome-credits span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
}
.welcome-donate {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: #04211d;
  background: linear-gradient(135deg, #ffd76a, #ffb347);
  border-radius: 999px;
  padding: 13px 20px;
  margin-bottom: 16px;
  animation: welcome-donate-pulse 2.2s ease infinite;
}
@keyframes welcome-donate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 183, 71, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 183, 71, 0); }
}

.welcome-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 28px 0 22px;
}
.welcome-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s ease, transform 0.2s ease;
}
.welcome-dot.active { background: var(--accent); transform: scale(1.35); }

.welcome-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.welcome-nav .welcome-btn-secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
}
.welcome-nav .welcome-btn-secondary:hover { color: var(--text); border-color: var(--accent-dim); }
.welcome-nav .welcome-btn-secondary.hidden { visibility: hidden; }
.welcome-nav .welcome-btn-primary {
  flex: 1;
  background: var(--accent);
  color: #04211d;
  border: none;
  font-size: 15.5px;
  font-weight: 700;
  padding: 13px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.welcome-nav .welcome-btn-primary:hover { filter: brightness(1.08); }
