* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #172033;
  background: linear-gradient(135deg, #dbeafe 0%, #eef2ff 48%, #f8fafc 100%);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.weather-app {
  width: min(1360px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: 14px;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  gap: 12px;
}

.hero {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 4px;
}

.eyebrow {
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

h1 {
  font-size: clamp(1.45rem, 2.6vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.9rem;
}

.app-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 12px;
}

.sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.content-panel {
  min-width: 0;
  min-height: 0;
}

.search-card,
.subscription-card,
.weather-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 42px rgba(30, 64, 175, 0.13);
  backdrop-filter: blur(14px);
}

.search-card,
.subscription-card {
  padding: 16px;
}

.search-form label,
.select-stack label,
.panel-title,
.result-label,
.detail-title {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 900;
}

.compact-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 11px;
  padding: 0 11px;
  color: #172033;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
}

input:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  min-height: 38px;
  border-radius: 11px;
  padding: 0 13px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  color: #1d4ed8;
  background: #fff;
  border: 1px solid rgba(37, 99, 235, 0.16);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
}

.selector-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.panel-heading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  margin-bottom: 7px;
}

.panel-title {
  margin: 0;
}

.hint {
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.select-stack {
  display: grid;
  gap: 6px;
}

#select-city-button,
.location-button {
  width: 100%;
}

.action-row {
  margin-top: 9px;
}

.message {
  min-height: 34px;
  margin-top: 8px;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.35;
}

.message.error {
  color: #dc2626;
  font-weight: 900;
}

.subscription-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: 1.18rem;
  line-height: 1.1;
}

.subscription-actions {
  display: flex;
  gap: 6px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.delete-button {
  color: #dc2626;
}

.subscription-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  padding-right: 3px;
}

.subscription-list::-webkit-scrollbar,
.forecast-list::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.subscription-list::-webkit-scrollbar-thumb,
.forecast-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.26);
}

.subscription-empty {
  padding: 12px;
  border-radius: 12px;
  color: #64748b;
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.68);
}

.subscription-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.subscription-name {
  color: #172033;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.3;
}

.subscription-meta {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.35;
}

.subscription-weather {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #eff6ff;
}

.subscription-weather-icon {
  font-size: 1.45rem;
}

.subscription-temp {
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
}

.subscription-condition {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}

.subscription-item-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.weather-card {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, auto) auto;
  gap: 13px;
  padding: 22px;
  overflow: hidden;
}

.weather-card.is-hidden {
  display: none;
}

.weather-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  align-items: center;
  gap: 18px;
}

#city-name {
  margin-top: 4px;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  word-break: break-word;
}

.location {
  margin-top: 5px;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.4;
}

.weather-icon {
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  font-size: 4.4rem;
  background: linear-gradient(145deg, #ffffff, #dbeafe);
}

.temperature-row {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr;
  align-items: end;
  gap: 18px;
}

.temperature {
  font-size: clamp(4rem, 8vw, 6.8rem);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.weather-text {
  padding-bottom: 8px;
  color: #1d4ed8;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 900;
  text-align: right;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.detail-item {
  min-width: 0;
  padding: 13px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.68);
}

.detail-item strong {
  display: block;
  margin-top: 5px;
  font-size: 1.04rem;
  word-break: break-word;
}

.forecast-panel {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.forecast-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 9px;
}

.forecast-heading h3 {
  margin-top: 3px;
  font-size: 1.28rem;
}

.forecast-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.forecast-item {
  min-width: 82px;
  padding: 10px 7px;
  border-radius: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.68);
}

.forecast-day {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 900;
}

.forecast-icon {
  margin: 6px 0 4px;
  font-size: 1.58rem;
}

.forecast-text {
  min-height: 32px;
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 900;
}

.forecast-temp {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 0.9rem;
  font-weight: 900;
}

.forecast-temp .low {
  color: #64748b;
}

.subscribe-button {
  width: 100%;
}

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

@media (max-width: 1180px) and (min-width: 901px) {
  .app-shell {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .weather-card {
    padding: 18px;
  }

  .weather-main {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .weather-icon {
    width: 96px;
    height: 96px;
    font-size: 3.8rem;
  }

  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  html,
  body {
    height: auto;
  }

  body {
    overflow: auto;
  }

  .weather-app {
    width: min(760px, 100%);
    height: auto;
    min-height: 100vh;
    padding: 12px;
    grid-template-rows: auto auto;
  }

  .hero,
  .app-shell,
  .weather-main,
  .temperature-row,
  .forecast-heading,
  .section-heading {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar {
    display: contents;
  }

  .location-panel {
    order: 1;
  }

  .content-panel {
    order: 2;
  }

  .subscription-card {
    order: 3;
  }

  .weather-card {
    height: auto;
    grid-template-rows: none;
    padding: 16px;
    overflow: visible;
  }

  .weather-icon {
    width: 100%;
    height: 96px;
  }

  .weather-text {
    text-align: left;
    padding-bottom: 0;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .compact-row,
  .subscription-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  button {
    width: 100%;
  }
}
