:root {
  --bg: #071018;
  --panel: rgba(13, 27, 38, 0.92);
  --panel-strong: #102332;
  --line: rgba(127, 170, 190, 0.2);
  --line-strong: rgba(109, 223, 193, 0.38);
  --text: #edf6f4;
  --muted: #8ca4ad;
  --green: #6ddfc1;
  --green-dim: #173f3a;
  --gold: #e7bd68;
  --gold-dim: #3e3420;
  --red: #ff7a79;
  --red-dim: #47252a;
  --yellow: #e7bd68;
  --orange: #ee9655;
  --blue: #72b7db;
  --radius: 14px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 0%, rgba(35, 115, 115, 0.2), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgba(103, 86, 40, 0.13), transparent 28rem),
    linear-gradient(145deg, #050b11 0%, var(--bg) 48%, #09151c 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(109, 223, 193, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 223, 193, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.025;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, #fff 4px);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0 30px;
}

.command-header,
.section-heading,
.storage-topline,
.storage-note,
.mission-header,
.progress-header,
.mission-footer,
.gate-row,
.grave-top,
.verdict-reference,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.command-header { margin-bottom: 24px; }

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.7rem); letter-spacing: -0.05em; }
h2 { margin-bottom: 0; font-size: 1.45rem; }
h3 { margin: 4px 0 0; font-size: 1.3rem; }
.subtitle { margin: 0; color: var(--muted); }

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--green);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(13, 35, 36, 0.72);
  font-size: 0.84rem;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.precedence-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 24px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(7, 17, 25, 0.75);
  font-size: 0.79rem;
}

.precedence-banner strong { color: var(--text); }
.precedence-banner small { margin-left: auto; color: #6f8790; }
.precedence-label { color: var(--gold); font-weight: 800; }
.telemetry-times { display: grid; margin-left: auto; justify-items: end; gap: 3px; }
.telemetry-times small { margin-left: 0; }
.freshness { font-family: ui-monospace, monospace; font-weight: 800; }
.freshness.current { color: var(--green); }
.freshness.stale { color: var(--red); }

.dashboard-content { display: grid; gap: 24px; }
.panel {
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16, 35, 50, 0.94), var(--panel));
  box-shadow: var(--shadow);
}

.panel::before {
  display: block;
  width: 55px;
  height: 2px;
  margin: -22px 0 20px;
  content: "";
  background: var(--green);
  box-shadow: 0 0 14px rgba(109, 223, 193, 0.7);
}

.section-heading { margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.counter, .boss-tag {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}
.boss-tag { color: var(--gold); border-color: rgba(231, 189, 104, 0.3); }
.gate-heading-status { display: flex; align-items: center; gap: 8px; }

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

.watcher-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.watcher-message {
  display: flex;
  grid-column: 1 / -1;
  padding: 12px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 14, 21, 0.48);
}
.watcher-message.ready { color: var(--green); border-color: rgba(109, 223, 193, 0.32); }
.watcher-message.blocked { color: var(--red); border-color: rgba(255, 122, 121, 0.35); }
.watcher-message code { color: var(--muted); font-size: 0.63rem; }

.storage-resource,
.resource-item {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 15, 22, 0.48);
}

.storage-topline { font-size: 0.81rem; }
.storage-topline strong { color: var(--green); font-size: 1rem; }
.meter-track, .progress-track {
  height: 9px;
  margin: 18px 0 12px;
  overflow: hidden;
  border: 1px solid rgba(109, 223, 193, 0.2);
  border-radius: 999px;
  background: #071018;
}
.meter-fill, .progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #308b7b, var(--green));
  box-shadow: 0 0 18px rgba(109, 223, 193, 0.4);
}
.storage-resource.warn .meter-fill { background: linear-gradient(90deg, #9b7e3d, var(--yellow)); }
.storage-resource.blocked .meter-fill { background: linear-gradient(90deg, var(--orange), var(--red)); }
.storage-note { color: var(--muted); font-size: 0.72rem; }

.resource-item { display: flex; align-items: center; gap: 10px; }
.resource-icon {
  display: grid;
  flex: 0 0 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--green);
  font-family: ui-monospace, monospace;
  font-weight: 900;
  background: var(--green-dim);
}
.resource-icon.gold { color: var(--gold); border-color: rgba(231, 189, 104, 0.4); background: var(--gold-dim); }
.resource-icon.blocked { color: var(--red); border-color: rgba(255, 122, 121, 0.35); background: var(--red-dim); }
.resource-icon.neutral { color: var(--blue); background: rgba(27, 55, 70, 0.72); }
.resource-copy { display: grid; gap: 4px; min-width: 0; }
.resource-title { color: var(--muted); font-size: 0.7rem; }
.resource-copy strong { font-size: 0.83rem; }
.resource-copy code { overflow: hidden; color: #66818b; font-size: 0.6rem; text-overflow: ellipsis; }

.mission-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mission-card {
  position: relative;
  display: flex;
  min-height: 330px;
  padding: 20px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(16, 35, 50, 0.96), rgba(7, 17, 24, 0.98));
  box-shadow: var(--shadow);
}
.mission-card::after {
  position: absolute;
  inset: 7px;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.025);
  border-radius: 9px;
}
.mission-card.complete { border-color: rgba(231, 189, 104, 0.32); }
.mission-card.blocked { border-color: rgba(255, 122, 121, 0.35); }
.mission-card.locked { opacity: 0.72; border-style: dashed; }
.mission-id { color: var(--muted); font-family: ui-monospace, monospace; font-size: 0.75rem; letter-spacing: 0.15em; }

