:root {
  --stage-black: #050507;
  --surface: #111116;
  --surface-strong: rgba(8, 8, 11, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --paper: #eee9df;
  --paper-text: #18171b;
  --paper-soft: #d8d1c5;
  --line: rgba(238, 233, 223, 0.15);
  --line-strong: rgba(238, 233, 223, 0.34);
  --text: #f2f0eb;
  --text-soft: rgba(242, 240, 235, 0.62);
  --text-faint: rgba(242, 240, 235, 0.38);
  --accent: #a93632;
  --gold: #ffd479;
  --mint: #5eead4;
  --danger: #ff8e9c;
  --radius-control: 6px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--stage-black);
  color: var(--text);
  font-family: var(--font-serif);
}

button { font: inherit; }

button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
  background: var(--stage-black);
}

.scene-art,
.scene-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-art {
  z-index: -4;
  object-fit: cover;
  object-position: center;
  filter: grayscale(0.78) brightness(0.38) contrast(1.15);
  transform: scale(1.02);
}

.scene-shade {
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(5,5,7,0.98) 0%, rgba(5,5,7,0.9) 34%, rgba(5,5,7,0.56) 61%, rgba(5,5,7,0.88) 100%),
    radial-gradient(circle at 76% 42%, rgba(169,54,50,0.2), transparent 27%),
    linear-gradient(180deg, rgba(5,5,7,0.65), transparent 36%, rgba(5,5,7,0.9));
  box-shadow: inset 0 -20vh 20vh rgba(0,0,0,0.56);
}

.scene-shade::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0.14;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 100% 4px;
  pointer-events: none;
}

.stage-frame {
  position: absolute;
  z-index: 0;
  inset: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px) calc(var(--safe-bottom) + 8px) calc(var(--safe-left) + 8px);
  border-left: 1px solid rgba(238,233,223,0.07);
  border-right: 1px solid rgba(238,233,223,0.07);
  pointer-events: none;
}

.stage-frame::before,
.stage-frame::after {
  position: absolute;
  width: 1px;
  height: 42px;
  content: "";
  background: var(--accent);
}

.stage-frame::before { top: 16%; left: -1px; }
.stage-frame::after { right: -1px; bottom: 16%; }

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px minmax(170px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  height: calc(50px + var(--safe-top));
  padding: var(--safe-top) max(22px, calc(var(--safe-right) + 14px)) 0 max(22px, calc(var(--safe-left) + 14px));
  border-bottom: 1px solid var(--line);
  background: rgba(5,5,7,0.74);
  backdrop-filter: blur(15px);
}

.icon-button,
.text-button,
.primary-button,
.secondary-button,
.move-button,
.drag-handle {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  color: var(--text);
}

.icon-button svg,
.primary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hud__identity { min-width: 0; }

.hud__identity span,
.eyebrow {
  display: block;
  color: var(--text-faint);
  font: 9px/1.2 var(--font-mono);
  letter-spacing: 0.22em;
}

.hud__identity strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud__status {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--text-soft);
  font: 10px/1 var(--font-mono);
  white-space: nowrap;
}

.hud__status b {
  margin-left: 4px;
  color: var(--text);
  font-weight: 500;
}

.text-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
}

.workspace {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  width: min(1240px, calc(100% - max(44px, calc(var(--safe-left) + var(--safe-right) + 32px))));
  height: calc(100% - 50px - var(--safe-top));
  margin: 0 auto;
  padding: clamp(24px, 4vh, 46px) 0 max(18px, calc(var(--safe-bottom) + 12px));
}

.request-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 12px 0 0 clamp(16px, 2.2vw, 30px);
  border-left: 1px solid var(--line-strong);
  overflow-y: auto;
}

.request-panel::before {
  position: absolute;
  top: 12px;
  left: -1px;
  width: 1px;
  height: 68px;
  content: "";
  background: var(--accent);
}

.case-tabs {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 1fr));
  gap: 6px;
  margin: 0 0 18px;
}

