:root {
  font-family: "Cascadia Mono", "JetBrains Mono", "IBM Plex Mono", Consolas, "SFMono-Regular", monospace;
  color-scheme: light dark;
  --titlebar-height: 34px;
  --app-bg: #11131b;
  --panel-bg: #181b25;
  --panel-border: #2b3141;
  --preview-bg: #090b11;
  --surface: #1b1f2a;
  --surface-hover: #222839;
  --text: #dce7ff;
  --muted: #7380a4;
  --input-bg: #10131c;
  --input-border: #30384f;
  --status-bg: #151924;
  --status-text: #8fd3ff;
  --error-bg: #271820;
  --error-text: #ff6971;
  --primary: #d8954f;
  --primary-strong: #f0a85a;
  --secondary: #172235;
  --disabled: #34394a;
  --track: #30364b;
  --thumb-border: #0c0f17;
  --success: #5ba36a;
  --crop: #d8954f;
  --crop-bg: rgba(216, 149, 79, 0.14);
  --trim-removed: rgba(0, 0, 0, 0.56);
  --playback-removed: #000;
  --blue-line: #31536f;
  --orange-soft: rgba(216, 149, 79, 0.16);
  background: var(--app-bg);
  color: var(--text);
}

html {
  height: 100%;
  background: var(--app-bg);
}

:root[data-theme="light"] {
  color-scheme: light;
  --app-bg: #f3f4f6;
  --panel-bg: #ffffff;
  --panel-border: #d7dbe1;
  --preview-bg: #101214;
  --surface: #f7f8fa;
  --surface-hover: #eceff3;
  --text: #1d2025;
  --muted: #626a75;
  --input-bg: #fff;
  --input-border: #ccd2da;
  --status-bg: #f0f2f5;
  --status-text: #2b3038;
  --error-bg: #fff0f1;
  --error-text: #a11616;
  --primary: #245dcc;
  --primary-strong: #245dcc;
  --secondary: #e7ebf0;
  --disabled: #c4c9d1;
  --track: #d9dee5;
  --thumb-border: #fff;
  --success: #138a4b;
  --crop: #0f9f5f;
  --crop-bg: rgba(15, 159, 95, 0.14);
  --trim-removed: rgba(15, 21, 35, 0.42);
}

:root[data-theme="light"] h2 {
  color: #33415f;
}

:root[data-theme="light"] .upload-button,
:root[data-theme="light"] button,
:root[data-theme="light"] .download-link {
  color: #7a4f20;
}

:root[data-theme="light"] .small-action,
:root[data-theme="light"] .close-video-button {
  border-color: #b9c7da;
  color: #245dcc;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--app-bg);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.02em;
}

body.is-desktop {
  height: 100vh;
  overflow: hidden;
}

.desktop-titlebar {
  display: none;
}

body.is-desktop .desktop-titlebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  height: var(--titlebar-height);
  border: 0;
  border-bottom: 1px solid var(--blue-line);
  background: var(--panel-bg);
  color: var(--text);
  user-select: none;
}

