:root {
  color-scheme: dark;
  --bg: #050710;
  --bg2: #07111a;
  --panel: rgba(9, 15, 31, 0.94);
  --panel2: rgba(12, 20, 42, 0.96);
  --line: rgba(120, 166, 230, 0.24);
  --line2: rgba(255, 255, 255, 0.10);
  --text: #edf4ff;
  --muted: #9ca9c6;
  --muted2: #74809d;
  --accent: #65d9f5;
  --accent2: #77f0c4;
  --good: #47f5a5;
  --warn: #ffd166;
  --bad: #ff6b8b;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  --radius: 7px;
  --gap: 8px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(101,217,245,0.10) 1px, transparent 1px),
    linear-gradient(0deg, rgba(101,217,245,0.06) 1px, transparent 1px),
    radial-gradient(circle at 10% 8%, rgba(101, 217, 245, 0.13), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(119, 240, 196, 0.10), transparent 28%),
    linear-gradient(140deg, var(--bg), var(--bg2) 55%, #060814);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
small { color: var(--muted); }
code { color: #e4f8ff; }

.app-shell {
  height: 100vh;
  height: 100svh;
  width: 100vw;
  padding: var(--gap);
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  gap: var(--gap);
  overflow: hidden;
}

.topbar {
  min-height: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(4, 8, 18, 0.94);
  box-shadow: var(--shadow);
  overflow: visible;
}
.brand-block { min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand-orb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 950;
  color: #021017;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
h1 { font-size: clamp(1.06rem, 1.35vw, 1.55rem); letter-spacing: -0.04em; line-height: 1.05; white-space: nowrap; }
.topbar p { color: var(--muted); margin-top: 3px; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  transition: border-color .14s ease, background .14s ease, filter .14s ease;
}
.btn:hover { border-color: rgba(101,217,245,.58); background: rgba(255,255,255,.08); }
.btn.primary { color: #031219; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent2)); font-weight: 850; }
.btn.secondary { border-color: rgba(101,217,245,.35); background: rgba(101,217,245,.09); }
.btn.ghost { background: rgba(255,255,255,.025); }
.btn.tiny { min-height: 26px; padding: 4px 8px; font-size: .72rem; border-radius: 4px; }
.btn.full { width: 100%; justify-content: center; margin-top: 8px; }

.btn.is-playing { border-color: rgba(255, 119, 119, .82); background: rgba(255, 91, 91, .18); color: #ffdede; }
.btn.is-rendering { border-color: rgba(255, 209, 102, .82); background: rgba(255, 209, 102, .14); color: #ffe9aa; }
.menu-wrap { position: relative; }
.export-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  min-width: 224px;
  padding: 5px;
  background: rgba(5, 9, 20, .98);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.export-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  background: transparent;
}
.export-menu button:hover { background: rgba(101,217,245,.12); }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(292px, 22vw) minmax(520px, 1fr) minmax(284px, 20vw);
  gap: var(--gap);
  align-items: stretch;
  overflow: hidden;
}
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.control-panel, .info-panel {
  min-height: 0;
  height: 100%;
  padding: 10px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(101,217,245,.50) rgba(255,255,255,.04);
}
.panel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-title.nested { margin-top: 12px; }
.panel-title.compact { margin: 0 0 6px; }
.panel-title span {
  min-width: 32px;
  height: 22px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(101,217,245,.36);
  color: var(--accent);
  background: rgba(101,217,245,.08);
  font-size: .72rem;
  font-weight: 900;
}
.panel-title h2 { font-size: .92rem; letter-spacing: -0.02em; }
.drop-zone {
  display: grid;
  gap: 6px;
  border: 1px dashed rgba(101,217,245,.42);
  border-radius: 5px;
  padding: 10px;
  background: rgba(101,217,245,.055);
  color: var(--text);
}
.drop-zone input { display: none; }
.drop-zone small { line-height: 1.28; font-size: .76rem; }
.file-row { display: grid; gap: 6px; color: var(--muted); }
.file-row input { color: var(--muted); }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 7px; }
.mini-grid label, .control-panel label { color: var(--muted); font-size: .78rem; }
input[type="text"], input[type="number"], select {
  width: 100%;
  margin-top: 4px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: rgba(2, 6, 16, .72);
  padding: 7px 9px;
  outline: none;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus { border-color: rgba(101,217,245,.65); }
input[type="range"] { width: 100%; margin-top: 10px; accent-color: var(--accent); }

.stage-panel {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 126px;
  gap: var(--gap);
  overflow: hidden;
}
.stage-toolbar {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  overflow: hidden;
}
.stage-toolbar > div:first-child { min-width: 0; }
.stage-toolbar strong { display: block; margin-bottom: 2px; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-toolbar small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-side { display: grid; gap: 6px; justify-items: end; min-width: 260px; }
.stat-pills { display: flex; flex-wrap: nowrap; gap: 5px; justify-content: flex-end; flex: 0 0 auto; }
.stat-pills span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255,255,255,.045);
  color: var(--muted);
  font-size: .76rem;
  white-space: nowrap;
}

.preview-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.scrub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .72rem;
  min-width: 170px;
}
.scrub-row input { margin: 0; min-height: 0; }

.canvas-wrap {
  min-height: 0;
  min-width: 0;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #02050e;
  box-shadow: var(--shadow);
}
.canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), inset 0 -72px 90px rgba(0,0,0,.34);
}
#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #030812;
}
.export-log-panel {
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}
#logOutput {
  margin: 0;
  height: 80px;
  overflow: auto;
  white-space: pre-wrap;
  color: #b9c7ed;
  font-size: .76rem;
  line-height: 1.32;
  background: rgba(0,0,0,.24);
  border: 1px solid var(--line2);
  border-radius: 5px;
  padding: 8px;
}
.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.check-list li { color: var(--muted); line-height: 1.28; border-bottom: 1px solid var(--line2); padding-bottom: 7px; font-size: .86rem; }
.check-list strong { color: var(--text); }
.warning-card, .summary-box {
  margin-top: 9px;
  border: 1px solid rgba(255, 209, 102, .28);
  border-radius: 5px;
  padding: 9px;
  background: rgba(255, 209, 102, .08);
  color: #ffe8a2;
}
.warning-card p { margin-top: 5px; font-size: .78rem; line-height: 1.32; color: #dec78b; }
.summary-box { border-color: var(--line); background: rgba(255,255,255,.04); color: var(--muted); font-size: .82rem; line-height: 1.38; overflow: auto; }
.summary-box strong { color: var(--text); }

.toast-stack {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 7px;
  width: min(360px, calc(100vw - 24px));
  z-index: 80;
  pointer-events: none;
}
.toast {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: rgba(7, 12, 26, .97);
  box-shadow: var(--shadow);
  border-radius: 5px;
  padding: 9px 10px;
  animation: toastIn .18s ease both;
  pointer-events: auto;
}
.toast.success { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--bad); }
.toast-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 5px; }
.toast strong { font-size: .86rem; }
.toast small { color: var(--muted2); }
.toast p { color: var(--muted); font-size: .78rem; line-height: 1.28; }
.toast .bar { height: 3px; border-radius: 99px; background: rgba(255,255,255,.08); margin-top: 7px; overflow: hidden; }
.toast .bar span { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(8px) translateY(5px); } to { opacity: 1; transform: translateX(0) translateY(0); } }

@media (max-width: 1360px) {
  .workspace { grid-template-columns: minmax(270px, 28vw) minmax(460px, 1fr); }
  .info-panel { display: none; }
}
@media (max-width: 860px) {
  html, body { overflow: auto; }
  body { min-height: 100%; }
  .app-shell { height: auto; min-height: 100vh; min-height: 100svh; overflow: visible; grid-template-rows: auto auto; }
  .topbar { min-height: auto; flex-direction: column; align-items: stretch; }
  .brand-block { align-items: flex-start; }
  .topbar p, h1 { white-space: normal; }
  .top-actions { justify-content: space-between; }
  .workspace { grid-template-columns: 1fr; overflow: visible; }
  .control-panel, .info-panel { height: auto; max-height: none; display: block; }
  .stage-panel { grid-template-rows: auto minmax(280px, 58vh) 126px; }
  .stage-toolbar { min-height: 0; flex-direction: column; align-items: stretch; }
  .stage-side { justify-items: stretch; min-width: 0; }
  .stat-pills { justify-content: flex-start; flex-wrap: wrap; }
  .preview-controls { justify-content: flex-start; flex-wrap: wrap; }
  .mini-grid { grid-template-columns: 1fr; }
}

/* Phase 9 timeline/project + QA editor */
.stage-panel {
  grid-template-rows: 56px minmax(0, 1fr) 112px 112px;
}
.timeline-panel {
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}
.timeline-strip {
  height: 72px;
  overflow: auto hidden;
  border: 1px solid var(--line2);
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(101,217,245,.12) 1px, transparent 1px),
    rgba(0,0,0,.22);
  background-size: 80px 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(101,217,245,.50) rgba(255,255,255,.04);
}
.timeline-content {
  position: relative;
  min-width: 100%;
  height: 72px;
}
.tl-note {
  position: absolute;
  height: 7px;
  min-width: 2px;
  border-radius: 2px;
  opacity: .88;
  box-shadow: 0 0 8px rgba(101,217,245,.22);
}
.tl-lane-label {
  position: absolute;
  left: 4px;
  color: rgba(237,244,255,.65);
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}
.tl-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 0 8px rgba(255,255,255,.45);
}
@media (max-width: 860px) {
  .stage-panel { grid-template-rows: auto minmax(280px, 52vh) 112px 126px; }
}


