* { box-sizing: border-box; }

:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #122637;
  background: #edf2f5;
  --ink: #122637;
  --muted: #506678;
  --line: #dce5eb;
  --fault: #b52239;
  --fault-light: #fff0f1;
}

body { margin: 0; }

.masthead {
  background: #102b40;
  color: #fff;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px max(24px, calc((100vw - 1230px) / 2)) 46px;
}

.heading p { margin: 0; color: #c4d9e6; }
.heading .context { color: #8bd4d0; font-size: 13px; font-weight: 700; }
h1 { margin: 10px 0 6px; font-size: clamp(27px, 6vw, 40px); line-height: 1.16; }
.mode { margin: 4px 0 0; color: #d2e6ee; font-size: 13px; white-space: nowrap; }
main { max-width: 1278px; margin: -24px auto 0; padding: 0 24px 32px; }

.stats, .panel, .load-status {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.load-status { padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
.stats > div { display: flex; flex-direction: column; gap: 4px; padding: 13px 17px; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.fault-stat strong { color: var(--fault); }
.dashboard { display: grid; grid-template-columns: 1.24fr 1fr; gap: 16px; align-items: start; }
.panel { min-width: 0; padding: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-heading > span { color: var(--muted); font-size: 12px; }
h2 { font-size: 17px; margin: 0; }
.image-frame { position: relative; overflow: hidden; background: #f1f5f7; border-radius: 8px; }
.image-frame img { display: block; width: 100%; height: auto; }
.overlays { position: absolute; inset: 0; }
.overlay { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; }
.overlay[data-state="affected"] { border: 2px solid var(--fault); background: #cb293526; }
.overlay.is-selected { outline: 2px solid #1d6997; outline-offset: -2px; z-index: 1; }
.overlay.is-selected[data-state="affected"] { outline-color: #88142d; background: #c1273540; }
.matrix { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: 4px; }
.position, .next { color: var(--ink); border: 1px solid var(--line); cursor: pointer; font: inherit; }
.position { min-width: 0; min-height: 29px; padding: 1px; border-radius: 5px; background: #f0f6f8; font-size: clamp(9px, 2.3vw, 12px); }
.position[data-state="affected"] { color: #9c092b; background: var(--fault-light); border-color: #f3acb6; font-weight: 700; }
.position[aria-pressed="true"] { outline: 2px solid #1d6997; outline-offset: 1px; position: relative; }
.position[aria-pressed="true"][data-state="affected"] { outline-color: #9c092b; }
.next { background: #f4f8fb; padding: 6px 9px; border-radius: 6px; font-size: 12px; }
.next:disabled { cursor: default; color: var(--muted); }
.position:focus-visible, .next:focus-visible { outline: 2px solid #1d6997; outline-offset: 2px; }

.details { margin-top: 14px; padding: 12px; border-radius: 8px; background: #f2f7fa; }
.cell-title, .cell-status { margin: 0; }
.cell-title { font-weight: 700; }
.cell-status { margin-top: 3px; color: var(--muted); font-size: 13px; }
.cell-status[data-state="affected"] { color: var(--fault); }
dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 0; font-size: 12px; }
dt { color: var(--muted); }
dd { margin: 2px 0 0; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .masthead { padding-left: 16px; padding-right: 16px; }
  main { padding-left: 16px; padding-right: 16px; }
  .dashboard { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .masthead { flex-direction: column; gap: 7px; padding-top: 20px; }
  .panel { padding: 11px; }
  .stats > div { padding: 10px; }
  .stats strong { font-size: 18px; }
}