.desktop-titlebar-drag {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  gap: 8px;
  padding: 0 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.desktop-titlebar-drag img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.desktop-titlebar-drag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-window-controls {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.desktop-window-controls button {
  width: 44px;
  height: 100%;
  border: 0;
  border-left: 1px solid var(--panel-border);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.desktop-window-controls button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.desktop-window-controls .window-close:hover {
  background: var(--error-text);
  color: #fff;
}

.desktop-resize-handles {
  display: none;
}

body.is-desktop .desktop-resize-handles {
  display: block;
}

body.is-window-maximized .desktop-resize-handles {
  display: none;
}

.resize-handle {
  position: fixed;
  z-index: 1000;
  pointer-events: auto;
}

.resize-top,
.resize-bottom {
  left: 12px;
  right: 12px;
  height: 8px;
}

.resize-top {
  top: 0;
  cursor: ns-resize;
}

.resize-bottom {
  bottom: 0;
  cursor: ns-resize;
}

.resize-left,
.resize-right {
  top: 12px;
  bottom: 12px;
  width: 8px;
}

.resize-left {
  left: 0;
  cursor: ew-resize;
}

.resize-right {
  right: 0;
  cursor: ew-resize;
}

.resize-top-left,
.resize-top-right,
.resize-bottom-right,
.resize-bottom-left {
  width: 16px;
  height: 16px;
}

.resize-top-left {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.resize-top-right {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}

.resize-bottom-right {
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
}

.resize-bottom-left {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  height: 100vh;
  min-height: 0;
}

body.is-desktop .app-shell {
  height: calc(100vh - var(--titlebar-height));
  min-height: 0;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 10px 12px 12px;
  gap: 10px;
}

.topbar {
  display: grid;
  grid-template-columns: max-content minmax(max-content, 1fr) max-content;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.topbar-title {
  justify-self: start;
  min-width: max-content;
}

.zoom-controls {
  min-width: max-content;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  flex-wrap: wrap;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #92a0c8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.2;
  white-space: nowrap;
  text-transform: uppercase;
}

h2 {
  color: #a8b6e3;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin: 0 -12px 10px;
  border-bottom: 1px solid var(--panel-border);
  padding: 10px 12px;
  background: var(--surface);
  text-transform: uppercase;
}

.upload-button,
button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(216, 149, 79, 0.72);
  border-radius: 5px;
  padding: 0 12px;
  background: rgba(216, 149, 79, 0.12);
  color: #ffb05e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.theme-slider {
  position: relative;
  width: 46px;
  height: 22px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--input-bg);
}

.theme-slider::before {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  content: "";
  background: var(--primary);
  transition: transform 140ms ease;
}

.theme-switch input:checked + .theme-slider::before {
  transform: translateX(24px);
}

.small-action {
  min-height: 30px;
  border-color: #365a78;
  color: #83d0ff;
  background: var(--secondary);
}

.small-action.is-active {
  border-color: var(--primary);
  background: var(--orange-soft);
  color: #ffb05e;
}

:root[data-theme="light"] .small-action,
:root[data-theme="light"] .close-video-button {
  color: var(--text);
}

.close-video-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 5px;
  padding: 0;
  background: var(--secondary);
  font-size: 13px;
  line-height: 1;
}

button:disabled {
  background: var(--disabled);
  border-color: #3d4353;
  color: #707895;
  cursor: not-allowed;
}

.preview-wrap {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 8px;
  min-height: 0;
  flex: 1 1 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px;
  background: var(--preview-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.preview-wrap.is-drag-over {
  border-color: var(--primary-strong);
}

.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 8;
  display: grid;
  place-items: center;
  border: 1px dashed var(--primary-strong);
  border-radius: 8px;
  background: rgba(13, 16, 24, 0.86);
  color: #ffb05e;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none;
}

.open-progress {
  position: absolute;
  z-index: 9;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 36px));
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 12px;
  background: rgba(17, 20, 29, 0.94);
  color: #8fd3ff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  pointer-events: none;
}

.open-progress[hidden] {
  display: none;
}

.open-progress-text {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.open-progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.open-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d8954f, #bf7145);
  transition: width 120ms ease;
}

.open-progress.is-indeterminate .open-progress-fill {
  position: absolute;
  width: 42%;
  animation: open-progress-slide 950ms ease-in-out infinite;
}

.open-progress-cancel {
  justify-self: end;
  border-color: var(--error-text);
  background: var(--error-bg);
  color: var(--error-text);
  pointer-events: auto;
}

@keyframes open-progress-slide {
  0% {
    left: -45%;
  }

  100% {
    left: 103%;
  }
}

.crop-overlay {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.crop-overlay[hidden] {
  display: none;
}

.crop-box {
  position: absolute;
  min-width: 12px;
  min-height: 12px;
  border: 2px solid var(--crop);
  background: var(--crop-bg);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  cursor: move;
  pointer-events: auto;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--crop);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.crop-handle-nw {
  top: -6px;
  left: -6px;
  cursor: nwse-resize;
}

.crop-handle-ne {
  top: -6px;
  right: -6px;
  cursor: nesw-resize;
}

.crop-handle-n,
.crop-handle-s {
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-handle-n {
  top: -6px;
}

.crop-handle-s {
  bottom: -6px;
}

.crop-handle-e,
.crop-handle-w {
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-handle-e {
  right: -6px;
}

.crop-handle-w {
  left: -6px;
}

.crop-handle-sw {
  bottom: -6px;
  left: -6px;
  cursor: nesw-resize;
}

.crop-handle-se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.zoom-controls {
  display: inline-flex;
  justify-self: center;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  background: var(--surface);
}

.zoom-controls button {
  min-width: 34px;
  min-height: 28px;
  border-radius: 0;
  padding: 0 9px;
  background: transparent;
  color: var(--text);
}

.zoom-controls button + button {
  border-left: 1px solid var(--panel-border);
}

.playback-controls {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: auto auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px;
  background: rgba(17, 20, 29, 0.92);
  color: #fff;
  backdrop-filter: blur(8px);
}

.playback-controls button {
  min-height: 28px;
  min-width: 36px;
  border-color: #365a78;
  border-radius: 5px;
  background: rgba(23, 34, 53, 0.8);
  color: #8fd3ff;
  font-size: 13px;
  line-height: 1;
}

.playback-controls button:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

.playback-controls input {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--primary-strong);
  appearance: none;
}

.playback-seek-wrap {
  position: relative;
  height: 20px;
}

.playback-seek-wrap::before,
.playback-selected,
.playback-removed {
  position: absolute;
  top: 50%;
  height: 5px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.playback-seek-wrap::before {
  right: 0;
  left: 0;
  content: "";
  background: rgba(255, 255, 255, 0.2);
}

.playback-selected {
  z-index: 1;
  background: var(--primary-strong);
}

.playback-removed {
  z-index: 2;
  background: var(--playback-removed);
}

.playback-controls input::-webkit-slider-runnable-track {
  height: 5px;
  background: transparent;
}

.playback-controls input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -4.5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary-strong);
  cursor: pointer;
  appearance: none;
}

.playback-controls input::-moz-range-track {
  height: 5px;
  background: transparent;
}

.playback-controls input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary-strong);
  cursor: pointer;
}