/* Phase 9 QA / failure detector matrix */
.qa-mini {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line2);
  border-radius: 5px;
  background: rgba(0,0,0,.20);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.32;
}
.qa-box {
  max-height: 260px;
  padding: 8px;
}
.qa-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px solid var(--line2);
}
.qa-summary small { font-size: .72rem; }
.qa-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid var(--line2);
}
.qa-row b {
  min-width: 0;
  color: var(--text);
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.qa-row span {
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .66rem;
  font-weight: 900;
}
.qa-row small {
  grid-column: 1 / -1;
  font-size: .74rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.qa-row.pass span { color: var(--good); }
.qa-row.warn span { color: var(--warn); }
.qa-row.fail span { color: var(--bad); }

.button-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.button-grid .btn { width: 100%; min-height: 32px; }
.compact-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.designer-grid label { border-left: 1px solid rgba(104,225,253,.12); padding-left: 6px; }
@media (max-width: 900px) { .button-grid, .compact-actions { grid-template-columns: 1fr; } }

.keyframe-grid label { min-width: 0; }
#keyframeStatus { border-color: rgba(255, 209, 102, .30); color: rgba(255, 241, 196, .86); }


/* Phase 10.5 finished preset thumbnails + visual QA */
.finished-grid input[disabled] {
  opacity: .76;
  color: var(--muted);
  cursor: default;
}
.preset-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.preset-thumb {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line2);
  border-radius: 5px;
  color: var(--text);
  background: rgba(255,255,255,.035);
  text-align: left;
}
.preset-thumb:hover,
.preset-thumb.active {
  border-color: rgba(101,217,245,.62);
  background: rgba(101,217,245,.08);
}
.preset-thumb-art {
  height: 46px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 4px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(0,0,0,.26);
}
.preset-thumb-art b {
  display: flex;
  align-items: end;
  gap: 3px;
  width: 72%;
  height: 100%;
}
.preset-thumb-art i {
  flex: 1;
  min-width: 2px;
  border-radius: 2px 2px 0 0;
  background: rgba(255,255,255,.82);
  box-shadow: 0 0 8px rgba(255,255,255,.5);
}
.preset-thumb strong {
  min-width: 0;
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-thumb small {
  font-size: .66rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#visualQaStatus .qa-summary { margin-bottom: 4px; }
#visualQaStatus .qa-row { padding: 5px 0; }
@media (max-width: 900px) { .preset-preview-grid { grid-template-columns: 1fr; } }

.resource-pass { border-color: rgba(71,245,165,.45); background: rgba(71,245,165,.08); }
.resource-warn { border-color: rgba(255,209,102,.55); background: rgba(255,209,102,.09); }
.resource-fail { border-color: rgba(255,107,139,.65); background: rgba(255,107,139,.10); }

/* Phase 10.9 Export Profile Wizard */
.wizard-card {
  margin-top: 8px;
  padding: 9px;
  border: 1px solid rgba(101,217,245,.25);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(101,217,245,.07), rgba(119,240,196,.035));
}
.wizard-card strong { display: block; color: var(--text); font-size: .84rem; margin-bottom: 4px; }
.wizard-card p { color: var(--muted); font-size: .76rem; line-height: 1.32; margin-bottom: 8px; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.button-row .btn { width: 100%; min-height: 34px; padding: 7px 9px; font-size: .76rem; }
.export-wizard-status { margin-top: 8px; }
@media (max-width: 860px) { .button-row { grid-template-columns: 1fr; } }


/* OREV UI Phase 1 - transparent brand asset installation */
:root {
  --bg: #020306;
  --bg2: #090c15;
  --panel: rgba(6, 9, 17, 0.95);
  --panel2: rgba(14, 17, 27, 0.96);
  --line: rgba(75, 197, 255, 0.28);
  --line2: rgba(230, 169, 75, 0.15);
  --text: #f6f2e9;
  --muted: #b6bfd2;
  --muted2: #7f8aa5;
  --accent: #1fc6ff;
  --accent2: #ff8a17;
  --gold: #f4c76b;
  --raven: #05070d;
  --ember: #ff4b10;
  --ice: #28c8ff;
  --shadow: 0 18px 44px rgba(0,0,0,.58);
  --topbar-h: 92px;
}
body {
  background:
    radial-gradient(circle at 8% 30%, rgba(255, 69, 16, .20), transparent 26%),
    radial-gradient(circle at 92% 24%, rgba(40, 200, 255, .18), transparent 28%),
    radial-gradient(circle at 50% 0%, rgba(244, 199, 107, .14), transparent 32%),
    linear-gradient(135deg, #010205 0%, #070912 46%, #02050d 100%);
}
.topbar {
  min-height: var(--topbar-h);
  padding: 8px 14px;
  border-color: rgba(244, 199, 107, .33);
  background:
    linear-gradient(90deg, rgba(255, 75, 16, .10), transparent 22%, transparent 76%, rgba(40, 200, 255, .11)),
    rgba(2, 4, 10, .96);
}
.orev-brand-block { gap: 14px; }
.brand-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: clamp(198px, 24vw, 312px);
  height: 76px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 50%, rgba(244,199,107,.10), transparent 62%);
  text-decoration: none;
}
.brand-logo {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(31,198,255,.22)) drop-shadow(0 0 18px rgba(255,75,16,.18));
}
.brand-copy { min-width: 0; display: grid; gap: 4px; }
.brand-copy h1 { color: var(--text); text-shadow: 0 0 18px rgba(31,198,255,.18); }
.brand-copy p { color: #d8c39a; }
.brand-orb { display: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--accent2) 48%, var(--ice));
  color: #090807;
}
.btn.secondary { border-color: rgba(244,199,107,.32); background: rgba(244,199,107,.08); }
.panel-title span { border-color: rgba(244,199,107,.36); color: var(--gold); background: rgba(244,199,107,.08); }
@media (max-width: 860px) {
  :root { --topbar-h: auto; }
  .brand-logo-link { width: min(76vw, 320px); height: 84px; justify-content: flex-start; }
  .orev-brand-block { align-items: center; }
}


