:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #6366f1;
  --danger: #f87171;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg), #16213e);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.4;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.appbar h1 { font-size: 18px; font-weight: 700; }

.iconbtn {
  background: var(--card2);
  border: none;
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.iconbtn:active { transform: scale(0.94); }

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.search { display: flex; gap: 8px; margin-bottom: 8px; }

#cityInput {
  flex: 1;
  min-height: 48px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  outline: none;
}
#cityInput:focus { border-color: var(--accent); }
#cityInput::placeholder { color: var(--muted); }

.btn {
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 20px;
  min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0b1220; }

.hint { font-size: 13px; color: var(--muted); padding: 2px 4px 8px; }

.citylist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cityitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 52px;
}
.cityitem:active { background: var(--card2); }
.cityitem .co { color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h3 { font-size: 15px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }

.card.current .current-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.current h2 { font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin-top: 10px; }

.temp { font-size: 56px; font-weight: 800; line-height: 1; }
.temp sup { font-size: 26px; font-weight: 600; color: var(--muted); }

.current-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.current-grid li { background: var(--card2); border-radius: 12px; padding: 12px 8px; text-align: center; }
.current-grid span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.current-grid b { font-size: 15px; }

.forecast { display: flex; flex-direction: column; gap: 8px; }
.day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.day:last-child { border-bottom: none; }
.day .dname { width: 84px; font-size: 15px; font-weight: 600; }
.day .dicon { font-size: 20px; }
.day .dscope { flex: 1; height: 6px; border-radius: 3px; background: var(--card2); position: relative; }
.day .dscope i {
  position: absolute;
  top: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.day .dtemps { width: 92px; text-align: right; font-size: 14px; white-space: nowrap; }
.day .dtemps b { color: #7dd3fc; }
.day .dtemps span { color: #fca5a5; }

.status { text-align: center; color: var(--muted); font-size: 14px; padding: 12px 0; }
.status.error { color: var(--danger); }

.hidden { display: none !important; }