.case-tab {
  position: relative;
  display: grid;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgba(255,255,255,0.025);
  color: var(--text-faint);
  cursor: pointer;
  text-align: left;
}

.case-tab b {
  font: 11px/1 var(--font-mono);
  font-weight: 500;
}

.case-tab span {
  align-self: end;
  font-size: 9px;
  line-height: 1;
}

.case-tab::after {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  content: "";
  background: transparent;
}

.case-tab.is-complete::after { background: var(--mint); }

.case-tab.is-active {
  border-color: color-mix(in srgb, var(--accent) 70%, white 15%);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
}

.request-panel__index {
  position: absolute;
  top: -28px;
  right: 0;
  color: rgba(238,233,223,0.07);
  font: 700 clamp(72px, 9vw, 132px)/1 var(--font-mono);
  pointer-events: none;
}

.request-panel h1 {
  position: relative;
  margin: 12px 0 16px;
  font-size: clamp(30px, 3.4vw, 54px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.08;
}

.request-copy {
  position: relative;
  max-width: 35em;
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.9;
}

.original-result,
.objective {
  position: relative;
  margin-top: 24px;
  padding: 14px 0 14px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(169,54,50,0.12), transparent 82%);
}

.objective {
  margin-top: 12px;
  background: linear-gradient(90deg, rgba(255,212,121,0.08), transparent 82%);
}

.original-result small,
.objective small {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font: 9px/1 var(--font-mono);
  letter-spacing: 0.18em;
}

.objective small { color: var(--gold); }

.original-result strong {
  font-size: 16px;
  font-weight: 500;
}

.original-result p,
.objective p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.method-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 18px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.55;
}

.method-note i {
  flex: 0 0 auto;
  width: 18px;
  height: 1px;
  margin-top: 8px;
  background: var(--accent);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(8,8,11,0.78);
  backdrop-filter: blur(18px);
}

.editor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.editor-head h2 {
  margin: 7px 0 0;
  font-size: clamp(20px, 2.1vw, 30px);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.editor-head p {
  margin: 0;
  text-align: right;
}

.editor-head p b,
.editor-head p span {
  display: block;
  font: 9px/1.4 var(--font-mono);
  letter-spacing: 0.12em;
}

.editor-head p b { color: var(--gold); }
.editor-head p span { margin-top: 3px; color: var(--text-faint); }

.timeline {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 16px 20px;
  overflow-y: auto;
  list-style: none;
}

.fragment {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: stretch;
  min-height: 62px;
  border: 1px solid rgba(24,23,27,0.18);
  border-left: 3px solid var(--fragment-color, var(--paper-text));
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--paper-text);
  box-shadow: 0 9px 28px rgba(0,0,0,0.16);
  transition: transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.fragment:hover { transform: translateX(-3px); }

.fragment.is-dragging {
  z-index: 10;
  opacity: 0.46;
  transform: translateY(var(--drag-y, 0)) scale(1.012);
  box-shadow: 0 18px 36px rgba(0,0,0,0.42);
  cursor: grabbing;
  transition: none;
}

.fragment.is-drop-target { box-shadow: 0 0 0 2px var(--accent), 0 9px 28px rgba(0,0,0,0.16); }

.fragment__order {
  display: grid;
  place-items: center;
  border-right: 1px solid rgba(24,23,27,0.16);
  color: rgba(24,23,27,0.48);
  font: 11px/1 var(--font-mono);
}

.fragment__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 9px 12px;
  touch-action: none;
}

.fragment__copy small {
  margin-bottom: 3px;
  color: rgba(24,23,27,0.48);
  font: 8px/1 var(--font-mono);
  letter-spacing: 0.14em;
}

.fragment__copy strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fragment__actions {
  display: grid;
  grid-template-columns: 44px 44px 44px;
  border-left: 1px solid rgba(24,23,27,0.16);
}

.move-button,
.drag-handle {
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid rgba(24,23,27,0.12);
  background: transparent;
  color: rgba(24,23,27,0.58);
}

.move-button { cursor: pointer; }