/* OREV UI Phase 2 - palette and chrome overhaul */
:root {
  --bg: #010204;
  --bg2: #070913;
  --panel: rgba(8, 9, 15, 0.965);
  --panel2: rgba(17, 14, 18, 0.965);
  --line: rgba(244, 199, 107, 0.30);
  --line2: rgba(40, 200, 255, 0.16);
  --text: #fff5e2;
  --muted: #c6bdac;
  --muted2: #8d9aaa;
  --accent: #23caff;
  --accent2: #ff7a0f;
  --gold: #ffd36e;
  --ember: #ff3f10;
  --crimson: #a31212;
  --ice: #20c7ff;
  --shield: #10121b;
  --radius: 10px;
  --gap: 10px;
  --topbar-h: 104px;
}
body {
  background:
    radial-gradient(circle at 0% 42%, rgba(255, 54, 10, .25), transparent 29%),
    radial-gradient(circle at 100% 36%, rgba(23, 154, 255, .23), transparent 30%),
    radial-gradient(circle at 48% -5%, rgba(255, 211, 110, .16), transparent 34%),
    linear-gradient(115deg, #000 0%, #060713 38%, #020408 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background:
    linear-gradient(90deg, rgba(255,211,110,.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(35,202,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}
.app-shell { position: relative; z-index: 1; }
.topbar {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 211, 110, .42);
  background:
    linear-gradient(90deg, rgba(255,63,16,.18), rgba(7,9,19,.96) 28%, rgba(4,8,18,.96) 70%, rgba(32,199,255,.18)),
    rgba(2,3,8,.98);
  box-shadow:
    0 18px 44px rgba(0,0,0,.66),
    inset 0 0 0 1px rgba(255,255,255,.04),
    inset 0 -1px 0 rgba(35,202,255,.28);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 18px 0 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,63,16,.78), rgba(255,211,110,.64), rgba(32,199,255,.78), transparent);
}
.brand-logo-link {
  width: clamp(240px, 27vw, 370px);
  height: 92px;
  border: 1px solid rgba(255,211,110,.16);
  background:
    radial-gradient(circle at 30% 50%, rgba(255,63,16,.20), transparent 50%),
    radial-gradient(circle at 78% 50%, rgba(32,199,255,.17), transparent 52%),
    linear-gradient(135deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  box-shadow: inset 0 0 28px rgba(0,0,0,.42), 0 0 26px rgba(35,202,255,.10);
}
.brand-copy h1 {
  color: #fff8e8;
  letter-spacing: -.045em;
  text-shadow: 0 0 22px rgba(255,211,110,.18), 0 0 18px rgba(32,199,255,.13);
}
.brand-copy p { color: #f2d28a; }
.panel {
  border-color: rgba(255,211,110,.24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 72%),
    radial-gradient(circle at 0% 0%, rgba(255,63,16,.055), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(32,199,255,.06), transparent 38%),
    var(--panel);
  box-shadow: 0 16px 42px rgba(0,0,0,.58), inset 0 0 0 1px rgba(255,255,255,.028);
}
.control-panel, .info-panel { scrollbar-color: rgba(255,211,110,.52) rgba(255,255,255,.04); }
.stage-toolbar strong { color: #fff8e8; }
.stage-toolbar small { color: #c9a85f; }
.panel-title span {
  color: #0a0b0d;
  border-color: rgba(255,211,110,.52);
  background: linear-gradient(135deg, #ffe29a, #ff8a17 58%, #25caff);
  box-shadow: 0 0 18px rgba(255,138,23,.14);
}
.panel-title h2 { color: #fff5dc; }
.drop-zone {
  border-color: rgba(255, 138, 23, .45);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,63,16,.12), transparent 48%),
    radial-gradient(circle at 100% 100%, rgba(32,199,255,.11), transparent 50%),
    rgba(0,0,0,.26);
}
.drop-zone strong { color: #ffe29a; }
input[type="text"], input[type="number"], select {
  border-color: rgba(255,211,110,.22);
  background: rgba(0, 2, 8, .82);
  color: #fff6e6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: rgba(35,202,255,.68);
  box-shadow: 0 0 0 2px rgba(35,202,255,.12), inset 0 1px 0 rgba(255,255,255,.04);
}
input[type="range"] { accent-color: var(--gold); }
.btn {
  border-color: rgba(255,211,110,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.btn:hover {
  border-color: rgba(35,202,255,.58);
  background: linear-gradient(180deg, rgba(35,202,255,.12), rgba(255,138,23,.055));
}
.btn.primary {
  background: linear-gradient(135deg, #ffdf86 0%, #ff7a0f 36%, #d92910 50%, #20c7ff 100%);
  color: #070708;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  box-shadow: 0 0 22px rgba(255,122,15,.16), inset 0 1px 0 rgba(255,255,255,.38);
}
.btn.secondary {
  color: #ffe8ae;
  border-color: rgba(255,211,110,.32);
  background: linear-gradient(180deg, rgba(255,211,110,.10), rgba(255,63,16,.045));
}
.btn.ghost { color: #ccefff; border-color: rgba(32,199,255,.24); }
.export-menu {
  border-color: rgba(255,211,110,.36);
  background: linear-gradient(180deg, rgba(13,9,10,.99), rgba(3,6,14,.99));
}
.export-menu button:hover { background: linear-gradient(90deg, rgba(255,63,16,.16), rgba(32,199,255,.12)); }
.canvas-wrap {
  border-color: rgba(255,211,110,.30);
  background:
    radial-gradient(circle at 30% 30%, rgba(255,63,16,.12), transparent 35%),
    radial-gradient(circle at 72% 36%, rgba(32,199,255,.12), transparent 38%),
    #01030a;
}
#previewCanvas { background: #01030a; }
.timeline-strip {
  border-color: rgba(255,211,110,.18);
  background:
    linear-gradient(90deg, rgba(255,211,110,.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,63,16,.06), rgba(32,199,255,.04)),
    rgba(0,0,0,.26);
}
.stat-pills span, .qa-mini, .summary-box {
  border-color: rgba(255,211,110,.18);
  background: rgba(0,0,0,.22);
}
.warning-card { border-color: rgba(255,138,23,.40); background: rgba(255,63,16,.08); }
.toast { border-color: rgba(255,211,110,.26); background: rgba(5,6,12,.98); }
@media (max-width: 860px) {
  .brand-logo-link { width: min(82vw, 370px); height: 96px; }
  .top-actions { flex-wrap: wrap; }
}


/* OREV UI Phase 3 - layout hierarchy pass */
:root {
  --topbar-h: 96px;
  --left-rail: clamp(302px, 22vw, 358px);
  --right-rail: clamp(292px, 18vw, 342px);
  --stage-glow: rgba(35, 202, 255, .18);
  --source-glow: rgba(255, 138, 23, .16);
  --diagnostic-glow: rgba(255, 211, 110, .14);
}
.app-shell {
  grid-template-rows: var(--topbar-h) auto minmax(0, 1fr);
}
.topbar {
  min-height: var(--topbar-h);
  padding-block: 6px;
}
.brand-logo-link {
  width: clamp(232px, 25vw, 348px);
  height: 84px;
}
.phase3-flowbar {
  min-height: 42px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 211, 110, .22);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255,63,16,.10), rgba(6,8,15,.90) 34%, rgba(32,199,255,.10)),
    rgba(2, 3, 8, .86);
  box-shadow: 0 12px 28px rgba(0,0,0,.34), inset 0 0 0 1px rgba(255,255,255,.025);
  overflow: hidden;
}
.flow-step {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}
.flow-step span {
  width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 950;
  color: #08090a;
  background: linear-gradient(135deg, #ffe29a, #ff8a17 58%, #25caff);
}
.flow-step strong {
  color: #fff8e8;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.flow-step small {
  min-width: 0;
  color: #ccb98e;
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-step { box-shadow: inset 3px 0 0 rgba(255, 138, 23, .66); }
.stage-step { box-shadow: inset 3px 0 0 rgba(35, 202, 255, .68); }
.diagnostics-step { box-shadow: inset 3px 0 0 rgba(255, 211, 110, .70); }
.workspace {
  grid-template-columns: minmax(300px, var(--left-rail)) minmax(580px, 1.42fr) minmax(292px, var(--right-rail));
  gap: 10px;
}
.control-panel,
.info-panel {
  padding: 12px;
}
.control-panel {
  box-shadow: 0 16px 42px rgba(0,0,0,.58), inset 3px 0 0 rgba(255,138,23,.23), inset 0 0 0 1px rgba(255,255,255,.025);
}
.info-panel {
  box-shadow: 0 16px 42px rgba(0,0,0,.58), inset -3px 0 0 rgba(255,211,110,.21), inset 0 0 0 1px rgba(255,255,255,.025);
}
.stage-panel {
  grid-template-rows: 62px minmax(0, 1fr) 96px 98px;
  gap: 10px;
}
.stage-toolbar {
  border-color: rgba(35, 202, 255, .30);
  background:
    linear-gradient(90deg, rgba(35,202,255,.10), rgba(0,0,0,.08), rgba(255,138,23,.075)),
    var(--panel);
  box-shadow: 0 16px 42px rgba(0,0,0,.58), inset 0 -1px 0 rgba(35,202,255,.22);
}
.canvas-wrap {
  min-height: 390px;
  border-color: rgba(35,202,255,.34);
  box-shadow:
    0 20px 52px rgba(0,0,0,.64),
    0 0 38px rgba(35,202,255,.065),
    inset 0 0 0 1px rgba(255,255,255,.035);
}
.canvas-wrap::after {
  content: "STAGE";
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  padding: 3px 7px;
  border: 1px solid rgba(35,202,255,.28);
  border-radius: 999px;
  color: rgba(205,241,255,.62);
  background: rgba(0,0,0,.22);
  font-size: .64rem;
  font-weight: 950;
  letter-spacing: .13em;
  pointer-events: none;
}
.control-panel > .panel-title:not(:first-child) {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,211,110,.11);
}
.control-panel > .panel-title:first-child {
  margin-top: 0;
}
.panel-title h2 {
  letter-spacing: .01em;
}
.panel-title span {
  min-width: 38px;
}
.drop-zone,
.wizard-card,
.qa-mini,
.summary-box,
.warning-card,
.timeline-strip,
#logOutput {
  border-radius: 8px;
}
.mini-grid {
  gap: 8px;
}
.timeline-strip,
.timeline-content {
  height: 58px;
}
#logOutput {
  height: 62px;
}
.phase3-overview {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid rgba(35,202,255,.24);
  border-radius: 9px;
  background:
    radial-gradient(circle at 0% 0%, rgba(35,202,255,.11), transparent 48%),
    radial-gradient(circle at 100% 0%, rgba(255,138,23,.10), transparent 52%),
    rgba(0,0,0,.24);
}
.phase3-overview strong {
  display: block;
  color: #fff5dc;
  font-size: .86rem;
  margin-bottom: 5px;
}
.phase3-overview p {
  color: #c7bdad;
  font-size: .78rem;
  line-height: 1.35;
  margin-bottom: 8px;
}
.phase3-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.phase3-chip-row span {
  border: 1px solid rgba(255,211,110,.20);
  border-radius: 999px;
  padding: 3px 7px;
  color: #ffe2a0;
  background: rgba(255,211,110,.065);
  font-size: .68rem;
  font-weight: 850;
}
.info-panel .check-list li {
  font-size: .82rem;
  padding-bottom: 8px;
}
.stat-pills span {
  border-color: rgba(35,202,255,.24);
}
@media (max-width: 1360px) {
  .workspace {
    grid-template-columns: minmax(292px, 30vw) minmax(0, 1fr);
  }
  .info-panel { display: none; }
  .phase3-flowbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow-step { grid-template-columns: auto minmax(0, 1fr); }
  .flow-step small { display: none; }
}
@media (max-width: 860px) {
  :root { --topbar-h: auto; }
  .app-shell {
    grid-template-rows: auto auto auto;
  }
  .phase3-flowbar {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .flow-step {
    grid-template-columns: auto minmax(0, auto) minmax(0, 1fr);
  }
  .flow-step small { display: block; }
  .brand-logo-link {
    width: min(82vw, 360px);
    height: 92px;
  }
  .stage-panel {
    grid-template-rows: auto minmax(300px, 52vh) 96px 110px;
  }
  .canvas-wrap { min-height: 300px; }
  .timeline-strip,
  .timeline-content { height: 58px; }
  #logOutput { height: 74px; }
}


/* OREV UI Phase 4 - visualizer stage skin */
:root {
  --phase4-ember: #ff4c12;
  --phase4-ice: #25caff;
  --phase4-gold: #ffd77d;
  --phase4-deep: #02030a;
  --phase4-glass: rgba(4, 8, 18, .78);
  --phase4-stage-radius: 18px;
}
.phase4-flowbar {
  border-color: rgba(255, 215, 125, .30);
  background:
    linear-gradient(90deg, rgba(255,76,18,.16), rgba(2,4,10,.88) 32%, rgba(37,202,255,.16)),
    radial-gradient(circle at 50% 0%, rgba(255,215,125,.12), transparent 55%);
}
.phase4-flowbar .stage-step {
  border-color: rgba(37, 202, 255, .22);
  background:
    radial-gradient(circle at 18% 50%, rgba(255,76,18,.13), transparent 48%),
    radial-gradient(circle at 86% 50%, rgba(37,202,255,.14), transparent 48%),
    rgba(0,0,0,.25);
}
.stage-panel {
  position: relative;
}
.stage-panel::before {
  content: "";
  position: absolute;
  inset: 54px -4px 84px -4px;
  pointer-events: none;
  border-radius: 24px;
  background:
    radial-gradient(circle at 7% 48%, rgba(255,76,18,.20), transparent 34%),
    radial-gradient(circle at 93% 47%, rgba(37,202,255,.20), transparent 35%),
    radial-gradient(circle at 50% 2%, rgba(255,215,125,.10), transparent 32%);
  filter: blur(2px);
  opacity: .74;
  z-index: -1;
}
.stage-toolbar {
  border-radius: 14px;
  border-color: rgba(255, 215, 125, .30);
  background:
    linear-gradient(90deg, rgba(255,76,18,.13), rgba(2,5,13,.88) 38%, rgba(37,202,255,.13)),
    radial-gradient(circle at 50% 0%, rgba(255,215,125,.10), transparent 58%),
    var(--panel);
}
.stage-toolbar strong::before {
  content: "◆";
  margin-right: 8px;
  color: var(--phase4-gold);
  text-shadow: 0 0 14px rgba(255, 215, 125, .42);
}
.stage-side .stat-pills span {
  border-color: rgba(255, 215, 125, .24);
  background:
    linear-gradient(135deg, rgba(255,76,18,.075), rgba(37,202,255,.075)),
    rgba(0,0,0,.24);
}
.phase4-stage-skin {
  padding: 14px;
  border-radius: var(--phase4-stage-radius);
  border-color: rgba(255, 215, 125, .48);
  background:
    linear-gradient(90deg, rgba(255,76,18,.18), transparent 24%, transparent 76%, rgba(37,202,255,.18)),
    radial-gradient(circle at 50% 2%, rgba(255,215,125,.18), transparent 34%),
    radial-gradient(circle at 50% 96%, rgba(255,215,125,.10), transparent 30%),
    linear-gradient(135deg, #010204, #070812 48%, #02050b);
  box-shadow:
    0 24px 68px rgba(0,0,0,.74),
    0 0 42px rgba(255,76,18,.10),
    0 0 46px rgba(37,202,255,.11),
    inset 0 0 0 1px rgba(255,255,255,.04),
    inset 0 0 36px rgba(0,0,0,.52);
}
.phase4-stage-skin::before {
  content: "";
  position: absolute;
  inset: 7px;
  pointer-events: none;
  z-index: 2;
  border-radius: calc(var(--phase4-stage-radius) - 6px);
  border: 1px solid rgba(255, 215, 125, .18);
  background:
    linear-gradient(90deg, rgba(255,76,18,.38), transparent 16%, transparent 84%, rgba(37,202,255,.36)) border-box,
    linear-gradient(180deg, rgba(255,215,125,.26), transparent 18%, transparent 82%, rgba(255,215,125,.18)) border-box;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    inset 0 0 54px rgba(0,0,0,.58),
    inset 0 -76px 96px rgba(0,0,0,.38);
}
.phase4-stage-skin::after {
  content: "OREV STAGE";
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 5;
  padding: 4px 9px;
  border: 1px solid rgba(255, 215, 125, .35);
  border-radius: 999px;
  color: rgba(255, 239, 202, .76);
  background:
    linear-gradient(90deg, rgba(255,76,18,.18), rgba(37,202,255,.13)),
    rgba(0,0,0,.42);
  font-size: .64rem;
  font-weight: 950;
  letter-spacing: .16em;
  text-shadow: 0 0 11px rgba(37,202,255,.24);
  pointer-events: none;
}
.phase4-stage-skin #previewCanvas {
  position: relative;
  z-index: 1;
  border-radius: 11px;
  border: 1px solid rgba(255, 215, 125, .18);
  background:
    radial-gradient(circle at 12% 34%, rgba(255,76,18,.11), transparent 38%),
    radial-gradient(circle at 88% 34%, rgba(37,202,255,.11), transparent 38%),
    #01030a;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.03),
    0 16px 34px rgba(0,0,0,.46);
}
.stage-ornament {
  position: absolute;
  z-index: 4;
  width: 28px;
  height: 28px;
  pointer-events: none;
  transform: rotate(45deg);
  border: 1px solid rgba(255, 215, 125, .42);
  background:
    radial-gradient(circle at 50% 50%, rgba(37,202,255,.62), rgba(37,202,255,.12) 34%, transparent 56%),
    linear-gradient(135deg, rgba(255,215,125,.36), rgba(255,76,18,.08));
  box-shadow:
    0 0 16px rgba(37,202,255,.22),
    inset 0 0 12px rgba(255,215,125,.12);
}
.stage-ornament-tl { left: 14px; top: 14px; }
.stage-ornament-tr { right: 14px; top: 14px; }
.stage-ornament-bl { left: 14px; bottom: 14px; }
.stage-ornament-br { right: 14px; bottom: 14px; }
.stage-skin-label {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  padding: 5px 14px;
  border: 1px solid rgba(255, 215, 125, .32);
  border-radius: 999px;
  color: rgba(255,245,224,.72);
  background:
    linear-gradient(90deg, rgba(255,76,18,.16), rgba(37,202,255,.13)),
    rgba(0,0,0,.46);
  font-size: .66rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255,215,125,.20);
}
.timeline-panel {
  border-color: rgba(255, 215, 125, .28);
  background:
    linear-gradient(90deg, rgba(255,76,18,.065), rgba(37,202,255,.055)),
    rgba(5,6,13,.92);
}
.timeline-strip {
  border-radius: 10px;
  border-color: rgba(255, 215, 125, .30);
  background:
    linear-gradient(90deg, rgba(255,215,125,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,76,18,.12), transparent 28%, transparent 72%, rgba(37,202,255,.12)),
    rgba(0,0,0,.32);
  background-size: 48px 100%, auto, auto;
  box-shadow: inset 0 0 20px rgba(0,0,0,.48);
}
.export-log-panel {
  border-color: rgba(37, 202, 255, .24);
  background:
    linear-gradient(90deg, rgba(255,76,18,.05), rgba(37,202,255,.08)),
    rgba(4, 6, 13, .94);
}
#logOutput {
  border-color: rgba(37, 202, 255, .20);
  background:
    radial-gradient(circle at 0% 0%, rgba(37,202,255,.06), transparent 42%),
    rgba(0,0,0,.34);
}
.phase3-overview {
  border-color: rgba(255, 215, 125, .30);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,76,18,.13), transparent 46%),
    radial-gradient(circle at 100% 0%, rgba(37,202,255,.13), transparent 48%),
    rgba(0,0,0,.30);
}
.phase3-overview strong::before {
  content: "◆";
  margin-right: 8px;
  color: var(--phase4-gold);
}
.phase3-chip-row span {
  border-color: rgba(255,215,125,.30);
  background:
    linear-gradient(135deg, rgba(255,76,18,.08), rgba(37,202,255,.08)),
    rgba(0,0,0,.18);
}
@media (max-width: 860px) {
  .phase4-stage-skin { padding: 10px; border-radius: 14px; }
  .stage-ornament { width: 20px; height: 20px; }
  .stage-skin-label { bottom: 11px; font-size: .58rem; padding-inline: 10px; }
  .phase4-stage-skin::after { top: 12px; right: 14px; font-size: .58rem; }
}

/* OREV UI Phase 5 - input and form refinement */
:root {
  --phase5-field-bg: rgba(1, 4, 13, .62);
  --phase5-field-bg-hover: rgba(4, 10, 24, .78);
  --phase5-field-border: rgba(255, 215, 125, .18);
  --phase5-field-border-hot: rgba(37, 202, 255, .62);
  --phase5-field-ring: rgba(37, 202, 255, .16);
  --phase5-ember-ring: rgba(255, 76, 18, .14);
}
.orev-ui-phase5 .phase3-flowbar,
.orev-ui-phase5 .phase4-flowbar {
  box-shadow:
    0 12px 30px rgba(0,0,0,.38),
    inset 0 0 0 1px rgba(255,255,255,.03),
    0 0 24px rgba(37,202,255,.045);
}
.orev-ui-phase5 .control-panel .mini-grid {
  gap: 10px;
}
.orev-ui-phase5 .control-panel label:not(.drop-zone),
.orev-ui-phase5 .stage-panel label,
.orev-ui-phase5 .file-row {
  position: relative;
}
.orev-ui-phase5 .control-panel .mini-grid label,
.orev-ui-phase5 .control-panel .file-row {
  min-height: 62px;
  padding: 9px 10px 10px;
  border: 1px solid var(--phase5-field-border);
  border-radius: 11px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,76,18,.055), transparent 48%),
    radial-gradient(circle at 100% 100%, rgba(37,202,255,.06), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,.032), transparent 70%),
    var(--phase5-field-bg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.035),
    0 6px 18px rgba(0,0,0,.18);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.orev-ui-phase5 .control-panel .mini-grid label:hover,
.orev-ui-phase5 .control-panel .file-row:hover {
  border-color: rgba(255, 215, 125, .32);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,76,18,.085), transparent 48%),
    radial-gradient(circle at 100% 100%, rgba(37,202,255,.095), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 70%),
    var(--phase5-field-bg-hover);
}
.orev-ui-phase5 .control-panel .mini-grid label:focus-within,
.orev-ui-phase5 .control-panel .file-row:focus-within,
.orev-ui-phase5 .stage-panel label:focus-within {
  border-color: var(--phase5-field-border-hot);
  box-shadow:
    0 0 0 2px var(--phase5-field-ring),
    0 0 22px rgba(37,202,255,.09),
    inset 0 1px 0 rgba(255,255,255,.05);
}
.orev-ui-phase5 .control-panel label,
.orev-ui-phase5 .stage-panel label {
  color: #e9d69c;
  font-weight: 800;
  letter-spacing: .01em;
}
.orev-ui-phase5 input[type="text"],
.orev-ui-phase5 input[type="number"],
.orev-ui-phase5 select {
  min-height: 40px;
  margin-top: 7px;
  border-radius: 9px;
  border-color: rgba(255, 215, 125, .24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
    rgba(0, 2, 9, .88);
  color: #fff8ea;
  padding: 8px 10px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    inset 0 -14px 22px rgba(0,0,0,.18);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}
.orev-ui-phase5 select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
}
.orev-ui-phase5 .phase5-select-field::after {
  content: "▾";
  position: absolute;
  right: 20px;
  bottom: 19px;
  color: rgba(37,202,255,.88);
  font-size: .74rem;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(37,202,255,.32);
}
.orev-ui-phase5 input[type="text"]::placeholder,
.orev-ui-phase5 input[type="number"]::placeholder {
  color: rgba(204, 185, 142, .62);
}
.orev-ui-phase5 input[type="text"]:hover,
.orev-ui-phase5 input[type="number"]:hover,
.orev-ui-phase5 select:hover {
  border-color: rgba(255, 215, 125, .42);
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.016)),
    rgba(2, 7, 18, .94);
}
.orev-ui-phase5 input[type="text"]:focus,
.orev-ui-phase5 input[type="number"]:focus,
.orev-ui-phase5 select:focus {
  border-color: rgba(37,202,255,.76);
  box-shadow:
    0 0 0 2px rgba(37,202,255,.15),
    0 0 20px rgba(37,202,255,.10),
    inset 0 1px 0 rgba(255,255,255,.05);
}
.orev-ui-phase5 button:focus-visible,
.orev-ui-phase5 input:focus-visible,
.orev-ui-phase5 select:focus-visible {
  outline: 2px solid rgba(37,202,255,.82);
  outline-offset: 2px;
}
.orev-ui-phase5 input:disabled,
.orev-ui-phase5 select:disabled,
.orev-ui-phase5 button:disabled {
  cursor: not-allowed;
  opacity: .55;
  filter: saturate(.72);
}
.orev-ui-phase5 input[type="file"] {
  width: 100%;
  margin-top: 8px;
  color: #ccb98e;
  font-size: .75rem;
}
.orev-ui-phase5 input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 8px;
  border: 1px solid rgba(255,215,125,.26);
  border-radius: 8px;
  color: #070708;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe29a, #ff8a17 58%, #25caff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  cursor: pointer;
}
.orev-ui-phase5 input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 24px;
  margin-top: 13px;
  background: transparent;
  accent-color: var(--phase4-gold);
}
.orev-ui-phase5 input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid rgba(255,215,125,.22);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255,76,18,.62), rgba(255,215,125,.72) 48%, rgba(37,202,255,.70)),
    rgba(0,0,0,.38);
  box-shadow: inset 0 0 10px rgba(0,0,0,.42);
}
.orev-ui-phase5 input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 2px solid rgba(255,245,224,.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, #25caff 34%, #08243a 70%);
  box-shadow: 0 0 0 3px rgba(37,202,255,.12), 0 0 16px rgba(37,202,255,.34);
}
.orev-ui-phase5 input[type="range"]::-moz-range-track {
  height: 8px;
  border: 1px solid rgba(255,215,125,.22);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,76,18,.62), rgba(255,215,125,.72) 48%, rgba(37,202,255,.70));
  box-shadow: inset 0 0 10px rgba(0,0,0,.42);
}
.orev-ui-phase5 input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,245,224,.88);
  border-radius: 50%;
  background: #25caff;
  box-shadow: 0 0 0 3px rgba(37,202,255,.12), 0 0 16px rgba(37,202,255,.34);
}
.orev-ui-phase5 .phase5-range-field {
  padding-right: 62px !important;
}
.orev-ui-phase5 .phase5-range-value {
  position: absolute;
  top: 8px;
  right: 10px;
  min-width: 42px;
  text-align: center;
  padding: 2px 7px;
  border: 1px solid rgba(37,202,255,.24);
  border-radius: 999px;
  color: #cdf5ff;
  background: rgba(0,0,0,.34);
  box-shadow: inset 0 0 10px rgba(37,202,255,.08);
  font-size: .68rem;
  font-weight: 950;
  line-height: 1.25;
}
.orev-ui-phase5 .drop-zone {
  border-radius: 12px;
  border-color: rgba(37,202,255,.34);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    0 8px 22px rgba(0,0,0,.18);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.orev-ui-phase5 .drop-zone:hover,
.orev-ui-phase5 .drop-zone:focus-within {
  border-color: rgba(255,215,125,.48);
  background:
    radial-gradient(circle at 0% 0%, rgba(255,63,16,.15), transparent 48%),
    radial-gradient(circle at 100% 100%, rgba(32,199,255,.14), transparent 50%),
    rgba(0,0,0,.28);
  box-shadow: 0 0 0 2px rgba(255,215,125,.08), 0 0 26px rgba(37,202,255,.075);
}
.orev-ui-phase5 .scrub-row {
  min-width: 198px;
  padding: 5px 8px;
  border: 1px solid rgba(255,215,125,.18);
  border-radius: 999px;
  background: rgba(0,0,0,.24);
}
.orev-ui-phase5 .scrub-row input[type="range"] {
  margin-top: 0;
  height: 18px;
}
.orev-ui-phase5 .btn {
  border-radius: 9px;
}
.orev-ui-phase5 .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37,202,255,.16), 0 0 22px rgba(37,202,255,.16);
}
.orev-ui-phase5 .phase3-overview {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.032),
    0 8px 22px rgba(0,0,0,.20);
}
@media (max-width: 860px) {
  .orev-ui-phase5 .control-panel .mini-grid label,
  .orev-ui-phase5 .control-panel .file-row {
    min-height: 58px;
    padding: 8px 9px 9px;
  }
  .orev-ui-phase5 .phase5-range-field {
    padding-right: 54px !important;
  }
  .orev-ui-phase5 .phase5-range-value {
    right: 8px;
    min-width: 38px;
  }
  .orev-ui-phase5 .scrub-row {
    width: 100%;
    min-width: 0;
  }
}



