:root {
  --bg: #020202;
  --panel: rgba(5, 4, 4, 0.95);
  --panel-soft: rgba(8, 6, 5, 0.96);
  --cyan: #91fff8;
  --cyan-soft: rgba(145, 255, 248, 0.18);
  --orange: #ff8f1f;
  --orange-strong: #ff5a00;
  --orange-soft: rgba(255, 143, 31, 0.12);
  --green-line: #6aff4f;
  --green-soft: rgba(106, 255, 79, 0.12);
  --text: #f8f7ef;
  --muted: #c9a17e;
  --line: rgba(255, 143, 31, 0.82);
  --ok: #79f7b6;
  --error: #ff5138;
  --warn: #ffd05b;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.62);
  --font-eva-display: "EvaMatisseDisplay", "EVA Matisse Classic", "EVA Matisse Standard", "Matisse Pro EB", "Matisse EB", "Audiowide", sans-serif;
  --font-eva-ui: "EvaMatisseUI", "EVA Matisse Standard", "Matisse Pro EB", "Oxanium", sans-serif;
  --font-eva-cjk: "Source Han Serif CN", "SourceHanSerifCN-Heavy", "Noto Serif SC", "Noto Sans", serif;
}

@font-face {
  font-family: "EvaMatisseDisplay";
  src:
    local("EVA Matisse Classic"),
    local("EVA Matisse Standard"),
    local("Matisse Pro EB"),
    local("Matisse EB"),
    url("/static/fonts/EVA-Matisse-Classic.woff2") format("woff2"),
    url("/static/fonts/FOT-MatissePro-EB.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "EvaMatisseUI";
  src:
    local("EVA Matisse Standard"),
    local("Matisse Pro EB"),
    local("Matisse EB"),
    url("/static/fonts/FOT-MatissePro-EB.woff2") format("woff2"),
    url("/static/fonts/EVA-Matisse-Classic.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "SourceHanSerifCN-Heavy";
  src:
    local("Source Han Serif CN Heavy"),
    local("SourceHanSerifCN-Heavy"),
    url("/static/fonts/SourceHanSerifCN-Heavy.woff2") format("woff2");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 82, 0, 0.13), transparent 20%),
    linear-gradient(90deg, rgba(67, 20, 0, 0.42) 0, transparent 7%, transparent 93%, rgba(67, 20, 0, 0.42) 100%),
    linear-gradient(180deg, #000 0%, #050404 100%);
  color: var(--text);
  font-family: var(--font-eva-cjk);
  overflow-x: hidden;
}

.grid,
.scanline,
.frame-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.grid {
  background-image:
    linear-gradient(rgba(255, 128, 20, 0.048) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 128, 20, 0.048) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.33;
}

.scanline {
  background: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.018) 50%, transparent 100%);
  background-size: 100% 5px;
  opacity: 0.18;
}

.frame-noise {
  box-shadow:
    inset 0 0 160px rgba(255, 89, 0, 0.11),
    inset 0 0 18px rgba(255, 255, 255, 0.03);
}

.birthday-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 2px solid rgba(145, 255, 248, 0.72);
  background:
    linear-gradient(90deg, rgba(145, 255, 248, 0.18), rgba(255, 143, 31, 0.12)),
    rgba(3, 8, 10, 0.94);
  color: var(--cyan);
  font-family: var(--font-eva-ui);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(145, 255, 248, 0.35);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(145, 255, 248, 0.12);
}

.shell {
  width: min(1640px, calc(100% - 24px));
  margin: 14px auto 26px;
  position: relative;
  z-index: 1;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px);
}

.auth-gate.hidden {
  display: none;
}

.auth-panel {
  width: min(520px, calc(100% - 24px));
  padding: 24px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin: 18px 0 14px;
}

.auth-tab {
  flex: 1;
}

.auth-tab.is-active {
  color: #11161c;
  background: linear-gradient(90deg, rgba(145, 255, 248, 0.95), rgba(111, 249, 232, 0.86));
  border-color: rgba(145, 255, 248, 0.9);
  text-shadow: none;
}

.auth-form {
  gap: 10px;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 128, 20, 0.22);
  pointer-events: none;
}

.title-bar {
  min-height: 86px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 18px 24px;
  clip-path: none;
}

.title-kicker,
.module-tag,
.status-inline strong,
h1,
button,
label,
.node-banner,
.provider-card h3 {
  font-family: var(--font-eva-ui);
}

.title-kicker {
  display: block;
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 0.36em;
  margin-bottom: 8px;
  text-shadow:
    0 0 6px rgba(255, 123, 24, 0.4),
    0 0 14px rgba(255, 123, 24, 0.16);
}

h1 {
  margin: 0;
  font-family: var(--font-eva-cjk);
  font-size: clamp(46px, 6vw, 80px);
  letter-spacing: 0.12em;
  color: #f5fbf6;
  text-transform: uppercase;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.75),
    0 0 12px rgba(145, 255, 248, 0.18);
  font-weight: 900;
}

.title-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-inline {
  min-width: 240px;
  padding: 10px 14px;
  background: rgba(255, 128, 20, 0.055);
  border: 1px solid rgba(255, 128, 20, 0.35);
  text-align: right;
}

