/* LetterMotion · tema scuro/chiaro, layout tre colonne.
 * Icone Lucide (licenza MIT), incorporate senza dipendenze esterne.
 */
:root {
  color-scheme: dark;
  /* Scala tipografica dell'interfaccia: modifica questi valori per cambiare tutte le scritte. */
  --font-4xs: 10px; /* micro-etichette, solo dove lo spazio è minimo */
  --font-3xs: 11px;
  --font-2xs: 12px;
  --font-xs: 13px;
  --font-sm: 14px;
  --font-md: 16px;
  --font-lg: 18px;
  --font-xl: 22px;
  --font-2xl: 25px;
  --font-3xl: 32px;
  --font-4xl: 36px;
  --page: #101114;
  --surface: #17191d;
  --surface-2: #1d2025;
  --surface-3: #252930;
  --input: #202329;
  --stroke: #31353c;
  --stroke-strong: #434851;
  --text: #f3f4f6;
  --secondary: #b3b8c1;
  --muted: #858c97;
  --accent: #085dbd;
  --accent-text: #74b5ff; /* blu leggibile su superfici scure per testo e icone */
  --accent-rgb: 8, 93, 189;
  --accent-contrast: #fff;
  --accent-soft: rgba(8, 93, 189, 0.2);
  --danger: #ffaaa9;
  --preview-border: #343842;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.17);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}
:root[data-theme='light'] {
  color-scheme: light;
  --page: #eceef1;
  --surface: #fff;
  --surface-2: #f7f8fa;
  --surface-3: #edeff3;
  --input: #fff;
  --stroke: #d8dce3;
  --stroke-strong: #b9bfc9;
  --text: #1b2028;
  --secondary: #505967;
  --muted: #727d8a;
  --accent: #085dbd;
  --accent-text: #085dbd;
  --accent-rgb: 8, 93, 189;
  --accent-contrast: #fff;
  --accent-soft: rgba(8, 93, 189, 0.1);
  --danger: #b12339;
  --preview-border: #c5cad3;
  --shadow: 0 10px 28px rgba(18, 26, 41, 0.06);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--page);
  color: var(--text);
}
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.topbar {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 23px;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--stroke);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-logo {
  height: 36px;
  width: 36px;
  object-fit: contain;
  flex: none;
  border-radius: 9px;
  background: var(--surface-2);
}
.brand strong {
  display: block;
  font-size: var(--font-xl);
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 6px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-weight: 700;
  font-size: var(--font-sm);
  color: var(--text);
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  padding: 9px 13px;
  min-height: 36px;
  transition:
    background 0.15s,
    transform 0.15s;
}
.btn:not(:disabled):active {
  transform: translateY(1px);
}
.btn-quiet:hover,
.btn-outline:hover,
.btn-icon:hover,
.btn-theme:hover {
  background: var(--surface-3);
}
.btn-theme {
  background: var(--surface-2);
}
#themeIcon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  fill: none;
}
.btn .icon {
  width: 16px;
  height: 16px;
}
.brand-logo:focus {
  outline: 2px solid var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: clamp(293px, 23.5vw, 354px) minmax(0, 1fr) clamp(305px, 23vw, 347px);
  width: 100%;
  height: calc(100dvh - 64px);
  min-height: 0;
  overflow: hidden;
}
.sidebar,
.export-sidebar {
  background: var(--surface);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sidebar {
  border-right: 1px solid var(--stroke);
  padding: 20px 18px 13px;
}
.export-sidebar {
  border-left: 1px solid var(--stroke);
  padding: 18px 17px 17px;
  overflow-y: auto;
  scrollbar-color: var(--stroke-strong) transparent;
}
.panel-header {
  flex: none;
  margin: 0 0 16px 1px;
}
.panel-header h1 {
  font-size: var(--font-2xl);
  letter-spacing: -0.8px;
  margin: 0 0 1px;
  line-height: 1.25;
}
.panel-header p,
.export-panel-heading p {
  color: var(--muted);
  font-size: var(--font-xs);
  margin: 0;
  line-height: 1.5;
}
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 3px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 11px;
  margin-bottom: 13px;
  flex: none;
}
.settings-tab {
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: var(--font-2xs);
  font-weight: 680;
  color: var(--muted);
  height: 35px;
  padding: 0 1px;
  min-width: 0;
  white-space: nowrap;
}
.settings-tab:hover {
  color: var(--text);
  background: var(--surface-3);
}
.settings-tab[aria-selected='true'] {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.22);
}
.settings-panel {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 4px 1px 24px;
  scrollbar-color: var(--stroke-strong) transparent;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
}
.step {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex: none;
  font-weight: 800;
  font-size: var(--font-2xs);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.section h2 {
  font-size: var(--font-md);
  letter-spacing: -0.25px;
  margin: 0;
}
.section-count {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--secondary);
  border-radius: 99px;
  padding: 5px 9px;
  font-size: var(--font-2xs);
}
.field {
  min-width: 0;
}
.field label,
.section > label:not(.upload-tile):not(.font-upload):not(.outline-toggle) {
  display: block;
  font-weight: 690;
  font-size: var(--font-xs);
  color: var(--secondary);
  margin-bottom: 6px;
}
textarea,
input[type='number'],
select {
  display: block;
  background: var(--input);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 8px;
  width: 100%;
  min-width: 0;
  outline: none;
}
textarea:focus,
input[type='number']:focus,
select:focus {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea {
  padding: 11px;
  resize: vertical;
  min-height: 122px;
  max-height: 32vh;
  line-height: 1.55;
  font-size: var(--font-sm);
}
input[type='number'],
select {
  height: 35px;
  padding: 0 8px;
  font-size: var(--font-xs);
}
select {
  cursor: pointer;
}
input[type='range'],
input[type='checkbox'] {
  accent-color: var(--accent-text);
}
input[type='range'] {
  display: block;
  width: 100%;
  margin: 10px 0 4px;
  cursor: pointer;
}
input[type='color'] {
  width: 33px;
  height: 27px;
  cursor: pointer;
  border: 1px solid var(--stroke);
  border-radius: 5px;
  padding: 2px;
  background: none;
}
.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 35px;
  padding: 3px 7px;
  background: var(--input);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.color-field span {
  font-size: var(--font-xs);
  color: var(--secondary);
  letter-spacing: 0.4px;
}
.field-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  font-size: var(--font-2xs);
  color: var(--muted);
  margin-top: 8px;
}
.field-help .toggle-row {
  padding-top: 0;
  font-size: var(--font-xs);
}
.inline-btn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-text);
  font-size: var(--font-xs);
  font-weight: 760;
  white-space: nowrap;
}
.inline-btn:hover {
  text-decoration: underline;
}
.sorted-box {
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 12px 13px;
  margin-top: 14px;
}
.sorted-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  letter-spacing: 0.85px;
  font-size: var(--font-3xs);
  font-weight: 850;
}
.sorted-box ol {
  padding-left: 19px;
  margin: 9px 0 0;
  color: var(--secondary);
  font-size: var(--font-xs);
  line-height: 1.7;
}
.sorted-box li {
  padding-left: 2px;
  overflow-wrap: anywhere;
}
.sorted-box li::marker {
  color: var(--accent-text);
}
.upload-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 11px;
  border: 1px dashed var(--stroke-strong);
  border-radius: 10px;
  background: var(--surface-2);
}
.upload-tile:hover {
  border-color: var(--accent-text);
  background: var(--accent-soft);
}
.upload-icon {
  display: flex;
  align-items: center;
  color: var(--accent-text);
}
.upload-icon .icon {
  width: 22px;
  height: 22px;
}
.upload-tile strong {
  display: block;
  max-width: 210px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--font-sm);
}
.upload-tile small {
  display: block;
  color: var(--muted);
  font-size: var(--font-3xs);
  margin-top: 4px;
}
.upload-arrow {
  margin-left: auto;
  color: var(--accent-text);
}
.upload-arrow .icon {
  width: 18px;
  height: 18px;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 13px;
}
.two-col.tight {
  margin-top: 16px;
}
.label-note {
  color: var(--muted);
  font-weight: 450;
}
.font-upload {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  margin-top: 13px;
  border-bottom: 1px dashed var(--accent-text);
  color: var(--accent-text);
  font-weight: 630;
  font-size: var(--font-2xs);
}
.muted-label {
  font-size: var(--font-2xs);
  color: var(--muted);
  margin-top: 4px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 12px;
  color: var(--secondary);
  font-size: var(--font-xs);
  cursor: pointer;
}
.field-tip {
  font-size: var(--font-xs);
  line-height: 1.55;
  color: var(--muted);
  margin: 12px 0 0;
}
.field-tip strong {
  color: var(--secondary);
}
.remove-link {
  margin-top: 12px;
}
.field-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin: 16px 0 8px;
  color: var(--secondary);
  font-size: var(--font-xs);
  font-weight: 750;
}
.field-divider::before {
  content: '';
  display: block;
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
}
.field-divider > span {
  flex: 1;
}
.outline-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0 !important;
  cursor: pointer;
  color: var(--secondary) !important;
  font-size: var(--font-xs) !important;
  font-weight: 650 !important;
}
.direction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.direction-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 9px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--secondary);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-size: var(--font-xs);
}
.direction-choice:has(input:checked) {
  border-color: var(--accent-text);
  background: var(--accent-soft);
  color: var(--text);
}
.direction-choice input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
}
.direction-choice span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
/* Colonna centrale: il video occupa solo lo spazio disponibile in larghezza e altezza. */
.studio {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 21px clamp(13px, 2vw, 30px) 20px;
  background: var(--page);
}
.studio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 10px;
  margin-bottom: 15px;
}
.studio-heading h2 {
  font-size: var(--font-2xl);
  font-weight: 800;
  letter-spacing: -0.8px;
  margin: 0;
}
.resolution-chip {
  white-space: nowrap;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--secondary);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: var(--font-xs);
  font-variant-numeric: tabular-nums;
}
.preview-outer {
  flex: 1 1 auto;
  min-height: 100px;
  min-width: 0;
  border: 1px solid var(--preview-border);
  border-radius: 13px;
  background: #0c0d11;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
  box-shadow: var(--shadow);
}
.preview-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  background: #141720;
  overflow: hidden;
  border-radius: 7px;
}
.preview-inner canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-overlay {
  position: absolute;
  left: 12px;
  top: 11px;
  z-index: 4;
  pointer-events: none;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 11, 15, 0.73);
  color: white;
  font-size: var(--font-3xs);
  font-weight: 800;
  letter-spacing: 0.7px;
  padding: 7px 9px;
}
.box-outline {
  position: absolute;
  z-index: 3;
  left: 9%;
  top: 29%;
  width: 82%;
  height: 42%;
  border: 2px dashed var(--accent-text);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: move;
  touch-action: none;
  user-select: none;
}
.box-outline:hover,
.box-outline.is-dragging {
  border-color: var(--text);
  background: rgba(var(--accent-rgb), 0.14);
}
.box-outline-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(-100%);
  pointer-events: none;
  white-space: nowrap;
  padding: 4px 6px;
  background: #cde5ff;
  color: #073d78;
  border-radius: 4px 4px 0 0;
  font-weight: 800;
  font-size: var(--font-3xs);
  letter-spacing: 0.3px;
}
.box-resize {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #cde5ff;
  border: 2px solid var(--accent);
  cursor: nwse-resize;
  touch-action: none;
  box-shadow: 0 2px 6px #0006;
}
.box-outline.is-locked {
  pointer-events: none;
  opacity: 0.5;
}
.transport {
  flex: none;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 13px 15px 12px;
  margin-top: 14px;
}
.transport-top,
.transport-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.current-name {
  font-size: var(--font-sm);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clock {
  color: var(--muted);
  font-size: var(--font-xs);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.transport input[type='range'] {
  margin: 12px 0 10px;
  height: 5px;
}
.play-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-icon {
  height: 35px;
  min-height: 35px;
  min-width: 36px;
  padding: 7px;
  font-size: var(--font-md);
  background: var(--surface-2);
}
.btn-play {
  min-height: 35px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: rgba(var(--accent-rgb), 0.35);
  padding: 7px 11px;
}
.btn-play:hover {
  background: rgba(var(--accent-rgb), 0.2);
}
.select-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 50%;
}
.select-name label {
  font-size: var(--font-2xs);
  color: var(--muted);
  white-space: nowrap;
}
.select-name select {
  min-width: 0;
  max-width: 215px;
  font-size: var(--font-2xs);
  height: 34px;
}
/* Colonna esportazione. Gli elementi restano sempre accessibili senza scroll di pagina. */
.export-panel-heading {
  flex: none;
  margin-bottom: 10px;
}
.export-panel-heading h2 {
  margin: 0;
  font-size: var(--font-2xl);
  letter-spacing: -0.6px;
}
.export-settings {
  border-top: 1px solid var(--stroke);
  padding-top: 15px;
}
.export-settings .section-title {
  margin: 0 0 12px;
}
.export-settings .field > label {
  margin-bottom: 5px;
}
.export-settings .two-col {
  margin-top: 10px;
  gap: 9px;
}
.export-settings .field-tip {
  margin-top: 9px;
  font-size: var(--font-2xs);
  line-height: 1.4;
}
.export-card {
  border-top: 1px solid var(--stroke);
  padding: 15px 0 0;
  margin-top: 14px;
}
.export-top {
  display: flex;
  align-items: center;
  gap: 9px;
}
.export-symbol {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  flex: none;
}
.export-symbol .icon {
  width: 20px;
  height: 20px;
}
.export-card h3 {
  margin: 0 0 3px;
  font-size: var(--font-md);
  letter-spacing: -0.25px;
}
.export-card p {
  margin: 0;
  font-size: var(--font-2xs);
  color: var(--muted);
  line-height: 1.45;
}
.metrics {
  display: grid;
  grid-template-columns: 0.95fr 1.12fr 1.5fr;
  gap: 7px;
  margin: 14px 0;
  padding: 13px 0;
  border-top: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
}
.metrics > div {
  min-width: 0;
}
.metrics > div + div {
  border-left: 1px solid var(--stroke);
  padding-left: 7px;
}
.metrics small {
  display: block;
  min-height: 20px;
  white-space: normal;
  overflow-wrap: normal;
  font-size: var(--font-4xs);
  letter-spacing: 0.18px;
  line-height: 1.25;
  color: var(--muted);
  font-weight: 790;
}
.metrics strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
  font-size: var(--font-sm);
  letter-spacing: -0.3px;
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 7px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: transparent;
  font-size: var(--font-sm);
  min-height: 42px;
  padding: 11px 14px;
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.export-actions .btn-primary {
  flex: 1 1 auto;
}
.btn-outline {
  border-color: var(--stroke-strong);
  background: var(--surface-2);
}
.export-actions #downloadBtn {
  flex: 1 0 100%;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: rgba(var(--accent-rgb), 0.35);
}
.progress-wrap {
  margin: 0 0 11px;
}
.progress-line {
  height: 6px;
  background: var(--surface-3);
  border-radius: 9px;
  overflow: hidden;
}
.progress-line > div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.1s;
}
.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--font-2xs);
  font-variant-numeric: tabular-nums;
}
.export-card .message {
  margin-top: 10px;
  color: var(--accent-text);
  font-size: var(--font-2xs);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.export-card .message:empty {
  display: none;
}
.export-card .export-note {
  margin-top: 11px;
  font-size: var(--font-2xs);
  line-height: 1.5;
}
/* Su desktop tutta la pagina rimane nel viewport. Le colonne possono
   scorrere autonomamente solo con finestre eccezionalmente basse. */
@media (max-width: 1190px) {
  .workspace {
    grid-template-columns: 290px minmax(0, 1fr) 292px;
  }
  .sidebar {
    padding: 17px 12px 10px;
  }
  .export-sidebar {
    padding: 16px 12px;
  }
  .studio {
    padding-left: 13px;
    padding-right: 13px;
  }
  .select-name label {
    display: none;
  }
}
@media (max-height: 680px) and (min-width: 901px) {
  .topbar {
    height: 54px;
  }
  .workspace {
    height: calc(100dvh - 54px);
  }
  .sidebar {
    padding-top: 12px;
  }
  .panel-header {
    margin-bottom: 8px;
  }
  .panel-header h1 {
    font-size: var(--font-xl);
  }
  .settings-tabs {
    margin-bottom: 8px;
  }
  .studio {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .studio-heading {
    margin-bottom: 9px;
  }
  .studio-heading h2 {
    font-size: var(--font-xl);
  }
  .transport {
    margin-top: 9px;
    padding: 9px 10px;
  }
  .transport input[type='range'] {
    margin: 8px 0;
  }
  .export-panel-heading h2 {
    font-size: var(--font-xl);
  }
  .export-settings {
    padding-top: 9px;
  }
  .export-card {
    margin-top: 8px;
    padding-top: 10px;
  }
  .metrics {
    margin: 8px 0;
    padding: 8px 0;
  }
}
/* Tablet/telefono: nel poco spazio orizzontale le colonne vengono
   impilate. Su desktop, anche a 1024px, resta l'editor a tre colonne. */
@media (max-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }
  .workspace {
    height: auto;
    overflow: visible;
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .sidebar,
  .export-sidebar {
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--stroke);
  }
  .sidebar {
    padding: 18px;
  }
  .settings-panel {
    overflow: visible;
    min-height: auto;
    padding-bottom: 12px;
  }
  .studio {
    min-height: 520px;
    padding: 24px;
    overflow: visible;
  }
  .preview-outer {
    flex: none;
    height: min(62vw, 440px);
  }
  .export-sidebar {
    padding: 20px 22px;
  }
  .export-panel-heading {
    margin-bottom: 16px;
  }
  .export-settings,
  .export-card {
    max-width: 580px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}
@media (max-width: 540px) {
  .topbar {
    height: 61px;
    padding: 0 12px;
  }
  .brand strong {
    font-size: var(--font-sm);
  }
  .brand-logo {
    width: 30px;
    height: 30px;
  }
  .header-right {
    gap: 5px;
  }
  .btn-theme,
  .btn-quiet {
    padding: 6px 8px;
    font-size: var(--font-2xs);
    min-height: 32px;
  }
  #themeLabel {
    display: none;
  }
  .studio {
    padding: 18px 12px;
    min-height: 380px;
  }
  .studio-heading h2 {
    font-size: var(--font-xl);
  }
  .resolution-chip {
    padding: 6px;
    font-size: var(--font-3xs);
  }
  .preview-outer {
    height: 62vw;
    padding: 5px;
  }
  .preview-overlay {
    font-size: var(--font-4xs);
    left: 6px;
    top: 6px;
    padding: 4px;
  }
  .box-outline-label {
    font-size: var(--font-4xs);
    padding: 2px 4px;
  }
  .transport {
    padding: 10px;
  }
  .transport-bottom {
    flex-wrap: wrap;
  }
  .select-name {
    max-width: 100%;
    width: 100%;
  }
  .select-name label {
    display: block;
  }
  .select-name select {
    max-width: 100%;
    flex: 1;
  }
  .export-sidebar {
    padding: 20px 16px;
  }
}

/* Colore sempre disponibile, anche senza immagine. */
.bg-color-option {
  margin-top: 14px;
}
.bg-color-option > label {
  display: block;
  font-weight: 690;
  font-size: var(--font-xs);
  color: var(--secondary);
  margin-bottom: 6px;
}
.bg-color-option .field-tip {
  margin: 6px 0 0;
  font-size: var(--font-2xs);
}
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Stato registrazione: modal fuori dal canvas, dunque assente dal file esportato. */
.recording-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 9, 14, 0.76);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.recording-modal {
  width: min(100%, 460px);
  padding: 32px;
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  text-align: center;
}
.recording-modal-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.recording-modal-icon .icon {
  width: 27px;
  height: 27px;
}
.recording-modal h2 {
  font-size: var(--font-2xl);
  line-height: 1.25;
  letter-spacing: -0.6px;
  margin: 0 0 7px;
}
.recording-subtitle {
  color: var(--secondary);
  font-size: var(--font-sm);
  margin: 0 0 27px;
  line-height: 1.5;
}
.recording-progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.recording-progress-heading strong {
  color: var(--text);
  font-size: var(--font-4xl);
  line-height: 1;
  letter-spacing: -1.8px;
  font-variant-numeric: tabular-nums;
}
.recording-progress-heading span {
  font-size: var(--font-xs);
  color: var(--muted);
  font-weight: 600;
}
.recording-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.recording-progress-track > div {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.16s linear;
}
.recording-times {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--secondary);
  font-size: var(--font-xs);
  margin-top: 11px;
  font-variant-numeric: tabular-nums;
}
.recording-warning {
  margin: 27px 0 23px;
  padding: 13px 14px;
  display: flex;
  text-align: left;
  gap: 10px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--secondary);
  font-size: var(--font-xs);
  line-height: 1.55;
}
.recording-warning .icon {
  color: var(--accent-text);
  width: 19px;
  height: 19px;
  margin-top: 1px;
}
.recording-cancel {
  width: 100%;
  min-height: 41px;
  font-size: var(--font-sm);
}
@media (max-width: 540px) {
  .recording-overlay {
    padding: 14px;
  }
  .recording-modal {
    padding: 24px 20px;
    border-radius: 14px;
  }
  .recording-modal h2 {
    font-size: var(--font-xl);
  }
  .recording-progress-heading strong {
    font-size: var(--font-3xl);
  }
}
@media (prefers-reduced-motion: reduce) {
  .recording-progress-track > div {
    transition: none;
  }
}
