:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #ecf4ff;
  color: #102542;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem 3rem;
  box-sizing: border-box;
  background: radial-gradient(circle at top, rgba(96, 165, 250, 0.45) 0%, rgba(236, 244, 255, 0) 58%),
    #ecf4ff;
}

header {
  text-align: center;
  margin-bottom: 2.75rem;
  max-width: 56rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 3.35rem);
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.75rem auto 0;
  font-size: 1.05rem;
  color: #2f5c8c;
  max-width: 40rem;
}

main {
  width: min(100%, 72rem);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.controls {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 2.5vw, 2rem);
  box-shadow: 0 1.6rem 3.6rem rgba(16, 37, 66, 0.12);
}

.controls h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

form {
  display: grid;
  gap: 0.75rem;
}

.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;
}

.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

input[type="text"] {
  flex: 1 1 16rem;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(16, 37, 66, 0.15);
  background: rgba(255, 255, 255, 0.92);
  font-size: 1rem;
  color: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: rgba(47, 92, 140, 0.8);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.35);
}

button[type="submit"],
.remove-city {
  border: none;
  border-radius: 0.9rem;
  padding: 0.85rem 1.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button[type="submit"]:hover,
.remove-city:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.75rem 1.6rem rgba(37, 99, 235, 0.25);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.helper-text {
  margin: 0;
  font-size: 0.92rem;
  color: #466789;
}

.form-status {
  margin: 0;
  font-size: 0.95rem;
}

.form-status[hidden] {
  display: none;
}

.form-status.error {
  color: #b91c1c;
}

.form-status.success {
  color: #166534;
}

.form-status.info {
  color: #315b85;
}

.cities {
  display: grid;
  gap: 1.75rem;
}

.empty-state {
  margin: 0;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: #3a5a7b;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed rgba(16, 37, 66, 0.18);
}

.city-selectors {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.city-selector {
  border: none;
  border-radius: 1.35rem;
  padding: 1.25rem 1.35rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1.4rem 3rem rgba(16, 37, 66, 0.12);
  display: grid;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.city-selector:hover,
.city-selector:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 1.6rem 3.4rem rgba(16, 37, 66, 0.18);
  outline: none;
}

.city-selector.is-selected {
  border: 2px solid rgba(59, 130, 246, 0.6);
  box-shadow: 0 1.6rem 3.4rem rgba(59, 130, 246, 0.25);
}

.selector-heading {
  display: grid;
  gap: 0.25rem;
}

.selector-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.selector-meta {
  font-size: 0.92rem;
  color: #3a5a7b;
}

.selector-today {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.selector-date {
  font-weight: 600;
  color: #2d4e74;
}

.selector-icon {
  font-size: 1.75rem;
}

.selector-description {
  color: #22405e;
}

.selector-temps {
  font-weight: 600;
  color: #102542;
}

.selector-status {
  font-size: 0.9rem;
  color: #3a5a7b;
}

.city-panel {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 2.5vw, 2.25rem);
  box-shadow: 0 1.6rem 3.6rem rgba(16, 37, 66, 0.12);
  display: grid;
  gap: 1.35rem;
}

.city-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.city-header h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
}

.city-meta {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: #3a5a7b;
}

.remove-city {
  background: rgba(220, 38, 38, 0.9);
  padding: 0.6rem 1rem;
}

.remove-city:hover {
  box-shadow: 0 0.75rem 1.5rem rgba(220, 38, 38, 0.25);
}

.city-status,
.city-updated {
  margin: 0;
  font-size: 0.95rem;
  color: #3a5a7b;
}

.city-forecast {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
}

.forecast-card {
  background: rgba(248, 251, 255, 0.95);
  border-radius: 1.2rem;
  padding: 1.25rem;
  box-shadow: 0 1.25rem 2.5rem rgba(16, 37, 66, 0.12);
  display: grid;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.forecast-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1.75rem 3rem rgba(16, 37, 66, 0.18);
}

.forecast-date {
  font-weight: 600;
  font-size: 1rem;
  color: #264b73;
}

.forecast-icon {
  font-size: 2.35rem;
}

.forecast-description {
  font-size: 1.05rem;
  color: #22405e;
}

.forecast-temps {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: #102542;
}

.forecast-precip {
  font-size: 0.95rem;
  color: #3a5a7b;
}

footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: #4f6c8b;
}

footer a {
  color: inherit;
}

@media (max-width: 640px) {
  body {
    padding: 2rem 1.25rem 2.5rem;
  }

  .controls,
  .city-panel {
    border-radius: 1.25rem;
    padding: 1.4rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    background: #07121f;
    color: #e4eef8;
  }

  body {
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.4) 0%, rgba(7, 18, 31, 0) 58%),
      #07121f;
  }

  .subtitle,
  .helper-text,
  .city-status,
  .city-updated,
  .city-meta,
  .selector-meta,
  .selector-description,
  .selector-status,
  .forecast-description,
  .forecast-precip,
  footer {
    color: #c1d6ec;
  }

  .controls,
  .city-panel,
  .city-selector,
  .forecast-card {
    background: rgba(15, 36, 58, 0.85);
    box-shadow: 0 1.75rem 3.25rem rgba(3, 9, 16, 0.6);
  }

  input[type="text"] {
    background: rgba(9, 20, 33, 0.9);
    border-color: rgba(193, 214, 236, 0.2);
    color: #f5f9ff;
  }

  input[type="text"]:focus {
    border-color: rgba(96, 165, 250, 0.75);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
  }

  .selector-temps,
  .forecast-temps {
    color: #f5f9ff;
  }
}

