:root {
  color-scheme: dark;
  --bg-page: #050807;
  --card: rgba(255, 255, 255, 0.07);
  --text-main: #f4fffb;
  --text-secondary: rgba(244, 255, 251, 0.68);
  --primary: #00e0b8;
  --primary-hover: #16f2c2;
  --primary-soft: rgba(0, 224, 184, 0.12);
  --primary-border: rgba(124, 247, 255, 0.3);
  --accent-gold: #d8a85f;
  --border: rgba(255, 255, 255, 0.12);
  --mint-wash: rgba(0, 224, 184, 0.08);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --ink: var(--text-main);
  --muted: var(--text-secondary);
  --line: var(--border);
  --paper: rgba(255, 255, 255, 0.06);
  --panel: var(--card);
  --accent: var(--primary);
  --accent-strong: var(--primary-hover);
  --accent-soft: var(--primary-soft);
  --warn: #ffb86b;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 20px 60px rgba(0, 224, 184, 0.14);
  --focus-ring: 0 0 0 3px rgba(0, 224, 184, 0.18);
  --checker-tile: rgba(124, 247, 255, 0.16);
}

* {
  box-sizing: border-box;
}

[data-option][hidden] {
  display: none !important;
}

[hidden] {
  display: none !important;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 10%, rgba(0, 224, 184, 0.18), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(124, 247, 255, 0.14), transparent 28%),
    radial-gradient(circle at 62% 92%, rgba(184, 255, 92, 0.08), transparent 34%),
    linear-gradient(135deg, #050807 0%, #07100f 48%, #0b1412 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 24%, rgba(0, 224, 184, 0.18), transparent 24%),
    radial-gradient(circle at 12% 72%, rgba(124, 247, 255, 0.1), transparent 30%);
  filter: blur(12px);
  animation: cinematic-drift 18s ease-in-out infinite alternate;
  z-index: -1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.16;
  z-index: -1;
}

@keyframes cinematic-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 1%, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  min-width: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto;
}

.panel,
.stage {
  border: 1px solid rgba(221, 232, 226, 0.88);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tools-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 253, 250, 0.76)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 24px 70px rgba(16, 35, 30, 0.12);
}

.sidebar-tools {
  margin: 4px 0 0;
  width: 100%;
}

.sidebar-tools.free-cutout-links {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-self: stretch;
  align-items: stretch;
  width: 100%;
}

.sidebar-tools .free-link-buttons,
.free-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
  gap: 10px;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(169, 215, 203, 0.62);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(246, 251, 248, 0.86);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 188px;
  padding: 22px;
  border: 1.5px dashed var(--primary-border);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(202, 220, 211, 0.32) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(202, 220, 211, 0.32) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(202, 220, 211, 0.32) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(202, 220, 211, 0.32) 75%),
    rgba(250, 253, 251, 0.82);
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.drop-zone.is-hidden {
  display: none;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 12px 26px rgba(15, 122, 104, 0.22);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.drop-title {
  display: block;
  font-weight: 780;
}

.drop-copy {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.control-group {
  display: grid;
  gap: 10px;
}

.control-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.control-label,
.field span,
.slider-row span {
  color: #405149;
  font-size: 13px;
  font-weight: 760;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(230, 245, 240, 0.6);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: center;
  cursor: pointer;
}

.segmented input:checked + span {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(16, 35, 30, 0.1);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 12px);
}

.field {
  display: grid;
  gap: 8px;
}

.color-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 5px 10px 5px 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.color-row input[type="color"] {
  width: 36px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.color-row input[type="color"]:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

select {
  appearance: none;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 52%,
    calc(100% - 14px) 52%;
  background-repeat: no-repeat;
  background-size:
    6px 6px,
    6px 6px;
  color: var(--ink);
  overflow: hidden;
  padding: 0 40px 0 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select.native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 12px 0 14px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  cursor: pointer;
}

.custom-select-button:hover {
  border-color: var(--primary-border);
  background: #fff;
}

.custom-select-button:focus-visible,
.custom-select.is-open .custom-select-button {
  border-color: var(--primary);
  outline: 0;
  box-shadow: var(--focus-ring);
}

.custom-select-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.custom-select-label,
.custom-select-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 150ms ease;
}

.custom-select.is-open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 100%;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--primary-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(16, 35, 30, 0.14);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: var(--primary-soft);
}

.custom-select-option[aria-selected="true"] {
  color: var(--primary-hover);
  font-weight: 800;
}

.custom-select-check {
  color: var(--primary);
  font-weight: 900;
  opacity: 0;
}

.custom-select-option[aria-selected="true"] .custom-select-check {
  opacity: 1;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  padding: 0 12px;
}

.api-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 252, 249, 0.8);
}

.api-panel[hidden] {
  display: none;
}

.api-help {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.api-help a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.api-help a:hover {
  text-decoration: underline;
}

.api-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.api-actions a {
  text-decoration: none;
}

.api-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.api-status.is-ok {
  color: var(--accent-strong);
}

.api-status.is-error {
  color: #b91c1c;
}

.slider-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: var(--accent-strong);
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.toggle-list {
  display: grid;
  gap: 10px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #30413a;
  font-size: 14px;
  font-weight: 650;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  gap: 10px;
}

.primary-button,
.icon-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  overflow: hidden;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.primary-button {
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 16px 34px rgba(15, 122, 104, 0.24);
}

.icon-button,
.small-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.primary-button span,
.small-button span,
.upload-more-button span,
.compress-start-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select:focus-visible,
input:focus-visible,
button:focus-visible {
  border-color: var(--primary-border);
  box-shadow: var(--focus-ring);
  outline: 0;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.stage {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  padding: 20px;
  border-radius: 8px;
}

.stage-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.stage-header > div:first-child {
  min-width: 0;
}

.stage-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.stage-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  justify-content: flex-end;
  gap: 12px;
}

.upload-more-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 144px;
  min-height: 68px;
  padding: 0 20px;
  border-color: var(--primary-border);
  border-radius: 8px;
  border: 1px solid rgba(169, 215, 203, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(230, 245, 240, 0.86)),
    var(--primary-soft);
  color: var(--primary-hover);
  font-size: 14px;
  font-weight: 840;
  box-shadow: 0 12px 28px rgba(16, 35, 30, 0.08);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease,
    opacity 150ms ease;
}

.upload-more-button svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.upload-more-button:not(:disabled):hover {
  border-color: var(--primary);
  box-shadow: 0 16px 34px rgba(15, 122, 104, 0.16);
}

.upload-more-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.free-cutout-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(221, 232, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(16, 35, 30, 0.05);
}

.free-links-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  gap: 12px;
  width: 100%;
}

.free-cutout-links h3 {
  color: #405149;
  font-weight: 820;
}

.free-link-buttons,
.free-links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.free-link-buttons a,
.free-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  height: 46px;
  min-height: 46px;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.free-link-buttons a:hover,
.free-link-button:hover {
  transform: translateY(-1px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-soft);
}

.free-link-buttons img,
.free-link-button img,
.free-link-button svg,
.free-link-button .icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
}