.move-button:first-child { border-left: 0; }
.move-button:disabled { cursor: default; opacity: 0.22; }
.move-button:not(:disabled):hover,
.drag-handle:hover { background: rgba(24,23,27,0.07); color: var(--paper-text); }

.move-button svg,
.drag-handle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drag-handle {
  cursor: grab;
  touch-action: none;
}

.drag-handle:active { cursor: grabbing; }

.editor-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px 14px 12px 20px;
  border-top: 1px solid var(--line);
  background: rgba(5,5,7,0.5);
}

.editor-foot p {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.55;
}

.editor-foot p span {
  margin-right: 8px;
  color: var(--gold);
  font: 9px/1 var(--font-mono);
  letter-spacing: 0.12em;
}

.editor-foot p i { font-style: normal; }

.comparison-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(8,8,11,0.82);
  box-shadow: 0 24px 80px rgba(0,0,0,0.32);
  backdrop-filter: blur(18px);
}

.comparison-head {
  display: grid;
  grid-template-columns: minmax(196px, 0.56fr) minmax(280px, 1.15fr) minmax(220px, 0.86fr);
  align-items: center;
  gap: 24px;
  min-height: 112px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 45%);
}

.comparison-head .case-tabs { margin: 0; }

.case-brief { min-width: 0; }

.case-brief h1 {
  overflow: hidden;
  margin: 5px 0 4px;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-brief .request-copy {
  display: -webkit-box;
  overflow: hidden;
  max-width: none;
  font-size: 11px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.comparison-objective {
  min-width: 0;
  margin: 0;
  padding: 10px 0 10px 13px;
}

.comparison-objective p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.comparison-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sequence-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.source-pane { border-right: 1px solid var(--line); }
.rewrite-pane { border-left: 1px solid var(--line); }

.pane-head {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.72fr);
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 10px 14px 9px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.018);
}

.pane-head > div > span,
.pane-head p span {
  color: var(--text-faint);
  font: 8px/1.25 var(--font-mono);
  letter-spacing: 0.12em;
}