.status-inline span {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.status-inline strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.view {
  margin-top: 18px;
}

.hidden {
  display: none;
}

.magi-stage {
  position: relative;
  display: block;
  min-height: 1040px;
  padding: 24px 0 40px;
}

.top-node {
  position: absolute;
  top: 86px;
  left: 50%;
  width: 440px;
  transform: translateX(-50%);
}

.left-node {
  position: absolute;
  top: 246px;
  left: calc(50% - 610px);
  width: 380px;
  height: 380px;
}

.right-node {
  position: absolute;
  top: 246px;
  right: calc(50% - 610px);
  width: 380px;
  height: 380px;
}

.center-stage {
  position: absolute;
  top: 612px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  grid-template-areas:
    "label label"
    "bridge verdict";
  gap: 12px;
  width: min(980px, calc(100% - 240px));
  z-index: 2;
}

.center-stage::before,
.center-stage::after {
  display: none;
}

.center-stage::before {
  left: calc(50% - 46px);
}

.center-stage::after {
  right: calc(50% - 46px);
}

.stage-ornament {
  position: absolute;
  z-index: 0;
  border: 2px solid var(--line);
  color: var(--orange);
  font-family: var(--font-eva-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 143, 31, 0.18);
  background: rgba(0, 0, 0, 0.65);
}

.stage-ornament span,
.stage-ornament strong {
  display: block;
}

.stage-ornament span {
  font-size: 11px;
  color: var(--muted);
}

.stage-ornament strong {
  font-size: 15px;
  color: var(--orange);
  text-shadow: 0 0 8px rgba(255, 143, 31, 0.24);
}

.support-left,
.support-right {
  top: 108px;
  width: 190px;
  min-height: 122px;
  padding: 10px 12px;
}

.support-panel {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  font-family: var(--font-eva-ui);
}

.support-panel strong {
  font-size: 16px;
  color: var(--orange);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-panel small {
  font-family: var(--font-eva-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.support-panel-pilot {
  justify-items: start;
}

.support-panel-pilot img {
  width: 84px;
  height: auto;
  object-fit: contain;
  filter:
    sepia(1)
    hue-rotate(-12deg)
    saturate(5.4)
    brightness(0.86)
    contrast(1.05)
    drop-shadow(0 0 8px rgba(255, 143, 31, 0.16));
  mix-blend-mode: screen;
}

.support-panel-pilot strong {
  font-size: 20px;
  color: var(--text);
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.6),
    0 0 10px rgba(145, 255, 248, 0.12);
}

.support-panel-pilot small {
  color: var(--orange);
}

.support-panel-songs {
  align-content: start;
  overflow: visible;
}

.support-panel-songs strong {
  font-size: 14px;
  line-height: 1.35;
}

.support-panel-songs small {
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(145, 255, 248, 0.18);
}

.music-panel {
  display: grid;
  gap: 6px;
  overflow: visible;
  padding-right: 0;
}

.music-track {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 5px 0;
  border-top: 1px solid rgba(255, 143, 31, 0.16);
}

.music-track:first-child {
  border-top: 0;
}

.music-play-button {
  min-height: 26px;
  min-width: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
}

.music-play-button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.music-play-button.is-playing {
  color: #11161c;
  background: linear-gradient(90deg, rgba(145, 255, 248, 0.95), rgba(111, 249, 232, 0.86));
  border-color: rgba(145, 255, 248, 0.9);
  text-shadow: none;
  box-shadow: 0 0 16px rgba(145, 255, 248, 0.2);
}

.icon-play,
.icon-pause {
  display: inline-block;
}

.icon-play {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  margin-left: 2px;
}

.icon-pause {
  width: 10px;
  height: 12px;
  position: relative;
}

.icon-pause::before,
.icon-pause::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px;
  height: 12px;
  background: currentColor;
}

.icon-pause::before {
  left: 0;
}

.icon-pause::after {
  right: 0;
}

.music-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.music-title {
  font-family: var(--font-eva-display);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.08;
  text-transform: uppercase;
}

.music-title.one-last-kiss {
  background: linear-gradient(90deg, #ffe46a 0%, #ff9448 45%, #ff4d9f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.music-title.beautiful-world {
  color: var(--orange);
}

.music-title.cruel-angel {
  color: var(--text);
  font-family: var(--font-eva-cjk);
  letter-spacing: 0.02em;
  font-size: 11px;
}

.music-meta,
.music-file,
.music-reason,
.music-status,
.music-empty {
  font-family: var(--font-eva-ui);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.music-meta {
  color: var(--muted);
}

.music-file {
  display: none;
}

.music-reason {
  color: var(--warn);
}

.music-status {
  margin-top: 5px;
  color: var(--cyan);
  line-height: 1.35;
}

.support-left {
  left: 48px;
}

.support-right {
  right: 48px;
}

.city-left,
.city-right {
  top: 564px;
  min-width: 112px;
  padding: 7px 9px;
}

.city-left {
  left: 76px;
}

.city-right {
  top: 564px;
  right: 76px;
}

.center-top {
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 132px;
  text-align: center;
  padding: 8px 14px;
  background: rgba(255, 143, 31, 0.12);
}

.center-top span {
  font-size: 28px;
  color: var(--orange);
  text-shadow: 0 0 10px rgba(255, 143, 31, 0.22);
}

.verdict-left,
.verdict-right {
  top: 392px;
  width: 166px;
  min-height: 78px;
  padding: 9px 11px;
}

.verdict-left {
  left: 44px;
}

.verdict-right {
  right: 44px;
}

.side-rail {
  position: absolute;
  top: 180px;
  bottom: 24px;
  width: 54px;
  z-index: 0;
  background:
    linear-gradient(var(--green-soft), var(--green-soft)) center/2px 100% no-repeat,
    repeating-linear-gradient(
      180deg,
      rgba(255, 143, 31, 0.9) 0 24px,
      transparent 24px 52px
    );
  opacity: 0.42;
}

.left-rail {
  left: 0;
}

.right-rail {
  right: 0;
}

.node-frame {
  padding: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  clip-path: none;
}

.node-frame::before,
.node-frame::after {
  display: none;
}

.node-banner {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 123, 24, 0.5);
  background: rgba(255, 128, 20, 0.08);
  color: var(--orange);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px rgba(255, 123, 24, 0.28);
  position: relative;
  z-index: 2;
}

.top-node .node-banner {
  margin-left: 0;
}

.left-node .node-banner {
  position: absolute;
  top: 4px;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}

.right-node .node-banner {
  position: absolute;
  top: 4px;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}

.center-label {
  grid-area: label;
  width: 140px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  color: var(--orange);
  font-family: var(--font-eva-display);
  font-size: 28px;
  letter-spacing: 0.16em;
  background:
    linear-gradient(180deg, rgba(255, 128, 20, 0.22), transparent 28%),
    linear-gradient(135deg, rgba(28, 14, 6, 0.96), rgba(7, 7, 7, 0.98));
  clip-path: polygon(22% 0, 78% 0, 100% 50%, 78% 100%, 22% 100%, 0 50%);
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.2),
    0 0 14px rgba(255, 123, 24, 0.42);
  margin-bottom: 0;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 143, 31, 0.12);
}

.bridge-panel {
  grid-area: bridge;
}

.verdict-panel {
  grid-area: verdict;
}

.council-archive-panel {
  grid-area: archive;
}

.center-label::before,
.center-label::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 94px;
  height: 2px;
  background: var(--orange);
  transform: translateY(-50%);
}

.center-label::before {
  left: -74px;
}

.center-label::after {
  right: -74px;
}

.module {
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 128, 20, 0.07), transparent 18%),
    var(--panel-soft);
  position: relative;
  z-index: 2;
}

.bridge-panel {
  transform: none;
  padding: 18px;
  border-color: rgba(145, 255, 248, 0.52);
  background:
    linear-gradient(180deg, rgba(145, 255, 248, 0.09), rgba(145, 255, 248, 0.015) 18%, transparent 52%),
    linear-gradient(135deg, rgba(8, 24, 28, 0.94), rgba(8, 10, 12, 0.98));
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(145, 255, 248, 0.08),
    inset 0 0 40px rgba(145, 255, 248, 0.05);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.verdict-panel {
  transform: none;
  padding: 18px;
  border-color: rgba(255, 143, 31, 0.76);
  background:
    linear-gradient(180deg, rgba(255, 143, 31, 0.1), rgba(255, 143, 31, 0.018) 20%, transparent 54%),
    linear-gradient(135deg, rgba(24, 13, 6, 0.96), rgba(8, 7, 7, 0.98));
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.52),
    inset 0 0 0 1px rgba(255, 143, 31, 0.08),
    inset 0 0 34px rgba(255, 143, 31, 0.04);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.module-tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 123, 24, 0.52);
  background: rgba(255, 128, 20, 0.08);
  color: var(--orange);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-shadow: 0 0 7px rgba(255, 123, 24, 0.25);
}

.bridge-panel .module-tag {
  color: var(--cyan);
  border-color: rgba(145, 255, 248, 0.46);
  background: rgba(145, 255, 248, 0.08);
  text-shadow: 0 0 8px rgba(145, 255, 248, 0.22);
}

.verdict-panel .module-tag {
  color: #ffbf72;
  border-color: rgba(255, 143, 31, 0.46);
  background: rgba(255, 143, 31, 0.08);
}

