/* ===== FGI Monitor-Editor – UI in the design language of the display ===== */
:root {
  --ui-bg: #eef0f3; --ui-surface: #ffffff; --ui-line: #d7dadf; --ui-line-soft: #eceef1;
  --ui-text: #282d37; --ui-muted: #646973; --ui-faint: #8b93a1;
  --ui-head: #282d37; --ui-accent: #f0b323; --ui-ok: #2e8b22; --ui-late: #ec0016; --ui-warn: #b58a00;
  --ui-font: "DB Neo Screen Sans", "FGI Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.preview { background: var(--ui-bg); color: var(--ui-text); font-family: var(--ui-font); font-size: 15px; line-height: 1.45; overflow: hidden; }
body.preview #app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body.preview #app *, .ed-modal *, #ed-toasts * { box-sizing: border-box; }
.muted { color: var(--ui-faint); } .pad { padding: 10px; } .err { color: var(--ui-late); } .late { color: var(--ui-late); font-style: normal; }
.hint { color: var(--ui-muted); font-size: 12.5px; line-height: 1.4; margin: 6px 0 0; }
.hint.ok { color: var(--ui-ok); } .hint.warn { color: var(--ui-warn); }
.eyebrow { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-faint); }

/* animations */
@keyframes stepIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.step-panel { animation: stepIn .35s cubic-bezier(.2, .7, .2, 1); }
.pop { animation: popIn .4s ease both; }
.step-panel > .ed-card:nth-of-type(1) { animation: popIn .4s .05s ease both; }
.step-panel > .ed-card:nth-of-type(2) { animation: popIn .4s .13s ease both; }
.step-panel > .ed-card:nth-of-type(3) { animation: popIn .4s .21s ease both; }
.colon { animation: blink 1s step-end infinite; }
@media (prefers-reduced-motion: reduce) { .step-panel, .pop, .step-panel > .ed-card { animation: none; } .colon { animation: none; } }

/* top bar = Fahrtkopf */
body.preview #topbar { flex: none; height: 56px; background: var(--ui-head); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 22px; }
body.preview #topbar .fgi-pill { background: #f0a622; color: #fff; font-weight: 800; border-radius: 999px; padding: 3px 12px; font-size: 14px; letter-spacing: .02em; }
body.preview #topbar b { font-size: 17px; }
body.preview #topbar .sub { color: #aab2bf; font-size: 13px; }
body.preview #topbar .clock { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 18px; }