.free-link-buttons span,
.free-link-button span {
  display: none;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compress-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(221, 232, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(16, 35, 30, 0.05);
}

.compress-head {
  appearance: none;
  border: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.compress-head h3 {
  color: #405149;
  font-weight: 820;
}

.compress-head-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.compress-chevron {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 160ms ease;
}

.compress-panel.is-expanded .compress-chevron {
  transform: rotate(180deg);
}

.compress-body {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.compress-body[hidden] {
  display: none;
}

.compress-file-column {
  display: grid;
  grid-template-columns: repeat(2, 126px);
  gap: 10px;
}

.compress-upload {
  display: grid;
  align-items: center;
  justify-content: center;
  align-content: center;
  aspect-ratio: 1;
  min-height: 126px;
  gap: 8px;
  border: 1.5px dashed var(--primary-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 820;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.compress-upload:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.compress-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.compress-upload-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  justify-self: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 122, 104, 0.2);
}

.compress-preview-card {
  display: grid;
  place-items: stretch;
  width: 100%;
  aspect-ratio: 1;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-align: left;
  box-shadow: 0 6px 18px rgba(16, 35, 30, 0.05);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.compress-preview-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.compress-preview-image-wrap {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background-color: rgba(255, 255, 255, 0.86);
  background-image:
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
}

.compress-preview-image-wrap > * {
  grid-area: 1 / 1;
}

.compress-preview-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.compress-preview-image-wrap img:not([src]) {
  display: none;
}

.compress-settings {
  display: grid;
  gap: 10px;
}

.compress-quality-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quality-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 94px;
  align-content: start;
  gap: 5px;
  column-gap: 6px;
  padding: 11px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(16, 35, 30, 0.05);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.quality-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-soft);
}

.quality-card input {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.quality-card:has(input:checked) {
  border-color: var(--primary);
  box-shadow:
    0 0 0 1px rgba(15, 122, 104, 0.16),
    var(--shadow-soft);
}

.quality-title {
  grid-column: 1 / -1;
  padding-right: 26px;
  font-size: 18px;
  font-weight: 860;
  line-height: 1.15;
  white-space: nowrap;
}

.quality-copy {
  grid-column: 1 / -1;
  color: #52607b;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.35;
}

.quality-badge,
.quality-size {
  justify-self: start;
  border-radius: 7px;
  padding: 4px 7px;
  background: #f1f1f3;
  color: #202327;
  font-size: 11px;
  font-weight: 820;
}

.quality-badge {
  margin-top: 2px;
}

.quality-size {
  margin-top: 2px;
  background: rgba(15, 122, 104, 0.09);
  color: var(--accent-strong);
}

.compress-custom-quality {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.compress-custom-quality[hidden] {
  display: none;
}

.compress-controls {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto 46px;
  gap: 10px;
  align-items: end;
}

.compress-start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  font-weight: 840;
  box-shadow: 0 14px 30px rgba(15, 122, 104, 0.22);
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.compress-start-button svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.compress-start-button:not(:disabled):hover {
  box-shadow: 0 18px 36px rgba(15, 122, 104, 0.26);
}

.compress-download-button {
  width: 46px;
  min-width: 46px;
  min-height: 44px;
  padding: 0;
}

.compress-download-button svg {
  width: 19px;
  height: 19px;
}

.compact-field {
  gap: 6px;
}

.compact-field input[type="range"] {
  margin: 0;
}

.compact-field output {
  justify-self: end;
  margin-top: -22px;
  font-size: 12px;
}

.progress-wrap {
  flex: 1 1 220px;
  min-width: 180px;
  display: grid;
  gap: 8px;
  align-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-align: right;
}

.progress-wrap[hidden] {
  display: none !important;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(221, 232, 226, 0.82);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #2b9f77);
  transition: width 180ms ease;
}

.main-workspace {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(620px, calc(100vh - 260px));
  padding: 16px;
  border: 1px solid rgba(221, 232, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.main-workspace:not(.has-items) {
  align-items: center;
  justify-content: center;
}

.main-workspace.has-items {
  display: block;
  min-height: min(620px, calc(100vh - 260px));
  padding: 18px;
}

.main-workspace.is-dragging {
  border-color: var(--primary-border);
  background: rgba(230, 245, 240, 0.6);
  box-shadow: var(--focus-ring);
}

.workspace-dropzone {
  width: min(100%, 760px);
  min-height: clamp(280px, 55vh, 560px);
  border-color: var(--primary-border);
  background:
    linear-gradient(45deg, rgba(202, 220, 211, 0.28) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(202, 220, 211, 0.28) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(202, 220, 211, 0.28) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(202, 220, 211, 0.28) 75%),
    rgba(255, 255, 255, 0.72);
}

.workspace-dropzone .drop-title {
  font-size: 18px;
}

.workspace-dropzone .drop-copy {
  max-width: 420px;
  text-align: center;
}

.workspace-dropzone.is-dragging,
.main-workspace.is-dragging .workspace-dropzone:not(.is-hidden) {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.empty-state {
  display: grid;
  min-height: 58vh;
  place-items: center;
  align-content: center;
  gap: 22px;
  border: 1px dashed var(--primary-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  text-align: center;
}

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

.sample-stack {
  position: relative;
  width: 170px;
  height: 124px;
}

.sample-stack span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(169, 215, 203, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%),
    white;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
  box-shadow: var(--shadow-soft);
}

.sample-stack span:nth-child(1) {
  transform: rotate(-8deg) translate(-24px, 10px);
}

.sample-stack span:nth-child(2) {
  transform: rotate(5deg) translate(20px, 2px);
}

.sample-stack span:nth-child(3) {
  background:
    radial-gradient(circle at 50% 42%, #2d8f74 0 22%, transparent 23%),
    radial-gradient(ellipse at 50% 84%, #263b34 0 28%, transparent 29%),
    #fff;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 300px));
  justify-content: start;
  align-content: start;
  align-items: start;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.task-grid:empty {
  display: none;
}

.image-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  min-height: 298px;
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(221, 232, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(16, 35, 30, 0.05);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.image-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.preview-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

figure {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.original-preview,
.result-canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  object-position: center center;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 252, 249, 0.86);
}

.preview-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 252, 249, 0.86);
  cursor: zoom-in;
}

.preview-thumb .original-preview {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: center center;
}

.preview-thumb:hover,
.preview-thumb:focus-visible {
  border-color: var(--primary-border);
  box-shadow: var(--focus-ring);
  outline: 0;
}

.result-canvas {
  cursor: default;
}

.result-canvas.is-previewable {
  cursor: zoom-in;
}

.result-canvas.is-previewable:hover,
.result-canvas.is-previewable:focus-visible {
  border-color: var(--primary-border);
  box-shadow: var(--focus-ring);
  outline: 0;
}

.checker .result-canvas {
  background:
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%),
    #ffffff;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.card-status {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(16, 35, 30, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-status.is-working {
  color: var(--warn);
}

.card-status.is-done {
  color: var(--accent-strong);
}

.card-status.is-error {
  color: #b91c1c;
}

.image-card.has-error .processed-figure,
.image-card.has-error .result-canvas,
.image-card.has-error .card-status {
  cursor: pointer;
}

.card-status.is-canceled {
  color: #6b7280;
}

.card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  min-width: 0;
  margin-top: auto;
}

.card-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.delete-button {
  color: #9f3a32;
}

.task-delete-button {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: rgba(216, 123, 112, 0.34);
  background: rgba(255, 248, 247, 0.92);
  color: #a33d35;
}

.task-cancel-button {
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: rgba(169, 215, 203, 0.76);
  background: rgba(246, 251, 248, 0.94);
  color: var(--primary-hover);
}

.task-cancel-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 10px 24px rgba(15, 122, 104, 0.12);
}

.task-cancel-button svg {
  width: 17px;
  height: 17px;
}

.task-cancel-button .label {
  display: none;
}

.task-delete-button:hover:not(:disabled) {
  border-color: rgba(198, 73, 61, 0.42);
  background: rgba(255, 237, 235, 0.96);
  box-shadow: 0 10px 24px rgba(163, 61, 53, 0.12);
}

.task-delete-button svg {
  width: 17px;
  height: 17px;
}

.task-delete-button .label {
  display: none;
}

.file-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.file-duration {
  display: block;
  min-height: 16px;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 720;
}

.file-error {
  display: -webkit-box;
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: #9f3028;
  font-size: 12px;
  font-weight: 740;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.file-error[hidden] {
  display: none;
}

.video-card.has-warning .file-error {
  color: #9a6700;
}

body.theme-dark .video-card.has-warning .file-error {
  color: #f7c65c;
}

.small-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 16px;
  font-size: 13px;
}

.preview-modal {
  width: min(92vw, 1280px);
  height: min(86vh, 860px);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.error-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.edit-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

.preview-modal::backdrop,
.edit-modal::backdrop,
.error-modal::backdrop {
  background: rgba(16, 35, 30, 0.56);
  backdrop-filter: blur(8px);
}

.preview-panel,
.edit-panel,
.error-panel {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 32px);
  border: 1px solid rgba(221, 232, 226, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 14px;
  box-shadow: 0 30px 80px rgba(16, 35, 30, 0.22);
}

.preview-panel {
  display: flex;
  width: 100%;
  height: 100%;
  max-height: none;
  flex-direction: column;
}

.error-json {
  max-height: min(55vh, 460px);
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(169, 215, 203, 0.52);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbf9;
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-toolbar h2 {
  max-width: min(560px, 52vw);
  overflow: hidden;
  margin-bottom: 3px;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(230, 245, 240, 0.72);
}

.preview-mode-toggle[hidden] {
  display: none;
}

.preview-mode-toggle .small-button {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
}

.preview-crop-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.preview-image-wrap {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.edit-controls {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 252, 249, 0.86);
  padding: 10px 12px;
}

.edit-tool-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(230, 245, 240, 0.7);
  padding: 4px;
}

.edit-tool-toggle label {
  position: relative;
  min-width: 0;
}

.edit-tool-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edit-tool-toggle span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.edit-tool-toggle input:checked + span {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(16, 35, 30, 0.1);
}

.pen-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-fill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.edit-fill-field {
  min-width: 0;
}

.small-button.is-active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--accent-strong);
}

.preview-image-wrap.checker,
.edit-canvas-wrap.checker {
  background:
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%),
    #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.preview-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
}

.compare-view {
  --compare-position: 50%;
  --compare-aspect: 1 / 1;
  position: relative;
  width: 100%;
  aspect-ratio: var(--compare-aspect);
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  border-radius: inherit;
  touch-action: none;
}

.compare-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.compare-layer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center center;
}

.compare-result {
  clip-path: inset(0 0 0 var(--compare-position));
}

.compare-result.checker {
  background:
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%),
    #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--compare-position);
  width: 2px;
  height: auto;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(16, 35, 30, 0.12);
  transform: translateX(-50%);
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(16, 35, 30, 0.42);
  box-shadow: 0 12px 30px rgba(16, 35, 30, 0.22);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.compare-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  touch-action: none;
}

.crop-overlay {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(18, 27, 22, 0.3);
  cursor: move;
  touch-action: none;
}

.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent 33.333%, rgba(255, 255, 255, 0.75) 33.333%, rgba(255, 255, 255, 0.75) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.75) 66.666%, rgba(255, 255, 255, 0.75) calc(66.666% + 1px), transparent calc(66.666% + 1px)),
    linear-gradient(to bottom, transparent 33.333%, rgba(255, 255, 255, 0.75) 33.333%, rgba(255, 255, 255, 0.75) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.75) 66.666%, rgba(255, 255, 255, 0.75) calc(66.666% + 1px), transparent calc(66.666% + 1px));
}

