/* Contest Direction Planner & Propagation Forecast (web) — dark theme, matches the desktop app. */
:root {
  --bg: #0b0e14;
  --bg2: #0f1117;
  --surface: #151a23;
  --surface2: #1b2230;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.35);
  --text: #e2e8f4;
  --muted: #8a97ac;
  --accent: #22d3a0;
  --accent2: #f59e0b;
  --band-20: #60a5fa; --band-15: #22d3a0; --band-40: #f59e0b;
  --band-10: #f472b6; --band-80: #a78bfa; --band-all: #e2e8f4;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
.mono, .small.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
h1, h3 { margin: 0; font-weight: 700; }

/* ---- header ---- */
.app-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #10141d, var(--bg));
  padding: 16px 20px;
}
.hwrap { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.home {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  white-space: nowrap; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 8px; transition: color .15s, border-color .15s;
}
.home:hover { color: var(--text); border-color: var(--border-strong); }
.titleblock { flex: 1; }
.app-header h1 { font-size: clamp(20px, 3vw, 28px); }
.tag { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.lite-note { font-size: 12.5px; }
.lite-note a { color: var(--accent); font-weight: 600; text-decoration: none; }
.lite-note a:hover { text-decoration: underline; }
.cty-badge {
  font-family: ui-monospace, monospace; font-size: 11px; color: var(--accent);
  border: 1px solid rgba(34, 211, 160, 0.4); background: rgba(34, 211, 160, 0.08);
  padding: 5px 9px; border-radius: 6px; white-space: nowrap;
}

/* ---- layout ---- */
main { max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px; }
.anchor-note {
  background: rgba(96, 165, 250, 0.08); border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; font-size: 13.5px;
  color: var(--text); line-height: 1.5;
}
.anchor-note b { color: var(--band-20); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; margin-bottom: 20px;
}

/* ---- upload ---- */
.drop {
  border: 2px dashed var(--border-strong); border-radius: 12px;
  padding: 26px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(34, 211, 160, 0.05); }
.drop-icon { font-size: 34px; }
.drop p { margin: 6px 0; }
.btn-ghost {
  margin-top: 8px; background: transparent; border: 1px solid var(--border-strong);
  color: var(--text); font: inherit; font-size: 13px; padding: 7px 12px;
  border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 6px 5px 12px; font-family: ui-monospace, monospace;
}
.file-chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 50%;
}
.file-chip button:hover { color: var(--accent2); }

/* ---- contest setup ---- */
.contest-setup { margin-top: 16px; }
.contest-pick {
  display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
  max-width: 420px;
}
.contest-pick select {
  background: var(--bg2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 14px; text-transform: none;
}
.contest-pick select:focus { outline: none; border-color: var(--accent); }
.contest-info {
  margin-top: 10px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 13px;
}
.contest-info .ci-row { margin: 3px 0; }
.contest-info .ci-k {
  display: inline-block; min-width: 92px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .3px;
}
.contest-info .ok { color: var(--accent); font-weight: 600; }

/* ---- controls ---- */
.controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-top: 18px;
}
.controls label {
  display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
}
.controls input, .controls select {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; text-transform: none;
}
.controls input:focus, .controls select:focus { outline: none; border-color: var(--accent); }

/* second setup row: live-data fetch (forecast + PSK) for the QTH set above */
.controls-data {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border);
  align-items: end;
}
.controls-data .lbl-btn button { padding: 9px 14px; white-space: nowrap; }