/* main: editor left, preview right */
body.preview #main { flex: 1 1 auto; min-height: 0; display: flex; }
#ed-panel { flex: 1 1 640px; min-width: 0; display: flex; min-height: 0; }
body.preview #view { flex: 0 0 400px; padding: 26px 22px 20px 0; display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }
body.preview #view > .eyebrow { margin: 0; }
body.preview #frame { background: #1b1f26; border-radius: 14px; padding: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .18); flex: none; }
body.preview #viewport { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
body.preview #stage { position: absolute; left: 0; top: 0; }
body.preview #ui { display: flex; align-items: center; gap: 8px; padding: 8px 2px 0; color: #ddd; font-size: 12px; }
body.preview #ui input[type=range] { flex: 1; min-width: 40px; accent-color: var(--ui-accent); }
body.preview #ui button, body.preview #ui select { background: #343b47; color: #eee; border: 0; padding: 4px 9px; border-radius: 6px; cursor: pointer; font: inherit; min-height: 28px; }
body.preview #ui #edbtn { background: var(--ui-accent); color: #111; font-weight: 700; }
body.preview #ui .mono, body.preview #seginfo { font-variant-numeric: tabular-nums; }
body.preview #seginfo { font-size: 11px; color: #8b93a1; padding: 4px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.preview #side-tools { display: flex; flex-direction: column; gap: 10px; }
.hint-card { font-size: 13px; line-height: 1.5; color: var(--ui-muted); padding: 12px 14px !important; margin: 0 !important; }
.hint-card b { display: block; color: var(--ui-text); margin-bottom: 2px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.side-actions button { border-radius: 999px !important; padding: 7px 12px !important; min-height: 32px !important; font-size: 12.5px !important; }
.file-line { font-size: 12px; }
/* enlarged preview */
body.preview-big #ed-panel { display: none; }
body.preview-big #view { flex: 1 1 auto; max-width: none; padding: 26px 26px 20px; }
body.preview-big #frame { max-width: 1500px; width: 100%; margin: 0 auto; }
body.preview-big #side-tools { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
body.preview-big .hint-card { display: none; }

/* rail = Perlschnur */
.ed-rail { flex: 0 0 240px; background: var(--ui-surface); border-right: 1px solid var(--ui-line); padding: 24px 0 24px; position: relative; overflow: auto; }
.ed-rail .rail-track { position: absolute; left: 38px; top: 57px; width: 6px; height: calc(4 * 66px); background: #c3c6cb; border-radius: 3px; }
.ed-rail .rail-done { position: absolute; left: 38px; top: 57px; width: 6px; max-height: calc(4 * 66px); height: 0; background: var(--ui-accent); border-radius: 3px; transition: height .45s cubic-bezier(.2, .7, .2, 1); }
.rail-step { display: flex; align-items: center; gap: 14px; width: 100%; height: 66px; background: transparent; border: 0; padding: 0 16px 0 28px; text-align: left; cursor: pointer; font: inherit; color: var(--ui-faint); position: relative; }
.rail-step .rail-dot { width: 26px; height: 26px; border-radius: 50%; border: 6px solid #c3c6cb; background: #fff; flex: none; position: relative; z-index: 1; transition: transform .25s, border-color .25s, background .25s; }
.rail-step.done .rail-dot { border-color: var(--ui-accent); background: var(--ui-accent); }
.rail-step.on .rail-dot { border-color: var(--ui-accent); transform: scale(1.25); }
.rail-step.done, .rail-step.on { color: var(--ui-text); }
.rail-step.on .rail-txt > span { font-weight: 700; }
.rail-step.dis { opacity: .45; cursor: not-allowed; }
.rail-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rail-txt small { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-faint); }
.rail-txt > span { font-size: 14.5px; }
.rail-txt em { font-style: normal; font-size: 11px; font-weight: 700; }
.rail-txt em.err { color: var(--ui-late); } .rail-txt em.warn { color: var(--ui-warn); }
.rail-note { margin: 18px 16px 0 28px; padding: 12px; background: #f4f5f7; border-radius: 10px; font-size: 12px; color: var(--ui-muted); line-height: 1.45; }
.rail-note b { display: block; color: var(--ui-text); }

/* content column */
.ed-content { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 28px 32px 32px; scroll-behavior: smooth; }
.step-title { margin: 0 0 16px; font-size: 28px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.ed-nav { display: flex; justify-content: space-between; gap: 8px; margin: 22px 0 0; max-width: 820px; }
.ed-card { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 14px; padding: 18px 20px; margin: 0 0 14px; max-width: 820px; }
.ed-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.ed-card > p.hint { margin: 0 0 12px; }
details.ed-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
details.ed-card > summary::-webkit-details-marker { display: none; }
details.ed-card > summary::before { content: "▸"; color: var(--ui-faint); }
details[open].ed-card > summary::before { content: "▾"; }
details.ed-card > summary h3 { margin: 0; }
details.ed-card[open] > summary { margin-bottom: 12px; }
.ed-loaded .ed-loaded-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ed-loaded .ed-loaded-row > div { flex: 1 1 200px; }
.ed-loaded b { font-size: 16px; }

/* fields */
.ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; margin: 8px 0; }
.ed-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ed-f.wide { grid-column: 1 / -1; }
.ed-f .lbl { font-size: 12.5px; color: var(--ui-muted); display: flex; gap: 4px; }
.ed-f .must { color: var(--ui-accent); font-style: normal; }
.ed-f small { color: var(--ui-faint); font-size: 11.5px; }
#ed-panel input[type=text], #ed-panel input[type=number], #ed-panel input[type=date], #ed-panel input[type=datetime-local], #ed-panel select, #ed-panel textarea, .ed-modal textarea, .ed-modal select {
  width: 100%; background: #fff; color: var(--ui-text); border: 1px solid #c3c6cb; border-radius: 10px; padding: 9px 12px; font: inherit; min-height: 44px; transition: border-color .15s, box-shadow .15s; }
#ed-panel input[type=color] { width: 60px; height: 44px; border: 1px solid #c3c6cb; border-radius: 10px; background: #fff; padding: 3px; }
#ed-panel input:focus, #ed-panel select:focus, #ed-panel textarea:focus { outline: 0; border-color: var(--ui-accent); box-shadow: 0 0 0 3px rgba(240, 179, 35, .28); }
#ed-panel input.bad { border-color: var(--ui-late); background: #fff3f3; }
#ed-panel textarea { resize: vertical; }
.ed-inline { display: flex; gap: 8px; }
.ed-inline input { flex: 1; min-width: 0; }
.ed-or { text-align: center; color: var(--ui-faint); margin: 10px 0; position: relative; }

/* buttons */
#ed-panel button, .ed-modal button, .ed-modal label.file, a.dl, .side-actions button {
  background: #fff; color: var(--ui-text); border: 1px solid #c3c6cb; border-radius: 10px; padding: 9px 16px; cursor: pointer; font: inherit; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .12s, background .15s, border-color .15s; }
#ed-panel button:hover, .ed-modal button:hover, .side-actions button:hover { transform: translateY(-1px); border-color: #aab2bf; }
#ed-panel button:active { transform: none; }
#ed-panel button.primary, .ed-modal button.primary, a.dl, .side-actions button.primary { background: var(--ui-accent); border-color: var(--ui-accent); color: #282d37; font-weight: 700; }
#ed-panel button.primary:hover, a.dl:hover { background: #ffc43d; }
#ed-panel button.dark { background: var(--ui-head); border-color: var(--ui-head); color: #fff; font-weight: 600; }
#ed-panel button.big, a.dl { padding: 12px 22px; font-size: 16px; }
#ed-panel button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
#ed-panel button.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
#ed-panel button.ghost, .side-actions button.ghost { background: transparent; border-color: transparent; color: var(--ui-faint); }
#ed-panel button.ib { padding: 0; width: 34px; height: 34px; min-height: 0; background: transparent; border-color: transparent; color: var(--ui-muted); font-size: 16px; }
#ed-panel button.ib:hover { background: #f4f5f7; color: var(--ui-text); }
#ed-panel button.ib.danger:hover { background: #fdeaea; color: var(--ui-late); }
#ed-panel button.ib.dis { opacity: .3; pointer-events: none; }
.ed-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.ed-actions.center { justify-content: center; }
.ed-modal label.file { position: relative; overflow: hidden; }
.ed-modal label.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* toggles / segmented */
.ed-toggles { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 2px; }
.ed-toggles .lbl { font-size: 12.5px; color: var(--ui-muted); }
.ed-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid #d7dadf; cursor: pointer; user-select: none; font-size: 14px; }
.ed-toggle input { appearance: none; width: 30px; height: 16px; border-radius: 999px; background: #c3c6cb; position: relative; margin: 0; cursor: pointer; flex: none; transition: background .2s; }
.ed-toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .18s; }
.ed-toggle input:checked { background: var(--ui-accent); }
.ed-toggle input:checked::after { left: 16px; }
.ed-toggle.on { border-color: var(--ui-accent); background: #fff8e6; }
.ed-toggle small { color: var(--ui-faint); }
.ed-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #d7dadf; border-radius: 10px; overflow: hidden; margin: 4px 0 10px; background: #fff; }
.ed-seg button { border: 0 !important; border-radius: 0 !important; background: #fff !important; color: var(--ui-muted); border-left: 1px solid #d7dadf !important; min-height: 42px !important; }
.ed-seg button:first-child { border-left: 0 !important; }
.ed-seg button:hover { transform: none !important; }
.ed-seg button.on { background: var(--ui-head) !important; color: #fff; font-weight: 600; }

/* themes */
.ed-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-bottom: 10px; }
.ed-theme { display: flex !important; flex-direction: column; gap: 6px; padding: 8px !important; border: 2px solid transparent !important; align-items: stretch !important; background: #fff !important; }
.ed-theme.on { border-color: var(--ui-accent) !important; }
.ed-theme .sw { height: 34px; border-radius: 6px; position: relative; }
.ed-theme .sw i { position: absolute; left: 8px; top: 9px; width: 34px; height: 16px; border-radius: 999px; }
.ed-theme span:last-child { font-size: 12px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 12px; font-weight: 700; background: #878c96; color: #fff; }
.pill.big { font-size: 18px; padding: 4px 16px; align-self: flex-start; }

/* issues */
.ed-issues { border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; border: 1px solid; max-width: 820px; }
.ed-issues.err { background: #fff3f3; border-color: #f3b4b4; }
.ed-issues.warn { background: #fff8e6; border-color: #f3dc9a; }
.ed-issues ul { margin: 6px 0 0; padding-left: 18px; }
.ed-issues li { cursor: pointer; margin: 2px 0; }
.ed-issues li.warn { color: #8a6500; } .ed-issues li.err { color: #b3121f; }
.ed-issues.ed-draft button { margin-top: 6px; }

/* stops */
.ed-summary { margin: 0 0 12px; max-width: 820px; }
.ed-stop { background: #fff; border: 1px solid var(--ui-line); border-left: 6px solid #c3c6cb; border-radius: 10px; padding: 6px 10px 6px 8px; margin: 0 0 6px; max-width: 900px; }
.ed-stop.has-err { border-left-color: var(--ui-late); }
.ed-stop.is-cancel { border-left-color: var(--ui-late); background: #f4f5f7; }
.ed-stop.is-cancel input.name { text-decoration: line-through; color: var(--ui-faint); }
.ed-stop.flash { outline: 3px solid var(--ui-accent); }
.ed-stop-main { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.ed-stop .num { width: 24px; height: 24px; border-radius: 50%; border: 5px solid #c3c6cb; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex: none; color: var(--ui-faint); margin-bottom: 7px; }
.ed-stop:first-of-type .num { border-color: var(--ui-accent); background: var(--ui-accent); color: #fff; }
.ed-stop.is-cancel .num { border-color: var(--ui-late); background: var(--ui-late); color: #fff; }
.ed-stop .cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ed-stop .cell small { font-size: 10.5px; line-height: 1.2; color: var(--ui-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ed-panel .ed-stop .cell input, #ed-panel .ed-stop .cell select { height: 34px; padding: 4px 8px; font-size: 14px; }
.ed-stop .cell.name { flex: 1 1 130px; }
#ed-panel .ed-stop .cell.name input { font-weight: 700; font-size: 15px; }
.ed-stop .cell:not(.name):not(.exit) { width: 64px; flex: none; }
#ed-panel .ed-stop .cell:not(.name) input { text-align: center; font-variant-numeric: tabular-nums; padding: 4px 0; font-size: 13.5px; letter-spacing: -.01em; }
.ed-stop .cell.gl { width: 44px; }
.ed-stop .cell.exit { width: auto; flex: none; }
#ed-panel button.ed-exit { box-sizing: border-box; width: 44px; height: 34px; border: 1px solid #d7dadf; border-radius: 8px; background: #fff; color: var(--ui-muted); font-size: 18px; padding: 0; cursor: pointer; font-family: system-ui, sans-serif; line-height: 1; }
#ed-panel button.ed-exit:hover { background: #f3f4f6; }
#ed-panel button.ed-exit.on { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
.ed-stop .cell.exit select { padding-right: 2px; }
.ed-stop-foot { display: flex; align-items: flex-start; gap: 8px; }
.ed-stop-foot .ed-sub { flex: 1; }
.ed-stop .tools { display: inline-flex; gap: 0; flex: none; }
.ed-stop-issues { margin: 4px 0 0 30px; padding-left: 16px; font-size: 12.5px; }
.ed-stop-issues li.err { color: #b3121f; } .ed-stop-issues li.warn { color: #8a6500; }
.ed-sub { margin: 2px 0 0 30px; }
.ed-sub > summary { cursor: pointer; color: var(--ui-muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; width: max-content; padding: 2px 0; }
.ed-sub .flags { display: inline-flex; gap: 4px; }
.ed-sub .flags i { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #f0f1f3; color: var(--ui-muted); }
.ed-stop.is-cancel .ed-sub .flags i:first-child { background: #fde3e5; color: #b3121f; }
.ed-sub[open] { padding-bottom: 4px; }
.ed-sub .hint { margin: 4px 0 0; }
.ed-sub .ed-toggles { margin: 6px 0 2px; }
.ed-sub .ed-toggle { padding: 4px 10px; font-size: 13px; }
.ed-conn-title { font-size: 12.5px; color: var(--ui-muted); margin: 8px 0 2px; }
.ed-conns { padding: 8px 0 0; }
.ed-conn { display: grid; grid-template-columns: 78px 78px 1fr 2fr 56px 1.6fr 34px; gap: 6px; align-items: center; margin: 4px 0; }
.ed-conn.head { font-size: 11px; color: var(--ui-faint); }
.ed-conn input, .ed-conn select { min-height: 36px !important; padding: 5px 8px !important; }
.ed-rating { display: flex; gap: 4px; }
.ed-rating input { width: 70px !important; flex: none; }

/* parts / notices */
.ed-part { background: #f9fafb; border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 14px; margin: 0 0 10px; }
.ed-part header { display: flex; align-items: center; justify-content: space-between; }

/* lists */
.ed-list { margin-top: 8px; max-height: 360px; overflow: auto; border: 1px solid var(--ui-line); border-radius: 10px; background: #fff; }
.ed-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 0 !important; border-top: 1px solid var(--ui-line-soft) !important; border-radius: 0 !important; background: #fff !important; min-height: 0 !important; justify-content: flex-start !important; }
.ed-row:hover { transform: none !important; background: #f4f5f7 !important; }
.ed-row.head { background: #f4f5f7 !important; color: var(--ui-muted); font-size: 12px; border-top: 0 !important; }
.ed-row.cancel { text-decoration: line-through; color: #888; }
.ed-row.dep .mono { font-variant-numeric: tabular-nums; min-width: 86px; }
.ed-row.dep .dest { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-busy { display: flex; align-items: center; gap: 8px; color: var(--ui-warn); margin-top: 8px; }
.ed-busy .spin { width: 14px; height: 14px; border: 2px solid var(--ui-warn); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

/* export */
#ed-panel progress { width: 100%; height: 10px; margin: 10px 0 6px; accent-color: var(--ui-accent); border-radius: 5px; }
.ed-result { margin-top: 8px; }

/* modal */
.ed-modal { position: fixed; inset: 0; background: rgba(40, 45, 55, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; font-family: var(--ui-font); color: var(--ui-text); }
.ed-dialog { background: #fff; border-radius: 14px; padding: 18px; width: 540px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 16px 50px rgba(0, 0, 0, .35); animation: popIn .25s ease; }
.ed-dialog.wide { width: 840px; }
.ed-dialog header { display: flex; align-items: center; justify-content: space-between; }
.ed-dialog h3 { margin: 0; }
.ed-dialog .ed-list { max-height: 50vh; margin: 0; }
.ed-dialog textarea { flex: 1; min-height: 300px; font-family: ui-monospace, monospace; font-size: 12px; }
.ed-modal button.ib { background: transparent; border-color: transparent; width: 34px; height: 34px; padding: 0; min-height: 0; }

/* toasts */
#ed-toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; width: min(560px, 92vw); }
.ed-toast { background: var(--ui-head); color: #fff; padding: 11px 16px; border-radius: 10px; font: 14px/1.4 var(--ui-font); opacity: 0; transform: translateY(10px); transition: all .25s; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); border-left: 6px solid var(--ui-ok); }
.ed-toast.show { opacity: 1; transform: none; }
.ed-toast.warn { border-left-color: var(--ui-accent); } .ed-toast.err { border-left-color: var(--ui-late); }
#ed-panel [hidden], .ed-modal [hidden] { display: none !important; }

/* ===== phone / narrow ===== */
@media (max-width: 640px) {
  .ed-stop .cell.name { flex: 1 1 calc(100% - 40px); order: -1; }
  .ed-stop .cell:not(.name):not(.exit) { width: 63px; }
  #ed-panel .ed-stop .cell:not(.name) input { font-size: 13px; }
  .ed-stop .cell.gl { width: 40px; }
  .ed-stop .num { order: -2; margin-bottom: 3px; align-self: center; }
}
@media (max-width: 1000px) {
  body.preview #main, body.preview #view, body.preview #frame, body.preview #side-tools { }
  body.preview #app { height: auto; min-height: 100dvh; }
  body.preview { overflow: auto; }
  body.preview #main { flex-direction: column; }
  body.preview #view { order: -1; flex: none; padding: 14px 14px 0; overflow: visible; }
  body.preview #frame { box-shadow: none; }
  #ed-panel { flex-direction: column; }
  .ed-rail { flex: none; border-right: 0; border-bottom: 1px solid var(--ui-line); padding: 10px 6px; display: flex; overflow-x: auto; }
  .ed-rail .rail-track, .ed-rail .rail-done, .rail-note { display: none; }
  .rail-step { width: auto; height: auto; flex: none; flex-direction: column; gap: 6px; padding: 6px 10px; text-align: center; }
  .rail-txt small { display: none; }
  .rail-txt > span { font-size: 12px; }
  .ed-content { padding: 16px 14px 24px; }
  .step-title { font-size: 22px; }
  .ed-conn { grid-template-columns: 1fr 1fr 1fr 34px; }
  .ed-conn.head { display: none; }
  .ed-conn input:nth-child(4) { grid-column: 1 / 4; }
  .ed-rating { grid-column: 1 / 4; }
  body.preview #side-tools { order: 1; }
  .hint-card { display: none; }
}

/* specificity fixes (the generic #ed-panel button rule must not restyle these) */
#ed-panel .rail-step { background: transparent; border: 0; border-radius: 0; padding: 0 16px 0 28px; min-height: 66px; justify-content: flex-start; }
#ed-panel .rail-step:hover { transform: none; background: #f8f9fa; }
#ed-panel .ed-seg button.on, #ed-panel .ed-seg button.on:hover { color: #fff; }
#ed-panel button.ib, .ed-modal button.ib { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
#ed-panel .ed-rail .rail-track, #ed-panel .ed-rail .rail-done { left: 38px; }

/* render mode (render.js / screenshots): bare 1920x1080 stage at the origin */
body:not(.preview) #topbar, body:not(.preview) #ui, body:not(.preview) #seginfo, body:not(.preview) #view-label { display: none !important; }
body:not(.preview) #app, body:not(.preview) #main, body:not(.preview) #view, body:not(.preview) #frame, body:not(.preview) #viewport { display: block; padding: 0; margin: 0; }