.crop-handle {
  position: absolute;
  width: 26px;
  height: 26px;
  min-height: 0;
  border: 0;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(18, 27, 22, 0.16);
  cursor: pointer;
}

.crop-handle-nw,
.crop-handle-ne,
.crop-handle-se,
.crop-handle-sw {
  width: 22px;
  height: 22px;
}

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

.crop-handle-n {
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

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

.crop-handle-e {
  top: 50%;
  right: -13px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

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

.crop-handle-s {
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

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

.crop-handle-w {
  top: 50%;
  left: -13px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-handle-n:hover,
.crop-handle-s:hover {
  transform: translateX(-50%);
}

.crop-handle-e:hover,
.crop-handle-w:hover {
  transform: translateY(-50%);
}

.crop-handle-nw:hover,
.crop-handle-ne:hover,
.crop-handle-se:hover,
.crop-handle-sw:hover {
  transform: none;
}

.edit-canvas-wrap {
  position: relative;
  box-sizing: border-box;
  display: block;
  overflow: hidden;
  height: clamp(320px, 56vh, 520px);
  min-height: 320px;
  max-height: calc(100vh - 210px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: grab;
  outline: 0;
  touch-action: none;
  user-select: none;
}

.edit-canvas-wrap:focus-visible {
  border-color: var(--primary-border);
  box-shadow:
    inset 0 0 0 1px var(--primary-border),
    var(--focus-ring);
}

.edit-canvas-stage {
  position: absolute;
  inset: 0;
  display: block;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
}

#editBackgroundCanvas,
#editCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  border: 0;
  cursor: crosshair;
  image-rendering: auto;
  outline: 0;
  box-shadow: none;
  z-index: 1;
}

#editBackgroundCanvas {
  cursor: default;
  pointer-events: none;
  z-index: 0;
}

.edit-canvas-wrap[data-tool="eraser"],
.edit-canvas-wrap[data-tool="eraser"] #editCanvas {
  cursor: none;
}

.edit-canvas-wrap[data-tool="pen"],
.edit-canvas-wrap[data-tool="pen"] #editCanvas {
  cursor: crosshair;
}

.edit-canvas-wrap[data-tool="pick"],
.edit-canvas-wrap[data-tool="pick"] #editCanvas {
  cursor: url("./assets/eyedropper-cursor.svg") 4 20, pointer;
}

#penOverlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  box-shadow: none;
  z-index: 2;
  pointer-events: none;
}

#eraserBrushPreview {
  position: absolute;
  top: 0;
  left: 0;
  width: 56px;
  height: 56px;
  border: 2px solid rgba(7, 47, 42, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(7, 47, 42, 0.18);
  pointer-events: none;
  z-index: 3;
}

#eraserBrushPreview[hidden] {
  display: none;
}

.edit-canvas-wrap.is-erasing,
.edit-canvas-wrap.is-erasing #editCanvas {
  cursor: none;
}

.edit-canvas-wrap.is-panning,
.edit-canvas-wrap.is-panning #editCanvas {
  cursor: grabbing;
}

@media (max-width: 880px) {
  .app-shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .tools-panel {
    position: static;
  }

  .stage {
    min-height: 60vh;
  }

  .stage-header {
    display: grid;
  }

  .stage-header-actions {
    width: 100%;
    flex: none;
    justify-content: space-between;
  }

  .progress-wrap {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    text-align: left;
  }

  .free-cutout-links {
    align-items: flex-start;
  }

  .compress-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compress-body {
    grid-template-columns: 1fr;
  }

  .compress-file-column {
    grid-template-columns: repeat(2, minmax(0, 126px));
  }

  .compress-quality-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-toolbar {
    align-items: flex-start;
  }

  .preview-toolbar h2 {
    max-width: 54vw;
  }
}

