:root {
  color-scheme: light;
  --background: #eef3f5;
  --surface: #ffffff;
  --text: #17262c;
  --muted: #5b6c73;
  --line: #cfdbdf;
  --primary: #087f8c;
  --primary-dark: #076775;
  --primary-soft: #d9eef0;
  --shadow: 0 12px 36px rgba(18, 45, 55, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

body {
  padding: clamp(12px, 2.5vw, 28px);
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(8, 127, 140, 0.28);
  outline-offset: 3px;
}

.app-shell {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3.2vw, 1.85rem);
  line-height: 1.25;
}

.current-year {
  min-width: 92px;
  color: var(--primary-dark);
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 700;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.viewer {
  width: min(700px, 100%);
  margin: 0 auto;
}

.image-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #d5ded8;
  border: 1px solid #b8c7c9;
  border-radius: 10px;
}

.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.image-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  color: #ffffff;
  background: rgba(8, 50, 57, 0.78);
  border-radius: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}

.loading-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(8, 50, 57, 0.58);
  font-weight: 600;
}

.loading-state[hidden] {
  display: none;
}

.metadata {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  padding: 11px 8px 2px;
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.separator {
  color: #9aabad;
}

.water-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 7px 12px;
  margin-top: 9px;
  padding: 9px 12px;
  color: var(--muted);
  background: #f4f8f7;
  border: 1px solid #d3dfdc;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.legend-title {
  color: var(--text);
  font-weight: 700;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend-swatch {
  width: 16px;
  height: 11px;
  border: 1px solid rgba(23, 38, 44, 0.2);
  border-radius: 2px;
}

.water-normal {
  background: #536f73;
}

.bloom-light {
  background: #9aaa6c;
}

.bloom-medium {
  background: #648c46;
}

.bloom-heavy {
  background: #b6cc42;
}

.legend-note {
  color: #74848a;
  font-size: 0.7rem;
}

.timeline {
  width: min(700px, 100%);
  margin: 18px auto 0;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.icon-button,
.play-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.icon-button:hover,
.play-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.icon-button:active,
.play-button:active {
  transform: translateY(1px);
}

.icon-button {
  width: 40px;
  height: 38px;
  padding: 0;
  color: var(--primary-dark);
  background: var(--surface);
  font-size: 1.75rem;
  line-height: 1;
}

.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 126px;
  height: 38px;
  gap: 8px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.play-button:hover {
  color: #ffffff;
  background: var(--primary-dark);
}

.year-slider {
  --progress: 0%;
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.year-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(to right, var(--primary) 0 var(--progress), #d5dfe2 var(--progress) 100%);
  border-radius: 999px;
}

.year-slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  appearance: none;
  background: #ffffff;
  border: 3px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(9, 66, 74, 0.24);
}

.year-slider::-moz-range-track {
  height: 8px;
  background: #d5dfe2;
  border-radius: 999px;
}

.year-slider::-moz-range-progress {
  height: 8px;
  background: var(--primary);
  border-radius: 999px;
}

.year-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 3px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(9, 66, 74, 0.24);
}

.year-ticks {
  display: grid;
  grid-template-columns: repeat(19, minmax(0, 1fr));
  margin-top: 1px;
  color: var(--muted);
  font-size: clamp(0.5rem, 1.45vw, 0.68rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.year-ticks span {
  min-width: 0;
}

.year-ticks .active {
  color: var(--primary-dark);
  font-weight: 700;
}

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  width: min(700px, 100%);
  margin: 20px auto 0;
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  line-height: 1.5;
}

.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: 540px) {
  body {
    padding: 0;
    background: var(--surface);
  }

  .app-shell {
    padding: 14px 12px 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .title-row {
    align-items: center;
    margin-bottom: 12px;
  }

  .current-year {
    min-width: 70px;
  }

  .image-badge {
    top: 8px;
    left: 8px;
  }

  .metadata {
    font-size: 0.8rem;
  }

  .water-legend {
    gap: 6px 9px;
    padding: 8px;
    font-size: 0.72rem;
  }

  .legend-note {
    flex-basis: 100%;
    text-align: center;
  }

  .timeline {
    margin-top: 12px;
    padding-top: 12px;
  }

  footer {
    margin-top: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .icon-button,
  .play-button {
    transition: none;
  }
}
