/* Convertissima — quiet editorial UI, dark first */
:root {
  color-scheme: dark;
  --bg: #14110d;
  --bg-tint: #1a1612;
  --surface: #1d1814;
  --surface-2: #221d18;
  --surface-3: #2a241e;
  --ink: #f1ead9;
  --ink-soft: #d6cdba;
  --muted: #8e8472;
  --line: rgba(241, 234, 217, 0.08);
  --line-strong: rgba(241, 234, 217, 0.16);
  --accent: #9fb0a8;
  --accent-hover: #b5c5bd;
  --accent-fg: #0f0f0f;
  --accent-soft: rgba(159, 176, 168, 0.14);
  --danger: #e98c8c;
  --danger-bg: rgba(233, 140, 140, 0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --maxw: 70rem;
  --space: clamp(1.1rem, 3.2vw, 2rem);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.18);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.32);
}

/* image/index.html: shared platform shell + converter tool (matches index.html chrome) */
body.page-converter.pl {
  --bg: #08080a;
  --bg-tint: #0c0c10;
  --surface: rgba(18, 18, 24, 0.82);
  --surface-2: #12121a;
  --surface-3: #18181f;
  --ink: #f4f4f5;
  --ink-soft: #d4d4d8;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.1);
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-fg: #050505;
  --accent-soft: rgba(34, 211, 238, 0.14);
  --danger: #fca5a5;
  --danger-bg: rgba(248, 113, 113, 0.12);
}

:root[data-theme="light"] body.page-converter.pl {
  --bg: #f4f4f5;
  --bg-tint: #e4e4e7;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-2: #ffffff;
  --surface-3: #e4e4e7;
  --ink: #09090b;
  --ink-soft: #27272a;
  --muted: #71717a;
  --line: rgba(9, 9, 11, 0.08);
  --line-strong: rgba(9, 9, 11, 0.12);
  --accent: #0891b2;
  --accent-hover: #06b6d4;
  --accent-fg: #fafafa;
  --accent-soft: rgba(8, 145, 178, 0.12);
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.08);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4eee0;
  --bg-tint: #efe8d8;
  --surface: #fbf7ec;
  --surface-2: #f5efe1;
  --surface-3: #ede5d2;
  --ink: #1d1812;
  --ink-soft: #38302a;
  --muted: #7a6f5c;
  --line: rgba(29, 24, 18, 0.1);
  --line-strong: rgba(29, 24, 18, 0.16);
  --accent: #5f7369;
  --accent-hover: #4a5c54;
  --accent-fg: #fbfcf9;
  --accent-soft: rgba(95, 115, 105, 0.12);
  --danger: #98322a;
  --danger-bg: rgba(152, 50, 42, 0.08);
  --shadow-sm: 0 1px 0 rgba(29, 24, 18, 0.05);
  --shadow-md: 0 6px 24px rgba(29, 24, 18, 0.08);
  --shadow-lg: 0 18px 50px rgba(29, 24, 18, 0.13);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .progress--busy .progress__bar,
  .queue-item--working,
  .queue-item--working .queue-thumb,
  .queue-status--spinner {
    animation: none !important;
  }

  .progress__bar {
    transition-duration: 0.12s;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.62;
  letter-spacing: 0.005em;
  color: var(--ink-soft);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a.pl-logo:hover,
.pl-header a.pl-btn:hover,
.pl-footer a:hover {
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  z-index: 100;
}

.skip-link:focus {
  left: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  -webkit-backdrop-filter: saturate(120%) blur(8px);
}

@supports not (backdrop-filter: blur(1px)) {
  .site-header {
    background: var(--bg);
  }
}

.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem var(--space);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid var(--accent);
  padding-left: 0.55rem;
}

.logo:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  font: inherit;
}

.nav-toggle__bar {
  display: block;
  width: 1.35rem;
  height: 1.5px;
  background: var(--ink);
  margin: 5px 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.site-nav__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__links a {
  font-weight: 500;
  font-size: 0.93rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav__links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.theme-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.5rem 0.9rem;
  min-width: 4.2rem;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.35rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
  text-decoration: none;
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--ink);
  text-decoration: none;
}

