:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #171a20;
  --panel-2: #20242c;
  --panel-3: #252a33;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f6f8;
  --muted: #aeb6c2;
  --soft: #d8dee7;
  --accent: #64d2ff;
  --green: #7ee787;
  --gold: #ffd166;
  --red: #ff7b72;
  --tap: 56px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(100, 210, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #111318 0%, #0d0f12 36%, #0b0c0f 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 14px calc(env(safe-area-inset-bottom) + 22px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow,
.status-label,
.meta,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: 0;
}

h2,
h3,
p {
  margin-top: 0;
}

.version-pill {
  display: grid;
  gap: 3px;
  min-width: 116px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: right;
  color: var(--soft);
  font-size: 0.75rem;
  font-weight: 750;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.status-strip > div {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.status-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.02rem;
}

.status-strip small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.connection-online strong {
  color: var(--green);
}

.connection-offline strong {
  color: var(--gold);
}

.connection-error strong,
.connection-auth strong {
  color: var(--red);
}

.dashboard {
  display: grid;
  gap: 10px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 26, 32, 0.92);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
  transition: border-color 180ms ease, background 180ms ease;
}

.card.is-open {
  border-color: rgba(100, 210, 255, 0.34);
  background: rgba(28, 32, 39, 0.98);
}

.card-toggle {
  display: grid;
  grid-template-columns: 44px 1fr 36px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 800;
}

.card-text {
  min-width: 0;
}

.card-title {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
  font-weight: 800;
}

.card-summary {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.chevron {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--soft);
  font-size: 1.35rem;
  font-weight: 500;
  transition: transform 180ms ease, background 180ms ease;
}

.is-open .chevron {
  transform: rotate(45deg);
  background: rgba(100, 210, 255, 0.16);
}

.card-detail {
  display: grid;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  padding: 0 12px;
  opacity: 0;
  transition: max-height 240ms ease, opacity 180ms ease, padding 220ms ease;
}

.card.is-open .card-detail {
  max-height: 3600px;
  padding: 0 12px 14px;
  opacity: 1;
}

.detail-grid,
.forecast-grid,
.vehicle-grid,
.weather-metrics-grid,
.weather-compare-grid {
  display: grid;
  gap: 8px;
}

.detail-row,
.news-item,
.reader-topic,
.history-row,
.setting-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-row strong,
.news-item strong,
.reader-topic strong {
  color: var(--text);
}

.detail-row span,
.news-item p,
.reader-topic p,
.history-row span {
  color: var(--muted);
  line-height: 1.35;
}

.weather-location-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.weather-location-tab {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  font-weight: 800;
}

.weather-location-tab.is-active {
  border-color: rgba(100, 210, 255, 0.7);
  background: rgba(100, 210, 255, 0.16);
  color: var(--text);
}

.weather-scene {
  position: relative;
  overflow: hidden;
  min-height: 178px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141922;
}

.weather-scene-sky {
  position: absolute;
  inset: 0;
  opacity: 0.9;
}

.weather-scene-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  min-height: 178px;
  align-content: end;
  padding: 14px;
  background: linear-gradient(180deg, rgba(13, 15, 18, 0.08), rgba(13, 15, 18, 0.72));
}

.weather-scene h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.14;
}

.weather-temp {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.weather-condition,
.weather-updated,
.weather-unavailable {
  color: var(--soft);
  line-height: 1.3;
}

.condition-clear .weather-scene-sky {
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 209, 102, 0.95) 0 34px, transparent 36px),
    linear-gradient(135deg, #175f8f, #5aa9d6 58%, #132638);
  animation: sky-drift 7s ease-in-out infinite alternate;
}

.condition-clouds .weather-scene-sky {
  background:
    radial-gradient(ellipse at 24% 38%, rgba(255, 255, 255, 0.7) 0 42px, transparent 44px),
    radial-gradient(ellipse at 62% 32%, rgba(222, 231, 242, 0.55) 0 56px, transparent 58px),
    linear-gradient(135deg, #425568, #8aa0b5);
  animation: sky-drift 9s ease-in-out infinite alternate;
}

.condition-rain .weather-scene-sky,
.condition-storm .weather-scene-sky {
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.22) 0 2px, transparent 2px 12px),
    linear-gradient(135deg, #182333, #38516c);
  animation: rain-slide 700ms linear infinite;
}

.condition-snow .weather-scene-sky {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 34%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 45% 62%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
    linear-gradient(135deg, #53687c, #b3c3cf);
  animation: sky-drift 6s ease-in-out infinite alternate;
}

.condition-fog .weather-scene-sky,
.condition-unavailable .weather-scene-sky {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 18%, transparent 19% 35%, rgba(255, 255, 255, 0.12) 36% 54%, transparent 55%),
    linear-gradient(135deg, #303945, #66717c);
  animation: fog-drift 8s ease-in-out infinite alternate;
}

.weather-metrics-grid,
.weather-compare-grid {
  grid-template-columns: 1fr 1fr;
}

.weather-compare-card {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.weather-compare-card span {
  color: var(--muted);
  line-height: 1.3;
}

@keyframes sky-drift {
  from { transform: translate3d(-6px, -2px, 0) scale(1.02); }
  to { transform: translate3d(8px, 4px, 0) scale(1.05); }
}

@keyframes rain-slide {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 24px, 0 0; }
}

@keyframes fog-drift {
  from { transform: translateX(-10px); }
  to { transform: translateX(10px); }
}

.section-title {
  margin: 2px 0 0;
  font-size: 1rem;
}

.section-list {
  display: grid;
  gap: 8px;
}

.badge-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.controls,
.form-row {
  display: grid;
  gap: 8px;
}

.controls {
  grid-template-columns: repeat(3, 1fr);
}

.primary-button,
.ghost-button {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-button {
  background: var(--accent);
  color: #061015;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101319;
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(100, 210, 255, 0.6);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.metric strong {
  font-size: 1.12rem;
}

.reader-output {
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101319;
  color: var(--soft);
  line-height: 1.5;
  white-space: pre-wrap;
}

.alert {
  border-color: rgba(255, 209, 102, 0.4);
  background: rgba(255, 209, 102, 0.08);
}

.danger {
  color: var(--red);
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100%, 960px);
  }

  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card.is-open {
    grid-column: 1 / -1;
  }

  .forecast-grid,
  .vehicle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