.badge {
  display: inline-flex;
  max-width: 180px;
  padding: 6px 8px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(12, 25, 34, 0.86);
  font-size: 0.68rem;
}
.badge code { color: inherit; opacity: 0.66; font-size: 0.56rem; }
.badge.pass { color: var(--green); border-color: rgba(109, 223, 193, 0.32); background: var(--green-dim); }
.badge.warn { color: var(--yellow); border-color: rgba(231, 189, 104, 0.35); background: var(--gold-dim); }
.badge.blocked { color: var(--red); border-color: rgba(255, 122, 121, 0.35); background: var(--red-dim); }
.badge.muted { color: #aebcc0; }
.badge.neutral { color: var(--blue); }

.mission-progress { margin: 28px 0 14px; }
.progress-header { color: var(--muted); font-size: 0.78rem; }
.progress-header strong { color: var(--text); }
.progress-track { height: 12px; margin-bottom: 7px; }
.progress-percent { color: var(--green); font-family: ui-monospace, monospace; font-size: 0.75rem; }

.blocker-callout {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(255, 122, 121, 0.28);
  border-radius: 9px;
  background: rgba(71, 37, 42, 0.58);
  font-size: 0.77rem;
}
.readiness-summary {
  display: grid;
  gap: 5px;
  margin: 4px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 14, 21, 0.48);
}
.readiness-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.7rem; }
.readiness-summary .detail-row { margin-top: 3px; grid-template-columns: 82px 1fr; }
.readiness-summary .detail-row code { text-align: right; }
.blocker-callout span:last-child { color: #cda8a8; }
.blocker-title { color: var(--red); font-size: 0.67rem; font-weight: 800; letter-spacing: 0.1em; }
.detail-row { display: grid; gap: 4px; margin-top: 16px; }
.detail-row span { color: var(--muted); font-size: 0.68rem; }
.detail-row code { overflow-wrap: anywhere; color: var(--text); font-size: 0.68rem; }
.mission-footer { margin-top: auto; padding-top: 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.72rem; }
.mission-footer code { color: #66818b; }
.lock-state { display: grid; margin: auto; place-items: center; color: var(--muted); }
.lock-glyph { color: var(--gold); font-size: 2.4rem; }

.two-column { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; }
.gate-list { display: grid; gap: 8px; }
.gate-row { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 14, 21, 0.48); }
.gate-row.pass { border-left: 3px solid var(--green); }
.gate-row.blocked { border-left: 3px solid var(--red); }
.gate-row.overall { margin-top: 5px; background: rgba(10, 24, 32, 0.82); }
.gate-identity { display: flex; align-items: center; gap: 10px; }
.gate-glyph { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 6px; color: var(--green); background: var(--green-dim); }
.blocked .gate-glyph { color: var(--red); background: var(--red-dim); }
.gate-state { display: grid; justify-items: end; gap: 2px; font-size: 0.72rem; }
.gate-state code { max-width: 250px; overflow: hidden; color: var(--muted); font-size: 0.58rem; text-overflow: ellipsis; white-space: nowrap; }

.next-action { display: grid; gap: 13px; }
.action-alert { color: var(--red); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; }
.action-code { color: var(--text); font-size: clamp(1.05rem, 2.4vw, 1.55rem); overflow-wrap: anywhere; }
.action-headline { color: var(--red); font-size: 0.9rem; line-height: 1.5; }
.action-route { display: flex; margin: 5px 0; padding: 0; list-style: none; counter-reset: route; }
.action-route li { position: relative; flex: 1; padding: 27px 5px 0; color: var(--muted); text-align: center; font-size: 0.67rem; counter-increment: route; }
.action-route li::before {
  position: absolute;
  top: 0;
  left: calc(50% - 10px);
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  content: counter(route);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--green);
  background: var(--panel-strong);
  z-index: 1;
}
.action-route li:not(:last-child)::after { position: absolute; top: 10px; left: 60%; width: 80%; height: 1px; content: ""; background: var(--line-strong); }
.action-note { margin: 0; color: var(--muted); font-size: 0.73rem; }

