:root {
  color-scheme: dark;
  --bg-top: #0b1337;
  --bg-mid: #1d275d;
  --bg-bottom: #2a346f;
  --panel: rgba(53, 68, 132, 0.44);
  --panel-strong: rgba(69, 85, 155, 0.54);
  --border: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-soft: rgba(232, 237, 255, 0.78);
  --text-muted: rgba(214, 221, 255, 0.54);
  --accent: #56f0eb;
  --accent-soft: rgba(86, 240, 235, 0.16);
  --warning: #ffd666;
  --shadow: 0 18px 48px rgba(4, 11, 34, 0.36);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 999px;
  --app-font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--app-font);
  background:
    radial-gradient(circle at top, rgba(96, 110, 209, 0.14), transparent 34%),
    linear-gradient(180deg, var(--bg-top) 0%, #121942 22%, var(--bg-mid) 60%, var(--bg-bottom) 100%);
  color: var(--text-main);
}

body {
  display: flex;
  justify-content: center;
  padding: 18px 12px 30px;
}

.app-shell {
  width: min(100%, 420px);
}

.phone-frame {
  position: relative;
  display: grid;
  gap: 18px;
}

.hero-card,
.panel,
.metric-card {
  background: linear-gradient(180deg, rgba(56, 68, 132, 0.52), rgba(35, 47, 100, 0.76));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero-card {
  padding: 26px 20px 20px;
  border-radius: 34px;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 26%),
    radial-gradient(circle at 18% 22%, rgba(106, 226, 233, 0.18), transparent 26%);
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-top,
.section-head,
.forecast-item,
.metric-main,
.air-quality-grid,
.pollutant-item,
.sun-times,
.hero-condition,
.hero-temp {
  display: flex;
}

.hero-top,
.section-head,
.forecast-item,
.air-quality-grid {
  justify-content: space-between;
}

.hero-top,
.section-head,
.metric-main,
.air-quality-grid,
.forecast-item,
.sun-times {
  align-items: center;
}

.hero-top {
  gap: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 9vw, 38px);
  line-height: 1.08;
}

h2 {
  font-size: 18px;
}

.hero-date,
.section-head span,
.metric-foot,
.source-note,
.forecast-weekday,
.forecast-condition {
  color: var(--text-soft);
}

.hero-date,
.section-head span,
.source-note {
  font-size: 13px;
}

.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.ghost-btn {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.ghost-btn.small {
  padding: 8px 12px;
}

.primary-btn {
  color: #122357;
  background: linear-gradient(135deg, #8cf7ef, #eaf5ff);
  font-weight: 700;
}

.ghost-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
}

.hero-badges {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.badge {
  min-width: 88px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.badge-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.badge strong {
  font-size: 19px;
}

.hero-condition {
  gap: 10px;
  align-items: baseline;
  margin-top: 28px;
  color: var(--text-soft);
  font-size: 22px;
  font-weight: 600;
}

.hero-condition #tempRange {
  font-size: 18px;
}

.hero-temp {
  gap: 20px;
  align-items: flex-start;
  margin-top: 6px;
}

.hero-temp #currentTemp {
  font-size: clamp(88px, 26vw, 120px);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.hero-temp #currentTemp::after {
  content: "°C";
  font-size: 0.34em;
  vertical-align: top;
  margin-left: 6px;
}

.feels-like {
  padding-top: 18px;
  display: grid;
  gap: 2px;
  color: var(--text-soft);
}

.feels-like strong {
  font-size: 22px;
}

.panel {
  padding: 18px 16px;
  border-radius: var(--radius-xl);
}

.hourly-section {
  margin-top: 18px;
}

.hourly-chart {
  margin-top: 14px;
  height: 96px;
}

#hourlySvg {
  width: 100%;
  height: 100%;
}

.hourly-fill {
  fill: rgba(83, 236, 229, 0.09);
}

.hourly-line {
  fill: none;
  stroke: #59e7eb;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.hourly-item {
  text-align: center;
  padding: 4px 0 2px;
}

.hourly-time {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
}

.hourly-icon {
  display: block;
  margin: 7px 0 6px;
  font-size: 20px;
}

.hourly-temp {
  font-size: 15px;
}