/* divider between "what you set" and "what you get" */
.section-split {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 18px; color: var(--muted);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
}
.section-split::before, .section-split::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ---- summary ---- */
.summary { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.summary .stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 18px; display: flex; flex-direction: column; min-width: 120px;
}
.summary .num { font-size: 24px; font-weight: 700; font-family: ui-monospace, monospace; }
.summary .lbl { font-size: 12px; color: var(--muted); }
.summary .meta-line {
  flex-basis: 100%; font-size: 12.5px; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 10px;
}
.diag {
  background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.mismatch-warn {
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 18px;
  color: var(--text); line-height: 1.5;
}
.mismatch-warn b { color: var(--accent2); }
.diag .mono { font-family: ui-monospace, monospace; color: var(--accent2); }

/* ---- source layer selector ---- */
.source-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.source-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.source-tab {
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px;
  border-radius: 8px; cursor: pointer;
}
.source-tab:hover:not(.empty) { color: var(--text); border-color: var(--border-strong); }
.source-tab.active { background: var(--accent2); color: #1a1205; border-color: var(--accent2); }
.source-tab.empty { opacity: .4; cursor: default; }

/* static metric label shown for non-log layers (spots / reliability % / blend) */
.mt-static {
  font-size: 13px; font-weight: 600; color: var(--accent2);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px;
}

/* ---- metric toggle ---- */
.metric-toggle { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.mt-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.metric-toggle button {
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.metric-toggle button.active { background: var(--accent); color: #07140f; border-color: var(--accent); }

/* ---- hour slider ---- */
.hour-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hour-row input[type="range"] {
  flex: 1; max-width: 420px; accent-color: var(--accent); cursor: pointer;
}
.hour-val {
  font-family: ui-monospace, monospace; font-size: 13px; color: var(--accent);
  min-width: 72px; font-weight: 600;
}

/* ---- band tabs ---- */
.band-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.band-tab {
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--bc, #e2e8f4);
  color: var(--text); cursor: pointer; border-radius: 8px; padding: 8px 14px;
  display: flex; flex-direction: column; align-items: flex-start; font: inherit; min-width: 78px;
}
.band-tab .bl { font-size: 13px; font-weight: 600; }
.band-tab .bn { font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace; }
.band-tab.active { background: var(--surface); border-color: var(--bc, #e2e8f4); }
.band-tab.empty { opacity: .35; cursor: default; }

/* ---- compass ---- */
.compass-card { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.compass-wrap { flex: 0 0 auto; }
#compass {
  width: 460px; max-width: 100%; height: auto; border-radius: 12px;
  background: #0f1117; border: 1px solid var(--border);
}
.compass-caption { text-align: center; color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.top-panel { flex: 1; min-width: 260px; }
.hover-info {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 14px; font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); min-height: 20px;
}
.hover-info b { color: var(--band-20); }
.top-panel h3 { margin-bottom: 12px; font-size: 16px; }
.top-list { display: flex; flex-direction: column; gap: 8px; }
.top-row {
  display: grid; grid-template-columns: 34px 52px 48px 1fr auto auto;
  gap: 10px; align-items: center; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13.5px;
}
.top-row .rank { color: #07140f; font-weight: 700; text-align: center; border-radius: 6px; padding: 2px 0; font-size: 12px; }
.top-row .az { font-family: ui-monospace, monospace; font-weight: 700; }
.top-row .cn { color: var(--muted); }
.top-row .sec { color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.top-row .sc { font-family: ui-monospace, monospace; }
.top-row .pc { color: var(--accent); font-weight: 700; font-family: ui-monospace, monospace; }

/* ---- planner ---- */
.planner-card h3 { font-size: 16px; margin-bottom: 14px; }
.table-scroll { overflow-x: auto; }
table.planner { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.planner th, table.planner td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.planner th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
table.planner td.utc { font-family: ui-monospace, monospace; font-weight: 700; }
table.planner td.others { color: var(--muted); font-size: 12.5px; font-family: ui-monospace, monospace; }
table.planner tr.hour-start td { border-top: 1px solid var(--border-strong); }
table.planner tr.alt td { color: var(--muted); }
table.planner .q-good b { color: var(--accent); }
table.planner .q-mid b { color: var(--accent2); }
table.planner .q-low b { color: var(--muted); }
.pill {
  display: inline-block; color: #07140f; font-weight: 700; font-size: 11.5px;
  padding: 2px 8px; border-radius: 20px; font-family: ui-monospace, monospace;
}

/* ---- desktop download banner ---- */
.download-banner {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(34,211,160,0.08), rgba(96,165,250,0.06));
  border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px; margin-bottom: 20px;
}
.download-banner .db-text { flex: 1; min-width: 260px; font-size: 13.5px; color: var(--muted); }
.download-banner .db-text b { color: var(--text); }
.db-btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--accent); color: #07140f; font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 10px; text-decoration: none;
  transition: background .15s, transform .15s;
}
.db-btn:hover { background: #1fbf90; transform: translateY(-1px); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface2); border: 1px solid var(--border-strong); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px; max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--error); color: #fecaca; }

/* ---- footer ---- */
.app-footer {
  text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 20px; border-top: 1px solid var(--border);
}
.app-footer a { color: var(--accent); }

@media (max-width: 640px) {
  .compass-card { flex-direction: column; }
  #compass { width: 100%; }
  .top-row { grid-template-columns: 30px 46px 1fr auto; }
  .top-row .cn, .top-row .sec { display: none; }
}
