:root {
  color-scheme: light;
  --ink: #10241f;
  --muted: #60706a;
  --quiet: #89958f;
  --brand: #08634f;
  --brand-strong: #04513f;
  --brand-soft: #e7f3ee;
  --surface: #ffffff;
  --page: #f7faf8;
  --line: #dfe7e3;
  --line-strong: #cbd7d1;
  --low: #149667;
  --medium: #c78b12;
  --high: #d84b3d;
  --danger-soft: #fff1ef;
  --warning-soft: #fff8e9;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --shadow-header: 0 1px 0 rgba(16, 36, 31, 0.06);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-header);
  backdrop-filter: blur(14px);
}

.header-inner,
.page-shell,
.footer-inner {
  width: calc(100% - 32px);
  max-width: 820px;
  margin-inline: auto;
}

.header-inner {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--brand);
  color: #fff;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand strong {
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.refresh-button,
.secondary-button,
.camera-refresh-button {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.refresh-button {
  display: inline-flex;
  min-width: 54px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 9px;
  font-size: 12px;
}

.refresh-button svg {
  width: 22px;
  height: 22px;
}

.refresh-button:disabled,
.secondary-button:disabled,
.camera-refresh-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.refresh-button.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

.page-shell {
  background: var(--surface);
}

.direction-panel {
  padding: 18px 0 0;
}

.direction-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.direction-switch button {
  display: inline-flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.direction-switch button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.direction-switch button[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
}

.current-card {
  position: relative;
  padding: 38px 2px 34px;
  border-bottom: 1px solid var(--line);
}

.current-topline {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.current-topline > *,
.section-heading > *,
.reminder-row > *,
.camera-caption > * {
  min-width: 0;
}

.card-label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.current-status {
  margin: 0;
  color: var(--ink);
  font-size: clamp(39px, 11vw, 54px);
  font-weight: 850;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.advice {
  margin: 14px 0 0;
  color: #364b44;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge-good {
  background: var(--brand-soft);
  color: var(--brand);
}

.badge-busy {
  background: var(--warning-soft);
  color: #855c0c;
}

.badge-danger {
  background: var(--danger-soft);
  color: #a8362b;
}

.badge-neutral {
  background: #eef2f0;
  color: var(--muted);
}

.current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.warning-box {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  margin-top: 20px;
  padding: 12px 14px;
  border-left: 3px solid #c98b14;
  background: var(--warning-soft);
  color: #704e0c;
  font-size: 13px;
}

.warning-box[hidden] {
  display: none;
}

.warning-box svg {
  width: 20px;
  height: 20px;
}

.warning-box strong,
.warning-box p {
  margin: 0;
}

.error-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #ead6aa;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
}

.error-panel[hidden] {
  display: none;
}

.error-panel h2,
.error-panel p {
  margin: 0;
}

.error-panel h2 {
  font-size: 15px;
}

.error-panel p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.secondary-button {
  flex: 0 0 auto;
  padding: 8px 14px;
}

.section-block {
  padding: 30px 2px;
  border-bottom: 1px solid var(--line);
}

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

.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.section-note {
  max-width: 58%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.forecast-meta {
  margin: -8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.forecast-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.forecast-slot {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 138px;
  align-content: start;
  gap: 7px;
  padding: 13px 9px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.forecast-slot:nth-child(4n) {
  border-right: 0;
}

.forecast-slot:nth-child(n + 5) {
  border-bottom: 0;
}

.forecast-slot::after {
  position: absolute;
  right: 10px;
  bottom: 9px;
  left: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  content: "";
}

.forecast-slot.risk-low::after {
  background: var(--low);
}

.forecast-slot.risk-medium::after {
  background: var(--medium);
}

.forecast-slot.risk-high::after {
  background: var(--high);
}

.forecast-slot .time {
  color: #3b5048;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.forecast-slot .risk {
  color: var(--brand);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.3;
}

.forecast-slot.risk-medium .risk {
  color: #9a690b;
}

.forecast-slot.risk-high .risk {
  color: #bd3c31;
}

.forecast-slot.risk-unavailable .risk {
  color: var(--muted);
}

.forecast-slot .detail {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.risk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.risk-legend[hidden] {
  display: none;
}

.risk-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.risk-legend i {
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.risk-legend .legend-low {
  background: var(--low);
}

.risk-legend .legend-medium {
  background: var(--medium);
}

.risk-legend .legend-high {
  background: var(--high);
}

.camera-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #dbe4e0;
}

.camera-frame {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  background: #dbe4e0;
  color: #334841;
  isolation: isolate;
}

.camera-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms ease;
}

.camera-frame.has-image img {
  opacity: 1;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.camera-frame.has-image .camera-placeholder {
  display: none;
}

.camera-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(7, 56, 45, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.camera-caption {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(9, 27, 22, 0.84);
  color: #fff;
}

.camera-copy h3,
.camera-copy p {
  margin: 0;
}

.camera-copy h3 {
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-updated {
  margin-top: 2px !important;
  color: #d9e6e1;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.camera-refresh-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-color: rgba(255, 255, 255, 0.7);
  background: #fff;
  color: var(--brand-strong);
  font-size: 12px;
}

.camera-error {
  margin: 0;
  padding: 10px 13px;
  background: var(--warning-soft);
  color: #704e0c;
  font-size: 12px;
}

.camera-error[hidden] {
  display: none;
}

.reminder-list {
  border-top: 1px solid var(--line);
}

.reminder-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.context-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
}

.context-icon svg {
  width: 27px;
  height: 27px;
  stroke-width: 1.7;
}

.event-icon {
  background: #f0eafb;
  color: #7542aa;
}

.reminder-content {
  min-width: 0;
}

.reminder-content h3,
.reminder-content p {
  margin: 0;
}

.reminder-content h3 {
  color: #31463f;
  font-size: 14px;
  font-weight: 700;
}

.context-primary {
  margin-top: 3px !important;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.context-secondary {
  margin-top: 3px !important;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.calendar-item {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.calendar-item span {
  color: var(--brand);
  font-size: 12px;
}

.event-list {
  display: grid;
  min-width: 0;
  gap: 12px;
  margin-top: 5px;
}

.event-item {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.event-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.event-item > div {
  min-width: 0;
}

.event-time {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.event-item strong {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-item p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-more {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.empty-state.compact {
  padding: 14px 0;
  font-size: 13px;
}

.forecast-list > .empty-state {
  grid-column: 1 / -1;
  padding: 22px 4px;
}

.site-footer {
  background: var(--page);
}

.footer-inner {
  padding: 22px 2px calc(24px + env(safe-area-inset-bottom));
}

.footer-inner p {
  margin: 0;
  color: var(--quiet);
  font-size: 12px;
}

.noscript {
  margin: 0;
  padding: 14px 16px;
  background: var(--warning-soft);
  color: #704e0c;
  text-align: center;
}

button:hover {
  border-color: var(--brand);
}

button:focus-visible,
.skip-link:focus-visible {
  outline: 3px solid rgba(8, 99, 79, 0.24);
  outline-offset: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 680px) {
  .header-inner,
  .page-shell,
  .footer-inner {
    width: calc(100% - 48px);
  }

  .header-inner {
    min-height: 82px;
  }

  .direction-panel {
    padding-top: 24px;
  }

  .current-card {
    padding-block: 50px 42px;
  }

  .section-block {
    padding-block: 38px;
  }

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

  .forecast-slot {
    min-height: 150px;
    border-bottom: 0;
  }

  .forecast-slot:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .forecast-slot:last-child {
    border-right: 0;
  }

  .reminder-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 20px;
    padding-block: 24px;
  }

  .context-icon {
    width: 64px;
    height: 64px;
  }

}

@media (max-width: 374px) {
  .header-inner,
  .page-shell,
  .footer-inner {
    width: calc(100% - 24px);
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand strong {
    font-size: 16px;
  }

  .direction-switch button {
    gap: 4px;
    font-size: 14px;
  }

  .current-status {
    font-size: 38px;
  }

  .forecast-slot {
    min-height: 144px;
    padding-inline: 6px;
  }

  .forecast-slot .risk {
    font-size: 15px;
  }

  .forecast-slot .detail {
    font-size: 10px;
  }

  .camera-caption {
    align-items: center;
    padding: 9px;
  }

  .camera-copy h3 {
    font-size: 13px;
  }

  .camera-refresh-button {
    padding-inline: 9px;
  }
}

@media (max-width: 359px) {
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .section-note {
    max-width: 100%;
    text-align: left;
  }

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

  .forecast-slot {
    min-height: 126px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .forecast-slot:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .forecast-slot:nth-child(2n) {
    border-right: 0;
  }

  .forecast-slot:nth-child(n + 5) {
    border-bottom: 1px solid var(--line);
  }

  .forecast-slot:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