.toolbar-chip,
.evaluation-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 123, 24, 0.34);
  background: rgba(255, 128, 20, 0.07);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.toolbar-chip strong {
  color: var(--cyan);
  font-size: 13px;
  text-shadow: 0 0 8px rgba(139, 248, 255, 0.26);
}

.module-copy,
.notes p,
.provider-meta,
.history-empty {
  color: var(--muted);
}

form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--orange);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(255, 123, 24, 0.26);
}

textarea,
select,
input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: #04070a;
  color: var(--text);
  border: 1px solid rgba(255, 123, 24, 0.4);
  padding: 14px 16px;
  font: inherit;
  border-radius: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 123, 24, 0.08),
    inset 0 0 20px rgba(0, 255, 200, 0.015);
}

textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(139, 248, 255, 0.1);
}

textarea {
  min-height: 150px;
  resize: none;
  overflow: hidden;
  line-height: 1.7;
}

#consensusOutput,
#systemPrompt {
  min-height: 180px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--orange-strong);
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

button {
  border: 1px solid rgba(255, 123, 24, 0.56);
  background: linear-gradient(90deg, rgba(255, 90, 0, 0.2), rgba(255, 123, 24, 0.14));
  color: var(--orange);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 123, 24, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 123, 24, 0.12);
}

button:hover {
  background: linear-gradient(90deg, rgba(255, 90, 0, 0.32), rgba(255, 123, 24, 0.22));
}

.ghost-button {
  color: var(--cyan);
  border-color: rgba(139, 248, 255, 0.4);
  background: rgba(139, 248, 255, 0.06);
  text-shadow: 0 0 8px rgba(139, 248, 255, 0.22);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  font-family: var(--font-eva-cjk);
  font-size: 15px;
}

.node-slot .provider-card {
  min-height: 0;
}

.provider-card {
  border: 2px solid rgba(255, 123, 24, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 143, 31, 0.08), rgba(255, 143, 31, 0.02) 38%, rgba(0, 0, 0, 0.2)),
    rgba(8, 8, 9, 0.92);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 123, 24, 0.12),
    inset 0 0 0 1px rgba(255, 123, 24, 0.08),
    inset 0 0 24px rgba(255, 128, 20, 0.03),
    inset 0 28px 48px rgba(255, 143, 31, 0.03);
}

.provider-card-shell {
  position: relative;
  z-index: 1;
}

.provider-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 16px 18px;
  background:
    linear-gradient(90deg, rgba(255, 143, 31, 0.12), rgba(255, 143, 31, 0.04) 58%, transparent 100%);
}

.provider-card-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-card h3 {
  margin: 0;
  font-size: 17px;
  color: var(--text);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.status-pill.syncing {
  color: #1f1808;
  background: linear-gradient(90deg, #ffcf59, #ff8e35);
  position: relative;
  overflow: hidden;
}

.status-pill.syncing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: translateX(-100%);
  animation: scan-shift 1.1s linear infinite;
}

.provider-card-body {
  padding: 0 18px 18px;
  border-top: 1px solid rgba(255, 123, 24, 0.16);
}

.loading-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 10px;
}

.loading-line {
  height: 10px;
  background: linear-gradient(90deg, rgba(255, 123, 24, 0.1), rgba(255, 205, 113, 0.4), rgba(255, 123, 24, 0.1));
  background-size: 220px 100%;
  animation: loading-sweep 1.2s linear infinite;
}

.loading-line.short {
  width: 62%;
}

.loading-line.mid {
  width: 78%;
}

.node-frame {
  align-self: start;
}

.node-slot {
  min-height: 0;
}

.node-slot .provider-card {
  clip-path: none;
  transform: none;
}

.node-slot .provider-card-header {
  min-height: 72px;
  align-items: center;
  padding: 18px 20px;
  transform: none;
  margin: 0;
}

.node-slot .provider-card-summary {
  align-items: center;
}

.node-slot .provider-card h3 {
  font-size: 18px;
  letter-spacing: 0.12em;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.25),
    0 0 10px rgba(255, 143, 31, 0.12);
}

.node-slot .provider-card-body {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.28));
  transform: none;
  margin: 0;
  min-height: 108px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.node-slot .provider-card.tone-neutral {
  background:
    linear-gradient(180deg, rgba(255, 123, 24, 0.08), rgba(255, 123, 24, 0.018)),
    radial-gradient(circle at 50% 32%, rgba(255, 123, 24, 0.08), transparent 55%),
    rgba(8, 8, 9, 0.92);
}

.node-slot .provider-card.tone-neutral .provider-card-header {
  background: rgba(255, 123, 24, 0.045);
}

.left-node::after,
.right-node::after {
  display: none;
}

.left-node::after {
  right: -50px;
  transform: rotate(24deg);
  transform-origin: right center;
}

.right-node::after {
  left: -50px;
  transform: rotate(-24deg);
  transform-origin: left center;
}

.top-node::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -26px;
  width: 2px;
  height: 26px;
  background: var(--orange);
  transform: translateX(-50%);
  opacity: 0.55;
}

.bridge-panel textarea {
  min-height: 132px;
  border-color: rgba(145, 255, 248, 0.26);
  background:
    linear-gradient(180deg, rgba(8, 32, 36, 0.46), rgba(2, 7, 10, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(145, 255, 248, 0.06),
    inset 0 0 24px rgba(145, 255, 248, 0.03);
}

.verdict-panel pre {
  min-height: 206px;
  max-height: 286px;
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid rgba(255, 143, 31, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 143, 31, 0.04), rgba(0, 0, 0, 0.08));
}

.verdict-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.council-archive-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 24;
  width: min(1280px, calc(100vw - 72px));
  border-color: rgba(145, 255, 248, 0.42);
  background:
    linear-gradient(180deg, rgba(145, 255, 248, 0.06), rgba(145, 255, 248, 0.012) 18%, transparent 55%),
    linear-gradient(135deg, rgba(5, 14, 18, 0.96), rgba(7, 8, 10, 0.98));
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.62),
    inset 0 0 0 1px rgba(145, 255, 248, 0.06),
    inset 0 0 30px rgba(145, 255, 248, 0.04);
  max-height: min(76vh, 860px);
  overflow: hidden;
  padding: 18px;
}

.council-archive-panel::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(6px);
}

.council-archive-panel .module-tag {
  color: var(--cyan);
  border-color: rgba(145, 255, 248, 0.42);
  background: rgba(145, 255, 248, 0.08);
  text-shadow: 0 0 8px rgba(145, 255, 248, 0.2);
}

.council-archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-height: calc(min(76vh, 860px) - 124px);
  overflow: auto;
  padding-right: 6px;
  align-items: start;
}

