:root {
  color-scheme: light;
  --bg-start: #fff4df;
  --bg-end: #d9efff;
  --panel: rgba(255, 252, 245, 0.8);
  --panel-strong: rgba(255, 248, 232, 0.92);
  --line: rgba(36, 48, 73, 0.14);
  --text: #172033;
  --muted: #55627d;
  --accent: #d55d34;
  --accent-deep: #8e371f;
  --shadow: 0 24px 80px rgba(38, 53, 79, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-sans: "Avenir Next", "Manrope", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 184, 120, 0.5), transparent 30%),
    radial-gradient(circle at right center, rgba(89, 175, 255, 0.3), transparent 24%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

body {
  padding: 24px;
}

button,
a {
  font: inherit;
}

.page-shell,
.top-section {
  display: grid;
  gap: 24px;
}

.toolbar-card,
.frame-card {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.frame-card h2 {
  margin: 0;
}

.toolbar-card {
  display: grid;
  gap: 14px;
  padding: 22px 24px;
}

.city-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  overflow: visible;
}

.city-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  min-width: 200px;
  max-width: 240px;
  padding: 16px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.city-button:hover,
.city-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(213, 93, 52, 0.45);
  outline: none;
}

.city-button.is-active {
  background: linear-gradient(135deg, rgba(255, 225, 195, 0.95), rgba(255, 255, 255, 0.82));
  border-color: rgba(213, 93, 52, 0.75);
}

.city-name,
.city-meta {
  display: block;
}

.city-name {
  flex: 1 1 auto;
  font-size: 1.06rem;
  font-weight: 700;
}

.city-meta {
  flex: 0 1 72px;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
  text-align: right;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  text-decoration: none;
}

.inline-link {
  border: 1px solid rgba(36, 48, 73, 0.15);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  cursor: pointer;
}

.content {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 24px;
}

.frame-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.frame-card-main {
  grid-column: span 3;
}

.frame-card-forecast {
  grid-column: span 3;
}

.frame-card-history {
  grid-column: span 2;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.frame-wrap {
  min-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(243, 248, 255, 0.84));
}

iframe {
  width: 100%;
  height: 100%;
  min-height: 72vh;
  border: 0;
  background: transparent;
}

.frame-wrap-history,
.frame-wrap-history iframe {
  min-height: 62vh;
}

.frame-wrap-forecast,
.frame-wrap-forecast iframe {
  min-height: 90vh;
}

.frame-wrap-history {
  --history-frame-offset: 180px;
  height: 62vh;
  position: relative;
}

.frame-wrap-history iframe {
  position: absolute;
  top: calc(var(--history-frame-offset) * -1);
  left: 0;
  height: calc(100% + var(--history-frame-offset));
  min-height: calc(62vh + var(--history-frame-offset));
}

@media (min-width: 1181px) {
  .frame-card-history[data-history-offset="3"] .frame-wrap-history,
  .frame-card-history[data-history-offset="4"] .frame-wrap-history,
  .frame-card-history[data-history-offset="5"] .frame-wrap-history {
    --history-frame-offset: 430px;
  }
}

@media (max-width: 1180px) {
  .content {
    grid-template-columns: 1fr;
  }

  .frame-card-main,
  .frame-card-history {
    grid-column: 1 / -1;
  }

  .frame-wrap,
  iframe {
    min-height: 60vh;
  }

  .frame-wrap-history,
  .frame-wrap-history iframe {
    min-height: 58vh;
  }

  .frame-wrap-history {
    --history-frame-offset: 300px;
    height: 58vh;
  }

  .frame-wrap-history iframe {
    min-height: calc(58vh + var(--history-frame-offset));
  }
}

@media (max-width: 760px) {
  body {
    padding: 14px;
  }

  .toolbar-card,
  .frame-card {
    padding: 18px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .city-button {
    min-width: 170px;
    max-width: none;
  }

  .frame-wrap,
  iframe {
    min-height: 52vh;
  }

  .frame-wrap-history,
  .frame-wrap-history iframe {
    min-height: 52vh;
  }

  .frame-wrap-history {
    --history-frame-offset: 220px;
    height: 52vh;
  }

  .frame-wrap-history iframe {
    min-height: calc(52vh + var(--history-frame-offset));
  }
}