@media (max-width: 480px) {
  .control-grid,
  .preview-pair {
    grid-template-columns: 1fr;
  }

  .segmented span {
    font-size: 12px;
  }

  .actions {
    grid-template-columns: 1fr 42px 42px;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }

  .image-card {
    max-width: none;
  }

  .preview-toolbar {
    display: grid;
  }

  .preview-toolbar h2 {
    max-width: 100%;
  }

  .preview-actions {
    justify-content: space-between;
  }

  .pen-actions {
    justify-content: space-between;
  }

  .edit-fill-row {
    grid-template-columns: 1fr;
  }

  .card-footer {
    display: grid;
  }

  .card-buttons {
    justify-content: space-between;
  }

  .free-cutout-links {
    display: grid;
  }

  .sidebar-tools .free-link-buttons,
  .free-link-buttons {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .free-link-buttons a {
    width: 100%;
  }

  .compress-controls {
    grid-template-columns: 1fr;
  }

  .compress-file-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compress-quality-grid {
    grid-template-columns: 1fr;
  }
}

/* Cinematic video-era UI layer */
.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.module-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.module-tab {
  display: grid;
  gap: 4px;
  min-height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-main);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.module-tab span {
  font-size: 15px;
  font-weight: 900;
}

.module-tab small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.module-tab:hover,
.module-tab.is-active {
  border-color: rgba(0, 224, 184, 0.58);
  background:
    radial-gradient(circle at 20% 0%, rgba(124, 247, 255, 0.18), transparent 36%),
    rgba(0, 224, 184, 0.12);
  box-shadow: 0 12px 30px rgba(0, 224, 184, 0.12);
  transform: translateY(-1px);
}

.module-panel {
  display: grid;
  gap: 18px;
}

.module-panel[hidden] {
  display: none !important;
}

.panel,
.stage,
.tools-panel,
.compress-panel,
.free-links-card,
.image-card,
.video-card,
.edit-panel,
.preview-panel,
.error-panel,
.edit-controls {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.045)),
    rgba(5, 8, 7, 0.72);
  color: var(--text-main);
}

.tools-panel {
  background:
    radial-gradient(circle at 24% 0%, rgba(0, 224, 184, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045)),
    rgba(5, 8, 7, 0.78);
}

.drop-zone,
.video-upload-card,
.main-workspace,
.custom-select-button,
select,
.field input[type="text"],
.field input[type="password"],
.color-row,
.preview-thumb,
.original-preview,
.result-canvas,
.compress-preview-card,
.quality-card,
.preview-image-wrap {
  border-color: rgba(255, 255, 255, 0.13);
  background-color: rgba(255, 255, 255, 0.055);
  color: var(--text-main);
}

.segmented {
  background: rgba(255, 255, 255, 0.055);
}

.segmented input:checked + span {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.toggle,
.field > span,
.control-label,
.slider-row {
  color: rgba(255, 255, 255, 0.76);
}

.api-panel {
  background: rgba(255, 255, 255, 0.055);
}

.custom-select-menu {
  border-color: rgba(0, 224, 184, 0.42);
  background: rgba(6, 14, 13, 0.98);
}

.custom-select-option {
  color: var(--text-main);
}

.video-upload-card {
  display: grid;
  min-height: 168px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
}

.video-upload-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-mode-copy {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.video-mode-copy strong {
  color: var(--text-main);
  font-size: 15px;
}

.video-mode-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.video-output-note {
  color: rgba(124, 247, 255, 0.86) !important;
}

.video-background-picker {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.video-background-picker[hidden] {
  display: none !important;
}

.video-background-picker legend {
  padding: 0 6px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
}

.video-color-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.video-color-option {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.video-color-option.is-selected {
  border-color: rgba(124, 247, 255, 0.8);
  background: rgba(124, 247, 255, 0.1);
  color: var(--text-main);
  box-shadow: 0 0 0 2px rgba(124, 247, 255, 0.1);
}

.video-color-option > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-color-swatch,
.video-color-custom input[type="color"] {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: var(--video-color);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.video-color-custom input[type="color"] {
  overflow: hidden;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

#videoBackgroundColorValue {
  display: block;
  margin-top: 10px;
  color: var(--text-main);
  font: 800 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.video-workspace[hidden] {
  display: none !important;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.video-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.video-thumb::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(5, 8, 7, 0.06), rgba(5, 8, 7, 0.58));
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

.video-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.video-thumb-preview-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(6, 14, 13, 0.74);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.96);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.26);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.video-card.has-result .video-thumb:hover::after,
.video-card.has-result .video-thumb:focus-within::after {
  opacity: 1;
}

.video-card.has-result .video-thumb:hover .video-thumb-preview-button,
.video-card.has-result .video-thumb:focus-within .video-thumb-preview-button {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.video-thumb-preview-button:hover:not(:disabled) {
  background: rgba(0, 224, 184, 0.88);
  color: #06100d;
}

.video-thumb-preview-button:disabled {
  opacity: 0;
  pointer-events: none;
}

.task-type-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  border: 1px solid rgba(124, 247, 255, 0.32);
  border-radius: 999px;
  background: rgba(0, 224, 184, 0.16);
  color: var(--primary-hover);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.video-preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  background: #050505;
}

.video-preview-player {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 760px);
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #000;
}

.stage-header h2,
.brand-row h1,
.preview-toolbar h2 {
  color: var(--text-main);
}

.file-meta,
.file-duration,
.drop-copy,
.api-help,
.preview-toolbar p,
figcaption {
  color: var(--muted);
}

.primary-button {
  background: linear-gradient(135deg, #00a88a, #00e0b8 48%, #7cf7ff);
  color: #03110f;
  box-shadow: 0 18px 38px rgba(0, 224, 184, 0.22);
}

.small-button,
.icon-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.card-status {
  background: rgba(5, 8, 7, 0.72);
  color: var(--muted);
}

@media (max-width: 760px) {
  .module-switcher {
    grid-template-columns: 1fr;
  }

  .video-color-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Premium monochrome home and navigation */
:root {
  color-scheme: dark;
  --bg-page: #050505;
  --card: rgba(255, 255, 255, 0.07);
  --text-main: #f5f5f5;
  --text-secondary: rgba(245, 245, 245, 0.66);
  --primary: #f5f5f5;
  --primary-hover: #ffffff;
  --primary-soft: rgba(255, 255, 255, 0.1);
  --primary-border: rgba(255, 255, 255, 0.24);
  --accent-gold: #d8d8d8;
  --border: rgba(255, 255, 255, 0.13);
  --mint-wash: rgba(255, 255, 255, 0.06);
  --glass: rgba(255, 255, 255, 0.065);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --ink: var(--text-main);
  --muted: var(--text-secondary);
  --line: var(--border);
  --paper: rgba(255, 255, 255, 0.07);
  --panel: rgba(255, 255, 255, 0.07);
  --accent: #f5f5f5;
  --accent-strong: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.11);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
  --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.32);
  --shadow-hover: 0 22px 58px rgba(255, 255, 255, 0.1);
  --focus-ring: 0 0 0 3px rgba(255, 255, 255, 0.18);
  --checker-tile: rgba(255, 255, 255, 0.13);
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.13), transparent 24%),
    radial-gradient(circle at 80% 22%, rgba(180, 180, 180, 0.11), transparent 28%),
    radial-gradient(circle at 60% 88%, rgba(255, 255, 255, 0.07), transparent 34%),
    linear-gradient(135deg, #020202 0%, #0b0b0b 44%, #151515 100%);
}

body::before {
  background:
    radial-gradient(circle at 72% 24%, rgba(255, 255, 255, 0.12), transparent 24%),
    radial-gradient(circle at 12% 72%, rgba(145, 145, 145, 0.12), transparent 30%);
  filter: blur(16px);
  opacity: 0.9;
}

body::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  opacity: 0.12;
}

.app-shell {
  position: relative;
  transition: padding 240ms ease;
}

.app-shell:not(.is-home) {
  padding-left: 72px;
}

.home-view {
  position: relative;
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.1), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  animation: page-in 380ms ease both;
}

.home-view[hidden] {
  display: none !important;
}

.home-orb {
  position: absolute;
  width: 42vw;
  max-width: 620px;
  aspect-ratio: 1;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 64%);
  filter: blur(24px);
  opacity: 0.8;
  animation: home-orb-drift 16s ease-in-out infinite alternate;
}