.btn--ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.25rem) var(--space);
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero {
  padding-bottom: clamp(2.75rem, 7vw, 4.5rem);
}

.hero h1 {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 4.1rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--ink);
  max-width: 22ch;
}

.hero__lead {
  margin: 0;
  max-width: 36rem;
  font-size: 1.12rem;
  color: var(--muted);
  font-weight: 400;
}

.hero__actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section {
  padding: clamp(2.25rem, 5vw, 3.25rem) 0;
  border-top: 1px solid var(--line);
}

.section h2 {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.grid-3 {
  display: grid;
  gap: 1.1rem;
}

@media (min-width: 680px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.6rem 1.55rem;
  transition: border-color 0.15s ease;
}

.card:hover {
  border-color: var(--line-strong);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.6;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: 1rem;
}

@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steps li {
  position: relative;
  padding: 1.5rem 1.4rem 1.4rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  counter-increment: step;
}

.steps li::before {
  content: "0" counter(step);
  display: block;
  margin-bottom: 0.85rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.steps strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 1.02rem;
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
}

.steps span {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(2rem, 5vw, 4rem);
  padding: 1.85rem var(--space);
  background: var(--bg-tint);
}

.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer code {
  font-size: 0.82em;
  padding: 0.12em 0.4em;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Converter */
.page-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 24ch;
}

.page-intro {
  margin: 0 0 2rem;
  max-width: 44rem;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.page-intro strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2.1rem);
  box-shadow: var(--shadow-md);
}

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 2.6rem 1.5rem;
  text-align: center;
  background: var(--bg-tint);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.dropzone:hover,
.dropzone:focus-within {
  border-color: var(--accent);
}

.dropzone--active {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
}

.dropzone > strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.dropzone p {
  margin: 0.5rem 0 0;
  font-size: 0.97rem;
  color: var(--muted);
}

.dropzone__actions {
  margin-top: 1.4rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.dropzone__hint {
  font-size: 0.84rem;
  margin-top: 1.1rem;
  color: var(--muted);
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.url-row {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.url-row label {
  flex: 1 1 14rem;
  min-width: 0;
}

.url-row input[type="url"] {
  width: 100%;
  padding: 0.78rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-tint);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.url-row input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.field-label {
  display: block;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.preview-wrap {
  margin-top: 1.5rem;
  display: none;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    repeating-conic-gradient(
      color-mix(in srgb, var(--surface-2) 90%, #fff 6%) 0% 25%,
      color-mix(in srgb, var(--surface) 92%, #000 4%) 0% 50%
    )
    50% / 14px 14px;
}

.preview-wrap.is-visible {
  display: block;
}

.preview-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 320px;
  margin: 0 auto;
  object-fit: contain;
}

.formats {
  margin-top: 1.85rem;
  border: 0;
  padding: 0;
  min-width: 0;
}

.formats legend {
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
  margin-bottom: 0.85rem;
}

.format-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.format-grid label {
  position: relative;
  cursor: pointer;
}

.format-grid input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.format-grid span {
  display: inline-block;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.format-grid input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.format-grid input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.format-grid label.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.format-grid label.is-disabled span {
  text-decoration: line-through;
}

.note {
  margin-top: 0.85rem;
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.55;
}

.settings-panel {
  margin-top: 1.85rem;
  padding: 1.4rem 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-tint);
}

.settings-panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
}

.settings-panel h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.settings-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  max-width: 36rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.control {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.control > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.control output {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.control input,
.control select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.control input:focus,
.control select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
}

.control input[type="range"] {
  padding: 0;
  height: 2.6rem;
  accent-color: var(--accent);
  background: transparent;
  border: none;
}

.control input[type="color"] {
  min-height: 2.7rem;
  padding: 0.25rem;
}

.control--check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.7rem;
  min-height: 4.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.control--check input {
  width: auto;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--accent);
}

.control--check span {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
}

.actions-row {
  margin-top: 1.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.progress {
  width: 100%;
  max-width: 16rem;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  overflow: hidden;
  display: none;
}

.progress.is-visible {
  display: block;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.42s cubic-bezier(0.33, 0.86, 0.32, 1);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent);
}

.progress--busy .progress__bar {
  background: linear-gradient(
    105deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent-hover) 75%, white) 42%,
    var(--accent) 78%,
    color-mix(in srgb, var(--accent) 70%, var(--accent-hover)) 100%
  );
  background-size: 180% 100%;
  animation: progress-bar-shimmer 1.15s ease-in-out infinite;
}

@keyframes progress-bar-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0% 0;
  }
}

