@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #0d0f0c; --surface: #151812; --surface-2: #1c2019; --surface-3: #252a21;
  --line: #30372b; --muted: #89917f; --text: #eff3e7; --accent: #d8ff48;
  --accent-ink: #11140d; --danger: #ff6b57; --panel-width: 292px; --rail-width: 74px;
  font-family: "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, .viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-shell { display: grid; grid-template: 64px minmax(0, 1fr) / var(--rail-width) minmax(0, 1fr) var(--panel-width); width: 100%; height: 100%; }

.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 18px; border-bottom: 1px solid var(--line); background: #12150f; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font: 700 17px/1 "Chakra Petch", sans-serif; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 10px; margin-top: 5px; letter-spacing: .12em; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 8px); gap: 2px; padding: 6px; background: var(--accent); transform: rotate(3deg); }
.brand-mark i { width: 8px; height: 8px; background: var(--accent-ink); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .35; }
.top-actions { display: flex; align-items: center; gap: 5px; }
.divider { height: 24px; width: 1px; background: var(--line); margin: 0 5px; }
.button, .icon-button, .mini-button, .zoom-value { border: 1px solid transparent; border-radius: 7px; cursor: pointer; transition: 140ms ease; }
.button { min-height: 36px; padding: 0 14px; font-weight: 600; font-size: 12px; }
.button.ghost { background: transparent; color: #b8c0ae; }
.button.ghost:hover { background: var(--surface-3); color: var(--text); }
.button.accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 1px #e4ff7a inset; }
.button.accent:hover { background: #e2ff72; transform: translateY(-1px); }
.button.accent b { margin-left: 20px; font: 600 10px "Chakra Petch"; opacity: .55; }
.icon-button { width: 36px; height: 36px; background: transparent; color: #b7bfac; font: 500 22px/1 "Chakra Petch"; }
.icon-button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-button:disabled { opacity: .3; cursor: default; }
.icon-button.small { width: 28px; height: 28px; font-size: 17px; }

.tool-rail { grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 5px; overflow-y: auto; padding: 12px 8px; border-right: 1px solid var(--line); background: #11140f; scrollbar-width: none; }
.tool-button { width: 56px; min-height: 54px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.tool-button:hover { background: var(--surface-2); color: var(--text); }
.tool-button.active { background: var(--accent); color: var(--accent-ink); }
.tool-button span { display: block; height: 25px; font: 400 20px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.tool-button small { font-size: 10px; }
.tool-rail-spacer { flex: 1; }

.editor-main { grid-row: 2; min-width: 0; min-height: 0; display: grid; grid-template-rows: 48px minmax(0, 1fr) 28px; }
.context-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.context-group { display: flex; align-items: center; gap: 10px; }
.context-group:first-child { flex: 1; }
.context-group[data-context] { flex: 1; }
.context-group label { display: flex; align-items: center; gap: 8px; color: #abb3a1; font-size: 11px; white-space: nowrap; }
.context-group output { width: 39px; color: var(--text); font: 600 11px "Chakra Petch"; }
input[type="range"] { accent-color: var(--accent); height: 3px; }
.color-field { height: 30px; padding: 0 9px 0 5px; border: 1px solid var(--line); border-radius: 6px; background: #10130e; font: 600 11px "Chakra Petch"; }
.color-field input { width: 23px; height: 22px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.mini-button { height: 30px; padding: 0 9px; color: #aeb6a4; background: transparent; border-color: var(--line); font-size: 10px; }
.mini-button:hover { color: var(--text); border-color: #5c6751; }
.transform-context output { width: auto; min-width: 112px; color: var(--accent); }
.transform-context > * { flex: 0 0 auto; }
.transform-context .mini-button { white-space: nowrap; }
.fill-context > * { flex: 0 0 auto; }
.fill-context output { color: var(--accent); }
.zoom-controls { margin-left: auto; }
.zoom-value { width: 57px; height: 28px; border: 0; background: transparent; font: 600 11px "Chakra Petch"; }
.check-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.check-label input { accent-color: var(--accent); }

.viewport { position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: none; background-color: #0c0e0b; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 24px 24px; }
.viewport.dragging::after { content: ""; position: fixed; inset: 112px calc(var(--panel-width) + 12px) 40px calc(var(--rail-width) + 12px); border: 2px solid var(--accent); pointer-events: none; z-index: 8; }
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.empty-state h1 { margin: 0; font: 700 clamp(24px, 3vw, 42px)/1.1 "Chakra Petch", "Noto Sans SC"; letter-spacing: -.03em; }
.empty-state > p:not(.eyebrow) { margin: 12px 0 24px; color: var(--muted); font-size: 12px; }
.empty-state .button + .button { margin-left: 8px; }
.eyebrow { margin: 22px 0 10px; color: var(--accent); font: 700 10px "Chakra Petch"; letter-spacing: .18em; }
.empty-art { display: grid; grid-template-columns: repeat(5, 13px); grid-template-rows: repeat(5, 13px); transform: rotate(-4deg); }
.empty-art::before, .empty-art::after, .empty-art span { content: ""; background: var(--surface-3); box-shadow: 0 0 0 1px #333b2d inset; }
.empty-art::before { grid-area: 1 / 1 / 6 / 6; }
.empty-art::after { grid-area: 2 / 2 / 5 / 5; background: var(--accent); z-index: 1; }
.empty-art span { z-index: 2; background: var(--accent-ink); }
.empty-art span:nth-child(1) { grid-area: 2 / 2; }.empty-art span:nth-child(2) { grid-area: 2 / 4; }.empty-art span:nth-child(3) { grid-area: 4 / 3; }
.canvas-stage { min-width: 100%; min-height: 100%; width: max-content; height: max-content; padding: 88px; display: grid; place-items: center; }
.canvas-frame { position: relative; flex: none; line-height: 0; box-shadow: 0 18px 60px rgba(0,0,0,.5), 0 0 0 1px #50594a; background-color: #fff; background-image: linear-gradient(45deg,#c7c7c7 25%,transparent 25%),linear-gradient(-45deg,#c7c7c7 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#c7c7c7 75%),linear-gradient(-45deg,transparent 75%,#c7c7c7 75%); background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; }
#editorCanvas { display: block; image-rendering: pixelated; cursor: crosshair; }
.pixel-grid { position: absolute; inset: 0; display: none; pointer-events: none; background-image: linear-gradient(to right, rgba(40,45,34,.35) 1px, transparent 1px), linear-gradient(to bottom, rgba(40,45,34,.35) 1px, transparent 1px); }
.pixel-grid.visible { display: block; }
.transform-box { position: absolute; border: 1px solid var(--accent); cursor: move; pointer-events: auto; z-index: 3; box-shadow: 0 0 0 1px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.2); }
.transform-box::before { content: ""; position: absolute; inset: 0; background: rgba(216,255,72,.035); }
.transform-info { position: absolute; left: 50%; top: -28px; min-width: max-content; padding: 4px 7px; border-radius: 4px; background: #11140f; color: var(--accent); transform: translateX(-50%); font: 600 10px "Chakra Petch"; line-height: 1; box-shadow: 0 0 0 1px var(--line); }
.transform-box i { position: absolute; width: 10px; height: 10px; border: 1px solid #11140f; background: var(--accent); transform: translate(-50%,-50%); }
.transform-box i[data-transform-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.transform-box i[data-transform-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.transform-box i[data-transform-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.transform-box i[data-transform-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.transform-box i[data-transform-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.transform-box i[data-transform-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.transform-box i[data-transform-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.transform-box i[data-transform-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
.brush-cursor { position: fixed; display: none; border: 1px solid white; border-radius: 50%; box-shadow: 0 0 0 1px black; pointer-events: none; z-index: 4; transform: translate(-50%, -50%); }
.drop-indicator { position: fixed; inset: 50% auto auto 50%; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 24px 38px; background: var(--accent); color: var(--accent-ink); border-radius: 10px; transform: translate(-50%,-50%) scale(.94); opacity: 0; pointer-events: none; z-index: 10; transition: 150ms ease; }
.dragging .drop-indicator { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.drop-indicator strong { font: 700 20px "Chakra Petch", "Noto Sans SC"; }.drop-indicator span { font-size: 11px; opacity: .7; }
.statusbar { display: flex; align-items: center; gap: 24px; padding: 0 12px; color: #798170; background: #11140f; border-top: 1px solid var(--line); font: 500 10px "Chakra Petch", "Noto Sans SC"; }
.status-tip { margin-left: auto; }

.inspector { grid-row: 2; min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: #11140f; scrollbar-width: thin; }
.inspector.removal-active > .panel:not(.background-removal-panel) { display: none; }
.panel { padding: 14px; border-bottom: 1px solid var(--line); }
.panel-heading, .panel-subheading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading { margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font: 700 12px "Chakra Petch", "Noto Sans SC"; letter-spacing: .04em; }
.panel-heading > span { color: var(--muted); font: 600 10px "Chakra Petch"; }
.panel-heading button, .panel-subheading button { padding: 0; border: 0; background: none; color: var(--muted); font-size: 10px; cursor: pointer; }
.panel-heading button:hover, .panel-subheading button:hover { color: var(--accent); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.quick-grid button { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: #b4bcaa; font-size: 10px; cursor: pointer; }
.quick-grid button:hover { border-color: #56604d; color: var(--text); }
.quick-grid span { color: var(--accent); font-size: 16px; }
.property-grid, .dialog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.property-grid label, .dialog-fields label, .dialog-label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 10px; }
input[type="number"], input[type="text"], select { width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: #0e110d; color: var(--text); }
.control-row { display: grid; grid-template-columns: 66px minmax(0,1fr) 32px; align-items: center; gap: 5px; margin-top: 10px; color: #a6ae9c; font-size: 10px; }
.control-row output { color: var(--muted); text-align: right; font: 500 9px "Chakra Petch"; }
.select-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 10px; color: #a6ae9c; font-size: 10px; }
.select-row select { height: 30px; font-size: 10px; }
.panel-subheading { margin: 15px 0 4px; padding-top: 12px; border-top: 1px solid var(--line); color: #aab2a0; font-size: 10px; }

.layers-panel { padding-bottom: 0; }
.layer-list { max-height: 214px; overflow: auto; margin: 0 -14px; }
.layer-item { display: grid; grid-template-columns: 25px 40px minmax(0,1fr); align-items: center; gap: 7px; min-height: 52px; padding: 5px 12px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; cursor: pointer; }
.layer-item:hover { background: var(--surface); }
.layer-item.active { background: #262c20; border-color: #37412c; }
.visibility-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.layer-item:not(.visible) .visibility-button { opacity: .25; }
.layer-thumb { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; border: 1px solid #41493a; background-color: #fff; background-image: linear-gradient(45deg,#bbb 25%,transparent 25%),linear-gradient(-45deg,#bbb 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#bbb 75%),linear-gradient(-45deg,transparent 75%,#bbb 75%); background-size: 8px 8px; background-position: 0 0,0 4px,4px -4px,-4px 0; }
.layer-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.layer-name { overflow: hidden; color: #dce2d5; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.layer-meta small { color: var(--muted); font: 500 9px "Chakra Petch"; }
.layer-actions { display: grid; grid-template-columns: repeat(5, 1fr); margin: 8px -14px 0; border-top: 1px solid var(--line); }
.layer-actions button { height: 34px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.layer-actions button:hover { color: var(--accent); background: var(--surface); }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.palette p { grid-column: 1 / -1; margin: 0; color: #6f7768; font-size: 10px; line-height: 1.6; }
.swatch { aspect-ratio: 1; border: 1px solid rgba(255,255,255,.22); border-radius: 3px; cursor: pointer; }
.swatch:hover { transform: scale(1.12); }

dialog { width: min(430px, calc(100vw - 32px)); padding: 0; border: 1px solid #3e4736; border-radius: 10px; background: #171b14; color: var(--text); box-shadow: 0 24px 90px #000; }
dialog::backdrop { background: rgba(5,7,4,.76); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.dialog-heading h2 { margin: 3px 0 20px; font: 700 24px "Chakra Petch", "Noto Sans SC"; }
.dialog-heading .eyebrow { margin: 0; }
.preset-section { margin-bottom: 14px; }
.preset-section > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.preset-row { display: grid; gap: 6px; }
.pixel-presets { grid-template-columns: repeat(4, 1fr); }
.screen-presets { grid-template-columns: repeat(3, 1fr); }
.preset-row button { height: 32px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: #b7bfad; cursor: pointer; font: 600 10px "Chakra Petch"; }
.preset-row button:hover { border-color: var(--accent); color: var(--accent); }
.screen-presets button { display: flex; height: 52px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.screen-presets strong { color: var(--text); font: 700 13px "Chakra Petch"; }
.screen-presets small { color: var(--muted); font: 500 9px "Chakra Petch"; }
.screen-presets button:hover strong, .screen-presets button:hover small { color: var(--accent); }
.dialog-fields input, .dialog-fields select, .dialog-label input { height: 38px; }
.jpeg-background-field { grid-column: 1 / -1; }
.jpeg-background-field input { width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: 5px; background: #0e110d; cursor: pointer; }
.dialog-label { margin-bottom: 13px; }
.dialog-note { padding: 10px; border-left: 2px solid var(--accent); background: #11140f; color: var(--muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.background-removal-panel { min-height: 100%; padding: 18px 14px; border-bottom: 0; }
.removal-heading { align-items: flex-start; margin-bottom: 0; }
.removal-heading .eyebrow { display: block; margin: 0 0 5px; font-size: 8px; }
.removal-heading h2 { font-size: 16px; }
.live-badge { padding: 4px 7px; border: 1px solid #45512f; border-radius: 999px; background: #202719; color: var(--accent) !important; letter-spacing: .08em; }
.removal-intro { margin: 12px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.removal-sampling { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 9px; margin-bottom: 9px; padding: 11px 9px; border: 1px solid #657436; border-radius: 7px; background: linear-gradient(135deg, #202817, #171c13); }
.sampling-step { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12px "Chakra Petch"; }
.removal-sampling div { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.removal-sampling strong { color: var(--text); font-size: 10px; }
.removal-sampling small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.removal-sampling.sampled { border-color: #38422f; background: #171c13; }
.removal-sampling.sampled .sampling-step { background: #344125; color: var(--accent); }
.removal-sampling .mini-button { height: 27px; padding: 0 7px; }
.removal-status { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid #38422f; border-radius: 6px; background: #171c13; }
.removal-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(216,255,72,.7); }
.removal-status strong { color: #dce5d2; font: 600 10px "Chakra Petch", "Noto Sans SC"; }
.removal-controls { display: grid; gap: 16px; margin-top: 18px; }
.background-removal-panel.sampling .removal-controls { opacity: .38; pointer-events: none; }
.removal-color-row { display: grid; grid-template-columns: minmax(0,1fr) 36px 70px; align-items: center; gap: 7px; color: #b6beac; font-size: 10px; }
.removal-color-row input { width: 34px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.removal-color-row code { color: var(--text); font: 600 10px "Chakra Petch"; }
.removal-color-row small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.removal-control { display: grid; grid-template-columns: minmax(0,1fr) 38px; align-items: center; gap: 8px; }
.removal-control > span { color: #c8cfc0; font-size: 11px; }
.removal-control > span small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 400; }
.removal-control input { grid-column: 1 / -1; width: 100%; }
.removal-control output { color: var(--accent); text-align: right; font: 600 10px "Chakra Petch"; }
.removal-contiguous { align-items: flex-start; padding: 4px 0 2px; line-height: 1.5; }
.removal-contiguous input { margin-top: 2px; }
.removal-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 7px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.removal-actions .button { padding: 0 8px; }
.removal-actions .button:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.toast { position: fixed; left: 50%; bottom: 44px; min-width: 220px; max-width: 420px; padding: 11px 16px; border: 1px solid #4b5542; border-radius: 7px; background: #1c2118; color: var(--text); text-align: center; font-size: 11px; box-shadow: 0 10px 30px #0008; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 100; transition: 180ms ease; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

#videoLabDialog { width: min(1480px, calc(100vw - 24px)); max-width: none; height: min(920px, calc(100vh - 24px)); max-height: none; overflow: hidden; border-color: #4b573c; background: #0e110d; }
#videoLabDialog::backdrop { background: rgba(3,5,3,.88); }
.video-lab-shell { height: 100%; overflow: auto; background: radial-gradient(circle at 82% 0, rgba(216,255,72,.1), transparent 28%), linear-gradient(145deg, #10140e, #090b08 60%); }
.video-lab-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid #30382a; background: rgba(15,18,13,.94); backdrop-filter: blur(14px); }
.video-lab-header .eyebrow { margin: 0 0 4px; font-size: 8px; }
.video-lab-header h2 { margin: 0; font: 700 24px/1 "Chakra Petch", "Noto Sans SC"; letter-spacing: -.02em; }
.video-lab-header p { margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.video-lab-header-actions { display: flex; align-items: center; gap: 8px; }
.video-lab-header-actions .icon-button { border: 1px solid var(--line); font-size: 25px; }
.video-lab-empty { display: grid; place-items: center; align-content: center; min-height: calc(100% - 94px); padding: 48px; text-align: center; }
.video-lab-empty > span { font-size: 64px; filter: drop-shadow(0 14px 30px #000); }
.video-lab-empty strong { margin-top: 18px; font: 700 24px "Chakra Petch", "Noto Sans SC"; }
.video-lab-empty small { max-width: 520px; margin: 9px 0 24px; color: var(--muted); line-height: 1.7; }
.video-lab-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; padding: 14px; }
.video-section { min-width: 0; padding: 16px; border: 1px solid #2e3628; border-radius: 10px; background: rgba(20,24,18,.9); box-shadow: 0 10px 30px rgba(0,0,0,.16); }
.video-stage-section, .video-review-section, .video-export-section { grid-column: 1; }
.video-controls-column { grid-column: 2; grid-row: 1; display: grid; align-content: start; gap: 12px; }
.video-timeline-section, .video-matte-section { align-self: start; }
.video-review-section { grid-row: 2; }
.video-export-section { grid-column: 1 / -1; }
.video-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.video-section-heading > div:first-child > span { display: block; margin-bottom: 3px; color: var(--accent); font: 700 8px "Chakra Petch"; letter-spacing: .14em; }
.video-section-heading h3 { margin: 0; font: 700 15px "Chakra Petch", "Noto Sans SC"; }
.video-meta { color: var(--muted); text-align: right; font: 600 10px/1.6 "Chakra Petch"; }
.video-preview-grid { --video-aspect-ratio: 16 / 9; display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 10px; }
.video-preview-card { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #31392b; border-radius: 8px; background: #080a07; }
.video-preview-card figcaption { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; color: var(--muted); font-size: 9px; }
.video-preview-card figcaption strong { color: var(--text); font-size: 10px; }
.video-media-stage { display: grid; place-items: center; width: 100%; aspect-ratio: var(--video-aspect-ratio); max-height: min(64vh, 720px); overflow: hidden; background: #050605; }
.video-media-stage.checkerboard { background-color: #ddd; background-image: linear-gradient(45deg,#aaa 25%,transparent 25%),linear-gradient(-45deg,#aaa 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#aaa 75%),linear-gradient(-45deg,transparent 75%,#aaa 75%); background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0; }
.video-media-stage video, .video-media-stage canvas { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
#videoSource { cursor: crosshair; }
.video-play-row { display: grid; grid-template-columns: auto auto; align-items: center; gap: 9px; }
.video-play-row > span { color: var(--muted); font: 600 9px "Chakra Petch"; }
.video-progress-track { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 99px; background: #080a07; }
.video-progress-track i, .video-export-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #9cb52f, var(--accent)); transition: width 80ms linear; }
.video-range-grid { display: grid; gap: 13px; margin-top: 16px; }
.video-range-grid label { display: grid; grid-template-columns: minmax(0,1fr) 72px; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.video-range-grid label > span { grid-column: 1 / -1; color: #c5ccb9; font-size: 10px; }
.video-range-grid input[type="number"] { height: 28px; }
.video-matte-grid { display: grid; gap: 13px; }
.video-matte-grid > label:not(.video-color-control) { display: grid; gap: 7px; color: #c3cab8; font-size: 10px; }
.video-matte-grid output { float: right; color: var(--accent); font: 600 9px "Chakra Petch"; }
.video-color-control { display: grid; grid-template-columns: minmax(0,1fr) 34px 66px; align-items: center; gap: 7px; color: #c3cab8; font-size: 10px; }
.video-color-control input { width: 32px; height: 27px; padding: 0; border: 0; background: transparent; }
.video-color-control code { color: var(--text); font: 600 9px "Chakra Petch"; }
.video-color-control button { grid-column: 1 / -1; }
.video-switch { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.video-switch input { accent-color: var(--accent); }
.video-note { margin: 13px 0 0; padding: 9px 10px; border-left: 2px solid #6d7d3c; background: #10140e; color: var(--muted); font-size: 9px; line-height: 1.65; }
.video-review-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; min-height: 170px; }
.video-review-grid > p { grid-column: 1 / -1; align-self: center; margin: 0; color: #697260; text-align: center; font-size: 10px; }
.video-review-frame { position: relative; overflow: hidden; padding: 0; border: 1px solid #35402e; border-radius: 6px; background: #080a07; cursor: pointer; }
.video-review-frame:hover { border-color: var(--accent); transform: translateY(-1px); }
.video-review-frame img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background-color: #ddd; background-image: linear-gradient(45deg,#aaa 25%,transparent 25%),linear-gradient(-45deg,#aaa 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#aaa 75%),linear-gradient(-45deg,transparent 75%,#aaa 75%); background-size: 14px 14px; }
.video-review-frame span { position: absolute; right: 5px; bottom: 5px; padding: 3px 5px; border-radius: 4px; background: #080a07d9; color: var(--accent); font: 600 8px "Chakra Petch"; }
.video-export-options { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; align-items: end; gap: 9px; }
.video-export-options label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.video-export-options select { height: 36px; }
.video-export-options input[type="color"] { width: 100%; height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: #0e110d; }
.video-export-format-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.video-export-format-row .button { display: flex; min-height: 58px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; border-color: var(--line); text-align: left; }
.video-export-format-row .button:hover:not(:disabled) { border-color: #67754d; }
.video-export-format-row strong { color: var(--text); font: 700 10px "Chakra Petch", "Noto Sans SC"; }
.video-export-format-row small { color: var(--muted); font-size: 8px; }
.video-export-format-row .button:disabled { opacity: .42; cursor: not-allowed; }
.video-format-badge { padding: 5px 7px; border: 1px solid #485336; border-radius: 99px; color: var(--accent); font: 700 8px "Chakra Petch"; letter-spacing: .08em; }
.video-export-progress { position: relative; height: 24px; margin-top: 12px; overflow: hidden; border: 1px solid #34402c; border-radius: 5px; background: #080a07; }
.video-export-progress span { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text); font-size: 9px; }
.video-export-result { display: grid; grid-template-columns: minmax(0, 520px) minmax(220px,1fr); align-items: center; gap: 16px; margin-top: 13px; padding: 12px; border: 1px solid #3d4932; border-radius: 8px; background: #0a0d09; }
.video-export-result video { display: block; width: 100%; max-height: 290px; background: #050605; }
.video-export-result > div { display: grid; gap: 13px; }
.video-export-result strong { color: #dce4d3; font: 600 11px/1.7 "Chakra Petch", "Noto Sans SC"; }

@media (max-width: 1100px) {
  .video-lab-workspace { grid-template-columns: 1fr; }
  .video-stage-section, .video-review-section, .video-export-section, .video-controls-column { grid-column: 1; grid-row: auto; }
  .video-export-options { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .video-export-options .button { min-height: 36px; }
}

@media (max-width: 980px) {
  :root { --panel-width: 250px; }
  .topbar .brand small, .top-actions .button.ghost, .button.accent b, .context-group:nth-child(2) { display: none; }
  .context-bar { gap: 7px; }
  .context-group { gap: 4px; }
}
@media (max-width: 720px) {
  :root { --rail-width: 58px; --panel-width: 100%; }
  .app-shell { grid-template: 56px minmax(0,1fr) 248px / var(--rail-width) minmax(0,1fr); }
  .topbar { height: 56px; }
  .brand { min-width: 0; }
  .brand strong { font-size: 14px; }
  .top-actions .divider, #saveButton { display: none; }
  .inspector { grid-row: 3; grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; border-left: 0; border-top: 1px solid var(--line); }
  .inspector.removal-active { display: block; }
  .background-removal-panel { min-height: auto; }
  .properties-panel, .palette-panel { display: none; }
  .layers-panel { border-left: 1px solid var(--line); }
  .layer-list { max-height: 160px; }
  .context-bar { overflow-x: auto; }
  .context-group:first-child { display: none; }
  .canvas-stage { padding: 52px; }
  #videoLabDialog { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .video-lab-header { padding: 12px; }
  .video-lab-header h2 { font-size: 18px; }
  .video-lab-header p, .video-entry-button { display: none; }
  .video-lab-workspace { padding: 8px; }
  .video-preview-grid, .video-review-grid, .video-export-result { grid-template-columns: 1fr; }
  .video-review-grid { min-height: 120px; }
  .video-export-options { grid-template-columns: 1fr 1fr; }
  .video-export-format-row { grid-template-columns: 1fr 1fr; }
}
