* { box-sizing: border-box }
body { margin:0; background:#f6f6f0; color:#181e1a; font:1rem/1.5 system-ui,sans-serif }
header { display:flex; align-items:center; gap:1.2rem; padding:1rem max(5vw,1rem); border-bottom:1px solid #d4d9cd }
header strong { font-size:1.65rem; letter-spacing:-.08em }
header strong span { color:#637c23 }
header>span { border-left:1px solid #bac2b1; padding-left:1.2rem }
main { width:min(92%,64rem); margin:clamp(2rem,6vw,5rem) auto }
h1 { font-size:clamp(2.6rem,6vw,4.8rem); letter-spacing:-.065em; line-height:1.05; margin:0 0 1.6rem }
section { overflow:hidden; border:1px solid #cbd1c6; border-radius:18px; background:white }
.stage { min-height:min(42vh,26rem); display:grid; place-items:center; background-color:#19221e; background-image:radial-gradient(#344038 1px,transparent 1px); background-size:16px 16px; color:#eef3e8 }
#empty { text-align:center; padding:2rem }
.film { margin:auto; width:4.3rem; padding:.35rem; border:2px solid #adcf85; border-radius:12px; color:#d3f69e; font-size:2rem }
h2 { font-size:1.05rem; font-weight:500 }
#frame { position:relative; width:min(100%,calc(64vh * var(--ratio,1.77778))); aspect-ratio:var(--ratio); background:black }
video { display:block; width:100%; height:100%; object-fit:contain }
.bar { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1.3rem }
.bar p { margin:0; overflow-wrap:anywhere }
#error { color:#98372c }
button { flex:none; font:inherit; font-weight:650; padding:.8rem 1.35rem; border:1px solid #97b75c; background:#d5ef9d; color:#192717; border-radius:9px; cursor:pointer }
button:hover { background:#c4e580 }
button:focus-visible { outline:3px solid #49691b; outline-offset:3px }
@media(max-width:560px){.bar{align-items:stretch;flex-direction:column}}
:root {color-scheme:dark;--page:#171b19;--ink:#eef2ed;--panel:#242b27;--line:#49534c}
:root[data-theme=light] {color-scheme:light;--page:#f6f6f0;--ink:#181e1a;--panel:white;--line:#cbd1c6}
body {background:var(--page);color:var(--ink)}
section,header {border-color:var(--line)}
section {background:var(--panel)}
.theme {margin-left:auto;display:flex;align-items:center;gap:.4rem}
select {background:var(--panel);color:inherit;border:1px solid var(--line);border-radius:8px;padding:.5rem;font:inherit;min-height:44px}
#settings {padding:1.25rem;margin-top:1rem}
#settings label {display:block;font-weight:600;margin-bottom:.4rem}
#settings h2 {font-size:1.35rem;font-weight:650}
#segments {padding-left:1.8rem}
#segments time {display:block;font-size:.85rem;font-variant-numeric:tabular-nums}
#segments li {padding:.6rem;overflow-wrap:anywhere}
#status:empty,#segments:empty {display:none}
button:disabled {opacity:.7;cursor:wait}
#error {color:#ffb2a9}
:root[data-theme=light] #error {color:#98372c}
@media(max-width:560px){header{gap:.5rem}header>span{padding-left:.5rem}.theme{font-size:.9rem}#frame{max-width:100%}}
#frame {container-type:inline-size}
#overlay {position:absolute;z-index:1;bottom:12%;left:5%;right:5%;text-align:center;pointer-events:none;color:white;line-height:1.24;font-size:clamp(.8rem,5cqw,2.8rem);overflow-wrap:anywhere;white-space:pre-line;max-height:83%;overflow:hidden}
#caption,#presets span {box-decoration-break:clone;-webkit-box-decoration-break:clone}
#caption:empty {display:none}
#presets {display:flex;flex-wrap:wrap;gap:.45rem;border:0;padding:0;margin:1rem 0}
#presets legend {margin-bottom:.4rem}
#settings #presets label {display:flex;align-items:center;gap:.4rem;background:#38443d;color:white;border-radius:8px;min-height:44px;padding:0 .7rem;cursor:pointer}
#presets label:has(:checked){outline:2px solid #85a84f}
#segments {list-style:none;padding:0}
#segments li {border-left:3px solid transparent}
#segments li[aria-current]{border-color:#84aa4a}
#segments button {background:transparent;color:var(--ink);border:0;text-decoration:underline;padding:.4rem 0;min-height:44px;font-variant-numeric:tabular-nums}
#segments textarea {width:100%;display:block;resize:vertical;font:inherit;background:var(--page);color:var(--ink);border:1px solid var(--line);padding:.6rem;border-radius:6px}
#download {max-width:100%}
#overlay {inset:0;max-height:none}
#caption,#caption:empty {display:block;width:100%;height:100%}
#mp4,#cancel-export {max-width:100%}
#download {background:var(--panel);color:var(--ink);border-color:var(--line)}
#export-status:empty {display:none}
.caption-options {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr));gap:1rem}
.caption-options input,.caption-options select {display:block;width:100%;min-height:44px;accent-color:#85a84f}
.caption-options output {font-weight:400;font-variant-numeric:tabular-nums}
#export-progress {width:100%;height:1rem;margin-top:.75rem;accent-color:#79ac39}
#speech-progress {width:100%;height:1rem;margin-top:.75rem;accent-color:#79ac39}
#settings label[hidden] {display:none}
.legal-footer {width:min(92%,64rem);margin:0 auto 2rem;border-top:1px solid var(--line)} .legal-footer nav {display:flex;flex-wrap:wrap;gap:1.5rem} .legal-footer a {display:inline-flex;align-items:center;min-height:44px;color:var(--ink)}
.stage.drag-active {outline:3px dashed #b5dc7d;outline-offset:-5px}
.intro,.export-guide {max-width:70ch}.intro {margin:0 0 1.5rem}.export-guide {margin:2.5rem 0 0}.export-guide h2 {font-size:1.3rem;font-weight:650}h1 {overflow-wrap:break-word}
