*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  background: #030C0A;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
}

/* ── Outer frame ── */
.magi-frame {
  width: 800px;
  background: #040E0C;
  border: 4px solid #CC8800;
  box-sizing: content-box;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.magi-header {
  height: 58px;
  border-bottom: 3px solid #CC8800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
}
.header-kanji {
  font-size: 36px;
  font-weight: 900;
  color: #FFAA00;
  letter-spacing: 12px;
  font-family: 'MS Gothic','Yu Gothic','Hiragino Kaku Gothic Pro','Noto Sans JP',sans-serif;
}

/* ── Content: 800 × 348 ── */
.magi-content {
  width: 800px;
  height: 348px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── System info ── */
.sys-info {
  position: absolute;
  top: 10px; left: 16px;
  color: #FF8800;
  font-size: 11.5px;
  line-height: 1.6;
  z-index: 30;
  pointer-events: none;
  font-family: 'Courier New', monospace;
}
.sys-info .code-line { font-size: 13px; font-weight: bold; }

/* ── Live diagnostic rows ── */
.diag-row {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.diag-name {
  display: inline-block;
  width: 26px;
  color: #CC8800;
  font-weight: bold;
}
.diag-state { font-weight: bold; letter-spacing: 0.5px; }
.diag-meta { color: #8a6a3a; font-size: 10.5px; margin-left: 2px; }
.st-online  { color: #00cc66; }
.st-fail    { color: #ff4444; }
.st-standby { color: #CC8800; }
.st-nokey   { color: #6f6f5a; }
.st-testing { color: #FFAA00; animation: diag-blink 0.8s steps(2,start) infinite; }
@keyframes diag-blink { 50% { opacity: 0.25; } }

.diag-btn {
  pointer-events: auto;
  margin-top: 3px;
  background: #040E0C;
  color: #FFAA00;
  border: 1px solid #7A4400;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 2px 8px;
  cursor: pointer;
}
.diag-btn:hover:not(:disabled) {
  background: #CC8800;
  color: #040E0C;
  border-color: #CC8800;
}
.diag-btn:disabled { opacity: 0.6; cursor: wait; }
.priority-select { pointer-events: auto; }

/* ── 情報 box ── */
.joho {
  position: absolute;
  top: 10px; right: 16px;
  border: 2px solid #CC8800;
  color: #CC8800;
  font-size: 19px;
  letter-spacing: 8px;
  padding: 3px 14px 3px 18px;
  z-index: 30;
  font-family: 'MS Gothic','Yu Gothic','Hiragino Kaku Gothic Pro','Noto Sans JP',sans-serif;
}

/* ── Full-content SVG for panels + connector ── */
.panels-svg {
  position: absolute;
  inset: 0;
  width: 800px;
  height: 348px;
}

/* ── Footer ── */
.magi-footer {
  border-top: 3px solid #CC8800;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5px 14px;
  gap: 5px;
  flex-shrink: 0;
  background: #040E0C;
}
.footer-row {
  display: flex;
  align-items: center;
}
.footer-label {
  color: #CC8800;
  font-size: 11.5px;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  width: 140px;
  flex-shrink: 0;
}
.question-input {
  background: #080F0E;
  border: 1px solid #CC8800;
  color: #CC8800;
  font-size: 16px;
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  flex: 1;
  height: 26px;
  outline: none;
  resize: none;
}
.question-textarea {
  background: #080F0E;
  border: 1px solid #CC8800;
  color: #CC8800;
  font-size: 16px;
  padding: 4px 6px;
  font-family: 'Courier New', monospace;
  flex: 1;
  min-height: 100px;
  outline: none;
  resize: none;
}
.question-input::placeholder,
.question-textarea::placeholder {
  color: #7A4400;
}
.submit-btn {
  background: #CC8800;
  color: #040E0C;
  border: 1px solid #CC8800;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 20px;
  cursor: pointer;
  letter-spacing: 2px;
  margin-left: 140px;
  margin-top: 2px;
}
.submit-btn:hover { background: #CC8800; }
.submit-btn:active {
  background: #7A4400;
  color: #FFAA00;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
}
.panel-input {
  background: rgba(4,14,12,0.75);
  border: 1px solid #CC8800;
  color: #FFAA00;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  text-align: center;
  outline: none;
  padding: 1px 4px;
  width: 160px;
}
.panel-select {
  background: transparent;
  border: none;
  color: #000;
  font-size: 16px;
  font-weight: 900;
  font-family: 'Arial Black', Impact, Arial, sans-serif;
  text-align: center;
  outline: none;
  padding: 2px 2px;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  letter-spacing: 0.5px;
}
.panel-select option {
  background: #040E0C;
  color: #FFAA00;
  font-weight: bold;
  font-size: 12px;
}

/* ── Custom MAGI Alert Modal ── */
.magi-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3,12,10,0.82);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
.magi-overlay.active { display: flex; }

.magi-alert {
  background: #040E0C;
  border: 3px solid #CC8800;
  width: 420px;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: alertAppear 0.12s ease-out;
}
@keyframes alertAppear {
  from { opacity: 0; transform: scaleY(0.85); }
  to   { opacity: 1; transform: scaleY(1); }
}
.magi-alert-header {
  border-bottom: 2px solid #CC8800;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.magi-alert-title {
  color: #FFAA00;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 4px;
  font-family: 'Courier New', monospace;
}
.magi-alert-code {
  color: #7A4400;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}
.magi-alert-body {
  padding: 18px 20px 14px;
  color: #FF8800;
  font-size: 12.5px;
  font-family: 'Courier New', monospace;
  line-height: 1.7;
  border-bottom: 2px solid #CC8800;
  min-height: 60px;
}
.magi-alert-body::before {
  content: '> ';
  color: #CC8800;
}
.magi-alert-footer {
  padding: 8px 14px;
  display: flex;
  justify-content: flex-end;
}
.magi-alert-btn {
  background: #CC8800;
  color: #040E0C;
  border: none;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 22px;
  cursor: pointer;
  letter-spacing: 3px;
}
.magi-alert-btn:active {
  background: #7A4400;
  color: #FFAA00;
}

/* ── Full UI scanline overlay ── */
.magi-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.13) 3px,
    rgba(0,0,0,0.13) 4px
  );
  pointer-events: none;
  z-index: 100;
}

.magi-alert-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
}
/* ── Report Modal ── */
.magi-report {
  background: #040E0C;
  border: 3px solid #CC8800;
  width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: alertAppear 0.12s ease-out;
}
.magi-report-header {
  border-bottom: 2px solid #CC8800;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.magi-report-body {
  overflow-y: auto;
  padding: 16px 20px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #CC8800 #040E0C;
}
.magi-report-body::-webkit-scrollbar { width: 6px; }
.magi-report-body::-webkit-scrollbar-track { background: #040E0C; }
.magi-report-body::-webkit-scrollbar-thumb { background: #CC8800; }

.report-entry {
  margin-bottom: 22px;
  border-left: 3px solid #CC8800;
  padding-left: 14px;
}
.report-entry-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.report-model-name {
  font-size: 12px;
  font-weight: bold;
  color: #FFAA00;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
}
.report-role {
  font-size: 10px;
  color: #FFAA00;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
}
.report-verdict {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 3px;
  font-family: 'Courier New', monospace;
  padding: 1px 8px;
  border: 1px solid;
}
.report-verdict.yes { color: #00cc66; border-color: #00cc66; }
.report-verdict.no  { color: #ff3333; border-color: #ff3333; }
.report-verdict.unk { color: #999;    border-color: #999; }

.report-section-label {
  font-size: 9.5px;
  color: #CC8800;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
  margin-bottom: 4px;
  margin-top: 10px;
}
.report-text {
  font-size: 11px;
  color: #FF8800;
  font-family: 'Courier New', monospace;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.report-text.reasoning {
  color: #CC8833;
}
.report-divider {
  border: none;
  border-top: 1px solid #2A1A00;
  margin: 4px 0 18px;
}

/* ── Panel deliberation pulse ── */
@keyframes panelPulse {
  0%, 100% { fill: #54C8DC; }
  50%       { fill: #FFAA00; }
}
.panel-pulsing {
  animation: panelPulse 2s ease-in-out infinite;
}


/* ── Report error code block ── */
.report-error-code {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Courier New', monospace;
  margin-bottom: 2px;
}
.report-error-status {
  font-size: 22px;
  font-weight: bold;
  color: #ff3333;
  letter-spacing: 2px;
}
.report-error-status-sep {
  font-size: 11px;
  color: #7A4400;
}
.report-error-status-desc {
  font-size: 11px;
  font-weight: bold;
  color: #CC8800;
  letter-spacing: 3px;
}
.report-error-msg {
  color: #ff6666;
  word-break: break-all;
}

/* ── Report error code block ── */
.report-error-code {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Courier New', monospace;
  margin-bottom: 2px;
}
.report-error-status {
  font-size: 22px;
  font-weight: bold;
  color: #ff3333;
  letter-spacing: 2px;
}
.report-error-status-sep {
  font-size: 11px;
  color: #7A4400;
}
.report-error-status-desc {
  font-size: 11px;
  font-weight: bold;
  color: #CC8800;
  letter-spacing: 3px;
}
.report-error-msg {
  color: #ff6666;
  word-break: break-all;
}

/* ── Waiting / pending report row ── */
.report-verdict.waiting {
  color: #54C8DC;
  border-color: #54C8DC;
}

.waiting-text {
  color: #54C8DC !important;
  opacity: 0.7;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   FIRST-BATCH ADDITIONS: sound, demo badge, sequential reveal,
   connector lighting, thinking streams, verdict stamps
   ═══════════════════════════════════════════════════════════════ */

/* ── Sound toggle button ── */
.sound-btn {
  background: #040E0C;
  color: #CC8800;
  border: 1px solid #CC8800;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 3px 10px;
  cursor: pointer;
}
.sound-btn:hover { background: #CC8800; color: #040E0C; }
.sound-btn:active { background: #7A4400; color: #FFAA00; }

/* ── Demo mode badge ── */
.demo-badge {
  position: absolute;
  top: 118px;
  left: 16px;
  z-index: 30;
  color: #ff3333;
  border: 1px solid #ff3333;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 2px 8px;
  font-family: 'Courier New', monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  text-shadow: 0 0 6px rgba(255,51,51,0.6);
}
.demo-badge.active {
  opacity: 1;
  animation: demoBlink 1.4s ease-in-out infinite;
}
@keyframes demoBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ── Connector lines: dim during deliberation, lit on connect ── */
.panels-svg line {
  transition: stroke 0.35s ease, filter 0.35s ease;
}
.panels-svg.deliberating line:not(.lit) {
  stroke: #3A2400;
}
.panels-svg line.lit {
  stroke: #FFAA00;
  filter: drop-shadow(0 0 6px #FFAA00);
  animation: linePulse 1.6s ease-in-out infinite;
}
@keyframes linePulse {
  0%, 100% { stroke: #FFAA00; }
  50%      { stroke: #FFD060; }
}

/* ── Panel glow after reveal + white flash ── */
.panel-glow {
  filter: drop-shadow(0 0 9px var(--glow, #54C8DC));
  transition: filter 0.3s ease;
}
.panel-flash {
  filter: drop-shadow(0 0 16px #FFFFFF) brightness(1.6);
}
/* ── Clickable panel after verdict: hover hint ── */
.panels-svg.verdict-ready polygon {
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.panels-svg.verdict-ready polygon:hover {
  opacity: 0.82;
}

/* ── Verdict stamps on each panel ── */
.verdict-label {
  fill: #040E0C;
  font-size: 22px;
  font-weight: 900;
  font-family: 'Arial Black', Impact, Arial, sans-serif;
  letter-spacing: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(4,14,12,0.25);
  stroke-width: 0.6;
}
.verdict-label.verdict-show {
  opacity: 1;
  animation: verdictPop 0.3s ease-out;
}
@keyframes verdictPop {
  0%   { opacity: 0; transform: scale(1.6); }
  100% { opacity: 1; transform: scale(1); }
}

/* ── Thinking data streams ── */
.think-stream {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 20;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  line-height: 1.4;
  color: rgba(4,14,12,0.5);
  overflow: hidden;
  white-space: nowrap;
}
.think-stream.active { opacity: 1; }
.think-status {
  font-weight: bold;
  color: rgba(4,14,12,0.75);
  letter-spacing: 1px;
}
.think-stream#think-top {
  clip-path: polygon(25.5% 0, 74.5% 0, 74.5% 36.2%, 57.9% 50.6%, 42.1% 50.6%, 25.5% 36.2%);
  padding: 132px 50px 0;
  text-align: center;
}
.think-stream#think-left {
  clip-path: polygon(0 54.6%, 19.5% 54.6%, 34.5% 67.5%, 34.5% 100%, 0 100%);
  padding: 200px 10px 0;
  text-align: left;
}
.think-stream#think-right {
  clip-path: polygon(65.5% 67.5%, 80.5% 54.6%, 100% 54.6%, 100% 100%, 65.5% 100%);
  padding: 200px 10px 0;
  text-align: right;
}

/* ── Disabled submit button ── */
.submit-btn:disabled {
  background: #3A2400;
  color: #7A4400;
  cursor: not-allowed;
  border-color: #3A2400;
}

/* ═══ Batch 2: provider / priority / presets ═══ */

/* ── Provider select in footer ── */
.provider-select {
  background: #080F0E;
  border: 1px solid #CC8800;
  color: #FFAA00;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  padding: 3px 24px 3px 8px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  letter-spacing: 1px;
  flex: 0 0 auto;
  min-width: 130px;
}
.provider-select option {
  background: #080F0E;
  color: #FFAA00;
}

/* ── API key save button + indicator ── */
.key-save-btn {
  background: #080F0E;
  border: 1px solid #CC8800;
  color: #FFAA00;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 1px;
  flex: 0 0 auto;
  border-radius: 0;
}
.key-save-btn:hover {
  background: #CC8800;
  color: #040E0C;
}
.key-saved-indicator {
  color: #00cc66;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  letter-spacing: 1px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s ease, min-width 0.3s ease, margin-left 0.3s ease;
}
.key-saved-indicator.show {
  min-width: 52px;
  max-width: 80px;
  margin-left: 6px;
}

/* ── Priority select in sys-info ── */
.priority-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.priority-select {
  background: transparent;
  border: none;
  color: #CC8800;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  letter-spacing: 2px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.priority-select option {
  background: #040E0C;
  color: #CC8800;
}

/* ── Preset question chips ── */
.preset-row {
  align-items: flex-start !important;
}
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.preset-chip {
  background: #040E0C;
  color: #CC8800;
  border: 1px solid #7A4400;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 1px;
  border-radius: 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.preset-chip:hover {
  background: #CC8800;
  color: #040E0C;
  border-color: #CC8800;
}
.preset-chip:active {
  background: #7A4400;
  color: #FFAA00;
}
.random-chip {
  font-size: 11px;
  padding: 4px 16px;
  border-color: #CC8800;
  color: #FFAA00;
  letter-spacing: 2px;
}
.random-chip:hover {
  background: #CC8800;
  color: #040E0C;
  box-shadow: 0 0 8px rgba(204,136,0,0.5);
}

/* ═══════════════════════════════════════════════════════════════
   BATCH 3: boot sequence, CRT effects, confidence, synthesis,
   critical warning, glitch
   ═══════════════════════════════════════════════════════════════ */

/* ── Boot sequence overlay ── */
.boot-overlay {
  position: fixed;
  inset: 0;
  background: #020806;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
.boot-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.boot-terminal {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.8;
  color: #FFAA00;
  text-shadow: 0 0 8px rgba(255,170,0,0.5);
  white-space: pre;
  width: 560px;
}
.boot-terminal .boot-ok {
  color: #00cc66;
  text-shadow: 0 0 8px rgba(0,204,102,0.5);
}
.boot-terminal .boot-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #FFAA00;
  vertical-align: middle;
  animation: bootBlink 0.6s step-end infinite;
  text-shadow: none;
}
@keyframes bootBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── CRT vignette ── */
.magi-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: radial-gradient(ellipse at center,
    transparent 55%,
    rgba(0,0,0,0.35) 80%,
    rgba(0,0,0,0.65) 100%);
}

/* ── CRT moving sweep line ── */
.magi-sweep {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to bottom,
    transparent,
    rgba(255,170,0,0.08) 30%,
    rgba(255,170,0,0.15) 50%,
    rgba(255,170,0,0.08) 70%,
    transparent);
  pointer-events: none;
  z-index: 98;
  animation: sweepMove 7s linear infinite;
  opacity: 0.6;
}
@keyframes sweepMove {
  0%   { top: -4px; }
  100% { top: 100%; }
}

/* ── Phosphor flicker (applied to frame) ── */
.magi-frame.phosphor {
  animation: phosphorFlicker 6s infinite;
}
@keyframes phosphorFlicker {
  0%, 97%, 100% { opacity: 1; }
  97.5%         { opacity: 0.96; }
  98%           { opacity: 1; }
  98.5%         { opacity: 0.98; }
}

/* ── Confidence labels on panels ── */
.conf-label {
  fill: rgba(4,14,12,0.55);
  font-size: 9px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.conf-label.conf-show {
  opacity: 1;
  animation: verdictPop 0.3s ease-out;
}

/* ── Critical topic warning ── */
.critical-warning {
  position: absolute;
  top: 140px;
  left: 16px;
  z-index: 50;
  color: #ff4444;
  border: 1px solid #ff3333;
  background: rgba(10,0,0,0.88);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 3px 8px;
  font-family: 'Courier New', monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  text-shadow: 0 0 6px rgba(255,51,51,0.6);
  white-space: nowrap;
}
.critical-warning.active {
  opacity: 1;
  animation: criticalBlink 0.8s ease-in-out infinite;
}
@keyframes criticalBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Synthesis bar in content area ── */
.synthesis-bar {
  position: absolute;
  bottom: 2px;
  left: 16px;
  right: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(4,14,12,0.92);
  border: 1px solid #CC8800;
  padding: 2px 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
.synthesis-bar.active {
  opacity: 1;
  transform: translateY(0);
}
.synthesis-code {
  color: #FFAA00;
  font-size: 9px;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.synthesis-text {
  color: #FF8800;
  font-size: 9px;
  font-family: 'Courier New', monospace;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Synthesis in report modal ── */
.report-synthesis {
  border: 1px solid #CC8800;
  background: rgba(204,136,0,0.06);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.report-synthesis-text {
  font-size: 12px;
  color: #FFAA00;
  font-family: 'Courier New', monospace;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ── Glitch effect for panels ── */
@keyframes panelGlitch {
  0%   { transform: translate(0,0); filter: drop-shadow(0 0 9px var(--glow,#ff3333)); }
  10%  { transform: translate(-2px,1px); filter: drop-shadow(0 0 16px #ff3333) brightness(1.4); }
  20%  { transform: translate(2px,-1px); filter: drop-shadow(0 0 8px #ff3333) brightness(1.2); }
  30%  { transform: translate(-1px,2px); filter: drop-shadow(0 0 14px #ff3333) brightness(1.5); }
  40%  { transform: translate(1px,-2px); filter: drop-shadow(0 0 6px #ff3333); }
  50%  { transform: translate(-2px,0); filter: drop-shadow(0 0 12px #ff3333) brightness(1.3); }
  60%  { transform: translate(2px,1px); filter: drop-shadow(0 0 10px #ff3333); }
  70%  { transform: translate(0,-1px); filter: drop-shadow(0 0 8px #ff3333) brightness(1.1); }
  80%  { transform: translate(-1px,1px); filter: drop-shadow(0 0 14px #ff3333); }
  90%  { transform: translate(1px,0); filter: drop-shadow(0 0 10px #ff3333) brightness(1.2); }
  100% { transform: translate(0,0); filter: drop-shadow(0 0 9px var(--glow,#ff3333)); }
}
.panel-glitch {
  animation: panelGlitch 0.35s steps(2) forwards;
}

/* ── Red flash overlay for critical/reject ── */
@keyframes redFlash {
  0%   { opacity: 0; }
  15%  { opacity: 0.25; }
  100% { opacity: 0; }
}
.magi-content.red-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #ff0000;
  pointer-events: none;
  z-index: 95;
  animation: redFlash 0.5s ease-out forwards;
}

/* ── Report confidence display ── */
.report-confidence {
  font-size: 10px;
  color: #54C8DC;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  margin-left: auto;
}
.report-verdict-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE / NARROW VIEWPORT ADAPTATION
   固定 800px 布局在手机端横向溢出，此媒体查询将其改为自适应
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  body { align-items: flex-start; }

  .magi-frame {
    width: 100%;
    box-sizing: border-box;
  }

  .magi-header { padding: 0 12px; }
  .header-kanji { font-size: 26px; letter-spacing: 8px; }

  /* 内容区：SVG 撑开高度，等比缩放 */
  .magi-content {
    width: 100%;
    height: auto;
  }
  .panels-svg {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
  }

  /* 内容区覆盖层微调 */
  .sys-info { font-size: 10px; top: 6px; left: 8px; }
  .joho { font-size: 14px; letter-spacing: 5px; padding: 2px 10px 2px 14px; top: 6px; right: 8px; }
  .demo-badge { top: 90px; left: 8px; }
  .critical-warning { top: 108px; left: 8px; font-size: 8px; }
  .synthesis-bar { left: 6px; right: 6px; bottom: 2px; }
  .synthesis-code { font-size: 8px; }
  .synthesis-text { font-size: 8px; }

  /* Footer：标签宽度收窄，行内容允许换行 */
  .magi-footer { padding: 6px 8px; }
  .footer-row { flex-wrap: wrap; row-gap: 5px; }
  .footer-label { width: auto; min-width: 60px; font-size: 10.5px; }
  .question-input { min-width: 0; }
  .question-textarea { min-width: 0; min-height: 72px; }
  .submit-btn { margin-left: 0; }
  .provider-select { min-width: 104px; }
  .key-save-btn { padding: 3px 8px; }

  /* 弹窗宽度适配（覆盖内联 width 样式） */
  .magi-alert { width: 92vw; max-width: 420px; }
  .magi-report { width: 94vw; max-width: 680px; }
  #panel-config-modal { width: 92vw !important; }
  #panel-verdict-overlay .magi-report { width: 92vw !important; }

  /* 启动终端 */
  .boot-terminal {
    width: min(92vw, 560px);
    overflow-x: auto;
    font-size: 12px;
  }
}