.home-orb-a {
  left: -8%;
  top: 8%;
}

.home-orb-b {
  right: -10%;
  bottom: -12%;
  animation-delay: -5s;
}

.home-hero {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  width: min(920px, calc(100vw - 56px));
  text-align: center;
}

.home-eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.home-hero h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 1.02;
  font-weight: 950;
}

.home-subtitle {
  margin: -8px auto 8px;
  max-width: 560px;
  color: rgba(255, 255, 255, 0.66);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.7;
}

.home-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.home-entry-card {
  position: relative;
  display: grid;
  gap: 14px;
  min-height: 230px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background:
    radial-gradient(circle at 24% 0%, rgba(255, 255, 255, 0.12), transparent 40%),
    rgba(255, 255, 255, 0.065);
  color: #fff;
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.home-entry-card::after {
  content: "";
  position: absolute;
  inset: auto 22px 18px 22px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 180ms ease;
}

.home-entry-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.34);
  background:
    radial-gradient(circle at 24% 0%, rgba(255, 255, 255, 0.18), transparent 42%),
    rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.44);
}

.home-entry-card:hover::after {
  opacity: 1;
}

.home-entry-icon,
.side-rail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-entry-icon {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.09);
}

.home-entry-icon svg,
.side-rail-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-entry-title {
  font-size: 28px;
  font-weight: 920;
}

.home-entry-copy {
  max-width: 280px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  line-height: 1.7;
}

.side-rail {
  position: fixed;
  left: 14px;
  top: 50%;
  z-index: 40;
  display: grid;
  gap: 10px;
  width: 48px;
  padding: 10px 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055)),
    rgba(5, 5, 5, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  transform: translateY(-50%);
  transition: width 180ms ease, border-radius 180ms ease, padding 180ms ease;
}

.side-rail:hover,
.side-rail:focus-within {
  width: 212px;
  border-radius: 24px;
  padding: 12px;
}

.side-rail[hidden] {
  display: none !important;
}

.side-rail-grip {
  justify-self: center;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
}

.side-rail-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 40px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.side-rail-item:hover,
.side-rail-item.is-active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-rail-label {
  overflow: hidden;
  opacity: 0;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
  transition: opacity 140ms ease;
}

.side-rail:hover .side-rail-label,
.side-rail:focus-within .side-rail-label {
  opacity: 1;
}

.workspace {
  animation: page-in 280ms ease both;
}

.panel,
.stage,
.tools-panel,
.compress-panel,
.free-links-card,
.image-card,
.video-card,
.edit-panel,
.preview-panel,
.error-panel,
.edit-controls {
  border-color: rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.045)),
    rgba(8, 8, 8, 0.74);
  color: var(--text-main);
}

.tools-panel {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.11), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045)),
    rgba(8, 8, 8, 0.78);
}

.drop-zone,
.video-upload-card,
.main-workspace,
.custom-select-button,
select,
.field input[type="text"],
.field input[type="password"],
.color-row,
.preview-thumb,
.original-preview,
.result-canvas,
.compress-preview-card,
.quality-card,
.preview-image-wrap {
  border-color: rgba(255, 255, 255, 0.14);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.custom-select-menu {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(14, 14, 14, 0.98);
}

.custom-select-option {
  color: var(--text-main);
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.custom-select-option.is-selected {
  color: #fff;
}

.primary-button,
.compress-start-button {
  background: linear-gradient(135deg, #f8f8f8, #cfcfcf);
  color: #080808;
  box-shadow: 0 18px 38px rgba(255, 255, 255, 0.12);
}

.primary-button:hover,
.compress-start-button:hover {
  background: linear-gradient(135deg, #ffffff, #dedede);
}

.small-button,
.icon-button,
.upload-more-button {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.main-workspace {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06), transparent 34%),
    rgba(255, 255, 255, 0.035);
}

.workspace-dropzone {
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.055) 75%),
    rgba(255, 255, 255, 0.035);
}

.sample-stack span:nth-child(3) {
  background:
    radial-gradient(circle at 50% 42%, #d8d8d8 0 22%, transparent 23%),
    radial-gradient(ellipse at 50% 84%, #8b8b8b 0 28%, transparent 29%),
    #f5f5f5;
}

.main-workspace.is-dragging,
.workspace-dropzone.is-dragging,
.main-workspace.is-dragging .workspace-dropzone:not(.is-hidden) {
  border-color: rgba(255, 255, 255, 0.46);
  background-color: rgba(255, 255, 255, 0.08);
}

.task-type-badge {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.stage-header h2,
.brand-row h1,
.preview-toolbar h2 {
  color: var(--text-main);
}

.file-meta,
.file-duration,
.drop-copy,
.api-help,
.preview-toolbar p,
figcaption,
.control-hint {
  color: var(--muted);
}

.eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.status-pill {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: #f5f5f5;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes home-orb-drift {
  from {
    transform: translate3d(-2%, -2%, 0) scale(1);
  }
  to {
    transform: translate3d(3%, 2%, 0) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-orb,
  .home-view,
  .workspace {
    animation: none;
  }
}

@media (max-width: 920px) {
  .app-shell:not(.is-home) {
    padding-left: 24px;
    padding-bottom: 82px;
  }

  .home-entry-grid {
    grid-template-columns: 1fr;
  }

  .side-rail {
    top: auto;
    left: 50%;
    bottom: 14px;
    width: min(360px, calc(100vw - 32px));
    grid-template-columns: 1fr 1fr;
    border-radius: 24px;
    padding: 10px;
    transform: translateX(-50%);
  }

  .side-rail:hover,
  .side-rail:focus-within {
    width: min(360px, calc(100vw - 32px));
    padding: 10px;
  }

  .side-rail-grip {
    display: none;
  }

  .side-rail-label {
    opacity: 1;
  }
}

.video-upscale-workflow-picker {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.7);
}

.video-upscale-workflow-picker[hidden] {
  display: none !important;
}

.video-upscale-workflow-picker legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.video-upscale-workflow-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.video-upscale-workflow-option {
  display: block;
  min-width: 0;
}

.video-upscale-workflow-option > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-upscale-workflow-card {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 64px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  color: #475569;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.video-upscale-workflow-card strong {
  display: block;
  max-width: 100%;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 850;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

#videoProcessButton {
  height: auto;
  min-height: 44px;
  padding: 8px 12px;
}

#videoProcessButtonLabel {
  overflow: visible;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
}

.video-upscale-workflow-option:hover .video-upscale-workflow-card {
  border-color: rgba(96, 165, 250, 0.55);
  background: #fff;
  color: #2563eb;
  transform: translateY(-1px);
}

.video-upscale-workflow-option > input:focus-visible + .video-upscale-workflow-card {
  outline: 3px solid rgba(96, 165, 250, 0.28);
  outline-offset: 2px;
}

.video-upscale-workflow-option > input:checked + .video-upscale-workflow-card {
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

body.theme-dark .video-upscale-workflow-picker {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
}

body.theme-dark .video-upscale-workflow-card {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.78);
  color: #a9b6c8;
}

body.theme-dark .video-upscale-workflow-option > input:checked + .video-upscale-workflow-card {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
}

@media (max-width: 480px) {
  .video-upscale-workflow-options {
    gap: 8px;
  }

  .video-upscale-workflow-card {
    padding-inline: 4px;
  }

  .video-upscale-workflow-card strong {
    font-size: 11px;
  }
}

/* Image preview zoom and persistent light/dark theme */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 80;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(16px);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.theme-toggle:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: #fff;
  color: #2563eb;
  box-shadow: 0 13px 34px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  font-size: 17px;
  line-height: 1;
}

.preview-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
}

.preview-zoom-button {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.preview-zoom-reset {
  min-height: 32px;
  padding: 0 10px;
}

.preview-zoom-value {
  min-width: 48px;
  color: var(--ink);
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}

#previewZoomContainer {
  display: block;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
}

#previewZoomContainer.is-pannable {
  cursor: grab;
}