/* --------------------------------------------------------------------------
   OREV UI Phase 6 - Export Menu & Workflow Polish
   Existing z-index audit before this phase: stage ornaments <= 5, export menu 60,
   toast stack 80. The menu is elevated to 360 and its header stacking context
   to 320, which is high enough to sit above workspace/stage chrome without
   resorting to unsafe global max values. The topbar overflow is set to visible
   because the prior hidden overflow clipped the dropdown below the header.
---------------------------------------------------------------------------- */
:root {
  --phase6-topbar-z: 320;
  --phase6-menu-z: 360;
  --phase6-menu-width: clamp(286px, 34vw, 430px);
}

.orev-ui-phase6 .topbar {
  overflow: visible;
  z-index: var(--phase6-topbar-z);
}

.orev-ui-phase6 .topbar::after {
  pointer-events: none;
}

.orev-ui-phase6 .top-actions,
.orev-ui-phase6 .menu-wrap {
  position: relative;
  z-index: calc(var(--phase6-topbar-z) + 1);
  overflow: visible;
}

.orev-ui-phase6 .export-menu {
  right: 0;
  top: calc(100% + 12px);
  width: var(--phase6-menu-width);
  max-width: min(calc(100vw - 24px), var(--phase6-menu-width));
  max-height: min(72vh, 680px);
  overflow: auto;
  z-index: var(--phase6-menu-z);
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 219, 132, .46);
  background:
    radial-gradient(circle at 0% 8%, rgba(255, 79, 18, .20), transparent 42%),
    radial-gradient(circle at 100% 8%, rgba(32, 199, 255, .20), transparent 44%),
    linear-gradient(180deg, rgba(17, 10, 9, .995), rgba(3, 6, 16, .995) 52%, rgba(2, 7, 15, .995));
  box-shadow:
    0 30px 82px rgba(0, 0, 0, .78),
    0 0 0 1px rgba(255, 255, 255, .04) inset,
    0 0 34px rgba(255, 103, 25, .16),
    0 0 38px rgba(32, 199, 255, .12);
  backdrop-filter: blur(18px) saturate(126%);
  isolation: isolate;
}