.msg {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--danger);
  display: none;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}

.msg.is-visible {
  display: block;
}

.queue {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.35rem;
}

.queue:empty {
  display: none;
}

.queue-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 0.95rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-tint);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.queue-item--working {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent), 0 8px 28px color-mix(in srgb, var(--accent) 8%, transparent);
  animation: queue-row-pulse 1.35s ease-in-out infinite;
}

.queue-item--has-result {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
}

@keyframes queue-row-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent), 0 4px 18px color-mix(in srgb, var(--accent) 6%, transparent);
  }
  50% {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 32px color-mix(in srgb, var(--accent) 14%, transparent);
  }
}

.queue-item--working .queue-thumb {
  animation: queue-thumb-live 1.2s ease-in-out infinite;
}

@keyframes queue-thumb-live {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.92;
    transform: scale(1.04);
  }
}

.queue-thumb {
  width: 3rem;
  height: 3rem;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--line);
}

.queue-info {
  min-width: 0;
}

.queue-name {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-detail {
  margin-top: 0.2rem;
}

.queue-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-meta--error {
  color: var(--danger);
  white-space: normal;
  line-height: 1.45;
}

.queue-transform {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-soft);
  word-break: break-word;
}

.queue-sizes {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.queue-note {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0.92;
}

.queue-status {
  justify-self: end;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.queue-status--done {
  color: var(--accent);
}

.queue-status--error {
  color: var(--danger);
}

.queue-status--spinner {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-top-color: var(--accent);
  animation: queue-spin 0.7s linear infinite;
  text-indent: -9999px;
  overflow: hidden;
  align-self: center;
}

@keyframes queue-spin {
  to {
    transform: rotate(360deg);
  }
}

.queue-download {
  display: inline-flex;
  white-space: nowrap;
  padding: 0.5rem 0.95rem;
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 3.65rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 1.1rem var(--space) 1.35rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    display: none;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav__links {
    flex-direction: column;
    gap: 0.65rem;
  }

  .site-nav__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-panel__head {
    display: block;
  }

  .settings-panel__head p {
    margin-top: 0.4rem;
  }

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

  .queue-item {
    grid-template-columns: 2.6rem minmax(0, 1fr);
  }

  .queue-status,
  .queue-download {
    grid-column: 2;
    justify-self: start;
  }
}

/* Converter page: tool first, fit viewport without page scroll (desktop) */
.page-converter {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page-converter .pl-header {
  flex-shrink: 0;
}

.page-converter .pl-header__inner {
  padding: 0.55rem var(--space);
}

.page-converter .pl-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.55rem var(--space);
}

.page-converter .pl-footer__inner {
  font-size: 0.78rem;
}

.main-converter {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  padding: 0.35rem var(--space) 0.25rem;
  box-sizing: border-box;
}

.converter-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 11.5rem) minmax(0, 1fr);
  gap: 0.85rem 1.1rem;
  align-items: stretch;
}

.converter-rail {
  padding-top: 0.15rem;
}

.converter-rail .eyebrow {
  margin-bottom: 0.45rem;
}

.page-title--compact {
  font-size: 1.35rem;
  line-height: 1.15;
  max-width: none;
  margin-bottom: 0.35rem;
}