#previewZoomContainer.is-panning {
  cursor: grabbing;
}

.preview-zoom-stage {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 1px;
  min-height: 1px;
  align-items: center;
  justify-content: center;
  margin: auto;
  transform-origin: center center;
  transition: transform 120ms ease-out;
  will-change: transform;
}

#previewZoomContainer.is-panning .preview-zoom-stage {
  transition: none;
}

.preview-zoom-stage > #previewImage {
  flex: 0 1 auto;
}

body.theme-dark {
  color-scheme: dark;
  --bg-page: #090d16;
  --card: rgba(20, 27, 40, 0.92);
  --text-main: #e8eef8;
  --text-secondary: #9aa8bc;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.18);
  --primary-border: rgba(96, 165, 250, 0.4);
  --border: rgba(148, 163, 184, 0.2);
  --glass: rgba(30, 41, 59, 0.72);
  --glass-strong: rgba(30, 41, 59, 0.94);
  --ink: var(--text-main);
  --muted: var(--text-secondary);
  --line: var(--border);
  --paper: rgba(15, 23, 42, 0.9);
  --panel: rgba(15, 23, 42, 0.9);
  --accent: var(--primary);
  --accent-strong: #93c5fd;
  --accent-soft: rgba(59, 130, 246, 0.2);
  --checker-tile: rgba(148, 163, 184, 0.16);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 16px 42px rgba(0, 0, 0, 0.34);
  background:
    radial-gradient(circle at 16% 12%, rgba(37, 99, 235, 0.2), transparent 27%),
    radial-gradient(circle at 86% 18%, rgba(30, 64, 175, 0.18), transparent 30%),
    linear-gradient(135deg, #070b12 0%, #0b1120 50%, #111827 100%);
  color: var(--text-main);
}

body.theme-dark::before {
  background:
    radial-gradient(circle at 76% 24%, rgba(59, 130, 246, 0.16), transparent 24%),
    radial-gradient(circle at 10% 76%, rgba(30, 64, 175, 0.18), transparent 30%);
  opacity: 0.72;
}

body.theme-dark::after {
  background:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  opacity: 0.16;
}

body.theme-dark .theme-toggle {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.86);
  color: #dbeafe;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

body.theme-dark .theme-toggle:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 41, 59, 0.98);
  color: #93c5fd;
}

body.theme-dark .home-view {
  background:
    radial-gradient(circle at 52% -6%, rgba(37, 99, 235, 0.24), transparent 36%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(8, 13, 24, 0.94));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.34);
}

body.theme-dark .home-hero h1,
body.theme-dark .home-entry-card,
body.theme-dark .stage-header h2,
body.theme-dark .brand-row h1,
body.theme-dark .preview-toolbar h2,
body.theme-dark h3 {
  color: #f1f5f9;
}

body.theme-dark .home-eyebrow,
body.theme-dark .home-subtitle,
body.theme-dark .file-meta,
body.theme-dark .file-duration,
body.theme-dark .drop-copy,
body.theme-dark .api-help,
body.theme-dark .preview-toolbar p,
body.theme-dark figcaption,
body.theme-dark .control-hint,
body.theme-dark .brand-subtitle,
body.theme-dark .card-status,
body.theme-dark .toggle,
body.theme-dark .field > span,
body.theme-dark .control-label,
body.theme-dark .slider-row {
  color: #9aa8bc;
}

body.theme-dark .home-entry-card {
  border-color: rgba(96, 165, 250, 0.22);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.9));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

body.theme-dark .home-entry-card:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 41, 59, 0.98);
}

body.theme-dark .home-entry-icon {
  border-color: rgba(96, 165, 250, 0.26);
  background: rgba(30, 64, 175, 0.22);
  color: #93c5fd;
}

body.theme-dark :is(.panel, .stage, .tools-panel, .compress-panel, .free-links-card, .image-card, .video-card, .edit-panel, .preview-panel, .error-panel, .edit-controls) {
  border-color: rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(22, 30, 45, 0.96), rgba(13, 19, 31, 0.94));
  color: var(--text-main);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.24);
}

body.theme-dark :is(.drop-zone, .video-upload-card, .main-workspace, .custom-select-button, select, .field input[type="text"], .field input[type="password"], .color-row, .preview-thumb, .original-preview, .result-canvas, .compress-preview-card, .quality-card, .preview-image-wrap, .api-panel, .error-json) {
  border-color: rgba(148, 163, 184, 0.2);
  background-color: rgba(30, 41, 59, 0.68);
  color: #e5edf8;
}

body.theme-dark select,
body.theme-dark option,
body.theme-dark input,
body.theme-dark textarea {
  color-scheme: dark;
}

body.theme-dark .custom-select-menu {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(15, 23, 42, 0.99);
}

body.theme-dark .custom-select-option {
  color: #dbe5f3;
}

body.theme-dark .custom-select-option:hover,
body.theme-dark .custom-select-option.is-active {
  background: rgba(59, 130, 246, 0.18);
}

body.theme-dark .segmented {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(30, 41, 59, 0.72);
}

body.theme-dark .segmented span {
  color: #9aa8bc;
}

body.theme-dark .segmented input:checked + span {
  background: rgba(51, 65, 85, 0.96);
  color: #f8fafc;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.28);
}

body.theme-dark :is(.small-button, .icon-button, .upload-more-button) {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.82);
  color: #e5edf8;
}

body.theme-dark :is(.small-button, .icon-button, .upload-more-button):hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(51, 65, 85, 0.95);
  color: #bfdbfe;
}

body.theme-dark .free-link-buttons a {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.82);
  color: #dbe5f3;
}

body.theme-dark .free-link-buttons a:hover {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(51, 65, 85, 0.96);
  color: #bfdbfe;
}

body.theme-dark .status-pill {
  border-color: rgba(96, 165, 250, 0.24);
  background: rgba(30, 41, 59, 0.82);
  color: #a9b6c8;
}

body.theme-dark .primary-button,
body.theme-dark .compress-start-button {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.28);
}

body.theme-dark .workspace-dropzone {
  border-color: rgba(96, 165, 250, 0.28);
  background-color: rgba(15, 23, 42, 0.66);
}

body.theme-dark .side-rail-item {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.86);
  color: #a9b6c8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
}

body.theme-dark .side-rail-item:hover,
body.theme-dark .side-rail-item.is-active {
  border-color: rgba(96, 165, 250, 0.48);
  background: rgba(30, 64, 175, 0.3);
  color: #bfdbfe;
}

body.theme-dark .preview-image-wrap.checker,
body.theme-dark .edit-canvas-wrap.checker,
body.theme-dark .compare-result.checker {
  background-color: #111827;
}

body.theme-dark .video-module .video-mode-switch {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.8);
}

body.theme-dark .video-module .video-mode-switch span {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.78);
  color: #a9b6c8;
}

body.theme-dark .video-module .video-mode-switch input:checked + span {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
}

body.theme-dark :is(.video-background-picker, .video-color-custom-card) {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: #e5edf8;
}

body.theme-dark .video-color-option {
  color: #9aa8bc;
}

body.theme-dark .video-color-option:hover,
body.theme-dark .video-color-option.is-selected {
  border-color: rgba(96, 165, 250, 0.44);
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

body.theme-dark #videoBackgroundColorValue {
  color: #f1f5f9;
}

body.theme-dark dialog::backdrop {
  background: rgba(2, 6, 23, 0.76);
}