.orev-ui-phase6 .export-menu[hidden] {
  display: none !important;
}

.orev-ui-phase6 .export-menu::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: -1;
  pointer-events: none;
  border-radius: 14px;
  border: 1px solid rgba(255, 219, 132, .13);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, .5);
}

.orev-ui-phase6 .export-menu-head {
  display: grid;
  gap: 2px;
  padding: 3px 5px 10px;
  border-bottom: 1px solid rgba(255, 219, 132, .18);
  margin-bottom: 8px;
}

.orev-ui-phase6 .export-menu-head strong {
  color: #fff3cf;
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(255, 155, 45, .35);
}

.orev-ui-phase6 .export-menu-head small {
  color: rgba(196, 236, 255, .70);
  font-size: .72rem;
}

.orev-ui-phase6 .export-menu-section {
  padding: 8px 0 10px;
  border-bottom: 1px solid rgba(93, 164, 190, .16);
}

.orev-ui-phase6 .export-menu-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.orev-ui-phase6 .export-menu-section h3 {
  margin: 0 3px 7px;
  color: rgba(255, 222, 149, .82);
  font-size: .68rem;
  letter-spacing: .16em;
  line-height: 1;
  text-transform: uppercase;
}

.orev-ui-phase6 .export-menu button {
  position: relative;
  display: block;
  min-height: 48px;
  margin: 3px 0;
  padding: 9px 12px 18px;
  border: 1px solid rgba(255, 219, 132, .14);
  border-radius: 12px;
  color: #fff8e8;
  background:
    linear-gradient(90deg, rgba(255, 89, 19, .09), rgba(32, 199, 255, .065)),
    rgba(255, 255, 255, .035);
  font-weight: 780;
  letter-spacing: .01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.orev-ui-phase6 .export-menu button::after {
  content: attr(data-help);
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  overflow: hidden;
  color: rgba(194, 228, 241, .68);
  font-size: .63rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orev-ui-phase6 .export-menu button:hover,
.orev-ui-phase6 .export-menu button:focus-visible {
  border-color: rgba(255, 219, 132, .42);
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(255, 85, 20, .20), rgba(32, 199, 255, .16)),
    rgba(255, 255, 255, .055);
  box-shadow:
    0 0 0 1px rgba(255, 219, 132, .08) inset,
    0 0 22px rgba(32, 199, 255, .12);
}

.orev-ui-phase6 .export-menu button:focus-visible {
  outline: 2px solid rgba(35, 202, 255, .78);
  outline-offset: 2px;
}

.orev-ui-phase6.export-menu-open .topbar {
  box-shadow:
    0 22px 56px rgba(0,0,0,.72),
    0 0 36px rgba(255, 119, 25, .16),
    inset 0 0 0 1px rgba(255,255,255,.05),
    inset 0 -1px 0 rgba(35,202,255,.32);
}

@media (max-width: 760px) {
  .orev-ui-phase6 .export-menu {
    position: fixed;
    top: max(76px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 98px);
  }
}


/* --------------------------------------------------------------------------
   OREV UI Phase 7 - Preset Gallery Restyle
   Adds a branded discovery layer around the existing finished preset engine.
   No export, rendering, FFmpeg, MIDI, or compositor logic is changed here.
---------------------------------------------------------------------------- */
:root {
  --phase7-gallery-border: rgba(255, 217, 133, .24);
  --phase7-gallery-border-hot: rgba(255, 217, 133, .58);
  --phase7-gallery-fire: #ff681f;
  --phase7-gallery-gold: #ffd979;
  --phase7-gallery-ice: #28cfff;
  --phase7-gallery-raven: rgba(2, 4, 12, .88);
}

.orev-ui-phase7 .phase3-flowbar,
.orev-ui-phase7 .phase4-flowbar {
  border-color: rgba(255, 217, 133, .26);
  box-shadow:
    0 18px 50px rgba(0,0,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.035),
    0 0 28px rgba(255, 112, 31, .08),
    0 0 32px rgba(40, 207, 255, .07);
}

.phase7-gallery-intro {
  display: grid;
  gap: 10px;
  margin: 8px 0 10px;
  padding: 12px;
  border: 1px solid rgba(255, 217, 133, .22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 99, 28, .16), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(40, 207, 255, .14), transparent 46%),
    linear-gradient(180deg, rgba(12, 10, 12, .80), rgba(4, 7, 17, .78));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.035),
    0 16px 34px rgba(0,0,0,.22);
}

.phase7-gallery-intro strong {
  display: block;
  color: #fff0c2;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(255, 154, 44, .28);
}

.phase7-gallery-intro p {
  margin: 5px 0 0;
  color: rgba(207, 234, 245, .74);
  font-size: .75rem;
  line-height: 1.45;
}

.phase7-gallery-kpis,
.phase7-gallery-filter-row,
.phase7-preset-meta,
.phase7-preset-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.phase7-gallery-kpis span,
.phase7-preset-badges span,
.phase7-preset-count {
  border: 1px solid rgba(255, 217, 133, .20);
  border-radius: 999px;
  padding: 4px 8px;
  color: rgba(255, 239, 197, .82);
  background: rgba(255, 255, 255, .045);
  font-size: .66rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.phase7-gallery-tools {
  display: grid;
  gap: 8px;
  margin: 10px 0 8px;
  padding: 10px;
  border: 1px solid rgba(40, 207, 255, .18);
  border-radius: 15px;
  background:
    linear-gradient(135deg, rgba(255, 104, 31, .08), rgba(40, 207, 255, .07)),
    rgba(0, 0, 0, .20);
}

.phase7-gallery-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.phase7-gallery-search {
  width: 100%;
  min-height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 217, 133, .24);
  color: #fff8e8;
  background:
    linear-gradient(90deg, rgba(255, 104, 31, .08), rgba(40, 207, 255, .055)),
    rgba(1, 4, 13, .66);
  padding: 8px 10px;
  font-size: .78rem;
  outline: none;
}

