:root {
  --bg: #0f172a;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #1e293b, #020617 60%);
  min-height: 100vh;
}

.app {
  width: min(96vw, 1400px);
  margin: 0 auto;
  padding: 24px clamp(12px, 2vw, 28px) 40px;
}

h1 { margin: 0; font-size: 2rem; }
.subtitle { margin-top: 6px; color: var(--muted); }

section {
  background: color-mix(in oklab, var(--card), black 10%);
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 16px;
  margin-top: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.content-grid section {
  margin-top: 0;
}

@media (orientation: landscape) and (min-width: 900px), (min-width: 1200px) {
  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #daily,
  #modelCharts,
  #photo,
  #models {
    grid-column: 1 / -1;
  }
}

@media (orientation: landscape) and (min-width: 1400px), (min-width: 1700px) {
  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #current,
  #fun,
  #hourly,
  #foehn {
    grid-column: span 1;
  }

  #daily,
  #modelCharts,
  #photo,
  #models {
    grid-column: 1 / -1;
  }
}

.search-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #374151;
  background: #0b1220;
  color: var(--text);
  padding: 10px 12px;
}

.suggest-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid #1f2937;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
  z-index: 5;
}

.suggest-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #1f2937;
  background: transparent;
  color: var(--text);
  border-radius: 0;
  padding: 10px 12px;
  font-weight: 500;
}

.suggest-item:last-child {
  border-bottom: 0;
}

.suggest-item:hover {
  background: #1f2937;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  color: #06202c;
  background: var(--accent);
}

button.ghost {
  color: var(--text);
  background: #1f2937;
}

.status { color: var(--muted); margin: 8px 0 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.kpi {
  background: #0b1220;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 10px;
}

.kpi .label { color: var(--muted); font-size: 0.86rem; }
.kpi .value { font-size: 1.2rem; font-weight: 700; margin-top: 4px; }

.hidden { display: none; }

.hourly-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
}

.hour-item {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  background: #0b1220;
}

.daily-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #1f2937;
  font-size: 0.92rem;
}

.daily-row:last-child { border-bottom: 0; }

.fun-big {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ok);
}

small { color: var(--muted); }

.models-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.models-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.models-table th,
.models-table td {
  border-bottom: 1px solid #1f2937;
  padding: 8px 6px;
  text-align: left;
}

.models-table th {
  color: var(--muted);
  font-weight: 600;
}

.badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #0f2a1f;
  color: #86efac;
  font-size: 0.8rem;
}

.unified-calendar-classic {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: hidden;
}

.uc-head {
  padding: 8px 6px;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
  background: #0f1a30;
  border-right: 1px solid #253047;
}
.uc-head:last-child { border-right: 0; }
.uc-head.weekend { background: #132645; color: #bfdbfe; }

.uc-cell {
  min-height: 120px;
  padding: 6px;
  border-top: 1px solid #253047;
  border-right: 1px solid #253047;
  background: #0a1324;
}
.uc-cell:nth-child(7n) { border-right: 0; }
.uc-cell.weekend { background: #0b1730; }
.uc-cell.out { opacity: 0.45; }

.uc-date-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.uc-daynum { font-weight: 800; font-size: 0.95rem; }
.uc-holiday { color: #fca5a5; font-size: 0.66rem; text-align: right; }
.uc-weather { margin-top: 4px; font-size: 0.84rem; }
.uc-pop { color: var(--muted); font-size: 0.70rem; margin-top: 2px; line-height: 1.2; }
.uc-src { color: #64748b; font-size: 0.64rem; margin-top: 2px; text-transform: uppercase; }
.uc-photo { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }
.uc-photo-item { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }
.uc-photo-pct { font-size: 0.58rem; color: #94a3b8; line-height: 1; }
.uc-chip { font-size: 0.66rem; border: 1px solid #334155; border-radius: 999px; padding: 0 5px; }
.uc-chip-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-color: color-mix(in oklab, var(--chip), #334155 45%);
  background: color-mix(in oklab, var(--chip), #0a1324 70%);
  font-size: 12px;
}
.uc-none { color: #64748b; font-size: 0.8rem; }

@media (max-width: 1000px) {
  .unified-calendar-classic {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border-radius: 10px;
    border: 1px solid #334155;
  }
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.photo-item {
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 10px;
  background: #0b1220;
}

.photo-item .title {
  color: var(--muted);
  font-size: 0.85rem;
}

.photo-item .score {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 4px;
}

.phenomena-stack {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.phenomenon-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #253047;
  border-radius: 10px;
  background: #0a1324;
}

.phenomenon-main {
  font-size: 1.02rem;
  font-weight: 700;
}

.phenomenon-prob {
  font-size: 1.15rem;
  font-weight: 800;
  color: #bae6fd;
}

.phenomenon-row.none .phenomenon-main {
  color: var(--muted);
}

.phenomenon-row.none .phenomenon-prob {
  color: var(--muted);
}

.foehn-strong { color: #93c5fd; font-weight: 700; }
.foehn-good { color: #86efac; font-weight: 700; }
.foehn-weak { color: #fca5a5; font-weight: 700; }

.mode-toggle {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 10px;
}

.mode-toggle button {
  background: #1f2937;
  color: var(--text);
}

.mode-toggle button.active {
  background: var(--accent);
  color: #06202c;
}

.aurora-box {
  margin-top: 6px;
  border: 1px solid #253047;
  border-radius: 10px;
  padding: 8px 10px;
  background: #0a1324;
  font-size: 0.9rem;
}

.aurora-box summary {
  cursor: pointer;
  font-size: 0.86rem;
}

.aurora-muted {
  color: #97a3b8;
  border-color: #293245;
}

.aurora-warn {
  color: #c7d2fe;
  border-color: #475569;
}

.aurora-hot {
  color: #fde68a;
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3) inset;
}

.model-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.model-chart-block {
  border: 1px solid #253047;
  border-radius: 12px;
  padding: 8px;
  background: #0a1324;
  overflow-x: hidden;
}

.model-chart-block h3 {
  margin: 0 0 6px 0;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.model-chart-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.overview-chart-wrap {
  overflow-x: auto;
  border: 1px solid #253047;
  border-radius: 12px;
  background: #0a1324;
  padding: 6px;
}

.overview-chart-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.model-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}

.model-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.model-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

@media (max-width: 980px) {
  .models-table {
    font-size: 0.88rem;
  }

  .models-table th,
  .models-table td {
    padding: 6px 6px;
    white-space: nowrap;
  }
}

.hour-row {
  display: grid;
  grid-template-columns: 72px 72px 170px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.85rem;
}

.hourly-list { display: grid; gap: 2px; }