@media (max-width: 720px) {
  .theme-toggle {
    top: 12px;
    right: 12px;
  }

  .preview-actions {
    flex-wrap: wrap;
  }

  .preview-zoom-controls {
    order: 2;
  }
}

/* Video controls: balanced mode switch and editor-style color picker */
.video-module .video-mode-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.9);
}

.video-mode-switch label {
  display: block;
  width: 100%;
}

.video-mode-switch span {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.video-mode-switch label:hover span {
  border-color: rgba(96, 165, 250, 0.55);
  background: #fff;
  color: #2563eb;
  transform: translateY(-1px);
}

.video-mode-switch input:focus-visible + span {
  outline: 3px solid rgba(96, 165, 250, 0.3);
  outline-offset: 2px;
}

.video-module .video-mode-switch input:checked + span,
.video-module .video-mode-switch label:hover input:checked + span {
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.video-background-picker {
  padding: 14px;
  border-color: rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.7);
}

.video-color-picker-layout {
  display: grid;
  gap: 14px;
}

.video-color-section-label {
  display: block;
  margin-bottom: 9px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.video-color-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.video-color-option {
  display: grid;
  min-width: 0;
  min-height: 66px;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.video-color-option:hover {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(219, 234, 254, 0.45);
  color: #2563eb;
  transform: translateY(-1px);
}

.video-color-option.is-selected {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(219, 234, 254, 0.7);
  color: #1d4ed8;
  box-shadow: none;
}

.video-color-swatch {
  position: relative;
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--video-color);
  box-shadow: 0 0 0 1px rgba(100, 116, 139, 0.38), 0 4px 10px rgba(15, 23, 42, 0.12);
}

.video-color-option.is-selected .video-color-swatch {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2563eb, 0 5px 12px rgba(37, 99, 235, 0.22);
}

.video-color-option.is-selected .video-color-swatch::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.video-color-custom-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.video-color-custom-card.is-selected {
  border-color: rgba(37, 99, 235, 0.62);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.13), 0 10px 28px rgba(37, 99, 235, 0.1);
}

.video-color-custom-card > input[type="radio"],
.video-native-color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-current-color {
  width: 52px;
  height: 52px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.1);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.video-current-color:hover {
  border-color: #60a5fa;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.18);
  transform: translateY(-1px);
}

.video-current-color span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: #00ff00;
}

.video-color-custom-copy {
  display: grid;
  gap: 4px;
}

.video-color-custom-copy > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

#videoBackgroundColorValue {
  display: block;
  margin: 0;
  color: #0f172a;
  font: 850 14px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.03em;
}

.video-custom-color-button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 9px;
  background: rgba(239, 246, 255, 0.92);
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.video-custom-color-button:hover {
  border-color: #3b82f6;
  background: #dbeafe;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .video-color-presets {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    overflow-x: auto;
  }

  .video-color-custom-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .video-current-color {
    width: 48px;
    height: 48px;
  }

  .video-custom-color-button {
    grid-column: 1 / -1;
  }
}

/* Light blue premium revision */
:root {
  color-scheme: light;
  --bg-page: #f8fbff;
  --card: rgba(255, 255, 255, 0.84);
  --text-main: #111827;
  --text-secondary: #6b7280;
  --primary: #4f8fe8;
  --primary-hover: #2563eb;
  --primary-soft: rgba(219, 234, 254, 0.74);
  --primary-border: rgba(96, 165, 250, 0.34);
  --accent-gold: #8a94a6;
  --border: rgba(148, 163, 184, 0.28);
  --mint-wash: rgba(239, 246, 255, 0.78);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --ink: var(--text-main);
  --muted: var(--text-secondary);
  --line: var(--border);
  --paper: rgba(255, 255, 255, 0.82);
  --panel: rgba(255, 255, 255, 0.86);
  --accent: var(--primary);
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(219, 234, 254, 0.82);
  --shadow: 0 28px 82px rgba(37, 99, 235, 0.12);
  --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 18px 54px rgba(59, 130, 246, 0.16);
  --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.22);
  --checker-tile: rgba(148, 163, 184, 0.18);
}

body {
  color: var(--text-main);
  background:
    radial-gradient(circle at 14% 12%, rgba(147, 197, 253, 0.34), transparent 27%),
    radial-gradient(circle at 88% 18%, rgba(219, 234, 254, 0.9), transparent 30%),
    radial-gradient(circle at 54% 92%, rgba(191, 219, 254, 0.34), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f8fbff 42%, #eaf5ff 100%);
}

body::before {
  background:
    radial-gradient(circle at 76% 24%, rgba(186, 230, 253, 0.34), transparent 24%),
    radial-gradient(circle at 10% 76%, rgba(219, 234, 254, 0.62), transparent 30%);
  filter: blur(20px);
  opacity: 0.95;
  animation: soft-blue-drift 20s ease-in-out infinite alternate;
}

body::after {
  background:
    linear-gradient(rgba(59, 130, 246, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  opacity: 0.18;
}

.app-shell:not(.is-home) {
  padding-left: 92px;
}

.home-view {
  border: 0;
  border-radius: 32px;
  background:
    radial-gradient(circle at 52% -6%, rgba(191, 219, 254, 0.55), transparent 35%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(239, 246, 255, 0.62));
  box-shadow: 0 34px 100px rgba(37, 99, 235, 0.1);
}

.home-orb {
  background: radial-gradient(circle, rgba(147, 197, 253, 0.46), transparent 66%);
  filter: blur(28px);
}

.home-eyebrow {
  color: #64748b;
  letter-spacing: 0.24em;
}

.home-hero {
  gap: 22px;
}

.home-hero h1 {
  color: #111827;
  font-size: clamp(38px, 6.2vw, 76px);
  letter-spacing: -0.03em;
}

.home-subtitle {
  margin: -6px auto 12px;
  color: #6b7280;
  font-size: clamp(15px, 1.8vw, 19px);
}

.home-entry-grid {
  grid-template-columns: repeat(2, minmax(180px, 230px));
  justify-content: center;
  gap: 18px;
}

.home-entry-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 86px;
  padding: 0 26px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.8)),
    rgba(255, 255, 255, 0.86);
  color: #111827;
  box-shadow: 0 16px 42px rgba(37, 99, 235, 0.1);
  text-align: center;
}

.home-entry-card::after {
  display: none;
}

.home-entry-card:hover {
  border-color: rgba(37, 99, 235, 0.38);
  background: #fff;
  box-shadow: 0 20px 56px rgba(37, 99, 235, 0.16);
}

.home-entry-icon {
  width: 42px;
  height: 42px;
  border-color: rgba(96, 165, 250, 0.26);
  border-radius: 15px;
  background: rgba(239, 246, 255, 0.88);
  color: #2563eb;
}

.home-entry-title {
  font-size: 20px;
  font-weight: 900;
}

.home-entry-copy {
  display: none !important;
}

.side-rail {
  left: 20px;
  width: 52px;
  padding: 0;
  gap: 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transition: none;
}

.side-rail:hover,
.side-rail:focus-within {
  width: 52px;
  padding: 0;
  border-radius: 0;
}

.side-rail-grip {
  display: none;
}

.side-rail-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 52px;
  height: 46px;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  color: #475569;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.09);
  backdrop-filter: blur(16px);
  padding: 0 14px;
  transition:
    width 220ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.side-rail-item:hover,