.phase7-gallery-search::placeholder {
  color: rgba(194, 228, 241, .42);
}

.phase7-gallery-search:focus-visible {
  border-color: rgba(40, 207, 255, .72);
  box-shadow: 0 0 0 2px rgba(40, 207, 255, .16), 0 0 24px rgba(40, 207, 255, .10);
}

.phase7-gallery-filter {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 217, 133, .18);
  color: rgba(255, 244, 218, .80);
  background: rgba(255, 255, 255, .045);
  padding: 4px 9px;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.phase7-gallery-filter:hover,
.phase7-gallery-filter.is-active,
.phase7-gallery-filter[aria-pressed="true"] {
  border-color: rgba(255, 217, 133, .54);
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(255, 104, 31, .20), rgba(40, 207, 255, .14)),
    rgba(255, 255, 255, .06);
  box-shadow: 0 0 18px rgba(255, 104, 31, .12), 0 0 20px rgba(40, 207, 255, .10);
}

.orev-ui-phase7 .preset-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.orev-ui-phase7 .preset-thumb {
  position: relative;
  isolation: isolate;
  gap: 7px;
  min-height: 174px;
  padding: 10px;
  border: 1px solid var(--phase7-gallery-border);
  border-radius: 18px;
  color: #fff7df;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 104, 31, .18), transparent 38%),
    radial-gradient(circle at 100% 0%, rgba(40, 207, 255, .16), transparent 42%),
    linear-gradient(180deg, rgba(16, 12, 12, .88), rgba(3, 6, 15, .92));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, .34),
    inset 0 0 0 1px rgba(255, 255, 255, .035);
  transform: translateZ(0);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.orev-ui-phase7 .preset-thumb::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: -1;
  border-radius: 14px;
  border: 1px solid rgba(255, 217, 133, .10);
  pointer-events: none;
}

.orev-ui-phase7 .preset-thumb:hover,
.orev-ui-phase7 .preset-thumb:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(40, 207, 255, .56);
  box-shadow:
    0 24px 44px rgba(0,0,0,.42),
    0 0 28px rgba(40, 207, 255, .13),
    0 0 26px rgba(255, 104, 31, .10),
    inset 0 0 0 1px rgba(255,255,255,.055);
}

.orev-ui-phase7 .preset-thumb.active {
  border-color: var(--phase7-gallery-border-hot);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 104, 31, .26), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(40, 207, 255, .24), transparent 44%),
    linear-gradient(180deg, rgba(26, 18, 12, .96), rgba(4, 8, 18, .97));
  box-shadow:
    0 24px 48px rgba(0,0,0,.48),
    0 0 0 2px rgba(255, 217, 133, .12),
    0 0 28px rgba(255, 190, 71, .22),
    0 0 30px rgba(40, 207, 255, .15);
}

.orev-ui-phase7 .preset-thumb.active::after {
  content: "ACTIVE LOOK";
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid rgba(255, 217, 133, .42);
  border-radius: 999px;
  padding: 3px 7px;
  color: #fff5cf;
  background: rgba(0,0,0,.42);
  font-size: .58rem;
  font-weight: 950;
  letter-spacing: .08em;
}

.orev-ui-phase7 .preset-thumb-art {
  position: relative;
  height: 82px;
  border-color: rgba(255, 217, 133, .23);
  border-radius: 14px;
  padding: 9px;
  box-shadow:
    inset 0 0 28px rgba(0,0,0,.44),
    0 0 18px rgba(40, 207, 255, .07);
}

.orev-ui-phase7 .preset-thumb-art::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255,255,255,.15), transparent 22%, transparent 78%, rgba(255,255,255,.10)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 1px, transparent 1px 15px);
  mix-blend-mode: screen;
  opacity: .45;
  pointer-events: none;
}

.orev-ui-phase7 .preset-thumb-art b {
  position: relative;
  z-index: 1;
  width: 78%;
}

.orev-ui-phase7 .preset-thumb-art i {
  background: linear-gradient(180deg, #ffffff, rgba(40, 207, 255, .78) 50%, rgba(255, 217, 133, .72));
  box-shadow: 0 0 10px rgba(255,255,255,.42), 0 0 14px rgba(40,207,255,.30);
}

.orev-ui-phase7 .preset-thumb strong {
  color: #fff2c9;
  font-size: .76rem;
  letter-spacing: .01em;
}

.orev-ui-phase7 .preset-thumb small {
  color: rgba(199, 232, 244, .68);
  font-size: .66rem;
}

.phase7-preset-meta {
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 217, 133, .10);
}

.phase7-preset-badges span {
  padding: 3px 6px;
  color: rgba(255, 241, 203, .86);
  background: rgba(0,0,0,.18);
  font-size: .56rem;
}

.phase7-preset-category {
  color: rgba(40, 207, 255, .78);
  font-size: .58rem;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.orev-ui-phase7 .preset-thumb[data-phase7-category="vertical"] .phase7-preset-category { color: rgba(142, 242, 255, .92); }
.orev-ui-phase7 .preset-thumb[data-phase7-category="square"] .phase7-preset-category { color: rgba(255, 217, 133, .94); }
.orev-ui-phase7 .preset-thumb[data-phase7-category="motion"] .phase7-preset-category { color: rgba(255, 104, 31, .95); }
.orev-ui-phase7 .preset-thumb[data-phase7-category="clean"] .phase7-preset-category { color: rgba(196, 236, 255, .92); }

.orev-ui-phase7 .preset-thumb[hidden] {
  display: none !important;
}

.orev-ui-phase7 .qa-mini.phase7-gallery-status {
  margin-top: 8px;
  border-color: rgba(255, 217, 133, .24);
  color: rgba(255, 239, 202, .82);
}

@media (max-width: 760px) {
  .phase7-gallery-search-row {
    grid-template-columns: 1fr;
  }
  .phase7-preset-count {
    width: fit-content;
  }
  .orev-ui-phase7 .preset-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orev-ui-phase7 .preset-thumb {
    transition: none;
  }
  .orev-ui-phase7 .preset-thumb:hover,
  .orev-ui-phase7 .preset-thumb:focus-visible {
    transform: none;
  }
}


/* --------------------------------------------------------------------------
   OREV UI Phase 8 - Responsive + Accessibility Hardening
   Adds skip links, mobile-safe layout, stronger keyboard focus, touch targets,
   reduced-motion support, safe-area handling, and quick UI status surfaces.
   No MIDI, FFmpeg, compositor, export, or preset engine logic is changed here.
---------------------------------------------------------------------------- */
:root {
  --phase8-focus: #8bf3ff;
  --phase8-focus-warm: #ffd978;
  --phase8-touch-min: 44px;
  --phase8-safe-inline: max(10px, env(safe-area-inset-left));
  --phase8-safe-right: max(10px, env(safe-area-inset-right));
  --phase8-safe-top: max(8px, env(safe-area-inset-top));
  --phase8-safe-bottom: max(8px, env(safe-area-inset-bottom));
}

.orev-ui-phase8 {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

.orev-ui-phase8 .app-shell {
  padding-left: var(--phase8-safe-inline);
  padding-right: var(--phase8-safe-right);
  padding-top: var(--phase8-safe-top);
  padding-bottom: var(--phase8-safe-bottom);
}

.phase8-skip-links {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 1200;
  pointer-events: none;
}

.phase8-skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  min-height: var(--phase8-touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 2px solid rgba(139, 243, 255, .92);
  border-radius: 999px;
  color: #041014;
  background: linear-gradient(135deg, #fff0b9, #8bf3ff);
  box-shadow: 0 12px 34px rgba(0,0,0,.45), 0 0 30px rgba(139,243,255,.22);
  font-weight: 950;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .16s ease;
  pointer-events: auto;
}

.phase8-skip-link:nth-child(2) { top: 64px; }
.phase8-skip-link:nth-child(3) { top: 116px; }
.phase8-skip-link:focus,
.phase8-skip-link:focus-visible {
  transform: translateY(0);
  outline: none;
}

.orev-ui-phase8 :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(139, 243, 255, .86);
  outline-offset: 3px;
  box-shadow:
    0 0 0 1px rgba(255, 217, 120, .72),
    0 0 28px rgba(139, 243, 255, .22) !important;
}

.orev-ui-phase8 :where(button, .btn, input, select, .drop-zone, .phase7-gallery-filter, .preset-thumb) {
  min-height: var(--phase8-touch-min);
}

.orev-ui-phase8 .btn.tiny {
  min-height: 34px;
}

.orev-ui-phase8 .topbar {
  align-items: center;
  isolation: isolate;
}

.orev-ui-phase8 .brand-logo-link {
  max-width: min(42vw, 348px);
}

.orev-ui-phase8 .brand-copy p {
  max-width: 72ch;
}

.phase8-a11y-bar {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto minmax(220px, .58fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(139, 243, 255, .24);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 104, 31, .14), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(40, 207, 255, .14), transparent 46%),
    linear-gradient(90deg, rgba(8, 7, 12, .91), rgba(3, 8, 18, .90));
  box-shadow:
    0 16px 38px rgba(0,0,0,.34),
    inset 0 0 0 1px rgba(255,255,255,.032);
}

.phase8-a11y-copy strong {
  display: block;
  color: #fff0c2;
  font-size: .80rem;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.phase8-a11y-copy p {
  margin-top: 3px;
  color: rgba(210, 235, 245, .76);
  font-size: .74rem;
  line-height: 1.35;
}

.phase8-a11y-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.phase8-a11y-actions a,
.phase8-a11y-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 217, 133, .20);
  border-radius: 999px;
  padding: 6px 10px;
  color: rgba(255, 243, 209, .88);
  background: rgba(255,255,255,.045);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-decoration: none;
  text-transform: uppercase;
}

.phase8-a11y-actions a:hover {
  border-color: rgba(139, 243, 255, .52);
  color: #ffffff;
  background: rgba(40,207,255,.10);
}