.council-reply-card {
  padding: 14px;
  min-width: 0;
  min-height: 100%;
  border: 1px solid rgba(145, 255, 248, 0.18);
  background:
    linear-gradient(180deg, rgba(145, 255, 248, 0.04), rgba(145, 255, 248, 0.012) 24%, rgba(0, 0, 0, 0.2)),
    rgba(6, 10, 12, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(145, 255, 248, 0.03),
    inset 0 0 20px rgba(145, 255, 248, 0.02);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.council-reply-card.tone-error {
  border-color: rgba(255, 81, 56, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 81, 56, 0.05), rgba(255, 81, 56, 0.012) 24%, rgba(0, 0, 0, 0.2)),
    rgba(12, 7, 7, 0.92);
}

.council-reply-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.council-reply-node {
  color: var(--cyan);
  font-family: var(--font-eva-display);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(145, 255, 248, 0.15);
}

.council-reply-provider,
.council-reply-meta {
  color: var(--muted);
  font-family: var(--font-eva-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.council-reply-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid rgba(145, 255, 248, 0.14);
  background: rgba(145, 255, 248, 0.03);
}

.council-reply-body {
  margin-top: 12px;
  min-height: 0;
  max-height: 46vh;
  overflow: auto;
  padding: 12px 13px;
  border: 1px solid rgba(145, 255, 248, 0.14);
  background:
    linear-gradient(180deg, rgba(4, 22, 26, 0.46), rgba(2, 7, 10, 0.94));
  color: rgba(245, 249, 248, 0.92);
  line-height: 1.68;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .council-archive-panel {
    width: min(1080px, calc(100vw - 40px));
  }

  .council-archive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .council-reply-card {
    padding: 12px;
  }

  .council-reply-body {
    font-size: 12px;
    line-height: 1.58;
  }
}

@media (max-width: 760px) {
  .council-archive-panel {
    width: calc(100vw - 20px);
    max-height: 82vh;
    padding: 14px;
  }

  .council-archive-grid {
    grid-template-columns: 1fr;
    max-height: calc(82vh - 118px);
  }

  .council-reply-body {
    max-height: 28vh;
  }
}

.history-panel {
  display: none;
}

.node-slot .provider-card.tone-approve {
  background:
    linear-gradient(180deg, rgba(144, 255, 244, 0.22), rgba(144, 255, 244, 0.08)),
    rgba(111, 249, 232, 0.84);
}

.node-slot .provider-card.tone-reject,
.node-slot .provider-card.tone-error {
  background:
    linear-gradient(180deg, rgba(255, 84, 44, 0.24), rgba(255, 84, 44, 0.08)),
    rgba(255, 66, 28, 0.9);
}

.node-slot .provider-card.tone-approve .provider-card-header,
.node-slot .provider-card.tone-reject .provider-card-header,
.node-slot .provider-card.tone-error .provider-card-header {
  background: transparent;
}

.node-slot .provider-card.tone-approve h3,
.node-slot .provider-card.tone-reject h3,
.node-slot .provider-card.tone-error h3 {
  color: #11161c;
  text-shadow: none;
}

.node-slot .provider-card.tone-approve .provider-meta,
.node-slot .provider-card.tone-approve pre,
.node-slot .provider-card.tone-reject .provider-meta,
.node-slot .provider-card.tone-reject pre,
.node-slot .provider-card.tone-error .provider-meta,
.node-slot .provider-card.tone-error pre {
  color: #11161c;
}

.node-slot .provider-card .node-answer-body {
  color: rgba(248, 247, 239, 0.94);
}

.top-node .provider-card {
  min-height: 190px;
  clip-path: none;
}

.left-node .node-slot,
.right-node .node-slot {
  position: absolute;
  inset: 48px 0 0;
  height: 332px;
}

.left-node .provider-card,
.right-node .provider-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 300px;
  min-height: 300px;
  height: 300px;
  clip-path: none;
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center;
}

.left-node .provider-card-shell,
.right-node .provider-card-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: rotate(-45deg);
  transform-origin: center;
  translate: -50% -50%;
  width: 236px;
  min-height: 208px;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
}

.left-node .provider-card-header,
.right-node .provider-card-header {
  position: static;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 8px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 123, 24, 0.12);
}

.left-node .provider-card-body,
.right-node .provider-card-body {
  transform: none;
  width: 100%;
  margin: 0;
  min-height: 140px;
  padding: 12px 10px 0;
  border-top: 0;
  background: transparent;
}

.left-node .provider-card-summary,
.right-node .provider-card-summary {
  justify-content: center;
  width: 100%;
}

.left-node .provider-card h3,
.right-node .provider-card h3 {
  max-width: 220px;
  font-size: 17px;
  text-align: center;
  line-height: 1.3;
}

.left-node .status-pill,
.right-node .status-pill {
  position: static;
  min-height: 24px;
  font-size: 10px;
}

.left-node .node-lore-block,
.right-node .node-lore-block {
  gap: 6px;
  text-align: center;
}

.left-node .node-lore-title,
.right-node .node-lore-title {
  text-align: center;
}

.left-node .node-lore-copy,
.right-node .node-lore-copy {
  font-size: 11px;
  line-height: 1.45;
  max-width: 220px;
  margin: 0 auto;
}

.left-node .node-stat-grid,
.right-node .node-stat-grid {
  margin-top: 2px;
  gap: 8px;
}

.left-node .node-stat,
.right-node .node-stat {
  padding: 8px 8px 7px;
  min-height: 58px;
}

.left-node .node-stat strong,
.right-node .node-stat strong,
.left-node .node-stat span,
.right-node .node-stat span {
  text-align: center;
}

.provider-meta {
  margin: 10px 0 0;
  font-size: 13px;
}

.node-lore-block {
  display: grid;
  gap: 8px;
}

.node-lore-title {
  color: var(--orange);
  font-family: var(--font-eva-ui);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 123, 24, 0.18);
}

.node-lore-copy {
  color: rgba(248, 247, 239, 0.82);
  font-size: 12px;
  line-height: 1.58;
}

.node-answer-body {
  min-height: 0;
  max-height: 106px;
  overflow: auto;
  padding: 10px 11px;
  border: 1px solid rgba(145, 255, 248, 0.16);
  background:
    linear-gradient(180deg, rgba(4, 22, 26, 0.48), rgba(2, 7, 10, 0.9));
  color: rgba(248, 247, 239, 0.93);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

.top-node .node-answer-body {
  max-height: 118px;
}

.left-node .node-answer-body,
.right-node .node-answer-body {
  max-height: 82px;
  padding: 8px 9px;
  font-size: 10px;
  line-height: 1.42;
}

.node-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.node-stat {
  padding: 8px 10px;
  border: 1px solid rgba(255, 123, 24, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 143, 31, 0.08), rgba(255, 143, 31, 0.025));
  box-shadow: inset 0 0 10px rgba(255, 143, 31, 0.04);
}

.node-stat span {
  display: block;
  color: var(--muted);
  font-family: var(--font-eva-ui);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.node-stat strong {
  display: block;
  color: var(--text);
  font-family: var(--font-eva-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: "Oxanium", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ready {
  color: #082818;
  background: var(--ok);
}

.missing_config {
  color: #583a00;
  background: var(--warn);
}

.error {
  color: #4f0f15;
  background: var(--error);
}

.config-stage {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.config-side,
.tuning-stack,
.notes,
.config-grid,
.custom-fields {
  display: grid;
  gap: 14px;
}

.server-setup-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 123, 24, 0.3);
  background: rgba(255, 123, 24, 0.06);
  color: var(--muted);
  line-height: 1.7;
}

.server-setup-notice.ready {
  border-color: rgba(121, 247, 182, 0.32);
  background: rgba(121, 247, 182, 0.08);
  color: #cffff0;
}

.server-setup-notice.missing {
  border-color: rgba(255, 208, 91, 0.35);
  background: rgba(255, 208, 91, 0.08);
  color: #ffe8a5;
}

.server-setup-notice code {
  color: var(--cyan);
}

.config-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.slot-card,
.tuning-block {
  padding: 16px;
  border: 1px solid rgba(255, 123, 24, 0.26);
  background: rgba(255, 123, 24, 0.035);
  box-shadow: inset 0 0 18px rgba(255, 123, 24, 0.025);
}

.inline-auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.auth-status,
.config-hint {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 12px;
}

.provider-doc-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-eva-ui);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(145, 255, 248, 0.28);
  width: fit-content;
}