.side-rail-item:focus-visible {
  width: 148px;
  border-color: rgba(96, 165, 250, 0.46);
  background: rgba(255, 255, 255, 0.95);
  color: #1d4ed8;
  box-shadow: 0 18px 44px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.side-rail-item.is-active {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(219, 234, 254, 0.94);
  color: #1d4ed8;
}

.side-rail-icon {
  flex: 0 0 22px;
  width: 22px;
}

.side-rail-label {
  min-width: 74px;
  opacity: 0;
  color: currentColor;
  font-size: 14px;
  font-weight: 850;
  transition: opacity 160ms ease 40ms;
}

.side-rail:hover .side-rail-label,
.side-rail:focus-within .side-rail-label {
  opacity: 0;
}

.side-rail-item:hover .side-rail-label,
.side-rail-item:focus-visible .side-rail-label {
  opacity: 1;
}

.panel,
.stage,
.tools-panel,
.compress-panel,
.free-links-card,
.image-card,
.video-card,
.edit-panel,
.preview-panel,
.error-panel,
.edit-controls {
  border-color: rgba(148, 163, 184, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.78)),
    rgba(255, 255, 255, 0.82);
  color: #111827;
}

.tools-panel {
  background:
    radial-gradient(circle at 16% 0%, rgba(219, 234, 254, 0.72), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.8));
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.08);
}

.drop-zone,
.video-upload-card,
.main-workspace,
.custom-select-button,
select,
.field input[type="text"],
.field input[type="password"],
.color-row,
.preview-thumb,
.original-preview,
.result-canvas,
.compress-preview-card,
.quality-card,
.preview-image-wrap {
  border-color: rgba(148, 163, 184, 0.28);
  background-color: rgba(255, 255, 255, 0.76);
  color: #111827;
}

.custom-select-menu {
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

.custom-select-option {
  color: #111827;
}

.custom-select-option:hover,
.custom-select-option.is-active {
  background: rgba(219, 234, 254, 0.7);
}

.custom-select-option[aria-selected="true"],
.custom-select-check,
output,
.api-status.is-ok,
.eyebrow {
  color: #1d4ed8;
}

.segmented {
  background: rgba(219, 234, 254, 0.45);
}

.segmented input:checked + span {
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
}

.toggle,
.field > span,
.control-label,
.slider-row {
  color: #334155;
}

.api-panel {
  background: rgba(255, 255, 255, 0.68);
}

.primary-button,
.compress-start-button {
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.22);
}

.primary-button:hover,
.compress-start-button:hover {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}

.small-button,
.icon-button,
.upload-more-button {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.82);
  color: #111827;
}

.main-workspace {
  background:
    radial-gradient(circle at 50% 0%, rgba(219, 234, 254, 0.44), transparent 34%),
    rgba(255, 255, 255, 0.52);
}

.workspace-dropzone {
  border-color: rgba(96, 165, 250, 0.32);
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.12) 75%),
    rgba(255, 255, 255, 0.68);
}

.file-meta,
.file-duration,
.drop-copy,
.api-help,
.preview-toolbar p,
figcaption,
.control-hint,
.brand-subtitle,
.card-status {
  color: #64748b;
}

.status-pill {
  border-color: rgba(96, 165, 250, 0.22);
  background: rgba(239, 246, 255, 0.86);
  color: #475569;
}

.sample-stack span:nth-child(3) {
  background:
    radial-gradient(circle at 50% 42%, #60a5fa 0 22%, transparent 23%),
    radial-gradient(ellipse at 50% 84%, #475569 0 28%, transparent 29%),
    #fff;
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  accent-color: #2563eb;
}

@keyframes soft-blue-drift {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 1.5%, 0) scale(1.08);
  }
}

@media (max-width: 920px) {
  .app-shell:not(.is-home) {
    padding-left: 24px;
    padding-bottom: 86px;
  }

  .home-entry-grid {
    grid-template-columns: minmax(0, 240px);
  }

  .home-entry-card {
    min-height: 78px;
  }

  .side-rail {
    top: auto;
    left: 50%;
    bottom: 16px;
    display: flex;
    flex-direction: row;
    width: auto;
    transform: translateX(-50%);
  }

  .side-rail:hover,
  .side-rail:focus-within {
    width: auto;
  }

  .side-rail-item,
  .side-rail-item:hover,
  .side-rail-item:focus-visible {
    width: 128px;
  }

  .side-rail-label {
    opacity: 1;
  }
}

/* Definitive dark-theme override; this block intentionally stays at EOF. */
body.theme-dark .main-workspace .workspace-dropzone,
body.theme-dark .video-workspace .workspace-dropzone,
body.theme-dark .tools-panel .drop-zone,
body.theme-dark .video-upload-card.video-upload-card {
  border-color: rgba(96, 165, 250, 0.54) !important;
  background-color: rgba(26, 39, 58, 0.96) !important;
  color: #edf4ff;
}

body.theme-dark .preview-panel .preview-image-wrap {
  border-color: rgba(148, 163, 184, 0.48) !important;
  background-color: #111827 !important;
}

body.theme-dark {
  --bg-page: #060a12;
  --card: #172235;
  --text-main: #f8fafc;
  --text-secondary: #c5d0df;
  --border: rgba(148, 163, 184, 0.34);
  --glass: rgba(37, 50, 69, 0.86);
  --glass-strong: rgba(45, 60, 82, 0.96);
  --paper: #111a2a;
  --panel: #121c2d;
  --muted: var(--text-secondary);
  --line: var(--border);
  --primary-border: rgba(96, 165, 250, 0.52);
  background:
    radial-gradient(circle at 16% 10%, rgba(37, 99, 235, 0.22), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(30, 64, 175, 0.2), transparent 30%),
    linear-gradient(135deg, #050812 0%, #09111f 52%, #0d1728 100%);
  color: #f8fafc;
}

body.theme-dark :is(.panel, .stage, .tools-panel, .compress-panel, .free-links-card, .image-card, .video-card, .edit-panel, .preview-panel, .error-panel, .edit-controls) {
  border-color: rgba(148, 163, 184, 0.34);
  background: linear-gradient(180deg, rgba(25, 37, 56, 0.98), rgba(16, 25, 41, 0.98));
  color: #f8fafc;
}

body.theme-dark :is(.main-workspace, .drop-zone, .workspace-dropzone, .video-upload-card, .compress-preview-card, .quality-card, .api-panel, .error-json) {
  border-color: rgba(148, 163, 184, 0.4);
  background-color: rgba(35, 49, 70, 0.82);
  color: #edf4ff;
}

body.theme-dark :is(.drop-zone, .workspace-dropzone, .video-upload-card) {
  border-color: rgba(96, 165, 250, 0.5);
  background-color: rgba(26, 39, 58, 0.94);
}

body.theme-dark :is(.drop-title, .file-info strong, .file-name, .stage-header h2, .preview-toolbar h2, .free-cutout-links h3, .compress-head h3) {
  color: #f8fafc;
}

body.theme-dark :is(.file-meta, .file-duration, .drop-copy, .api-help, .preview-toolbar p, figcaption, .control-hint, .brand-subtitle, .card-status, .toggle, .field > span, .control-label, .slider-row) {
  color: #c5d0df;
}

body.theme-dark :is(.small-button, .icon-button, .upload-more-button, .video-custom-color-button) {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(43, 57, 78, 0.94);
  color: #f1f5f9;
}

body.theme-dark button:disabled {
  color: #b6c2d2;
  opacity: 0.58;
}

body.theme-dark :is(.free-cutout-links, .free-links-card, .preview-mode-toggle, .preview-zoom-controls) {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(20, 31, 49, 0.96);
}

body.theme-dark .free-link-buttons a {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(43, 57, 78, 0.94);
  color: #e7eef8;
}

body.theme-dark .preview-zoom-value {
  color: #f8fafc;
}

body.theme-dark .preview-image-wrap {
  border-color: rgba(148, 163, 184, 0.46);
  background-color: #111827;
}

body.theme-dark :is(.preview-image-wrap.checker, .edit-canvas-wrap.checker, .compare-result.checker) {
  background-color: #172033;
}
