.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.spacer { flex: 1; }
button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--gap-medium); padding: var(--padding-medium); min-height: 0; }

.header { height: var(--height); }
.logo-mark { background-image: url("favicon.png"); }
.header-tools { height: 100%; }

.model-bar { grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-small); }
.model-field { display: flex; align-items: center; gap: var(--gap-small); flex: none; }
.model-field-main { flex: 1; min-width: 0; }
.model-label { font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; color: var(--fg-1); white-space: nowrap; }
.model-field select { min-width: 0; }
.model-field-main select { flex: 1; }

.workspace { grid-row: 2; position: relative; min-height: 0; display: flex; flex-direction: column; }
.drop-zone {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gap-medium); padding: var(--padding-extra-large);
  text-align: center; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-large); transition: border-color 0.2s, background 0.2s;
}
.drop-zone.over { border-color: var(--brand); background: var(--bg-1); }
.drop-illustration { display: flex; align-items: center; justify-content: center; width: calc(var(--unit) * 40); height: calc(var(--unit) * 40); background: var(--bg-1); border-radius: var(--border-radius-large); }
.drop-illustration .icon { width: var(--icon-size-extra-large); height: var(--icon-size-extra-large); color: var(--fg-1); }
.drop-title { font-size: var(--font-size-large); font-weight: 700; }
.drop-text { max-width: calc(var(--unit) * 160); color: var(--fg-1); }
.drop-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap-small); }
.drive-dialog { width: min(calc(var(--unit) * 200), calc(var(--vw) * 94)); height: min(calc(var(--vh) * 80), calc(var(--unit) * 300)); }
.drive-dialog[open] { display: flex; flex-direction: column; gap: var(--gap-small); padding: var(--padding-medium); }
.drive-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-small); height: var(--height); }
.drive-title { font-size: var(--font-size-large); font-weight: 700; }
.drive-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); }
.drive-file {
  display: grid; grid-template-columns: var(--icon-size-small) minmax(0, 1fr) minmax(0, 40%) calc(var(--unit) * 20); align-items: center; gap: var(--gap-small);
  flex: none; padding: 0 var(--padding-medium); border: 0; border-bottom: var(--border-width) solid var(--border); border-radius: 0; text-align: start; text-transform: none; font-weight: 400;
}
.drive-file:last-child { border-bottom: 0; }
.drive-file > span:not(.icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-file-folder, .drive-file-size { color: var(--fg-1); font-size: var(--font-size-small); }
.drive-file-size { text-align: end; }
.drive-message { padding: var(--padding-medium); color: var(--fg-1); text-align: center; }
.result-area { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap-small); }
.result-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-small); }
.panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-small); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--gap-small); }
.pane-title { font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; color: var(--fg-1); }
.image {
  flex: 1; min-height: calc(var(--unit) * 40); border: var(--border-width) solid var(--border); border-radius: var(--border-radius-large);
  background: var(--image, none) center / contain no-repeat, var(--bg-1);
}
.image { display: flex; align-items: center; justify-content: center; }
.image audio { width: calc(100% - var(--padding-large) * 2); }
.image video, .image canvas { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.image.background-transparent {
  background: var(--image, none) center / contain no-repeat,
    conic-gradient(var(--bg-1) 25%, var(--bg) 0 50%, var(--bg-1) 0 75%, var(--bg) 0) 0 0 / calc(var(--unit) * 6) calc(var(--unit) * 6);
}
.image.background-white { background: var(--image, none) center / contain no-repeat, var(--white); }
.image.background-custom { background: var(--image, none) center / contain no-repeat, var(--custom-colour); }
.swatch { width: var(--icon-size-small); height: var(--icon-size-small); flex: none; background: var(--custom-colour); border: var(--border-width) solid currentColor; border-radius: var(--border-radius-small); }
.image.background-black { background: var(--image, none) center / contain no-repeat, var(--black); }
dialog { color: var(--fg); background: var(--bg); border: var(--border-width) solid var(--border); padding: 0; }
dialog::backdrop { background: color-mix(in srgb, var(--black) 70%, transparent); }

@media (max-width: 48rem) {
  #background-switch button { padding-inline: var(--padding-small); }
  .panes { grid-template-columns: 1fr; overflow: auto; }
  .image { min-height: calc(var(--unit) * 70); }
}
#choose-button { width: calc(var(--height) * 4); }
#drive-button { width: calc(var(--height) * 4); }
#stop-button { width: calc(var(--height) * 3); }
#another-button { width: calc(var(--height) * 5); }
#save-button { width: calc(var(--height) * 5); }
#zip-button { width: calc(var(--height) * 5); }
#frame-rate-select { width: calc(var(--height) * 2); }
#format-select { width: calc(var(--height) * 6); }

.quality-value { min-width: calc(var(--unit) * 10); padding-inline-end: var(--padding-medium); color: var(--fg-1); text-align: end; }
#quality-range { flex: 1; min-width: calc(var(--height) * 4); }
#compress-format-select { width: calc(var(--height) * 6); }
#compress-size-select { width: calc(var(--height) * 6); }
#compress-fps-select { width: calc(var(--height) * 2); }
#compress-button { width: calc(var(--height) * 5); }
.pane-hint { display: flex; align-items: center; justify-content: center; height: 100%; padding: var(--padding-large); color: var(--fg-1); text-align: center; }
@media (max-width: 48rem) {
  .main { padding: var(--padding-small); }
}