.archive-rune { color: var(--gold); font-size: 2rem; }
.graveyard { display: grid; gap: 12px; }
.grave-card { padding: 15px; border: 1px solid rgba(231, 189, 104, 0.22); border-radius: 10px; background: rgba(31, 29, 23, 0.36); }
.grave-top { justify-content: flex-start; }
.grave-top .badge { margin-left: auto; }
.grave-mark { color: var(--gold); font-family: serif; font-size: 1.5rem; }
.achievement-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0; }
.achievement { padding: 5px 8px; border: 1px solid rgba(231, 189, 104, 0.24); border-radius: 999px; color: var(--gold); background: var(--gold-dim); font-size: 0.66rem; }
.verdict-reference { color: var(--muted); font-size: 0.68rem; }
.verdict-reference code { color: #9aaeb4; overflow-wrap: anywhere; }

.fatal-error {
  display: flex;
  margin: 60px 0;
  padding: 24px;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(255, 122, 121, 0.45);
  border-radius: var(--radius);
  background: var(--red-dim);
}
.fatal-error h2 { margin-bottom: 7px; }
.fatal-error p { margin-bottom: 0; color: #d8b3b3; }
.error-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--red); border-radius: 50%; color: var(--red); font-size: 1.4rem; font-weight: 900; }
.hidden { display: none !important; }

.engine-health {
  display: flex;
  margin-bottom: 24px;
  padding: 13px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 24, 32, 0.82);
}
.engine-health-copy { display: flex; align-items: center; gap: 11px; }
.engine-health-copy div { display: grid; gap: 3px; }
.engine-health-copy small { color: var(--muted); }
.engine-health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 12px currentColor; }
.engine-health.online { color: var(--green); border-color: rgba(109, 223, 193, 0.34); background: var(--green-dim); }
.engine-health.stale { color: var(--yellow); border-color: rgba(231, 189, 104, 0.38); background: var(--gold-dim); }
.engine-health.offline { color: var(--red); border-color: rgba(255, 122, 121, 0.42); background: var(--red-dim); }
.engine-health.online .engine-health-dot { background: var(--green); }
.engine-health.stale .engine-health-dot { background: var(--yellow); }
.engine-health.offline .engine-health-dot { background: var(--red); }

.skeleton-block { min-height: 90px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,255,255,.025), rgba(255,255,255,.055), rgba(255,255,255,.025)); background-size: 200% 100%; animation: pulse 1.4s infinite; }
@keyframes pulse { to { background-position: -200% 0; } }

footer { margin-top: 28px; padding-top: 18px; color: #607780; border-top: 1px solid var(--line); font-size: 0.68rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

@media (max-width: 980px) {
  .base-grid { grid-template-columns: repeat(2, 1fr); }
  .watcher-grid { grid-template-columns: repeat(2, 1fr); }
  .mission-grid { grid-template-columns: 1fr; }
  .mission-card { min-height: 280px; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .command-header { align-items: flex-start; flex-direction: column; }
  .engine-health { align-items: flex-start; flex-direction: column; }
  .telemetry-times { width: 100%; margin-left: 0; justify-items: start; }
  .two-column { grid-template-columns: 1fr; }
  .base-grid { grid-template-columns: 1fr; }
  .watcher-grid { grid-template-columns: 1fr; }
  .watcher-message { grid-column: auto; align-items: flex-start; flex-direction: column; }
  .panel { padding: 17px; }
  .panel::before { margin: -17px 0 15px; }
  .gate-state code { max-width: 150px; }
  footer { align-items: flex-start; flex-direction: column; }
}

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