:root {
  --bg: #0f1724;
  --card: #0b1220;
  --muted: #9aa6b2;
  --accent: #60a5fa;
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 16px;

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #071025 0%, #0b1220 100%);
  color: #e6eef6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 980px;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: clamp(18px, 4vw, 24px);
  margin: 0;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.controls input[type="text"] {
  flex: 1;
  min-width: 160px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  font-size: 15px;
}

/* Buttons */
.btn {
  background: linear-gradient(180deg, var(--accent), #3b82f6);
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  color: #02203a;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-size: 15px;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

/* Layout */
main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
}

.card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(4, 8, 15, 0.6);
}

/* Current Weather */
.current {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.current > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; 
  gap: 8px;
}

.current .place {
  font-weight: 700;
  font-size: clamp(16px, 5vw, 20px);
  word-break: break-word; 
}

.current .desc {
  color: var(--muted);
  font-size: clamp(13px, 4vw, 16px);
  display: flex;
  gap: 8px;
  align-items: center;
}

.temp {
  display: flex;
  flex-wrap: wrap; 
  gap: 12px;
  align-items: center;
}

.temp .big {
  font-size: clamp(28px, 10vw, 48px);
  font-weight: 700;
  line-height: 1.2;
}

.meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

/* refresh button row */
.card > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Forecasts */
.right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Hourly */
.hourly {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.hour {
  min-width: 72px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  scroll-snap-align: start;
}

/* Daily */
.daily-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.day {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

/* Footer */
footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Utilities */
.search-hint {
  color: var(--muted);
  font-size: 13px;
}

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

/* Light theme */
body.light {
  --bg: #f9fafb;
  --card: #ffffff;
  --muted: #4b5563;
  --accent: #2563eb;
  --glass: rgba(0, 0, 0, 0.03);

  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #1f2937;
}

body.light .btn {
  color: white;
}

body.light .btn.ghost {
  color: var(--muted);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light pre {
  color: #111827;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Media Queries */
@media (max-width: 880px) {
  main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .controls {
    flex-wrap: wrap;
  }
  .daily-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  body {
    padding: 12px;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .controls input[type="text"],
  .btn {
    width: 100%;
  }
  .daily-list {
    grid-template-columns: 1fr;
  }
}