.provider-doc-link:hover {
  color: #cffff0;
  border-bottom-color: rgba(145, 255, 248, 0.65);
}

.config-validation-status {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 123, 24, 0.24);
  background: rgba(255, 123, 24, 0.05);
  color: var(--muted);
  line-height: 1.6;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.config-validation-status.success {
  color: #cffff0;
  border-color: rgba(121, 247, 182, 0.38);
  background: rgba(121, 247, 182, 0.08);
}

.config-validation-status.error {
  color: #ffb0a5;
  border-color: rgba(255, 81, 56, 0.38);
  background: rgba(255, 81, 56, 0.08);
}

.config-validation-status.pending {
  color: #ffe8a5;
  border-color: rgba(255, 208, 91, 0.35);
  background: rgba(255, 208, 91, 0.08);
}

.identity-chip {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(139, 248, 255, 0.38);
  background: rgba(139, 248, 255, 0.06);
  color: var(--cyan);
  font-family: var(--font-eva-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-status.ready {
  color: #cffff0;
}

.auth-status.warn {
  color: #ffe8a5;
}

.auth-status.error {
  color: #ffb0a5;
}

.slot-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.slot-card h3 {
  margin: 0;
  color: var(--cyan);
  font-size: 16px;
  font-family: var(--font-eva-display);
  letter-spacing: 0.08em;
  text-shadow:
    0 0 6px rgba(139, 248, 255, 0.22),
    0 0 14px rgba(139, 248, 255, 0.08);
}

.server-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  font-family: var(--font-eva-ui);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 123, 24, 0.3);
}

.server-badge.is-ready {
  color: #0f2018;
  background: var(--ok);
  border-color: rgba(121, 247, 182, 0.5);
}

.server-badge.is-missing {
  color: #5c3b00;
  background: var(--warn);
  border-color: rgba(255, 208, 91, 0.5);
}

textarea,
select,
input[type="text"],
input[type="password"],
input[type="number"],
pre,
.history-answer {
  font-family: var(--font-eva-cjk);
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
  font-family: var(--font-eva-ui), var(--font-eva-cjk);
}

.notes p {
  margin: 0;
  line-height: 1.7;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 14px 16px;
  border: 1px solid rgba(255, 123, 24, 0.22);
  background: rgba(255, 123, 24, 0.035);
  cursor: pointer;
}

.history-item:hover {
  border-color: rgba(139, 248, 255, 0.34);
}