.playback-controls input:disabled::-webkit-slider-thumb {
  background: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
}

.playback-controls input:disabled::-moz-range-thumb {
  background: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
}

.playback-controls span {
  min-width: 78px;
  color: #fff;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: none;
}

.preview-wrap.has-video {
  cursor: grab;
}

.preview-wrap.is-panning,
.preview-wrap.is-panning video {
  cursor: grabbing;
}

.preview-wrap.is-panning video {
  transition: none;
}

.empty-state {
  position: absolute;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #d9e2f7;
  text-align: center;
}

.empty-state[hidden],
.empty-state.is-hidden {
  display: none;
}

.empty-state span {
  color: var(--muted);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border-left: 1px solid var(--panel-border);
  background: var(--app-bg);
  overflow: auto;
}

.status {
  min-height: 30px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 7px 9px;
  background: var(--status-bg);
  color: var(--status-text);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.status.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.tool-group {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0 12px 12px;
  background: var(--panel-bg);
}

.tool-group:first-child {
  padding-top: 0;
}

.tool-group + .status {
  margin-top: 0;
}

.history-actions {
  margin-bottom: 9px;
}

.history-list {
  display: grid;
  gap: 3px;
  max-height: 150px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  counter-reset: history-step;
}

.history-list li {
  counter-increment: history-step;
  position: relative;
  border-left: 2px solid var(--panel-border);
  padding: 5px 7px 5px 28px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.history-list li::before {
  content: counter(history-step);
  position: absolute;
  left: 7px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.history-list li.is-active {
  border-left-color: var(--accent);
  background: var(--control-bg);
  color: var(--text);
}

.history-list li.is-future {
  opacity: 0.5;
}

.history-list li.history-empty {
  counter-increment: none;
  padding-left: 7px;
  font-style: italic;
}

.history-list li.history-empty::before {
  content: none;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 5px 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.04em;
}

button:hover:not(:disabled),
.upload-button:hover,
.download-link:hover {
  border-color: var(--primary-strong);
  filter: brightness(1.08);
}

.small-action:hover:not(:disabled),
.close-video-button:hover:not(:disabled),
.zoom-controls button:hover:not(:disabled) {
  background: var(--surface-hover);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.download-link:focus-visible,
.upload-button:focus-within {
  outline: 2px solid var(--primary-strong);
  outline-offset: 2px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.scale-percent-label {
  margin-top: 8px;
}

.trim-slider {
  display: grid;
  gap: 8px;
}

.trim-track {
  position: relative;
  height: 28px;
}

.trim-track::before,
.trim-selected,
.trim-removed {
  position: absolute;
  top: 50%;
  height: 6px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.trim-track::before {
  right: 0;
  left: 0;
  content: "";
  background: var(--track);
}

.trim-selected {
  z-index: 2;
  left: 0;
  width: 0;
  background: linear-gradient(90deg, #d8954f, #bf7145);
}

.trim-removed {
  z-index: 1;
  width: 0;
  background: var(--trim-removed);
}

.frame-range {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: 100%;
  height: 28px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
}

.frame-range::-webkit-slider-runnable-track {
  height: 6px;
  background: transparent;
}

.frame-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 2px solid var(--thumb-border);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 1px 5px rgba(24, 32, 51, 0.28);
  cursor: grab;
  pointer-events: auto;
  appearance: none;
}

.frame-range::-moz-range-track {
  height: 6px;
  background: transparent;
}

.frame-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--thumb-border);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 1px 5px rgba(24, 32, 51, 0.28);
  cursor: grab;
  pointer-events: auto;
}

.frame-range:disabled::-webkit-slider-thumb {
  background: var(--disabled);
  cursor: not-allowed;
}

.frame-range:disabled::-moz-range-thumb {
  background: var(--disabled);
  cursor: not-allowed;
}

.trim-values {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.trim-summary {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.trim-summary strong {
  color: var(--text);
  font-weight: 650;
}

.trim-duration-input {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.trim-duration-input input {
  margin-top: 4px;
}

.tool-group button,
.tool-group .download-link {
  width: 100%;
  margin-top: 8px;
}

.button-row {
  display: flex;
  gap: 8px;
}

.button-row button {
  flex: 1;
  width: auto;
}

.crop-aspect-lock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: end;
  gap: 8px;
  margin-top: 8px;
}

.crop-aspect-lock .settings-check {
  min-height: 32px;
}

input.is-invalid {
  border-color: var(--error-text);
}

.crop-info {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.crop-info div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.crop-info strong {
  color: var(--text);
  font-weight: 650;
  text-align: right;
}

.crop-info strong.is-exact {
  color: #79d98b;
}

.crop-info strong.is-approximate {
  color: #f0c86a;
}

.download-link {
  border-color: #5ba36a;
  background: rgba(91, 163, 106, 0.14);
  color: #8bd29a;
}

.render-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.render-progress[hidden] {
  display: none;
}

.render-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.render-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d8954f, #bf7145);
  transition: width 160ms ease;
}

.cancel-render-button {
  margin-top: 8px;
  border-color: var(--error-text);
  background: var(--error-bg);
  color: var(--error-text);
}

.render-file-name {
  margin-top: 9px;
}

.desktop-only-setting {
  display: none;
}

body.is-desktop .desktop-only-setting {
  display: grid;
}

.render-progress span {
  min-width: 42px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 8, 12, 0.72);
}

.modal-backdrop[hidden] {
  display: none;
}

.settings-dialog,
.open-warning-dialog {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--panel-bg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.settings-dialog {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  min-height: 260px;
  padding: 0 16px 16px;
}

.settings-fields {
  min-height: 0;
  overflow: auto;
}

.settings-presets {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0 10px 10px;
  background: var(--status-bg);
}

.settings-presets h3 {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-preset-actions,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-preset-actions button {
  width: auto;
  flex: 1;
}

.settings-actions {
  justify-content: space-between;
  margin-top: 14px;
  border-top: 1px solid var(--panel-border);
  padding-top: 12px;
}

.settings-actions .settings-help {
  margin: 0;
}

.settings-actions button {
  width: auto;
  min-width: 110px;
}

.open-warning-dialog {
  display: grid;
  gap: 14px;
  width: min(480px, 100%);
  padding: 18px;
}

.settings-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 5px;
  padding: 0;
  background: var(--secondary);
  color: #8fd3ff;
  font-size: 13px;
  line-height: 1;
}

.settings-dialog [hidden] {
  display: none;
}

body.is-hosted .local-only-setting {
  display: none;
}

body.is-hosted .local-only-history {
  display: none;
}

.open-warning-message {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.open-warning-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 14px;
  margin: 0;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 12px;
  background: var(--status-bg);
}

.open-warning-details dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.open-warning-details dd {
  overflow-wrap: anywhere;
}

.open-warning-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.open-warning-actions button {
  width: auto;
  min-width: 94px;
}

.primary-action {
  border-color: var(--primary-strong);
  background: var(--primary);
  color: #11131b;
}

.settings-fields {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-right: 40px;
}

.folder-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.folder-picker button {
  width: auto;
  margin-top: 0;
}

.settings-help {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  letter-spacing: 0.08em;
}

.settings-help.is-ok {
  color: var(--success);
}

.settings-help.is-error {
  color: var(--error-text);
}

.upload-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.settings-check input {
  width: 15px;
  min-height: 15px;
  margin: 0;
}

.settings-check span {
  color: var(--text);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .topbar {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .topbar-title,
  .zoom-controls,
  .topbar-actions {
    justify-self: auto;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .close-video-button {
    align-self: flex-start;
  }

  .playback-controls {
    grid-template-columns: auto auto minmax(80px, 1fr);
  }

  .playback-controls span {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: center;
  }

  video {
    max-height: 100%;
  }
}