.forecast-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.forecast-item {
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.forecast-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.forecast-meta {
  width: 110px;
}

.forecast-date {
  display: block;
  font-size: 20px;
}

.forecast-icon {
  width: 30px;
  font-size: 24px;
  text-align: center;
}

.forecast-condition {
  flex: 1;
  text-align: left;
  font-size: 14px;
}

.forecast-range {
  width: 70px;
  text-align: right;
  font-size: 18px;
  font-weight: 700;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 170px;
  padding: 16px;
  border-radius: 26px;
}

.metric-title {
  color: var(--text-soft);
  font-size: 14px;
}

.metric-bar {
  position: relative;
  height: 6px;
  margin: 18px 0 20px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
}

.metric-bar span {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.08);
}

.metric-bar-heat {
  background: linear-gradient(90deg, #51e9f8, #f8d553, #ff4d65);
}

.metric-bar-uv {
  background: linear-gradient(90deg, #8cefd9, #ffd454, #ff6a54, #a754ff);
}

.metric-main {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.metric-main strong {
  font-size: clamp(28px, 8vw, 42px);
}

.metric-main span {
  color: var(--text-soft);
}

.wind-dial,
.pressure-gauge {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 12px auto 10px;
  border-radius: 50%;
}

.wind-dial {
  border: 1px dashed rgba(255, 255, 255, 0.18);
}

.pressure-gauge {
  width: 126px;
  height: 70px;
  margin-top: 18px;
  border-radius: 126px 126px 0 0;
  border: 10px solid rgba(255, 255, 255, 0.08);
  border-bottom: 0;
}

.wind-center {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  text-align: center;
}

.wind-center strong {
  font-size: 28px;
}

.wind-center small {
  color: var(--text-soft);
}

.wind-arrow,
.gauge-needle {
  position: absolute;
  left: 50%;
  transform-origin: bottom center;
}

.wind-arrow {
  bottom: 50%;
  width: 2px;
  height: 44px;
  background: linear-gradient(180deg, #ffffff, #58ece8);
}

.wind-arrow::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-top: 2px solid #ffffff;
  border-right: 2px solid #ffffff;
  transform: translateX(-50%) rotate(-45deg);
}

.gauge-needle {
  bottom: 0;
  width: 4px;
  height: 52px;
  background: linear-gradient(180deg, #ffffff, #8eedff);
}

.gauge-needle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transform: translateX(-50%);
}

.air-quality-grid {
  gap: 18px;
  margin-top: 18px;
}

.aqi-ring {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.aqi-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-base {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 10;
}

.ring-value {
  fill: none;
  stroke: url(#ringGradient);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
}

.aqi-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.aqi-content span,
.aqi-content p,
.pollutant-label {
  color: var(--text-soft);
}

.aqi-content strong {
  font-size: 36px;
  line-height: 1;
  margin: 8px 0 4px;
}

.pollutants {
  flex: 1;
  display: grid;
  gap: 12px;
}

.pollutant-item {
  gap: 10px;
}

.pollutant-label {
  width: 58px;
  font-size: 13px;
}

.pollutant-value {
  width: 24px;
}

.pollutant-bar {
  position: relative;
  flex: 1;
  height: 7px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
}

.pollutant-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #84f09d, #f7de69);
}

.sun-panel {
  padding-bottom: 22px;
}

.sun-graphic {
  position: relative;
  height: 118px;
  margin-top: 12px;
}

.sun-graphic svg {
  width: 100%;
  height: 100%;
}

.sun-arc {
  fill: none;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 3;
}

.sun-marker {
  position: absolute;
  top: 18px;
  left: calc(50% - 22px);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 26px rgba(8, 11, 39, 0.35);
  transition: left 0.4s ease, top 0.4s ease;
}

.sun-times {
  gap: 12px;
  justify-content: space-between;
  margin-top: 12px;
}

.sun-times div {
  display: grid;
  gap: 6px;
}

.sun-times span {
  color: var(--text-muted);
  font-size: 12px;
}

.sun-times strong {
  font-size: 16px;
}

.source-note {
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 8, 27, 0.68);
  backdrop-filter: blur(18px);
  z-index: 999;
}

.modal-backdrop.hidden {
  display: none;
}

.permission-modal {
  width: min(100%, 360px);
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(34, 47, 105, 0.96), rgba(21, 30, 71, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.permission-modal h2 {
  margin-bottom: 12px;
}

.permission-modal p:last-of-type {
  color: var(--text-soft);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 370px) {
  body {
    padding-inline: 8px;
  }

  .hero-card,
  .panel,
  .metric-card {
    border-radius: 24px;
  }

  .hourly-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .air-quality-grid {
    flex-direction: column;
    align-items: flex-start;
  }

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