.pane-head h2 {
  margin: 4px 0 0;
  font-size: clamp(17px, 1.7vw, 23px);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.pane-head p {
  min-width: 0;
  margin: 0;
  text-align: right;
}

.pane-head p b {
  display: block;
  overflow: hidden;
  color: var(--gold);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-head p span {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  line-height: 1.35;
  letter-spacing: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sequence-pane .timeline {
  align-content: start;
  padding: 12px 14px;
}

.timeline--source { background: rgba(255,255,255,0.012); }

.fragment__order {
  align-content: center;
  gap: 4px;
}

.fragment__order b {
  font: 11px/1 var(--font-mono);
  font-weight: 500;
}

.fragment__order small {
  color: rgba(24,23,27,0.42);
  font: 7px/1 var(--font-mono);
}

.fragment--source {
  grid-template-columns: 42px minmax(0, 1fr) 44px;
  cursor: grab;
  background: rgba(238,233,223,0.86);
}

.fragment--source:hover,
.fragment--source:focus-visible { transform: translateX(3px); }

.source-lock {
  display: grid;
  place-items: center;
  border-left: 1px solid rgba(24,23,27,0.12);
  color: rgba(24,23,27,0.44);
  font: 8px/1 var(--font-mono);
  writing-mode: vertical-rl;
}

.fragment--source.is-used {
  opacity: 0.5;
  cursor: default;
  filter: saturate(0.55);
}

.fragment--source.is-used .source-lock { color: #236b5f; font-weight: 700; }

.fragment--source.is-source-dragging { opacity: 0.22; }

.source-drag-ghost {
  position: fixed;
  z-index: 120;
  top: 0;
  left: 0;
  display: flex;
  width: min(320px, 42vw);
  min-height: 48px;
  flex-direction: column;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid rgba(24,23,27,0.18);
  border-left: 3px solid var(--fragment-color);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--paper-text);
  box-shadow: 0 22px 46px rgba(0,0,0,0.48);
  pointer-events: none;
  will-change: transform;
}

.source-drag-ghost small {
  color: rgba(24,23,27,0.48);
  font: 8px/1 var(--font-mono);
  letter-spacing: 0.14em;
}

.source-drag-ghost strong {
  margin-top: 4px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-empty {
  display: grid;
  align-self: stretch;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  color: var(--text-faint);
  text-align: center;
}

.timeline-empty span {
  color: var(--accent);
  font: 8px/1 var(--font-mono);
  letter-spacing: 0.16em;
}

.timeline-empty strong {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
}

.timeline-empty small {
  max-width: 24em;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.5;
}

.timeline.is-source-target {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.fragment.is-linked {
  box-shadow: 0 0 0 2px var(--fragment-color), 0 12px 30px rgba(0,0,0,0.28);
}

.fragment.is-linked .fragment__order b { color: var(--fragment-color); }

.causality-bridge {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
  color: var(--text-faint);
}

.causality-bridge::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  content: "";
  background: linear-gradient(transparent, var(--line-strong) 18%, var(--line-strong) 82%, transparent);
}

.causality-bridge span,
.causality-bridge b {
  position: relative;
  z-index: 1;
  padding: 4px 2px;
  background: #0a0a0e;
  font: 8px/1.35 var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-align: center;
  writing-mode: vertical-rl;
}

.causality-bridge b { color: var(--gold); letter-spacing: 0.04em; }

.causality-bridge svg {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 56px;
  padding: 5px;
  background: #0a0a0e;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.comparison-foot { min-height: 62px; }

.primary-button:disabled {
  background: rgba(255,255,255,0.08);
  color: var(--text-faint);
  cursor: not-allowed;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.primary-button {
  background: var(--gold);
  color: #211b12;
  font-weight: 700;
}

.primary-button:hover { background: #ffe09b; }

.secondary-button {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.result {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top)) max(18px, var(--safe-right)) max(18px, var(--safe-bottom)) max(18px, var(--safe-left));
  visibility: hidden;
  opacity: 0;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.result.is-open { visibility: visible; opacity: 1; }

.result__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(14px);
}

.result__panel {
  position: relative;
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(760px, 100%);
  max-height: min(620px, calc(100% - 36px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  box-shadow: 0 30px 90px rgba(0,0,0,0.58);
}

.result__panel::before {
  position: absolute;
  top: 0;
  left: 136px;
  width: 52px;
  height: 2px;
  content: "";
  background: var(--result-color, var(--mint));
}

.result__grade {
  display: grid;
  grid-row: 1 / -1;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--result-color, var(--mint));
  font: 200 clamp(68px, 9vw, 112px)/1 var(--font-mono);
  background: rgba(255,255,255,0.018);
}

.result__content {
  min-height: 0;
  padding: 30px 32px 20px;
  overflow-y: auto;
}

.result__content h2 {
  margin: 9px 0 12px;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.result__content > p {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.result__sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 18px;
}

.result__sequence span {
  padding: 5px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.055);
  color: var(--text-soft);
  font: 9px/1 var(--font-mono);
}

.result__sequence i {
  align-self: center;
  color: var(--text-faint);
  font-style: normal;
}

.result__effects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.result__effects span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: 10px/1 var(--font-mono);
}

.result__reason {
  display: block;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.55;
}

.result__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(18px, calc(var(--safe-bottom) + 10px));
  min-width: 220px;
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: rgba(9,9,12,0.94);
  color: var(--text);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: 180ms ease;
}

.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

.sr-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 920px), (max-height: 560px) {
  .hud {
    grid-template-columns: 44px minmax(130px, 1fr) auto auto;
    height: calc(46px + var(--safe-top));
    gap: 8px;
    padding-right: max(14px, var(--safe-right));
    padding-left: max(14px, var(--safe-left));
  }

  .hud__status { gap: 10px; }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: calc(100% - max(28px, calc(var(--safe-left) + var(--safe-right) + 18px)));
    height: calc(100% - 46px - var(--safe-top));
    padding: 12px 0 max(10px, var(--safe-bottom));
  }

  .request-panel { padding: 8px 0 0 13px; }
  .request-panel::before { top: 8px; height: 44px; }
  .request-panel__index { display: none; }
  .case-tabs { gap: 2px; margin-bottom: 7px; }
  .case-tab { padding: 4px; }
  .case-tab span { display: none; }
  .request-panel h1 { margin: 7px 0 8px; font-size: clamp(22px, 4vw, 30px); }
  .request-copy {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }
  .original-result,
  .objective { margin-top: 10px; padding: 8px 0 8px 10px; }
  .objective { margin-top: 6px; }
  .original-result strong { font-size: 13px; }
  .original-result p,
  .objective p { margin-top: 3px; font-size: 10px; line-height: 1.45; }
  .original-result p { display: none; }
  .method-note { display: none; }

  .comparison-head {
    grid-template-columns: 188px minmax(0, 1fr) minmax(166px, 0.62fr);
    gap: 10px;
    min-height: 70px;
    padding: 7px 10px;
  }
  .comparison-head .case-tabs { gap: 2px; margin: 0; }
  .case-brief h1 { margin: 3px 0 0; font-size: 17px; }
  .case-brief .request-copy { display: none; }
  .comparison-objective { padding: 6px 0 6px 9px; }
  .comparison-objective small { margin-bottom: 2px; font-size: 7px; }
  .comparison-objective p { margin-top: 2px; font-size: 9px; line-height: 1.35; -webkit-line-clamp: 2; }
  .comparison-body { grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); }
  .pane-head {
    grid-template-columns: auto minmax(92px, 0.68fr);
    gap: 8px;
    min-height: 49px;
    padding: 5px 8px 5px 10px;
  }
  .pane-head h2 { margin-top: 2px; font-size: 15px; }
  .pane-head p b { font-size: 9px; }
  .pane-head p span { display: none; }
  .sequence-pane .timeline { gap: 5px; padding: 6px 8px; }
  .fragment--source { grid-template-columns: 32px minmax(0, 1fr) 44px; }
  .source-lock { min-width: 44px; min-height: 44px; }
  .causality-bridge { gap: 5px; }
  .causality-bridge svg { width: 38px; height: 42px; }
  .causality-bridge span,
  .causality-bridge b { font-size: 7px; }
  .comparison-foot { min-height: 52px; }

  .editor-head { padding: 9px 12px 8px; }
  .editor-head h2 { margin-top: 3px; font-size: 18px; }
  .editor-head p span { display: none; }
  .timeline { gap: 5px; padding: 7px 10px; }
  .fragment { min-height: 44px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .fragment__copy { padding: 4px 8px; }
  .fragment__copy small { margin-bottom: 1px; font-size: 7px; }
  .fragment__copy strong { font-size: 11px; }
  .fragment__actions { grid-template-columns: 44px 44px 44px; }
  .move-button,
  .drag-handle { min-width: 44px; min-height: 44px; }
  .editor-foot { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 8px 7px 12px; }
  .editor-foot p { font-size: 9px; line-height: 1.35; }
  .editor-foot .primary-button { min-height: 44px; padding: 0 12px; font-size: 11px; }
  .editor-foot .primary-button svg { display: none; }

  .result__panel {
    grid-template-columns: 92px minmax(0, 1fr);
    width: min(680px, 100%);
    max-height: calc(100% - 20px);
  }
  .result__panel::before { left: 92px; }
  .result__content { padding: 18px 20px 12px; }
  .result__content h2 { margin: 5px 0 7px; font-size: 24px; }
  .result__content > p { font-size: 11px; line-height: 1.55; }
  .result__sequence { margin-top: 8px; }
  .result__effects { margin-top: 9px; }
  .result__reason { margin-top: 9px; padding-top: 8px; }
  .result__actions { padding: 8px 10px; }
}

@media (max-width: 690px) {
  .hud__status span:nth-child(2) { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .comparison-head { grid-template-columns: 182px minmax(0, 1fr) 154px; }
}

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