.history-time {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.history-question {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
}

.history-answer {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

@keyframes scan-shift {
  to {
    transform: translateX(100%);
  }
}

@keyframes loading-sweep {
  from {
    background-position: -220px 0;
  }
  to {
    background-position: 220px 0;
  }
}

@media (max-width: 1280px) and (min-width: 981px) {
  .shell {
    width: min(100% - 12px, 1640px);
  }

  .magi-stage {
    min-height: 1000px;
    padding-top: 12px;
  }

  .top-node {
    top: 70px;
    width: 380px;
  }

  .left-node {
    top: 230px;
    left: 18px;
    width: 340px;
    height: 340px;
  }

  .right-node {
    top: 230px;
    right: 18px;
    width: 340px;
    height: 340px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 268px;
    min-height: 268px;
    height: 268px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 214px;
    min-height: 190px;
  }

  .left-node .provider-card-header,
  .right-node .provider-card-header {
    gap: 7px;
    padding: 10px 10px 7px;
  }

  .left-node .provider-card-body,
  .right-node .provider-card-body {
    min-height: 118px;
    padding: 9px 8px 0;
  }

  .left-node .node-stat-grid,
  .right-node .node-stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .left-node .node-stat,
  .right-node .node-stat {
    min-height: 48px;
    padding: 6px;
  }

  .left-node .node-stat strong,
  .right-node .node-stat strong {
    font-size: 9px;
  }

  .left-node .node-answer-body,
  .right-node .node-answer-body {
    max-height: 62px;
  }

  .center-stage {
    top: 590px;
    width: min(940px, calc(100% - 28px));
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .verdict-left,
  .verdict-right,
  .side-rail {
    display: none;
  }

  .council-archive-panel {
    max-height: 318px;
  }

  .council-archive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 226px;
  }

  .council-reply-body {
    max-height: 112px;
    font-size: 12px;
    line-height: 1.55;
  }
}

@media (max-width: 980px) {
  .magi-stage,
  .config-stage,
  .config-grid,
  .title-bar {
    grid-template-columns: 1fr;
  }

  .magi-stage {
    min-height: auto;
    padding-top: 10px;
    display: grid;
    gap: 16px;
  }

  .top-node,
  .left-node,
  .right-node,
  .center-stage {
    width: 100%;
    transform: none;
    margin-top: 0;
    justify-self: stretch;
    position: static;
  }

  .left-node,
  .right-node {
    height: auto;
  }

  .center-stage {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "bridge"
      "verdict";
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .center-top,
  .verdict-left,
  .verdict-right,
  .side-rail {
    display: none;
  }

  .title-side {
    justify-items: start;
  }

  .center-stage::before,
  .center-stage::after,
  .left-node::after,
  .right-node::after,
  .top-node::after {
    display: none;
  }

  .node-slot .provider-card,
  .node-slot .provider-card-header,
  .node-slot .provider-card-body {
    transform: none;
    margin: 0;
  }

  .left-node .node-slot,
  .right-node .node-slot {
    position: static;
    inset: auto;
    height: auto;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    min-height: 0;
    height: auto;
    transform: none;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    position: static;
    width: auto;
    min-height: 0;
    transform: none;
    translate: none;
  }

  .left-node .provider-card-header,
  .right-node .provider-card-header {
    align-items: flex-start;
  }

  .left-node .provider-card-summary,
  .right-node .provider-card-summary {
    justify-content: flex-start;
  }

  .left-node .node-lore-block,
  .right-node .node-lore-block,
  .left-node .node-lore-title,
  .right-node .node-lore-title {
    text-align: left;
  }

  .left-node .node-lore-copy,
  .right-node .node-lore-copy {
    max-width: none;
    margin: 0;
  }

  .council-archive-panel {
    width: calc(100vw - 24px);
    max-height: 82vh;
    overflow: hidden;
  }

  .council-archive-grid {
    grid-template-columns: 1fr;
    max-height: calc(82vh - 118px);
    overflow: auto;
    padding-right: 0;
  }

  .history-panel {
    display: block;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 14px, 1500px);
  }

  h1 {
    font-size: 42px;
  }

  .module-head,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Compact command-board mode: council replies live in the three MAGI nodes. */
#councilArchivePanel,
#toggleCouncilArchiveButton {
  display: none !important;
}

.shell {
  width: min(1760px, calc(100% - 18px));
  margin: 8px auto 16px;
}

.title-bar {
  min-height: 68px;
  padding: 10px 18px;
}

.title-kicker {
  margin-bottom: 3px;
  font-size: 10px;
}

h1 {
  font-size: clamp(36px, 4.2vw, 58px);
  line-height: 1;
}

.title-side {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
}

.status-inline {
  min-width: 0;
  padding: 7px 10px;
}

.status-inline strong {
  font-size: 12px;
}

.view {
  margin-top: 10px;
}

.magi-stage {
  min-height: 790px;
  padding: 8px 0 18px;
}

.center-top {
  top: 18px;
}

.center-top span {
  font-size: 22px;
}

.top-node {
  top: 54px;
  width: 390px;
}

.left-node {
  top: 190px;
  left: calc(50% - 565px);
  width: 340px;
  height: 340px;
}

.right-node {
  top: 190px;
  right: calc(50% - 565px);
  width: 340px;
  height: 340px;
}

.center-stage {
  top: 480px;
  grid-template-columns: minmax(300px, 0.92fr) minmax(340px, 1.08fr);
  width: min(820px, calc(100% - 420px));
}

.center-label {
  width: 118px;
  min-height: 48px;
  font-size: 22px;
}

.center-label::before,
.center-label::after {
  width: 68px;
}

.center-label::before {
  left: -54px;
}

.center-label::after {
  right: -54px;
}

.bridge-panel,
.verdict-panel {
  padding: 14px;
}

.bridge-panel textarea {
  min-height: 92px;
}

.verdict-panel pre {
  min-height: 154px;
  max-height: 202px;
  font-size: 14px;
  line-height: 1.62;
}

.module-head {
  margin-bottom: 10px;
}

.module-tag {
  min-height: 30px;
  font-size: 12px;
}

button {
  padding: 10px 12px;
}

.top-node .provider-card {
  min-height: 164px;
}

.top-node .node-slot .provider-card-header {
  min-height: 54px;
  padding: 12px 16px;
}

.top-node .node-slot .provider-card-body {
  min-height: 96px;
  padding: 10px 16px 14px;
}

.top-node .node-answer-body {
  max-height: 74px;
}

.left-node .provider-card,
.right-node .provider-card {
  width: 276px;
  min-height: 276px;
  height: 276px;
}

.left-node .provider-card-shell,
.right-node .provider-card-shell {
  width: 218px;
  min-height: 190px;
}

.left-node .provider-card-header,
.right-node .provider-card-header {
  gap: 7px;
  padding: 10px 10px 6px;
}

.left-node .provider-card-body,
.right-node .provider-card-body {
  min-height: 118px;
  padding: 8px 8px 0;
}

.left-node .node-stat-grid,
.right-node .node-stat-grid {
  gap: 6px;
}

.left-node .node-stat,
.right-node .node-stat {
  min-height: 46px;
  padding: 6px;
}

.left-node .node-stat strong,
.right-node .node-stat strong {
  font-size: 9px;
}

.left-node .node-answer-body,
.right-node .node-answer-body {
  max-height: 66px;
  font-size: 10px;
  line-height: 1.38;
}

.support-left,
.support-right {
  top: 76px;
}

.verdict-left,
.verdict-right {
  top: 282px;
}

.city-left,
.city-right {
  top: 502px;
}

@media (max-width: 1280px) and (min-width: 981px) {
  .magi-stage {
    min-height: 770px;
  }

  .top-node {
    top: 46px;
    width: 360px;
  }

  .left-node {
    top: 180px;
    left: 12px;
  }

  .right-node {
    top: 180px;
    right: 12px;
  }

  .center-stage {
    top: 468px;
    width: min(760px, calc(100% - 28px));
  }
}

@media (max-width: 980px) {
  .title-side {
    grid-template-columns: 1fr;
  }

  .magi-stage {
    min-height: auto;
    display: grid;
  }

  .top-node,
  .left-node,
  .right-node,
  .center-stage {
    width: 100%;
    position: static;
    transform: none;
  }

  .left-node,
  .right-node {
    height: auto;
  }

  .center-stage {
    grid-template-columns: 1fr;
    grid-template-areas:
      "label"
      "bridge"
      "verdict";
  }

  .left-node .provider-card,
  .right-node .provider-card {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    min-height: 0;
    height: auto;
    transform: none;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    position: static;
    width: auto;
    min-height: 0;
    transform: none;
    translate: none;
  }

  .left-node .node-answer-body,
  .right-node .node-answer-body,
  .top-node .node-answer-body {
    max-height: 180px;
    font-size: 12px;
    line-height: 1.55;
  }
}

/* Balanced board layout: fixed rows for ornaments, MAGI nodes, and controls. */
@media (min-width: 1281px) {
  .shell {
    width: min(1760px, calc(100% - 18px));
  }

  .magi-stage {
    display: grid;
    grid-template-columns:
      minmax(170px, 220px)
      minmax(270px, 330px)
      minmax(360px, 430px)
      minmax(270px, 330px)
      minmax(170px, 220px);
    grid-template-rows: 128px 348px 292px;
    grid-template-areas:
      "supportL . centerTop . supportR"
      "verdictL left top right verdictR"
      "cityL controls controls controls cityR";
    justify-content: center;
    align-items: start;
    gap: 10px 16px;
    min-height: auto;
    padding: 8px 0 18px;
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .center-top,
  .verdict-left,
  .verdict-right,
  .top-node,
  .left-node,
  .right-node,
  .center-stage {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: 100%;
  }

  .support-left {
    grid-area: supportL;
  }

  .support-right {
    grid-area: supportR;
  }

  .center-top {
    grid-area: centerTop;
    justify-self: center;
    align-self: center;
    width: fit-content;
  }

  .verdict-left {
    grid-area: verdictL;
    align-self: start;
    margin-top: 42px;
  }

  .verdict-right {
    grid-area: verdictR;
    align-self: start;
    margin-top: 42px;
  }

  .city-left {
    grid-area: cityL;
    align-self: start;
    justify-self: center;
    width: fit-content;
  }

  .city-right {
    grid-area: cityR;
    align-self: start;
    justify-self: center;
    width: fit-content;
  }

  .top-node {
    grid-area: top;
    justify-self: stretch;
  }

  .left-node {
    grid-area: left;
    justify-self: stretch;
    height: 340px;
  }

  .right-node {
    grid-area: right;
    justify-self: stretch;
    height: 340px;
  }

  .center-stage {
    grid-area: controls;
    display: grid;
    grid-template-columns: minmax(320px, 0.92fr) minmax(390px, 1.08fr);
    grid-template-areas:
      "label label"
      "bridge verdict";
    gap: 10px 14px;
    justify-self: stretch;
    align-self: start;
    z-index: 3;
  }

  .side-rail {
    display: none;
  }

  .support-left,
  .support-right {
    min-height: 118px;
    padding: 10px 12px;
  }

  .support-panel-pilot img {
    width: 70px;
  }

  .center-top span {
    font-size: 22px;
  }

  .verdict-left,
  .verdict-right {
    width: 100%;
    min-height: 78px;
  }

  .top-node .node-banner,
  .left-node .node-banner,
  .right-node .node-banner {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 0 8px;
  }

  .top-node .provider-card {
    min-height: 238px;
  }

  .top-node .node-slot .provider-card-header {
    min-height: 58px;
    padding: 12px 16px;
  }

  .top-node .node-slot .provider-card-body {
    min-height: 158px;
    padding: 10px 16px 14px;
  }

  .top-node .node-answer-body {
    max-height: 122px;
  }

  .left-node .node-slot,
  .right-node .node-slot {
    inset: 42px 0 0;
    height: 298px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 250px;
    min-height: 250px;
    height: 250px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 196px;
    min-height: 174px;
  }

  .left-node .provider-card-header,
  .right-node .provider-card-header {
    gap: 6px;
    padding: 8px 8px 6px;
  }

  .left-node .provider-card h3,
  .right-node .provider-card h3 {
    font-size: 15px;
  }

  .left-node .status-pill,
  .right-node .status-pill {
    min-height: 22px;
    font-size: 9px;
  }

  .left-node .provider-card-body,
  .right-node .provider-card-body {
    min-height: 108px;
    padding: 7px 7px 0;
  }

  .left-node .node-stat-grid,
  .right-node .node-stat-grid {
    gap: 5px;
  }

  .left-node .node-stat,
  .right-node .node-stat {
    min-height: 42px;
    padding: 5px;
  }

  .left-node .node-stat span,
  .right-node .node-stat span {
    font-size: 8px;
  }

  .left-node .node-stat strong,
  .right-node .node-stat strong {
    font-size: 8px;
  }

  .left-node .node-answer-body,
  .right-node .node-answer-body {
    max-height: 58px;
    padding: 7px 8px;
    font-size: 9px;
    line-height: 1.35;
  }

  .bridge-panel,
  .verdict-panel {
    height: 238px;
    padding: 14px;
  }

  .bridge-panel textarea {
    min-height: 86px;
    max-height: 86px;
  }

  .verdict-panel pre {
    min-height: 112px;
    max-height: 134px;
    font-size: 13px;
    line-height: 1.55;
  }
}

@media (min-width: 981px) and (max-width: 1280px) {
  .magi-stage {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.15fr) minmax(260px, 1fr);
    grid-template-rows: 320px 292px;
    grid-template-areas:
      "left top right"
      "controls controls controls";
    gap: 12px 14px;
    min-height: auto;
    padding: 10px 0 18px;
  }

  .top-node,
  .left-node,
  .right-node,
  .center-stage {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: 100%;
  }

  .top-node {
    grid-area: top;
  }

  .left-node {
    grid-area: left;
    height: 320px;
  }

  .right-node {
    grid-area: right;
    height: 320px;
  }

  .center-stage {
    grid-area: controls;
    grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.08fr);
    grid-template-areas:
      "label label"
      "bridge verdict";
    gap: 10px 14px;
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .center-top,
  .verdict-left,
  .verdict-right,
  .side-rail {
    display: none;
  }

  .bridge-panel,
  .verdict-panel {
    height: 236px;
  }
}

/* Final cockpit composition: spacious MAGI triad with a vertical command stack. */
@media (min-width: 981px) {
  .shell {
    width: min(1760px, calc(100% - 24px));
    margin: 8px auto 18px;
  }

  .title-bar {
    min-height: 84px;
    padding: 12px 18px;
  }

  h1 {
    font-size: clamp(42px, 4.8vw, 68px);
    line-height: 0.95;
  }

  .title-side {
    grid-template-columns: repeat(3, minmax(112px, auto));
    align-items: stretch;
  }

  .status-inline {
    min-width: 0;
    padding: 8px 12px;
  }

  .magi-stage {
    display: grid;
    grid-template-columns:
      minmax(170px, 220px)
      minmax(300px, 370px)
      minmax(430px, 540px)
      minmax(300px, 370px)
      minmax(170px, 220px);
    grid-template-rows: 86px 392px auto;
    grid-template-areas:
      "supportL . centerTop . supportR"
      "cityL left top right cityR"
      ". command command command .";
    justify-content: center;
    align-items: start;
    gap: 16px 22px;
    min-height: auto;
    padding: 10px 0 28px;
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .center-top,
  .top-node,
  .left-node,
  .right-node,
  .center-stage {
    position: relative;
    inset: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
  }

  .verdict-left,
  .verdict-right,
  .side-rail {
    display: none;
  }

  .support-left {
    grid-area: supportL;
  }

  .support-right {
    grid-area: supportR;
  }

  .center-top {
    grid-area: centerTop;
    justify-self: center;
    align-self: center;
    width: fit-content;
    min-width: 142px;
  }

  .city-left {
    grid-area: cityL;
    justify-self: center;
    align-self: end;
    width: fit-content;
  }

  .city-right {
    grid-area: cityR;
    justify-self: center;
    align-self: end;
    width: fit-content;
  }

  .top-node {
    grid-area: top;
    align-self: start;
  }

  .left-node {
    grid-area: left;
    height: 372px;
  }

  .right-node {
    grid-area: right;
    height: 372px;
  }

  .center-stage {
    grid-area: command;
    display: grid;
    grid-template-columns: minmax(420px, 860px);
    grid-template-areas:
      "label"
      "bridge"
      "verdict";
    justify-content: center;
    gap: 12px;
    z-index: 3;
  }

  .support-left,
  .support-right {
    min-height: 86px;
    padding: 9px 12px;
    overflow: hidden;
  }

  .support-right {
    width: 224px;
    min-height: 186px;
    padding: 10px 12px 12px;
  }

  .support-panel {
    margin-top: 8px;
  }

  .support-panel-pilot img {
    width: 58px;
  }

  .support-panel-pilot strong {
    font-size: 16px;
  }

  .music-panel {
    max-height: none;
    overflow: hidden;
    gap: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .music-panel::-webkit-scrollbar {
    display: none;
  }

  .support-right .music-track {
    gap: 6px;
    padding: 4px 0;
  }

  .support-right .music-play-button {
    min-height: 24px;
    min-width: 24px;
  }

  .support-right .music-title {
    font-size: 10px;
    line-height: 1.05;
  }

  .support-right .music-meta {
    font-size: 7px;
    line-height: 1.2;
  }

  .support-right .music-status {
    margin-top: 5px;
    line-height: 1.2;
  }

  .center-top span {
    font-size: 24px;
  }

  .top-node .node-banner,
  .left-node .node-banner,
  .right-node .node-banner {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 0 8px;
  }

  .top-node .provider-card {
    min-height: 306px;
  }

  .top-node .node-slot .provider-card-header {
    min-height: 62px;
    padding: 14px 18px;
  }

  .top-node .node-slot .provider-card-body {
    min-height: 210px;
    padding: 14px 18px 16px;
  }

  .top-node .node-answer-body {
    max-height: 158px;
  }

  .left-node .node-slot,
  .right-node .node-slot {
    position: absolute;
    inset: 42px 0 0;
    height: 330px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 292px;
    min-height: 292px;
    height: 292px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 230px;
    min-height: 206px;
  }

  .left-node .provider-card-header,
  .right-node .provider-card-header {
    gap: 7px;
    padding: 12px 10px 8px;
  }

  .left-node .provider-card-body,
  .right-node .provider-card-body {
    min-height: 132px;
    padding: 9px 9px 0;
  }

  .left-node .node-answer-body,
  .right-node .node-answer-body {
    max-height: 76px;
    font-size: 10px;
    line-height: 1.42;
  }

  .center-label {
    width: 124px;
    min-height: 46px;
    font-size: 22px;
    margin-top: -4px;
  }

  .bridge-panel,
  .verdict-panel {
    width: 100%;
    height: auto;
    padding: 16px;
  }

  .bridge-panel {
    min-height: 236px;
  }

  .verdict-panel {
    min-height: 246px;
  }

  .bridge-panel textarea {
    min-height: 92px;
    max-height: 110px;
  }

  .verdict-panel pre {
    min-height: 128px;
    max-height: 154px;
    font-size: 14px;
    line-height: 1.58;
  }

  .bridge-panel .action-row {
    justify-content: flex-end;
  }
}

@media (min-width: 981px) and (max-width: 1380px) {
  .magi-stage {
    grid-template-columns:
      minmax(250px, 1fr)
      minmax(360px, 1.15fr)
      minmax(250px, 1fr);
    grid-template-rows: 372px auto;
    grid-template-areas:
      "left top right"
      "command command command";
    gap: 16px;
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right,
  .center-top {
    display: none;
  }

  .center-stage {
    grid-template-columns: minmax(420px, 760px);
  }

  .left-node,
  .right-node {
    height: 348px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 270px;
    min-height: 270px;
    height: 270px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 214px;
    min-height: 190px;
  }
}

/* Final command order: directive first, then the three MAGI nodes enclosing the resolution. */
@media (min-width: 981px) {
  .magi-stage {
    grid-template-columns:
      minmax(190px, 230px)
      minmax(280px, 350px)
      minmax(430px, 540px)
      minmax(280px, 350px)
      minmax(190px, 230px);
    grid-template-rows:
      minmax(132px, auto)
      54px
      246px
      58px
      280px;
    grid-template-areas:
      "supportL prompt prompt prompt supportR"
      ". . centerTop . ."
      ". . top . ."
      "cityL left magi right cityR"
      ". left verdict right .";
    gap: 10px 46px;
    padding: 8px 0 20px;
    align-items: start;
  }

  .center-stage {
    display: contents;
  }

  .bridge-panel {
    grid-area: prompt;
    align-self: stretch;
    min-height: 132px;
    padding: 12px 16px;
  }

  .bridge-panel .module-head {
    margin-bottom: 8px;
  }

  .prompt-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .prompt-actions button {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
  }

  .bridge-panel form {
    display: grid;
    gap: 8px;
  }

  .bridge-panel form label {
    line-height: 1;
  }

  .bridge-panel textarea {
    min-height: 58px;
    max-height: 66px;
    line-height: 1.35;
  }

  .bridge-panel .action-row {
    grid-area: action;
    margin-top: 0;
    justify-content: flex-end;
  }

  .bridge-panel .action-row button {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 11px;
  }

  .center-label {
    grid-area: magi;
    justify-self: center;
    align-self: center;
    width: 112px;
    min-height: 40px;
    margin: 0;
    font-size: 20px;
  }

  .verdict-panel {
    grid-area: verdict;
    align-self: start;
    min-height: 238px;
    padding: 14px 16px;
  }

  .verdict-panel pre {
    min-height: 128px;
    max-height: 142px;
    font-size: 13px;
    line-height: 1.52;
  }

  .top-node {
    align-self: stretch;
    height: 246px;
  }

  .top-node .provider-card {
    min-height: 202px;
    height: 202px;
    overflow: hidden;
  }

  .top-node .node-slot .provider-card-header {
    min-height: 48px;
    padding: 10px 14px;
  }

  .top-node .node-slot .provider-card-body {
    min-height: 134px;
    padding: 8px 14px 10px;
    overflow: hidden;
  }

  .top-node .node-lore-block {
    gap: 5px;
  }

  .top-node .node-lore-copy {
    line-height: 1.25;
  }

  .top-node .node-stat-grid {
    gap: 6px;
  }

  .top-node .node-stat {
    min-height: 46px;
    padding: 7px 9px;
  }

  .top-node .node-answer-body {
    max-height: 62px;
  }

  .left-node,
  .right-node {
    align-self: center;
    width: 100%;
    height: 340px;
    margin-top: -26px;
  }

  .left-node {
    justify-self: start;
  }

  .right-node {
    justify-self: end;
  }

  .left-node .node-slot,
  .right-node .node-slot {
    inset: 40px 0 0;
    height: 300px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 292px;
    min-height: 292px;
    height: 292px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 226px;
    min-height: 198px;
  }

  .left-node .provider-card-body,
  .right-node .provider-card-body {
    min-height: 122px;
    padding: 9px 9px 0;
  }

  .left-node .node-answer-body,
  .right-node .node-answer-body {
    max-height: 54px;
    font-size: 9px;
    line-height: 1.35;
  }

  .support-left,
  .support-right {
    position: relative;
    inset: auto;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    z-index: 4;
    width: 100%;
    align-self: stretch;
    min-height: 132px;
    padding: 10px 12px;
  }

  .support-left {
    grid-area: supportL;
  }

  .support-right {
    grid-area: supportR;
    min-height: 132px;
  }

  .city-left,
  .city-right {
    align-self: end;
    margin-bottom: 18px;
  }

  .left-node .node-banner {
    position: absolute;
    top: 0;
    left: -18px;
    right: auto;
    margin: 0;
    text-align: left;
    transform: none;
  }

  .right-node .node-banner {
    position: absolute;
    top: 14px;
    left: auto;
    right: -78px;
    margin: 0;
    text-align: right;
    transform: none;
  }
}

@media (min-width: 981px) and (max-width: 1380px) {
  .magi-stage {
    grid-template-columns:
      minmax(255px, 1fr)
      minmax(360px, 500px)
      minmax(255px, 1fr);
    grid-template-rows:
      minmax(132px, auto)
      46px
      230px
      54px
      258px;
    grid-template-areas:
      "prompt prompt prompt"
      ". centerTop ."
      ". top ."
      "left magi right"
      "left verdict right";
    gap: 9px 38px;
  }

  .support-left,
  .support-right,
  .city-left,
  .city-right {
    display: none;
  }

  .bridge-panel {
    min-height: 132px;
  }

  .top-node {
    height: 230px;
  }

  .top-node .provider-card {
    min-height: 188px;
    height: 188px;
  }

  .top-node .node-slot .provider-card-body {
    min-height: 124px;
    padding: 8px 13px 9px;
  }

  .left-node,
  .right-node {
    height: 308px;
    margin-top: -20px;
  }

  .left-node {
    justify-self: start;
  }

  .right-node {
    justify-self: end;
  }

  .left-node .node-slot,
  .right-node .node-slot {
    height: 268px;
  }

  .left-node .provider-card,
  .right-node .provider-card {
    width: 256px;
    min-height: 256px;
    height: 256px;
  }

  .left-node .provider-card-shell,
  .right-node .provider-card-shell {
    width: 202px;
    min-height: 174px;
  }

  .verdict-panel {
    min-height: 238px;
  }

  .verdict-panel pre {
    min-height: 116px;
    max-height: 128px;
  }

  .left-node .node-banner {
    position: absolute;
    top: 0;
    left: -12px;
    right: auto;
    margin: 0;
    text-align: left;
    transform: none;
  }

  .right-node .node-banner {
    position: absolute;
    top: 12px;
    left: auto;
    right: -56px;
    margin: 0;
    text-align: right;
    transform: none;
  }
}
