button, input, select, textarea { font: inherit; color: inherit; }
.noise { position: fixed; inset: 0; opacity: .2; pointer-events: none; z-index: 10; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"); }

.sub-wrap { position: relative; z-index: 11; max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.sub-hero { text-align: center; padding: 24px 0 8px; }
.sub-hero .kicker { color: var(--g-2); text-transform: uppercase; letter-spacing: 1.2px; font-size: 12px; font-weight: 700; }
.sub-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.04; letter-spacing: -1.8px; margin: 12px 0 10px; font-weight: 600; }
.sub-hero p { color: var(--muted); font-size: 15px; max-width: 620px; margin: 0 auto; line-height: 1.5; }

.sub-card { margin: 16px 0 0; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.sub-head, .sub-out-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.sub-head .kicker, .sub-out-head .kicker, .sub-cue-head .kicker, .sub-exportbar .kicker { color: var(--g-2); text-transform: uppercase; letter-spacing: 1px; font-size: 12px; font-weight: 700; }
.sub-stats { color: var(--muted); font-size: 13px; }

.sub-modes { display: flex; gap: 8px; }
.sub-modes button { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 700; color: var(--g-2); transition: .18s; }
.sub-modes button[aria-pressed="true"] { background: var(--solid); color: #fff; border-color: var(--solid); }
.sub-mode-sub { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.sub-explainer { margin-top: 14px; padding: 16px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2); }
.sub-explainer h2 { font-size: 15px; margin: 0 0 8px; }
.sub-explainer ol { margin: 0 0 8px; padding-left: 18px; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.sub-privacy { font-size: 12px; color: var(--muted); margin: 0; }
.sub-keyrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.sub-keystatus { font-size: 12px; } .sub-keystatus.ok { color: var(--green-deep, green); } .sub-keystatus.bad { color: var(--danger); }
.sub-check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }

.sub-row { display: flex; flex-wrap: wrap; gap: 12px; }
.sub-field { display: flex; flex-direction: column; gap: 6px; color: var(--g-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; flex: 1; min-width: 120px; }
.sub-input, .sub-field select, .sub-field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: 0; font-size: 14px; text-transform: none; letter-spacing: 0; }
.sub-field input[type="range"] { padding: 0; }
.sub-field input[type="color"] { padding: 4px; height: 42px; }
.sub-input:focus, .sub-field select:focus, .sub-field input:focus { border-color: var(--success); box-shadow: 0 0 0 3px rgba(185,245,111,.18); }
.mono { font-family: "DM Mono", monospace; }
.sub-hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.sub-drop { margin-top: 12px; padding: 30px; border: 1.5px dashed var(--line); border-radius: 16px; background: var(--surface-2); text-align: center; cursor: pointer; transition: .18s; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.sub-drop:hover, .sub-drop.drag { border-color: var(--accent); background: var(--bg-accent, var(--surface)); }
.sub-drop-mark { font-size: 26px; color: var(--g-2); }
.sub-drop strong { font-size: 15px; } .sub-drop small { color: var(--muted); font-size: 12px; }
.sub-fileinfo { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); font-family: "DM Mono", monospace; }
.sub-warn { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }

.sub-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.sub-btn { padding: 11px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 700; transition: .18s; }
.sub-btn:hover { transform: translateY(-1px); }
.sub-btn.primary { background: var(--solid); color: #fff; border-color: var(--solid); }
.sub-btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.sub-btn.danger:hover { background: var(--danger-soft); }
.sub-btn:disabled { opacity: .5; cursor: default; transform: none; }
.sub-progress { flex: 1; min-width: 100px; height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sub-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.sub-stage { font-size: 12px; color: var(--muted); }
.sub-error { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }

/* ---- editor ---- */
.sub-editor { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 880px) { .sub-editor { grid-template-columns: 1fr; } }

.sub-stage-wrap { position: relative; width: 100%; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.sub-stage-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.sub-overlay { position: absolute; inset: 0; pointer-events: none; }
#overlayText { position: absolute; top: var(--sub-pos, 84%); left: 5%; right: 5%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 3px; align-items: center; line-height: 1.25; font-weight: 700; }
.sub-line { display: inline-block; max-width: 100%; }
.sub-box-box .sub-line { background: rgba(0,0,0,.65); padding: .04em .35em; border-radius: 3px; }
.sub-box-shadow .sub-line { text-shadow: 0 2px 6px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9); }
.sub-box-outline .sub-line { -webkit-text-stroke: 1.4px #000; paint-order: stroke fill; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.sub-safe { position: absolute; inset: 10%; border: 1px dashed rgba(255,255,255,.55); pointer-events: none; border-radius: 2px; }
.sub-preview-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.sub-style { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
.sub-style-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- active-workspace red line ---- */
.sub-ws-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.sub-ws-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--g-2); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.sub-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g-3); }
.sub-keys { color: var(--g-3); font-size: 11px; }
.sub-editor[data-ws="monitor"] .sub-ws-tag { color: #fff; background: var(--accent); border-color: var(--accent); }
.sub-editor[data-ws="monitor"] .sub-dot { background: #fff; box-shadow: 0 0 0 3px rgba(255,74,63,.4); }
.sub-stage-wrap { outline: 2px solid transparent; outline-offset: 2px; }
.sub-editor[data-ws="monitor"] .sub-stage-wrap { outline-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 34px rgba(255,74,63,.2); }
.sub-rate { position: absolute; top: 8px; left: 8px; z-index: 3; background: rgba(255,74,63,.92); color: #fff; font: 700 12px "DM Mono", monospace; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.sub-editing { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .3px; }
.sub-cue.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sub-cue.active::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--accent); }

.sub-cue-col { display: flex; flex-direction: column; min-height: 0; }
.sub-settings { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px 14px; }
.sub-settings summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink); }
.sub-set-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.sub-cue-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sub-fastlegend { font-size: 11px; color: var(--danger); }
.sub-cuelist { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; padding-right: 4px; }

.sub-cue { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 12px; }
.sub-cue.fast { border-color: var(--danger); }
.sub-cue-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sub-cue-n { font-size: 11px; font-weight: 700; color: var(--g-2); text-transform: uppercase; letter-spacing: .5px; }
.sub-warn-ico { color: var(--danger); }
.sub-cue-tc { display: flex; align-items: center; gap: 3px; }
.sub-tcin { width: 104px; padding: 5px 4px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-size: 12px; text-align: center; letter-spacing: -.3px; }
.sub-nudge { width: 22px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); cursor: pointer; font-weight: 700; line-height: 1; }
.sub-arrow { color: var(--g-3); font-size: 12px; margin: 0 2px; }
.sub-cue-text { width: 100%; margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); resize: vertical; font-size: 14px; line-height: 1.4; }
.sub-cue-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sub-cps { font-size: 11px; color: var(--g-2); font-family: "DM Mono", monospace; margin-right: auto; }
.sub-mini { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); cursor: pointer; font-size: 12px; font-weight: 600; }
.sub-mini.danger { color: var(--danger); }
.sub-mini:disabled { opacity: .4; cursor: default; }

.sub-exportbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.sub-exports { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-avidnote { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.toast { position: fixed; bottom: 25px; left: 50%; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 60; background: var(--solid); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 13px; display: flex; gap: 9px; align-items: center; transition: .3s; }
.toast span:first-child { color: var(--green); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