.phase8-a11y-status {
  justify-self: stretch;
  min-width: 0;
  border-color: rgba(139, 243, 255, .20);
  color: rgba(212, 244, 255, .84);
  background: rgba(0,0,0,.20);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase8-a11y-status.is-good {
  border-color: rgba(71, 245, 165, .42);
  color: #caffe7;
}

.phase8-a11y-status.is-warn {
  border-color: rgba(255, 209, 102, .52);
  color: #ffe7a8;
}

.orev-ui-phase8 .workspace {
  min-width: 0;
}

.orev-ui-phase8 .control-panel,
.orev-ui-phase8 .info-panel,
.orev-ui-phase8 .stage-panel {
  scroll-margin-top: 16px;
}

.orev-ui-phase8 .stage-toolbar {
  min-height: 64px;
}

.orev-ui-phase8 .stage-toolbar small,
.orev-ui-phase8 .topbar p,
.orev-ui-phase8 .flow-step small {
  line-height: 1.35;
}

.orev-ui-phase8 .preview-controls {
  gap: 8px;
}

.orev-ui-phase8 .scrub-row {
  min-height: var(--phase8-touch-min);
  align-items: center;
}

.orev-ui-phase8 .canvas-wrap {
  contain: layout paint;
  overflow: hidden;
}

.orev-ui-phase8 #previewCanvas {
  max-width: 100%;
  height: auto;
}

.orev-ui-phase8 .export-menu {
  max-height: min(72vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
}

.orev-ui-phase8 .toast-stack {
  right: var(--phase8-safe-right);
  bottom: var(--phase8-safe-bottom);
}

.orev-ui-phase8.phase8-compact .phase8-a11y-copy p,
.orev-ui-phase8.phase8-compact .flow-step small,
.orev-ui-phase8.phase8-compact .phase7-gallery-intro p {
  display: none;
}

.orev-ui-phase8.phase8-compact .phase8-a11y-bar,
.orev-ui-phase8.phase8-compact .phase3-flowbar {
  min-height: 42px;
}

@media (max-width: 1440px) {
  .phase8-a11y-bar {
    grid-template-columns: minmax(0, 1fr);
  }
  .phase8-a11y-actions {
    justify-content: flex-start;
  }
  .phase8-a11y-status {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .orev-ui-phase8 .workspace {
    grid-template-columns: minmax(286px, 34vw) minmax(0, 1fr);
  }
  .orev-ui-phase8 .info-panel {
    display: block;
    grid-column: 1 / -1;
    max-height: 38vh;
  }
}

@media (max-width: 860px) {
  .orev-ui-phase8 .app-shell {
    gap: 9px;
  }
  .orev-ui-phase8 .topbar {
    gap: 10px;
  }
  .orev-ui-phase8 .orev-brand-block {
    align-items: flex-start;
  }
  .orev-ui-phase8 .brand-logo-link {
    width: min(88vw, 360px);
    max-width: 100%;
    height: clamp(76px, 24vw, 96px);
  }
  .orev-ui-phase8 .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .orev-ui-phase8 .top-actions .btn,
  .orev-ui-phase8 .menu-wrap,
  .orev-ui-phase8 .menu-wrap .btn {
    width: 100%;
  }
  .orev-ui-phase8 .export-menu {
    top: max(84px, env(safe-area-inset-top));
    left: var(--phase8-safe-inline);
    right: var(--phase8-safe-right);
    width: auto;
    max-height: calc(100dvh - 112px);
  }
  .phase8-a11y-bar {
    padding: 10px;
  }
  .phase8-a11y-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .phase8-a11y-actions a,
  .phase8-a11y-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .phase8-a11y-status {
    white-space: normal;
    line-height: 1.35;
    border-radius: 14px;
  }
  .orev-ui-phase8 .workspace {
    grid-template-columns: 1fr;
  }
  .orev-ui-phase8 .control-panel,
  .orev-ui-phase8 .info-panel {
    max-height: none;
  }
  .orev-ui-phase8 .stage-panel {
    min-height: auto;
    grid-template-rows: auto minmax(260px, 48svh) minmax(86px, auto) minmax(92px, auto);
    overflow: visible;
  }
  .orev-ui-phase8 .stage-toolbar {
    min-height: auto;
    overflow: visible;
  }
  .orev-ui-phase8 .stage-toolbar strong,
  .orev-ui-phase8 .stage-toolbar small {
    white-space: normal;
  }
  .orev-ui-phase8 .preview-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
  .orev-ui-phase8 .scrub-row {
    display: grid;
    gap: 4px;
  }
  .orev-ui-phase8 .canvas-wrap {
    min-height: 260px;
  }
  .orev-ui-phase8 .preset-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 540px) {
  .orev-ui-phase8 .top-actions,
  .phase8-a11y-actions {
    grid-template-columns: 1fr;
  }
  .orev-ui-phase8 .brand-copy h1 {
    font-size: 1.06rem;
    line-height: 1.14;
  }
  .orev-ui-phase8 .brand-copy p {
    font-size: .76rem;
  }
  .phase8-a11y-copy strong {
    font-size: .72rem;
  }
  .orev-ui-phase8 .panel,
  .orev-ui-phase8 .phase3-flowbar,
  .phase8-a11y-bar {
    border-radius: 12px;
  }
  .orev-ui-phase8 .mini-grid {
    gap: 9px;
  }
  .orev-ui-phase8 .canvas-wrap {
    min-height: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orev-ui-phase8 *,
  .orev-ui-phase8 *::before,
  .orev-ui-phase8 *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
  .phase8-skip-link {
    transition: none;
  }
}


/* --------------------------------------------------------------------------
   OREV UI Phase 9 - Motion + Microinteraction Layer
   Adds restrained movement, hover lift, menu reveal motion, stage accents,
   calm-motion controls, and reduced-motion safeguards. Core MIDI, FFmpeg,
   compositor, export, QA, preset, and project behaviors are not changed.
---------------------------------------------------------------------------- */
:root {
  --phase9-ease: cubic-bezier(.2, .78, .18, 1);
  --phase9-fast: 140ms;
  --phase9-med: 240ms;
  --phase9-slow: 720ms;
  --phase9-fire-glow: rgba(255, 104, 31, .28);
  --phase9-ice-glow: rgba(74, 218, 255, .22);
  --phase9-gold-glow: rgba(255, 217, 120, .24);
}

.orev-ui-phase9 .topbar,
.orev-ui-phase9 .panel,
.orev-ui-phase9 .phase3-flowbar,
.orev-ui-phase9 .phase8-a11y-bar,
.orev-ui-phase9 .phase9-motion-bar,
.orev-ui-phase9 .canvas-wrap,
.orev-ui-phase9 .timeline-panel,
.orev-ui-phase9 .export-log-panel,
.orev-ui-phase9 .preset-thumb,
.orev-ui-phase9 .phase7-gallery-filter,
.orev-ui-phase9 .btn,
.orev-ui-phase9 input,
.orev-ui-phase9 select {
  transition:
    transform var(--phase9-med) var(--phase9-ease),
    box-shadow var(--phase9-med) var(--phase9-ease),
    border-color var(--phase9-med) var(--phase9-ease),
    background var(--phase9-med) var(--phase9-ease),
    color var(--phase9-fast) ease,
    opacity var(--phase9-fast) ease;
}

.phase9-motion-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto minmax(230px, .55fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 217, 120, .26);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 4% 50%, rgba(255, 104, 31, .16), transparent 36%),
    radial-gradient(circle at 96% 50%, rgba(40, 207, 255, .16), transparent 38%),
    linear-gradient(90deg, rgba(12, 7, 12, .94), rgba(4, 12, 23, .92));
  box-shadow:
    0 18px 44px rgba(0,0,0,.36),
    inset 0 0 0 1px rgba(255,255,255,.035),
    0 0 26px rgba(255, 217, 120, .07);
  position: relative;
  overflow: hidden;
}

.phase9-motion-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,.055) 46%, transparent 62%);
  transform: translateX(-110%);
  animation: phase9BarSweep 8s var(--phase9-ease) infinite;
}

.phase9-motion-copy strong {
  display: block;
  color: #fff0c2;
  font-size: .80rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.phase9-motion-copy p {
  margin-top: 3px;
  color: rgba(217, 238, 247, .77);
  font-size: .74rem;
  line-height: 1.36;
}

.phase9-motion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.phase9-motion-status {
  justify-self: stretch;
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(139, 243, 255, .20);
  border-radius: 999px;
  padding: 6px 10px;
  color: rgba(212, 244, 255, .84);
  background: rgba(0,0,0,.22);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase9-motion-status.is-good {
  border-color: rgba(71, 245, 165, .42);
  color: #caffe7;
}

.phase9-motion-status.is-warn {
  border-color: rgba(255, 209, 102, .52);
  color: #ffe7a8;
}

.orev-ui-phase9 .btn:hover,
.orev-ui-phase9 .phase7-gallery-filter:hover,
.orev-ui-phase9 .phase8-a11y-actions a:hover,
.orev-ui-phase9 .preset-thumb:hover,
.orev-ui-phase9 .export-menu button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 26px rgba(0,0,0,.34),
    0 0 20px var(--phase9-ice-glow),
    inset 0 0 0 1px rgba(255,255,255,.055);
}

.orev-ui-phase9 .btn:active,
.orev-ui-phase9 .phase7-gallery-filter:active,
.orev-ui-phase9 .preset-thumb:active,
.orev-ui-phase9 .export-menu button:active {
  transform: translateY(0) scale(.992);
}

.orev-ui-phase9 .brand-logo-link:hover .brand-logo,
.orev-ui-phase9 .brand-logo-link:focus-visible .brand-logo {
  filter: drop-shadow(0 0 18px rgba(255, 217, 120, .35)) drop-shadow(0 0 20px rgba(74, 218, 255, .18));
}

.orev-ui-phase9 .topbar::after {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 217, 120, .62), rgba(74, 218, 255, .42), transparent);
  opacity: .82;
}

.orev-ui-phase9 .flow-step:hover,
.orev-ui-phase9 .phase8-a11y-bar:hover,
.orev-ui-phase9 .phase9-motion-bar:hover,
.orev-ui-phase9 .panel:hover {
  border-color: rgba(255, 217, 120, .28);
  box-shadow:
    0 18px 42px rgba(0,0,0,.34),
    0 0 24px rgba(255, 217, 120, .055),
    inset 0 0 0 1px rgba(255,255,255,.035);
}

.orev-ui-phase9 .export-menu:not([hidden]) {
  transform-origin: top right;
  animation: phase9MenuIn 170ms var(--phase9-ease) both;
}

.orev-ui-phase9 .export-menu:not([hidden]) .export-menu-section {
  animation: phase9SoftRise 260ms var(--phase9-ease) both;
}