.page-tagline {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.converter-seo-intro {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.converter-seo-intro strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.panel-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0;
}

.panel-details summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-details summary::-webkit-details-marker {
  display: none;
}

.panel-details__body {
  padding: 0 0.65rem 0.65rem;
  border-top: 1px solid var(--line);
}

.panel-details__body p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.converter-work {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.page-converter .tool-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.75rem 0.55rem;
  box-shadow: none;
}

.tool-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.15rem;
}

.queue-wrap {
  flex: 0 0 auto;
  max-height: min(28vh, 11rem);
  min-height: 0;
  margin-top: 0.45rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page-converter .queue {
  margin-top: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.45rem;
}

.dropzone--compact {
  padding: 0.65rem 0.75rem;
  text-align: left;
}

.dropzone__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dropzone__copy strong {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
}

.dropzone__copy p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}

.dropzone--compact .dropzone__actions {
  margin-top: 0;
}

.dropzone--compact .dropzone__hint {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  max-width: none;
  margin-left: 0;
}

.url-row--tight {
  margin-top: 0.55rem;
}

.url-row--tight input[type="url"] {
  padding: 0.55rem 0.7rem;
  font-size: 0.86rem;
}

.preview-wrap--compact {
  margin-top: 0.55rem;
}

.preview-wrap--compact img {
  max-height: 120px;
}

.formats--tight {
  margin-top: 0.65rem;
}

.formats--tight legend {
  margin-bottom: 0.45rem;
}

.page-converter .format-grid span {
  padding: 0.38rem 0.72rem;
  font-size: 0.8rem;
}

.settings-trigger-row {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
}

.settings-open-btn {
  flex: 0 0 auto;
}

