:root {
  --bg-top: #4a90d9;
  --bg-bottom: #1e3c72;
  --card-bg: rgba(8, 20, 45, 0.4);
  --card-border: rgba(255, 255, 255, 0.3);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.85);
  --accent: #ffd166;
  --focus-ring: #ffffff;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  background: #0b1d3a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 1000;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 32px 16px 64px;
}

.app {
  width: 100%;
  max-width: 640px;
}

header {
  position: relative;
}

header h1 {
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0 0 20px;
}

#search-form {
  display: flex;
  gap: 8px;
  position: relative;
}

#search-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

#search-input::placeholder { color: var(--text-dim); }

#search-form button {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}

#search-form button:hover { background: rgba(255,255,255,0.24); }

.suggestions {
  list-style: none;
  margin: 6px 0 0;
  padding: 6px;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1f3a63;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  z-index: 10;
  max-height: 220px;
  overflow-y: auto;
}

.suggestions li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.suggestions li:hover,
.suggestions li[aria-selected="true"] {
  background: rgba(255,255,255,0.18);
}

.disclaimer {
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.disclaimer strong {
  color: var(--accent);
}

.status {
  text-align: center;
  margin-top: 24px;
  color: var(--text-dim);
  min-height: 20px;
}

.status.error { color: #ffb4b4; }

.current {
  margin-top: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(6px);
}

.alerts {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alerts[hidden] {
  display: none;
}

.alert-card {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid;
  background: rgba(0, 0, 0, 0.15);
}

.alert-card.severity-extreme,
.alert-card.severity-severe {
  border-color: #ff5c5c;
  background: rgba(255, 92, 92, 0.18);
}

.alert-card.severity-moderate {
  border-color: #ffb020;
  background: rgba(255, 176, 32, 0.16);
}

.alert-card.severity-minor,
.alert-card.severity-unknown {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
}

.alert-card .alert-event {
  font-weight: 700;
  font-size: 15px;
}

.alert-card .alert-headline {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.alert-card .alert-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.alert-card details {
  margin-top: 8px;
}

.alert-card summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: underline;
}

.alert-card .alert-body {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.current-main { text-align: center; }

.place { font-size: 20px; font-weight: 600; }

.temp-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 4px;
}

.icon { font-size: 48px; }

.temp { font-size: 56px; font-weight: 300; }

.condition { color: var(--text-dim); font-size: 16px; }

.current-details {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}

.current-details > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-details .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.current-details span:last-child:not(.label) {
  font-size: 16px;
  font-weight: 500;
}

.hourly, .forecast {
  margin-top: 24px;
}

.hourly h2, .forecast h2 {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.hourly-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.hour-card {
  flex: 0 0 auto;
  width: 68px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
}

.hour-card.is-now {
  background: rgba(255, 209, 102, 0.22);
  border-color: rgba(255, 209, 102, 0.5);
}

.hour-card .hour-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.hour-card.is-now .hour-label {
  color: var(--accent);
}

.hour-card .hour-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.hour-card .hour-temp {
  font-weight: 600;
}

.hour-card .hour-precip {
  margin-top: 4px;
  font-size: 11px;
  color: #a8d8ff;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
}

.day-card .day-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.day-card .day-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.day-card .day-hi {
  font-weight: 600;
}

.day-card .day-lo {
  color: var(--text-dim);
  font-size: 13px;
}

.day-card .day-precip {
  margin-top: 6px;
  font-size: 12px;
  color: #a8d8ff;
}

@media (max-width: 560px) {
  .forecast-grid { grid-template-columns: repeat(4, 1fr); }
  .current-details { grid-template-columns: repeat(2, 1fr); }
}