.orev-ui-phase9 .export-menu:not([hidden]) .export-menu-section:nth-of-type(2) { animation-delay: 22ms; }
.orev-ui-phase9 .export-menu:not([hidden]) .export-menu-section:nth-of-type(3) { animation-delay: 44ms; }
.orev-ui-phase9 .export-menu:not([hidden]) .export-menu-section:nth-of-type(4) { animation-delay: 66ms; }

.orev-ui-phase9.phase9-menu-open .topbar {
  box-shadow:
    0 22px 58px rgba(0,0,0,.52),
    0 0 46px rgba(255, 217, 120, .12),
    inset 0 0 0 1px rgba(255,255,255,.04);
}

.orev-ui-phase9 .canvas-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 104, 31, .14), transparent 18%),
    radial-gradient(circle at 86% 18%, rgba(74, 218, 255, .12), transparent 20%),
    linear-gradient(110deg, transparent 0%, rgba(255,255,255,.045) 50%, transparent 64%);
  mix-blend-mode: screen;
  opacity: .28;
  transform: translateX(-14%);
  animation: phase9StageGlint 9s var(--phase9-ease) infinite;
}

.orev-ui-phase9 .stage-ornament {
  animation: phase9OrnamentGlow 4.8s ease-in-out infinite;
}

.orev-ui-phase9 .stage-ornament-tr,
.orev-ui-phase9 .stage-ornament-bl {
  animation-delay: 1.1s;
}

.orev-ui-phase9 .stage-skin-label {
  animation: phase9LabelBreath 5.6s ease-in-out infinite;
}

.orev-ui-phase9 .canvas-wrap.phase9-stage-pulse {
  animation: phase9ManualPulse 620ms var(--phase9-ease) 1;
}

.orev-ui-phase9 .stat-pills span,
.orev-ui-phase9 .phase3-chip-row span,
.orev-ui-phase9 .phase7-preset-badges span {
  transition: transform var(--phase9-fast) var(--phase9-ease), border-color var(--phase9-med) var(--phase9-ease), box-shadow var(--phase9-med) var(--phase9-ease);
}

.orev-ui-phase9 .stat-pills span:hover,
.orev-ui-phase9 .phase3-chip-row span:hover,
.orev-ui-phase9 .phase7-preset-badges span:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 217, 120, .38);
  box-shadow: 0 0 18px rgba(255, 217, 120, .10);
}

.orev-ui-phase9.phase9-calm-motion .phase9-motion-bar::before,
.orev-ui-phase9.phase9-calm-motion .canvas-wrap::after,
.orev-ui-phase9.phase9-calm-motion .stage-ornament,
.orev-ui-phase9.phase9-calm-motion .stage-skin-label,
.orev-ui-phase9.phase9-calm-motion .export-menu:not([hidden]),
.orev-ui-phase9.phase9-calm-motion .export-menu:not([hidden]) .export-menu-section {
  animation: none !important;
}

.orev-ui-phase9.phase9-calm-motion .btn:hover,
.orev-ui-phase9.phase9-calm-motion .phase7-gallery-filter:hover,
.orev-ui-phase9.phase9-calm-motion .phase8-a11y-actions a:hover,
.orev-ui-phase9.phase9-calm-motion .preset-thumb:hover,
.orev-ui-phase9.phase9-calm-motion .export-menu button:hover,
.orev-ui-phase9.phase9-calm-motion .stat-pills span:hover,
.orev-ui-phase9.phase9-calm-motion .phase3-chip-row span:hover {
  transform: none;
}

@keyframes phase9MenuIn {
  from { opacity: 0; transform: translateY(-8px) scale(.982); filter: saturate(.86); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: saturate(1); }
}

@keyframes phase9SoftRise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes phase9BarSweep {
  0%, 72% { transform: translateX(-110%); opacity: 0; }
  82% { opacity: .75; }
  100% { transform: translateX(110%); opacity: 0; }
}

@keyframes phase9StageGlint {
  0%, 70% { transform: translateX(-20%); opacity: .16; }
  84% { opacity: .36; }
  100% { transform: translateX(22%); opacity: .18; }
}

@keyframes phase9OrnamentGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 217, 120, .16)); opacity: .82; }
  50% { filter: drop-shadow(0 0 13px rgba(255, 217, 120, .38)) drop-shadow(0 0 12px rgba(74, 218, 255, .14)); opacity: 1; }
}

@keyframes phase9LabelBreath {
  0%, 100% { letter-spacing: .13em; opacity: .76; }
  50% { letter-spacing: .16em; opacity: .96; }
}

@keyframes phase9ManualPulse {
  0% { box-shadow: 0 0 0 rgba(255,217,120,0); }
  45% { box-shadow: 0 0 0 2px rgba(255,217,120,.36), 0 0 46px rgba(74,218,255,.18), 0 0 54px rgba(255,104,31,.14); }
  100% { box-shadow: 0 0 0 rgba(255,217,120,0); }
}

@media (max-width: 1440px) {
  .phase9-motion-bar {
    grid-template-columns: minmax(0, 1fr);
  }
  .phase9-motion-actions {
    justify-content: flex-start;
  }
  .phase9-motion-status {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .phase9-motion-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .phase9-motion-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .phase9-motion-status {
    white-space: normal;
    line-height: 1.35;
    border-radius: 14px;
  }
}

@media (max-width: 540px) {
  .phase9-motion-actions {
    grid-template-columns: 1fr;
  }
  .phase9-motion-copy strong {
    font-size: .72rem;
  }
  .phase9-motion-bar {
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orev-ui-phase9 *,
  .orev-ui-phase9 *::before,
  .orev-ui-phase9 *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
  }
  .orev-ui-phase9 .btn:hover,
  .orev-ui-phase9 .phase7-gallery-filter:hover,
  .orev-ui-phase9 .preset-thumb:hover,
  .orev-ui-phase9 .export-menu button:hover,
  .orev-ui-phase9 .stat-pills span:hover,
  .orev-ui-phase9 .phase3-chip-row span:hover {
    transform: none !important;
  }
}


/* UI Phase 10: transport repair, demo restore, and final skip-link cleanup */
.orev-ui-phase10 .topbar h1,
.orev-ui-phase10 .brand-copy h1 {
  letter-spacing: -.02em;
}

.orev-ui-phase10 .phase8-skip-links {
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  z-index: 1300;
}

.orev-ui-phase10 .phase8-skip-link,
.orev-ui-phase10 .phase8-skip-link:nth-child(2),
.orev-ui-phase10 .phase8-skip-link:nth-child(3) {
  position: fixed;
  left: -9999px;
  top: 14px;
  width: auto;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(139, 243, 255, .68);
  color: #f9fcff;
  background: linear-gradient(135deg, rgba(7, 15, 28, .98), rgba(9, 46, 62, .96));
  box-shadow: 0 12px 30px rgba(0,0,0,.44), 0 0 18px rgba(139,243,255,.18);
  font-weight: 850;
  transform: none;
  pointer-events: auto;
}

.orev-ui-phase10 .phase8-skip-link:focus,
.orev-ui-phase10 .phase8-skip-link:focus-visible {
  left: 14px;
  top: 14px;
  transform: none;
}

.phase10-repair-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(255, 209, 102, .22);
  background:
    radial-gradient(circle at 0 50%, rgba(255, 122, 24, .18), transparent 30%),
    radial-gradient(circle at 100% 50%, rgba(104, 225, 253, .16), transparent 34%),
    linear-gradient(135deg, rgba(17, 8, 6, .72), rgba(4, 16, 26, .78));
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.035);
}

.phase10-repair-copy strong {
  display: block;
  color: #fff4d6;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

.phase10-repair-copy p {
  margin: 2px 0 0;
  color: #d7e6f2;
  font-size: .82rem;
}

.phase10-repair-status {
  border: 1px solid rgba(111, 226, 255, .36);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(3, 28, 38, .72);
  color: #c9fff5;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: 0 0 24px rgba(48, 203, 255, .11);
}

.orev-ui-phase10 .stage-panel {
  grid-template-rows: minmax(72px, auto) minmax(0, 1fr) 126px;
}

.orev-ui-phase10 .stage-toolbar {
  overflow: visible;
  gap: 14px;
  align-items: center;
}

.orev-ui-phase10 .stage-side {
  min-width: min(430px, 46vw);
  gap: 8px;
}

.orev-ui-phase10 .phase10-preview-controls {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr);
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.phase10-transport {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(255, 209, 102, .32);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255,122,24,.12), rgba(104,225,253,.11)),
    rgba(2, 8, 14, .82);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 0 24px rgba(104,225,253,.10);
}

.orev-ui-phase10 .btn.transport {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 999px;
  font-weight: 950;
  letter-spacing: .02em;
  white-space: nowrap;
}

.orev-ui-phase10 .btn.transport.play {
  border-color: rgba(255, 209, 102, .58);
  background: linear-gradient(135deg, rgba(255, 149, 36, .92), rgba(91, 212, 255, .86));
  color: #081017;
  text-shadow: none;
}

.orev-ui-phase10 .btn.transport.play.is-playing {
  background: linear-gradient(135deg, rgba(255, 207, 51, .96), rgba(255, 122, 24, .88));
  color: #120804;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 0 24px rgba(255,122,24,.22);
}

.orev-ui-phase10 .btn.transport.play.is-paused {
  background: linear-gradient(135deg, rgba(104, 225, 253, .92), rgba(255, 241, 179, .88));
  color: #061017;
}

.orev-ui-phase10 .btn.transport.stop {
  border-color: rgba(255, 93, 93, .48);
  background: rgba(20, 6, 8, .78);
  color: #ffd0c2;
}

.orev-ui-phase10 .btn.transport.stop:disabled {
  opacity: .42;
  cursor: not-allowed;
  filter: grayscale(.25);
}

.orev-ui-phase10 .scrub-row {
  min-width: 190px;
}

.orev-ui-phase10 #previewAudioBtn {
  position: relative;
}

.orev-ui-phase10 #previewAudioBtn::after {
  content: ' Stage Play button now starts the linked audio preview too.';
  display: block;
  margin-top: 4px;
  color: rgba(255, 232, 181, .68);
  font-size: .68rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .phase10-repair-bar,
  .orev-ui-phase10 .phase10-preview-controls {
    grid-template-columns: 1fr;
  }
  .phase10-repair-status {
    white-space: normal;
  }
  .orev-ui-phase10 .stage-side {
    min-width: 0;
  }
  .phase10-transport {
    width: fit-content;
  }
}