.settings-summary {
  margin: 0;
  flex: 1 1 10rem;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

/* ── Settings overlay (custom, works on all mobile browsers) ─────────────── */
.settings-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.settings-dialog.is-open {
  opacity: 1;
  pointer-events: auto;
}

.settings-dialog__scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 8, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.settings-dialog__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(calc(100vw - 2rem), 26rem);
  max-height: min(88dvh, 34rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

.settings-dialog.is-open .settings-dialog__panel {
  transform: translateY(0) scale(1);
}

.settings-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.settings-dialog__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.settings-dialog__close {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
}

.settings-dialog__body {
  padding: 0.85rem 1rem 1rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.settings-dialog__lead {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
}

.settings-grid--dialog {
  gap: 0.75rem 0.85rem;
}

.settings-dialog__footer {
  padding: 0.75rem 1rem max(1rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.settings-dialog__footer .btn {
  width: 100%;
  justify-content: center;
  min-height: 2.75rem;
}

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

.actions-row--tight {
  margin-top: 0.55rem;
}

.page-converter .progress {
  max-width: 12rem;
}

@media (max-width: 900px) {
  .converter-layout {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: auto;
  }

  .converter-work {
    order: -1;
    width: 100%;
  }

  .converter-rail {
    padding-top: 0;
  }

  .page-title--compact {
    font-size: 1.2rem;
  }

  .page-tagline {
    font-size: 0.8rem;
    margin-bottom: 0.45rem;
  }

  .panel-details summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .main-converter {
    min-height: auto;
    padding-left: max(var(--space), env(safe-area-inset-left));
    padding-right: max(var(--space), env(safe-area-inset-right));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .page-converter .tool-panel {
    min-height: auto;
    padding: 0.75rem max(0.65rem, env(safe-area-inset-right)) 0.65rem max(0.65rem, env(safe-area-inset-left));
  }

  .tool-panel__scroll {
    overflow: visible;
  }

  .dropzone--compact {
    padding: 0.85rem 0.9rem;
    min-height: 5.5rem;
  }

  .dropzone--compact .dropzone__hint {
    font-size: 0.72rem;
  }

  .page-converter .url-row--tight {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .page-converter .url-row--tight .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .page-converter .url-row--tight input[type="url"] {
    min-height: 48px;
    font-size: 1rem;
  }

  .preview-wrap--compact img {
    max-height: 140px;
  }

  .page-converter .formats--tight .format-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.45rem;
    padding-bottom: 0.35rem;
    margin-inline: -0.15rem;
    padding-inline: 0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .page-converter .format-grid span {
    flex-shrink: 0;
  }

  .settings-trigger-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .settings-open-btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .settings-summary {
    font-size: 0.76rem;
    padding: 0 0.15rem;
  }

  .page-converter .actions-row--tight {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .page-converter .actions-row--tight .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .page-converter .actions-row--tight .progress {
    max-width: none;
    width: 100%;
    height: 6px;
  }

  .queue-wrap {
    max-height: none;
    overflow: visible;
    margin-top: 0.55rem;
    padding-top: 0.55rem;
  }

  .page-converter .queue {
    overflow: visible;
  }

  /* Bottom-sheet on tablets/phones */
  .settings-dialog {
    align-items: flex-end;
  }

  .settings-dialog__panel {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 1.25rem 1.25rem 0 0;
    transform: translateY(100%);
  }

  .settings-dialog.is-open .settings-dialog__panel {
    transform: translateY(0);
  }

  .settings-dialog .settings-grid--dialog.settings-grid--2 {
    grid-template-columns: 1fr;
  }

  .settings-dialog__footer .btn {
    min-height: 48px;
  }
}

/* ── 600 px — small tablets / large phones (portrait) ───────────────────── */
@media (max-width: 600px) {
  .page-converter .pl-header__inner {
    padding: 0.6rem max(0.85rem, env(safe-area-inset-right)) 0.6rem max(0.85rem, env(safe-area-inset-left));
  }

  .main-converter {
    padding: 0
             max(0.85rem, env(safe-area-inset-right))
             max(0.75rem, env(safe-area-inset-bottom))
             max(0.85rem, env(safe-area-inset-left));
  }

  .page-converter .tool-panel {
    padding: 0.85rem 0.85rem;
    border-radius: 0.75rem;
    box-shadow: none;
  }

  /* Dropzone: full-height centred tap target */
  .dropzone--compact {
    text-align: center;
    padding: 1.15rem 1rem;
    min-height: 7rem;
    border-radius: var(--radius);
  }

  .dropzone__main {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }

  .dropzone__copy {
    text-align: center;
  }

  .dropzone--compact .dropzone__actions .btn {
    width: 100%;
    min-height: 48px;
  }

  /* URL row: already column at 900, keep consistent at 600 */
  .url-row--tight label {
    flex: 1 1 auto;
  }

  /* Format chips: horizontal scroll, bigger tap height */
  .page-converter .format-grid span {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }

  /* Queue */
  .queue-item {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
  }

  .queue-thumb {
    width: 2.5rem;
    height: 2.5rem;
  }

  .queue-name {
    font-size: 0.88rem;
  }

  .queue-transform {
    font-size: 0.75rem;
  }

  .queue-sizes {
    font-size: 0.72rem;
  }

  .queue-status,
  .queue-download {
    grid-column: 2;
    justify-self: start;
  }

  .queue-download {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}

/* ── 480 px — compact phones ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Rail is SEO content; on tiny phones it just takes space — hide it */
  .converter-rail {
    display: none;
  }

  .page-converter .pl-footer {
    padding: 0.6rem max(0.85rem, env(safe-area-inset-right))
             max(0.6rem, env(safe-area-inset-bottom))
             max(0.85rem, env(safe-area-inset-left));
  }

  .page-converter .pl-footer__inner {
    font-size: 0.72rem;
  }

  /* Progress bar: slightly thicker for visibility */
  .page-converter .actions-row--tight .progress {
    height: 8px;
  }

  /* Dropzone hint: save space */
  .dropzone--compact .dropzone__hint {
    display: none;
  }

  /* Formats: tighter chips, bigger scroll area */
  .page-converter .formats--tight .format-grid {
    gap: 0.35rem;
    padding-bottom: 0.5rem;
  }

  .page-converter .format-grid span {
    padding: 0.48rem 0.75rem;
    font-size: 0.8rem;
  }
}
