:root {
  --bg: #f4f7f4;
  --surface: #ffffff;
  --ink: #111814;
  --muted: #6d766f;
  --line: #dfe6e0;
  --green: #28d17c;
  --green-dark: #0b6c41;
  --green-soft: #dff8ea;
  --red: #ff6b62;
  --red-soft: #ffe4e1;
  --yellow: #f4d35e;
  --shadow: 0 14px 40px rgba(19, 44, 28, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100%; color: var(--ink); background: radial-gradient(circle at 90% 0%, #e1f8eb 0, transparent 28rem), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
.hidden { display: none !important; }

.app-shell { width: min(100%, 760px); min-height: 100vh; margin: 0 auto; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--green); background: #14231b; box-shadow: 0 8px 20px rgba(13, 35, 23, .16); }
.brand-mark svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.brand-mark svg path:first-child { fill: currentColor; stroke: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.2px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.icon-button { width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.72); font-size: 18px; font-weight: 800; cursor: pointer; }

.welcome { min-height: calc(100vh - 74px); display: flex; flex-direction: column; align-items: center; padding: 38px 24px 36px; text-align: center; overflow: hidden; }
.welcome-art { position: relative; width: 240px; height: 154px; margin: 6px 0 28px; }
.film-frame { position: absolute; inset: 10px 12px 18px; border-radius: 22px; transform: rotate(-3deg); background: #17251d; box-shadow: var(--shadow); overflow: hidden; }
.film-frame::before, .film-frame::after { content: ""; position: absolute; left: 0; right: 0; height: 15px; background: repeating-linear-gradient(90deg, transparent 0 10px, #415046 10px 18px); }
.film-frame::before { top: 0; }.film-frame::after { bottom: 0; }
.film-frame span { position: absolute; inset: 24px 14px; border-radius: 12px; background: linear-gradient(160deg, #6cd99e 0%, #1b8052 50%, #173d2b 51%, #101b15 100%); }
.film-frame i, .film-frame b { position: absolute; z-index: 1; border-radius: 50%; background: #e3f7eb; opacity: .8; }
.film-frame i { width: 28px; height: 28px; top: 38px; right: 32px; }.film-frame b { width: 8px; height: 8px; top: 76px; right: 70px; }
.cut-line { position: absolute; left: 46px; right: 20px; bottom: 22px; height: 8px; border-bottom: 3px dashed var(--red); transform: rotate(3deg); }
.cut-line em { position: absolute; left: 57%; top: -2px; width: 38px; height: 14px; border-radius: 8px; background: var(--red-soft); }
.cut-line svg { position: absolute; width: 48px; right: -2px; top: -22px; padding: 8px; border-radius: 50%; background: var(--red); stroke: white; stroke-width: 2; fill: none; box-shadow: 0 8px 18px rgba(232, 83, 73, .28); }
.eyebrow { margin: 0 0 9px; color: var(--green-dark); font-size: 12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.welcome h1, .editor-heading h1 { margin: 0; font-size: clamp(32px, 9vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
.welcome h1 span { color: var(--green-dark); }
.intro { max-width: 420px; margin: 18px 0 26px; color: var(--muted); line-height: 1.55; }
.primary-button { width: 100%; min-height: 58px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; border: 0; border-radius: 16px; color: #06180f; background: var(--green); box-shadow: 0 10px 24px rgba(40, 209, 124, .26); font-weight: 850; cursor: pointer; transition: transform .16s ease, filter .16s ease; }
.primary-button:active { transform: scale(.98); }
.primary-button:hover { filter: brightness(.97); }
.primary-button svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.upload-button { max-width: 370px; }
.format-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.text-button { margin: 9px 0 24px; padding: 7px 10px; border: 0; color: var(--green-dark); background: transparent; font-size: 14px; font-weight: 750; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.privacy-note { display: flex; align-items: center; gap: 8px; max-width: 370px; color: var(--muted); font-size: 12px; line-height: 1.35; text-align: left; }
.privacy-note svg { flex: 0 0 20px; width: 20px; fill: none; stroke: var(--green-dark); stroke-width: 1.8; }

.editor { padding: 18px 18px 48px; }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 6px 2px 20px; }
.editor-heading h1 { max-width: 500px; font-size: clamp(26px, 7vw, 38px); }
.change-video { flex: none; margin-top: 18px; padding: 8px 0; border: 0; color: var(--green-dark); background: none; font-size: 13px; font-weight: 800; cursor: pointer; }
.video-card, .action-card, .cuts-card, .finish-card { border: 1px solid rgba(205, 216, 207, .78); border-radius: var(--radius); background: rgba(255,255,255,.94); box-shadow: var(--shadow); overflow: hidden; }
.auto-card { margin-top: 12px; padding: 15px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; border: 1px solid rgba(30, 143, 88, .22); border-radius: var(--radius); background: linear-gradient(135deg, #f4fff8, #eaf9f0); box-shadow: var(--shadow); }
.auto-copy { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.auto-copy strong, .auto-copy small { display: block; }.auto-copy strong { color: #143923; font-size: 13px; }.auto-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.auto-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--green); font-size: 18px; }
.auto-button { flex: none; padding: 10px 12px; border: 0; border-radius: 11px; color: white; background: #173c27; font-size: 11px; font-weight: 850; cursor: pointer; }
.auto-button:disabled { opacity: .55; cursor: wait; }
.auto-result { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border: 1px solid rgba(20, 108, 64, .2); border-radius: 11px; color: #173c27; background: rgba(255,255,255,.8); }
.auto-result strong, .auto-result span { display: block; }.auto-result strong { font-size: 13px; }.auto-result span { margin-top: 3px; color: #496353; font-size: 11px; line-height: 1.4; }
.auto-sensitive { flex: none; padding: 9px 11px; border: 1px solid #176b42; border-radius: 9px; color: #145b39; background: white; font-size: 11px; font-weight: 850; cursor: pointer; }
.video-stage { position: relative; width: 100%; aspect-ratio: var(--video-ratio, 16/9); display: grid; place-items: center; background: #111713; overflow: hidden; transition: aspect-ratio .18s ease; }
.video-stage video { width: 100%; height: 100%; object-fit: contain; }
.local-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #111713; }
.demo-visual { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(#6b9d9f 0 52%, #203b2b 53%); }
.demo-sky { position: absolute; width: 52px; height: 52px; top: 18%; left: 20%; border-radius: 50%; background: #ffeaa2; box-shadow: 0 0 60px #ffe9a0; }
.demo-mountains { position: absolute; inset: 32% -10% -30%; background: #2b5943; clip-path: polygon(0 60%, 14% 23%, 25% 53%, 42% 8%, 58% 55%, 72% 25%, 100% 65%, 100% 100%, 0 100%); }
.demo-title { position: absolute; inset: auto 0 16%; color: white; font-size: clamp(18px, 5vw, 34px); font-weight: 900; letter-spacing: .16em; text-align: center; text-shadow: 0 2px 12px #000; }
.big-play { position: relative; z-index: 3; width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: #101713; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); cursor: pointer; box-shadow: 0 8px 30px rgba(0,0,0,.24); }
.big-play svg { width: 42px; fill: currentColor; }
.video-badge { position: absolute; z-index: 4; top: 12px; left: 12px; padding: 5px 8px; border-radius: 7px; color: #fff; background: rgba(12,20,15,.68); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.watermark-preview { position: absolute; z-index: 4; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid rgba(255,45,86,.58); border-radius: 999px; color: white; background: rgba(0,0,0,.76); box-shadow: 0 2px 10px rgba(0,0,0,.3); pointer-events: none; }
.watermark-preview i, .watermark-note i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(#ff7891, #ff174b 55%, #b30027); box-shadow: 0 0 5px rgba(255,23,75,.65); }
.watermark-preview b { font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; letter-spacing: .01em; }
.video-loading { position: absolute; z-index: 5; inset: auto 50% 16px auto; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 10px; color: white; background: rgba(9,16,12,.78); font-size: 11px; transform: translateX(50%); backdrop-filter: blur(8px); }
.video-loading span { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.video-loading b { white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
.transport { display: grid; grid-template-columns: 1fr 1fr 1.18fr 1fr 1fr; align-items: center; padding: 12px 14px 5px; }
.transport button { min-width: 0; height: 48px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.transport button strong, .transport button small { display: block; }.transport button strong { font-size: 15px; }.transport button small { color: var(--muted); font-size: 9px; }
.transport .transport-play { width: 52px; height: 52px; justify-self: center; display: grid; place-items: center; border-radius: 50%; color: white; background: #17251d; }
.transport-play svg { grid-area: 1/1; width: 30px; fill: currentColor; }
.time-row { display: flex; justify-content: space-between; padding: 4px 20px 0; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 750; }
.timeline-wrap { position: relative; height: 48px; margin: 0 20px; }
.timeline-track { position: absolute; left: 0; right: 0; top: 19px; height: 10px; border-radius: 6px; background: #dce3dd; overflow: hidden; }
.segment { position: absolute; top: 0; bottom: 0; }.segment.keep { background: var(--green); }.segment.remove { background: var(--red); }
.timeline-wrap input { position: absolute; z-index: 3; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.timeline-markers { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.scrub-time { position: absolute; z-index: 5; top: -32px; padding: 5px 7px; border-radius: 7px; color: white; background: #17251d; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; transform: translateX(-50%); pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.playhead { position: absolute; top: 11px; width: 3px; height: 26px; border-radius: 2px; background: #111; transform: translateX(-1px); box-shadow: 0 0 0 3px rgba(255,255,255,.8); }
.marker { position: absolute; top: 7px; width: 2px; height: 34px; background: currentColor; transform: translateX(-1px); }.marker::before { content: ""; position: absolute; left: 50%; top: 0; width: 9px; height: 9px; border-radius: 50%; background: currentColor; transform: translateX(-50%); }
.marker.keep { color: var(--green-dark); }.marker.remove { color: #c9423a; }
.legend { display: flex; justify-content: center; gap: 7px; align-items: center; padding: 0 0 16px; color: var(--muted); font-size: 10px; }
.legend span { width: 8px; height: 8px; margin-left: 9px; border-radius: 50%; }.keep-dot { background: var(--green); }.remove-dot { background: var(--red); }

.action-card { margin-top: 16px; padding: 20px; }
.action-card > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; text-align: center; }
.mark-button svg { width: 25px; }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.secondary-actions button { min-height: 48px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: #f8faf8; font-size: 12px; font-weight: 800; cursor: pointer; }
.cuts-card { margin-top: 16px; padding: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; }
.section-title h2 { margin: 0 0 10px; font-size: 16px; }.section-title button { padding: 7px; border: 0; color: var(--green-dark); background: none; font-size: 12px; font-weight: 800; cursor: pointer; }
.cut-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #edf1ed; }
.cut-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--red-soft); color: #b73d36; font-weight: 900; }
.cut-item strong, .cut-item small { display: block; }.cut-item strong { font-size: 13px; }.cut-item small { margin-top: 2px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cut-item button { width: 34px; height: 34px; border: 0; border-radius: 10px; color: var(--muted); background: #f2f5f2; cursor: pointer; }
.finish-card { margin-top: 16px; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 18px; }
.finish-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); }
.finish-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.finish-card strong, .finish-card span { display: block; }.finish-card strong { margin-top: 2px; font-size: 15px; }.finish-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.finish-card .watermark-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; margin: 0; padding: 9px 11px; border-radius: 10px; color: #263d30; background: #f1f5f2; font-size: 11px; font-weight: 750; }
.finish-card button { grid-column: 1 / -1; }
.finish-card .finish-auto { margin: 0 auto; }
.preview-button { min-height: 48px; border: 1px solid var(--line); border-radius: 14px; color: var(--green-dark); background: white; font-weight: 800; cursor: pointer; }

dialog { width: min(calc(100% - 28px), 470px); padding: 26px; border: 0; border-radius: 24px; color: var(--ink); background: white; box-shadow: 0 24px 90px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(7, 16, 10, .64); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eff3ef; font-size: 24px; cursor: pointer; }
dialog h2 { margin: 0 0 18px; font-size: 28px; letter-spacing: -.03em; }
dialog ol { margin: 0 0 24px; padding: 0; list-style: none; }
dialog li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
dialog li > span { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); font-weight: 900; }
dialog li strong, dialog li small { display: block; }.dialog li small { margin-top: 2px; color: var(--muted); }
.result-dialog { text-align: center; }
.result-symbol { width: 74px; height: 74px; display: grid; place-items: center; margin: 6px auto 16px; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); }
.result-symbol svg { width: 46px; fill: none; stroke: currentColor; stroke-width: 3; }
.result-symbol.format-symbol { color: #14231b; background: var(--yellow); }
.result-symbol.format-symbol strong { font-size: 24px; letter-spacing: -.04em; }
.result-dialog p { color: var(--muted); line-height: 1.5; }
.result-summary { margin: 18px 0; padding: 14px; border-radius: 14px; background: #f2f6f3; color: var(--green-dark); font-weight: 800; }
.download-button { color: #06180f; text-decoration: none; }
.access-dialog p, .progress-dialog p, .auto-result-dialog p { color: var(--muted); line-height: 1.5; }
.access-dialog form { display: grid; gap: 14px; }
.access-dialog input { width: 100%; min-height: 58px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #f8faf8; font-size: 20px; font-weight: 800; letter-spacing: .12em; text-align: center; outline: none; }
.access-dialog input:focus { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(40, 209, 124, .16); }
.form-error { margin: -4px 0 0 !important; color: #b73d36 !important; font-size: 13px; font-weight: 750; text-align: center; }
.progress-dialog { text-align: center; }
.auto-result-dialog { text-align: center; }
.auto-result-dialog .primary-button { margin-top: 18px; }
.auto-result-dialog .text-button { margin-bottom: 0; }
.progress-symbol { width: 68px; height: 68px; display: grid; place-items: center; margin: 4px auto 16px; border-radius: 50%; color: var(--green-dark); background: var(--green-soft); font-size: 30px; font-weight: 900; }
.progress-track { height: 12px; margin: 22px 0 8px; border-radius: 8px; background: #e5ebe6; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .3s ease; }
.progress-numbers { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-numbers strong { color: var(--green-dark); }
.progress-dialog .text-button { margin-bottom: 0; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; color: white; background: #17251d; box-shadow: var(--shadow); font-size: 13px; font-weight: 750; transform: translate(-50%, 140%); opacity: 0; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 720px) {
  .topbar { padding-inline: 4px; }
  .welcome { padding-top: 50px; }
  .editor { padding-inline: 4px; }
}
@media (max-width: 390px) {
  .brand small { display: none; }
  .welcome { padding-inline: 18px; }
  .welcome-art { transform: scale(.88); margin-bottom: 12px; }
  .editor { padding-inline: 12px; }
  .action-card { padding: 16px; }
  .auto-card { align-items: stretch; flex-direction: column; }.auto-button, .auto-sensitive { width: 100%; }.auto-result { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; }.video-loading span { animation: none; } }
