:root {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: #f4f1f4;
  background: #121218;
  font-synthesis: none;
  --surface: #1b1a23;
  --surface-raised: #22212c;
  --border: #353342;
  --muted: #a8a5b5;
  --variant: #c2becd;
  --accent: #ffb495;
  --accent-dark: #301d1c;
  --focus: #ffd3c2;
}
* { box-sizing: border-box; }
[hidden], .sprite { display: none !important; }
body { margin: 0; min-width: 300px; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .47; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button:not(:disabled) { transition: background .15s, color .15s, border-color .15s; }
a { color: var(--accent); }
svg { display: inline-block; width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { border-bottom: 1px solid #2b2935; }
.topbar-inner { min-height: 70px; max-width: 1380px; padding: 0 42px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.identity, .topbar-actions, .icon-label, .local-label { display: inline-flex; align-items: center; gap: 10px; }
.identity { text-decoration: none; color: #fcf8fb; font-size: 1.3rem; font-weight: 760; letter-spacing: -.045em; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; color: var(--accent-dark); background: var(--accent); }
.brand-mark svg { width: 28px; height: 28px; stroke-width: 1.9; }
.brand-end { color: var(--accent); }
.topbar-actions { gap: 24px; }
.local-label { color: var(--muted); font-size: .875rem; }
.local-label svg { width: 17px; height: 17px; }
.plain { border: 0; background: none; padding: 0; color: var(--variant); font-size: .875rem; }
.plain:hover:not(:disabled) { color: var(--accent); }
.icon-label { padding: 8px 0 8px 7px; }
.workspace { max-width: 1380px; padding: 0 42px; margin: 0 auto; }
.intro { margin: 49px 0 31px; }
.intro h1 { margin: 0; font-size: clamp(2.25rem, 5.15vw, 3.8rem); font-weight: 740; line-height: 1.08; letter-spacing: -.065em; }
.intro p { margin: 12px 0 0; color: var(--variant); font-size: 1.05rem; }
.studio { display: grid; grid-template-columns: minmax(288px, 335px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }
.controls { display: flex; flex-direction: column; }
.setting { padding: 18px 19px 17px; border-bottom: 1px solid #302e3b; }
.setting h2, .quality-settings > label, .section-heading h2 { margin: 0 0 11px; font-size: .95rem; font-weight: 660; letter-spacing: -.013em; }
.quality-settings > label { display: block; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-heading h2 { margin: 0; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 69px; padding: 7px 4px; color: var(--variant); background: var(--surface-raised); border: 1px solid #373543; border-radius: 9px; font-size: .875rem; font-weight: 580; }
.mode:hover:not(:disabled) { border-color: #777181; background: #2b2837; }
.mode.active { color: var(--accent); background: #322727; border-color: #a87165; }
.mode svg { width: 22px; height: 22px; }
.subtext { margin: 8px 0 0; color: var(--muted); font-size: .875rem; line-height: 1.42; }
.source-actions { margin-top: 8px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 41px; padding: 7px 13px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; font-weight: 650; white-space: nowrap; }
.button svg { width: 18px; height: 18px; }
.button.secondary:hover:not(:disabled) { background: #302d3b; border-color: #6a6378; }
.button.primary { min-height: 46px; color: var(--accent-dark); background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: #ffd0bd; border-color: #ffd0bd; }
.button.full, .setting select { width: 100%; }
select, input[type="number"] { max-width: 100%; min-height: 39px; border: 1px solid var(--border); border-radius: 8px; background-color: #181720; padding: 7px 10px; font-size: .875rem; }
select { appearance: none; padding-right: 37px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23bdb8c8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.number-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.number-grid label, .roll-actions + label { display: block; color: var(--variant); font-size: .875rem; }
.number-grid input, #overlap { display: block; width: 100%; margin-top: 4px; }
.check-row { display: flex; align-items: start; gap: 8px; margin: 8px 0; color: var(--variant); font-size: .875rem; }
.check-row input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--accent); }
.roll-actions { margin: 12px 0 9px; }
.muted { color: var(--muted); }
.capture-actions { padding: 17px 19px; }
.new-button { display: block; margin: 12px auto 0; }
.stage { align-self: stretch; display: flex; flex-direction: column; min-width: 0; }
.stage-top, .stage-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding: 0 15px; }
.stage-top { border-bottom: 1px solid #302e3b; }
.preview-tabs { display: flex; align-self: stretch; gap: 16px; }
.preview-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; position: relative; white-space: nowrap; padding: 0 2px; }
.preview-tabs .active { color: #f8f3f6; font-weight: 650; }
.preview-tabs .active::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 2px; }
.indicator { width: 7px; height: 7px; border-radius: 50%; background: #666175; }
.indicator.live { background: #a4dda9; }
.source-meta { text-align: right; color: var(--muted); font-size: .875rem; }
.preview { flex: 1; display: grid; place-items: center; min-width: 0; min-height: 415px; max-height: 72vh; padding: 12px; background: radial-gradient(circle, #3b3647 1px, transparent 1px) 0 0 / 13px 13px, #16151e; overflow: auto; }
.empty-state { text-align: center; width: min(100%, 420px); padding: 20px; }
.empty-symbol { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 17px; color: var(--accent); background: #332825; border: 1px solid #634940; border-radius: 19px; }
.empty-symbol svg { width: 34px; height: 34px; stroke-width: 1.4; }
.empty-state h2 { margin: 0; font-size: 1.31rem; letter-spacing: -.035em; }
.empty-state p { margin: 8px auto 17px; max-width: 33ch; color: var(--muted); font-size: .95rem; line-height: 1.45; }
.source-options { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.source-options span { display: flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 8px; border: 1px solid #3a3748; border-radius: 6px; background: #221f2b; color: var(--variant); font-size: .8125rem; }
.source-options svg { width: 16px; height: 16px; }
.media-display { display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; min-width: 0; }
.media-frame { position: relative; width: max-content; max-width: 100%; line-height: 0; overflow: hidden; border-radius: 5px; background: #101014; }
.media-frame video, #result-canvas { display: block; max-width: 100%; max-height: min(66vh, 680px); width: auto; height: auto; object-fit: contain; }
.crop-overlay { cursor: crosshair; touch-action: none; position: absolute; inset: 0; }
.crop-box { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 200vmax #07060ab3; pointer-events: none; }
.crop-box span { position: absolute; display: inline-block; top: 2px; left: 2px; padding: 4px; color: var(--accent-dark); background: var(--accent); font-size: .8125rem; white-space: nowrap; line-height: 1; }
.stage-bottom { min-height: 66px; border-top: 1px solid #302e3b; }
.result-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.result-info > svg { color: var(--accent); }
.result-info > div { display: grid; gap: 2px; }
.result-info strong { font-size: .9rem; }
.result-info span { color: var(--muted); font-size: .8125rem; }
.export-controls, .pdf-options { display: flex; align-items: center; gap: 8px; }
.pdf-options { justify-content: flex-end; flex-wrap: wrap; padding: 12px 15px; border-top: 1px solid #302e3b; }
.pdf-options label { display: flex; align-items: center; gap: 7px; color: var(--variant); font-size: .875rem; }
.status { min-height: 1.375rem; margin: 13px 0 0; color: var(--variant); font-size: .9rem; }
.status.error { color: #ffbaa8; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 20px 0 31px; padding-top: 17px; border-top: 1px solid #2b2935; color: var(--muted); font-size: .875rem; }
#desktop-downloads { display: flex; flex-wrap: wrap; gap: 14px; }
#desktop-downloads a { color: var(--variant); }
#desktop-downloads a:hover { color: var(--accent); }
dialog { width: min(92vw, 550px); color: #f4f1f4; background: var(--surface); border: 1px solid #494554; border-radius: 16px; padding: 22px; }
dialog::backdrop { background: #08070bc9; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-header h2 { margin: 0; font-size: 1.4rem; }
.dialog-header button { display: grid; place-items: center; padding: 7px; }
dialog dt { margin-top: 14px; font-weight: 650; }
dialog dd { margin: 4px 0 0; color: var(--variant); line-height: 1.47; }
@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(250px, 275px) minmax(0, 1fr); gap: 12px; }
  .workspace, .topbar-inner { padding-inline: 24px; }
  .source-meta { font-size: .8125rem; }
}
@media (max-width: 670px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .intro { margin-top: 34px; }
  .controls { order: 0; }
  .stage { order: 1; }
  .preview { min-height: 310px; }
  .workspace, .topbar-inner { padding-inline: 14px; }
}
@media (max-width: 385px) {
  .local-label { display: none; }
  .stage-top, .stage-bottom { padding-inline: 9px; }
  .stage-bottom { align-items: flex-start; flex-direction: column; padding-block: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; } }
.preview.result-pane { place-items: start center; }
.result-pane .media-display { height: auto; }
#result-canvas { max-height: none; }

.folder-options { min-height: 44px; padding: 7px 15px; display: flex; flex-wrap: wrap; gap: 3px 16px; justify-content: space-between; align-items: center; border-top: 1px solid #302e3b; }
.folder-options > div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.folder-options .subtext { margin: 0; overflow-wrap: anywhere; }
.folder-options .check-row { margin: 0; }

.source-action-buttons { display: flex; flex-wrap: wrap; gap: 5px 14px; }
.media-frame.controlling { cursor: pointer; outline: 2px solid var(--accent); outline-offset: 2px; }

.navigation-bar { display: grid; gap: 7px; padding: 11px 15px; border-bottom: 1px solid #302e3b; }
.navigation-actions, .navigation-buttons { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.navigation-actions .button { min-height: 34px; padding: 6px 11px; font-size: .875rem; }
.navigation-actions .plain { min-height: 34px; padding: 5px 3px; }
.navigation-bar p { margin: 0; }
#open-standalone, #control-hint { color: var(--accent); font-size: .875rem; }
.preview.controlling-source { overscroll-behavior: contain; }

.export-controls { flex-wrap: wrap; }
.editor-dialog {
  width: min(1370px, calc(100% - 26px)); max-width: none;
  height: min(860px, calc(100% - 26px)); max-height: none;
  padding: 0; overflow: hidden; background: #1b1a23;
}
.editor-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.editor-header, .editor-toolbar, .editor-footer { padding: 12px 17px; }
.editor-header, .editor-toolbar, .editor-header-actions, .editor-tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.editor-header, .editor-toolbar { justify-content: space-between; border-bottom: 1px solid var(--border); }
.editor-header h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.035em; }
.editor-header p { margin: 4px 0 0; }
.editor-header-actions .button { min-height: 37px; }
.editor-toolbar { background: #201e2a; padding-block: 9px; }
.editor-tool { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; min-height: 36px; background: #252331; border: 1px solid #3b384a; border-radius: 7px; font-size: .82rem; }
.editor-tool svg { width: 17px; height: 17px; }
.editor-tool:hover:not(:disabled) { border-color: #83778d; background: #312d3e; }
.editor-tool[aria-pressed="true"], .editor-tool[aria-pressed="true"]:hover { color: var(--accent); background: #36282a; border-color: #a46c62; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 246px; min-height: 0; }
.editor-viewport { position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px; background: #13121b; background-image: radial-gradient(#3b3547 1px, transparent 1px); background-size: 14px 14px; }
.editor-viewport:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.editor-sheet { position: relative; display: block; margin-inline: auto; background: #1d1b26; box-shadow: 0 0 0 1px #454052; user-select: none; }
.editor-sheet:not([data-tool="pan"]) { cursor: crosshair; touch-action: none; }
.editor-sheet[data-tool="text"] { cursor: text; }
.editor-sheet[data-tool="pan"] { cursor: grab; }
.editor-sheet[data-panning] { cursor: grabbing; }
.editor-sheet canvas { position: absolute; display: block; max-width: none; pointer-events: none; }
.editor-side { min-width: 0; min-height: 0; padding: 15px; overflow: auto; border-left: 1px solid var(--border); }
.editor-field { display: grid; gap: 5px; color: var(--variant); font-size: .86rem; font-weight: 570; }
.editor-field input, .editor-field select, .editor-field textarea { width: 100%; }
.editor-field input[type="color"] { height: 33px; padding: 4px; background: #181720; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.editor-field textarea { min-height: 64px; resize: vertical; padding: 8px 9px; color: #f4f1f4; background: #181720; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.editor-field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.editor-help { margin: 11px 0; }
.editor-marks { display: grid; gap: 9px; }
.editor-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.editor-swatches button { width: 25px; height: 25px; border: 1px solid #686074; border-radius: 5px; background: var(--swatch); }
.editor-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 1px #15131d, 0 0 0 2px var(--focus); }
.editor-selection-actions { display: grid; gap: 6px; margin-top: 12px; }
.editor-selection-actions .button { min-height: 33px; font-size: .82rem; padding: 5px 8px; }
.editor-position { margin-top: 13px; border-block: 1px solid #302e3b; padding: 8px 0; }
.editor-position summary { color: var(--variant); cursor: pointer; font-size: .86rem; }
.editor-coordinate-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.editor-coordinate-fields input { padding-inline: 6px; }
.editor-annotation-list { margin-top: 13px; }
.editor-annotation-list .plain { margin-top: 7px; text-align: left; }
.editor-footer { padding-block: 8px; border-top: 1px solid var(--border); }
.editor-footer p { margin: 0; min-height: 1.2rem; }

@media (max-width: 720px) {
  .editor-dialog { width: calc(100% - 12px); height: calc(100% - 12px); }
  .editor-header, .editor-toolbar, .editor-footer { padding-inline: 10px; }
  .editor-header { padding-block: 8px; }
  .editor-header h2 { font-size: 1.18rem; }
  .editor-tool { min-height: 33px; padding: 5px 7px; }
  .editor-tool-group { gap: 5px; }
  .editor-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, min(26vh, 210px)); }
  .editor-side { border-left: 0; border-top: 1px solid var(--border); padding: 9px 12px; }
  .editor-viewport { padding: 12px; }
}

.scroll-edge-settings { margin-top: 9px; color: var(--variant); font-size: .875rem; }
.scroll-edge-settings summary { cursor: pointer; }
.scroll-edge-settings label { display: block; margin: 9px 0 5px; }
.scroll-edge-settings input { width: 100%; }

.cloud-dialog { width: min(94vw, 680px); max-height: min(830px, 90vh); overflow: auto; }
.cloud-dialog .status { min-height: 0; margin: 9px 0 0; }
.cloud-dialog .status:empty { display: none; }
.cloud-dialog .button { text-decoration: none; }
.cloud-card { margin-top: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-raised); }
.cloud-card p { margin: 0; line-height: 1.45; }
.cloud-card p + p, .cloud-card p + a, .cloud-card .cloud-form-actions + p { margin-top: 9px; }
.cloud-card h3, .cloud-library h3 { margin: 0 0 8px; font-size: 1rem; }
.cloud-identity { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cloud-identity strong, .cloud-item strong { overflow-wrap: anywhere; }
.cloud-identity a { white-space: nowrap; }
.cloud-save { border-color: #816259; color: var(--accent); }
.cloud-form-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.cloud-form-actions label { display: grid; min-width: 0; gap: 4px; color: var(--variant); font-size: .875rem; }
.cloud-form-actions .button { min-height: 39px; }
.cloud-form-actions input[type="email"] { width: min(58vw, 270px); min-height: 39px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; background: #181720; }
.cloud-library { margin-top: 16px; }
.cloud-list { margin: 0; padding: 0; list-style: none; }
.cloud-item { display: flex; justify-content: space-between; align-items: center; gap: 7px 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.cloud-item > div:first-child { min-width: 0; }
.cloud-item strong { display: block; font-size: .875rem; }
.cloud-item .subtext { display: block; margin: 3px 0 0; }
.cloud-item-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.cloud-item-actions .plain { padding: 6px 0; }
.cloud-item-actions .plain:hover, .cloud-identity .plain:hover { color: var(--accent); }
.cloud-admin summary { cursor: pointer; font-weight: 650; }
.cloud-admin summary + p, .cloud-admin .cloud-form-actions, .cloud-admin .cloud-list, #cloud-retry, #cloud-more { margin-top: 9px; }
@media (max-width: 600px) {
  .topbar-actions { gap: 12px; }
  .topbar .local-label { display: none; }
  .stage-bottom { align-items: flex-start; flex-direction: column; padding-block: 10px; }
  .cloud-dialog { padding: 15px; }
  .cloud-item { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 340px) {
  #cloud-open svg, #help-open svg { display: none; }
}
