/* ============================================================
   Compressor — clean, large, light. For everyone.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8fafc;
  --bg-art: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --primary: #2563eb;
  --primary-hi: #1d4ed8;
  --primary-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(15, 23, 42, .08);
}
/* per-section accent themes — hex colors */
[data-section="image"] { --primary: #ea580c; --primary-hi: #c2410c; --primary-soft: #fff7ed; }
[data-section="video"] { --primary: #2563eb; --primary-hi: #1d4ed8; --primary-soft: #eff6ff; }
[data-section="audio"] { --primary: #059669; --primary-hi: #047857; --primary-soft: #ecfdf5; }
[data-section="code"]  { --primary: #7c3aed; --primary-hi: #6d28d9; --primary-soft: #f5f3ff; }
[data-section="tools"] { --primary: #0891b2; --primary-hi: #0e7490; --primary-soft: #ecfeff; }

/* per-section visual identity — not just hex codes */
[data-section="image"] .dropzone { border-style: dashed; border-radius: 20px; }
[data-section="video"] .dropzone { border-style: solid; border-width: 3px; border-radius: 8px; background: linear-gradient(135deg, var(--primary-soft), var(--card)); }
[data-section="audio"] .dropzone { border-radius: 120px; border-style: dotted; }
[data-section="code"]  .dropzone { border-style: solid; border-width: 2px; border-radius: 4px; border-color: var(--border); font-family: "JetBrains Mono", monospace; }
[data-section="tools"] .dropzone { border-style: dashed; border-radius: 16px; border-width: 2px; }

[data-section="image"] .preset { border-radius: 18px; }
[data-section="video"] .preset { border-radius: 8px; }
[data-section="audio"] .preset { border-radius: 50px; }
[data-section="code"]  .preset { border-radius: 3px; font-family: "JetBrains Mono", monospace; }
[data-section="tools"] .preset { border-radius: 12px; }

[data-section="image"] .btn-go { border-radius: 20px; }
[data-section="video"] .btn-go { border-radius: 8px; }
[data-section="audio"] .btn-go { border-radius: 60px; }
[data-section="code"]  .btn-go { border-radius: 3px; }
[data-section="tools"] .btn-go { border-radius: 12px; }
[data-theme="dark"] {
  --bg: #09090b;
  --bg-art: #09090b;
  --card: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --border: #27272a;
  --border-2: #3f3f46;
  --primary: #3b82f6;
  --primary-hi: #60a5fa;
  --primary-soft: #1e3a5f;
  --green: #22c55e;
  --green-soft: #14532d;
  --red: #ef4444;
  --shadow: 0 18px 48px rgba(0,0,0,.4);
}
[data-theme="dark"][data-section="image"] { --primary: #f97316; --primary-hi: #fb923c; --primary-soft: #451a03; }
[data-theme="dark"][data-section="video"] { --primary: #3b82f6; --primary-hi: #60a5fa; --primary-soft: #1e3a5f; }
[data-theme="dark"][data-section="audio"] { --primary: #10b981; --primary-hi: #34d399; --primary-soft: #064e3b; }
[data-theme="dark"][data-section="code"]  { --primary: #8b5cf6; --primary-hi: #a78bfa; --primary-soft: #2e1065; }
[data-theme="dark"][data-section="tools"] { --primary: #22d3ee; --primary-hi: #67e8f9; --primary-soft: #083344; }

[data-theme="dark"][data-section="video"] .dropzone { background: linear-gradient(135deg, var(--primary-soft), var(--card)); }

:root[data-section="image"] {
  --bg: #fffaf3;
  --bg-art: linear-gradient(90deg, rgba(234,88,12,.08) 1px, transparent 1px), linear-gradient(180deg, rgba(234,88,12,.06) 1px, transparent 1px), #fffaf3;
  --card: #ffffff;
  --text: #24130b;
  --muted: #795f4d;
  --border: #efd8c7;
  --border-2: #dea985;
  --primary: #c84a10;
  --primary-hi: #99340b;
  --primary-soft: #fff1e4;
}
:root[data-section="video"] {
  --bg: #fafafa;
  --bg-art: linear-gradient(180deg, #f5f5f5 0 72px, #e5e5e5 72px 78px, #fafafa 78px), repeating-linear-gradient(90deg, rgba(0,0,0,.03) 0 1px, transparent 1px 72px);
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --primary: #e11d48;
  --primary-hi: #fb7185;
  --primary-soft: #fff1f2;
}
:root[data-section="audio"] {
  --bg: #f4fff9;
  --bg-art: repeating-linear-gradient(90deg, rgba(5,150,105,.12) 0 2px, transparent 2px 34px), linear-gradient(180deg, #f4fff9, #e8f7ff);
  --card: #fbfffd;
  --text: #06261c;
  --muted: #477568;
  --border: #bfddd3;
  --border-2: #6ab89e;
  --primary: #047857;
  --primary-hi: #075e45;
  --primary-soft: #ddf7ed;
}
:root[data-section="code"] {
  --bg: #fafafa;
  --bg-art: linear-gradient(180deg, #f5f5f5 0 42px, #fafafa 42px), repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 31px);
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --primary: #8b5cf6;
  --primary-hi: #c4b5fd;
  --primary-soft: #f5f3ff;
}
:root[data-section="tools"] {
  --bg: #f0fdfa;
  --bg-art: linear-gradient(135deg, rgba(8,145,178,.06) 0 50%, transparent 50%), linear-gradient(-135deg, rgba(8,145,178,.04) 0 50%, transparent 50%), #f0fdfa;
  --card: #ffffff;
  --text: #164e63;
  --muted: #6b7280;
  --border: #ccfbf1;
  --border-2: #06b6d4;
  --primary: #0891b2;
  --primary-hi: #0e7490;
  --primary-soft: #ecfeff;
}
[data-theme="dark"][data-section="image"] { --bg: #160d08; --bg-art: linear-gradient(90deg, rgba(249,115,22,.12) 1px, transparent 1px), linear-gradient(180deg, rgba(249,115,22,.10) 1px, transparent 1px), #160d08; --card: #21140d; --text: #fff7ed; --muted: #d6b49d; --border: #4d2b18; --border-2: #8b4a22; --primary: #f97316; --primary-hi: #fdba74; --primary-soft: #3c1d0a; }
[data-theme="dark"][data-section="video"] { --bg: #050505; --bg-art: linear-gradient(180deg, #000 0 72px, #272727 72px 78px, #050505 78px), repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 72px); --card: #111; --text: #fff; --muted: #aaa; --border: #2c2c2c; --border-2: #555; --primary: #fb7185; --primary-hi: #fecdd3; --primary-soft: #321018; }
[data-theme="dark"][data-section="audio"] { --bg: #061411; --bg-art: repeating-linear-gradient(90deg, rgba(16,185,129,.14) 0 2px, transparent 2px 34px), linear-gradient(180deg, #061411, #0b1d2c); --card: #0c1f1a; --text: #ecfdf5; --muted: #94c8b7; --border: #1f493d; --border-2: #31856e; --primary: #34d399; --primary-hi: #a7f3d0; --primary-soft: #0f3329; }
[data-theme="dark"][data-section="code"] { --bg: #090b10; --bg-art: linear-gradient(180deg, #181b22 0 42px, #090b10 42px), repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 31px); --card: #11141a; --text: #eef2ff; --muted: #9aa4b2; --border: #2a3342; --border-2: #536173; --primary: #a78bfa; --primary-hi: #ddd6fe; --primary-soft: #221936; }
[data-theme="dark"][data-section="tools"] { --bg: #042f2e; --bg-art: linear-gradient(135deg, rgba(34,211,238,.08) 0 50%, transparent 50%), linear-gradient(-135deg, rgba(34,211,238,.05) 0 50%, transparent 50%), #042f2e; --card: #0f2928; --text: #ecfeff; --muted: #94a3b8; --border: #134e4a; --border-2: #2dd4bf; --primary: #22d3ee; --primary-hi: #67e8f9; --primary-soft: #083344; }

main[data-section="image"] { --card: #ffffff; --text: #24130b; --muted: #795f4d; --border: #efd8c7; --border-2: #dea985; --primary: #c84a10; --primary-hi: #99340b; --primary-soft: #fff1e4; }
main[data-section="video"] { --card: #ffffff; --text: #0f172a; --muted: #64748b; --border: #e2e8f0; --border-2: #cbd5e1; --primary: #e11d48; --primary-hi: #fb7185; --primary-soft: #fff1f2; }
main[data-section="audio"] { --card: #fbfffd; --text: #06261c; --muted: #477568; --border: #bfddd3; --border-2: #6ab89e; --primary: #047857; --primary-hi: #075e45; --primary-soft: #ddf7ed; }
main[data-section="code"] { --card: #ffffff; --text: #0f172a; --muted: #64748b; --border: #e2e8f0; --border-2: #cbd5e1; --primary: #8b5cf6; --primary-hi: #c4b5fd; --primary-soft: #f5f3ff; }
main[data-section="tools"] { --card: #ffffff; --text: #164e63; --muted: #6b7280; --border: #ccfbf1; --border-2: #06b6d4; --primary: #0891b2; --primary-hi: #0e7490; --primary-soft: #ecfeff; }
[data-theme="dark"] main[data-section="image"] { --card: #21140d; --text: #fff7ed; --muted: #d6b49d; --border: #4d2b18; --border-2: #8b4a22; --primary: #f97316; --primary-hi: #fdba74; --primary-soft: #3c1d0a; }
[data-theme="dark"] main[data-section="video"] { --card: #111; --text: #fff; --muted: #aaa; --border: #2c2c2c; --border-2: #555; --primary: #fb7185; --primary-hi: #fecdd3; --primary-soft: #321018; }
[data-theme="dark"] main[data-section="audio"] { --card: #0c1f1a; --text: #ecfdf5; --muted: #94c8b7; --border: #1f493d; --border-2: #31856e; --primary: #34d399; --primary-hi: #a7f3d0; --primary-soft: #0f3329; }
[data-theme="dark"] main[data-section="code"] { --card: #11141a; --text: #eef2ff; --muted: #9aa4b2; --border: #2a3342; --border-2: #536173; --primary: #a78bfa; --primary-hi: #ddd6fe; --primary-soft: #221936; }
[data-theme="dark"] main[data-section="tools"] { --card: #0f2928; --text: #ecfeff; --muted: #94a3b8; --border: #134e4a; --border-2: #2dd4bf; --primary: #22d3ee; --primary-hi: #67e8f9; --primary-soft: #083344; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-art); background-size: 34px 34px, 34px 34px, auto; color: var(--text);
  min-height: 100vh; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-size: 18px;
}
.hidden { display: none !important; }

/* icons */
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-check { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- header ---------- */
.header {
  display: flex; align-items: center; justify-content: center;
  padding: 18px 20px 14px; position: relative; gap: 12px;
}
.header-left { text-align: center; flex: 1; min-width: 0; }
.header-right {
  position: absolute; top: 14px; right: 14px;
  display: flex; align-items: center; gap: 4px;
}
.theme-btn {
  width: 34px; height: 34px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.theme-btn:hover { background: var(--bg); color: var(--text); }
.theme-btn .ic { width: 18px; height: 18px; flex-shrink: 0; }
.app-title { font-size: 20px; font-weight: 700; letter-spacing: -.3px; margin: 0; }
.app-subtitle { color: var(--muted); font-size: 13px; margin: 0; }
.lang-toggle {
  display: flex; gap: 2px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px;
}
.lang-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; font-family: inherit;
  transition: background-color .15s, color .15s;
}
.lang-btn.active { background: var(--primary); color: #fff; }
.lang-btn:hover:not(.active) { color: var(--text); }

/* ---------- main ---------- */
.main { max-width: 600px; margin: 0 auto; padding: 0 20px 60px; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 3px; padding: 3px; margin-bottom: 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
}
.tab {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: none; cursor: pointer; padding: 10px 6px; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; font-family: inherit;
  transition: background-color .15s ease, color .15s ease; flex: 1; min-width: 0;
}
.tab span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab .ic { width: 16px; height: 16px; flex-shrink: 0; }
@media (min-width: 640px) {
  .tab { padding: 10px 8px; font-size: 15px; gap: 6px; }
  .tab .ic { width: 18px; height: 18px; }
}
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.tab:hover:not(.active) { background: var(--bg); color: var(--text); }

/* ---------- panels ---------- */
.panel { display: none; }
.panel.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- dropzone ---------- */
.dropzone {
  border: 3px dashed var(--border-2); border-radius: var(--radius);
  background: var(--card); padding: 48px 24px; text-align: center; cursor: pointer;
  margin-bottom: 20px; transition: border-color .2s, background .2s, transform .12s; position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.dropzone::before, .dropzone::after { content: ""; position: absolute; pointer-events: none; }
.dropzone > * { position: relative; z-index: 1; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.dz-icon { width: 56px; height: 56px; color: var(--primary); margin-bottom: 16px; margin-left: auto; margin-right: auto; display: block; }
.dz-text { font-size: 20px; font-weight: 600; }
.dz-sub { color: var(--muted); font-size: 16px; margin-top: 6px; }

:root[data-section="image"] .dropzone {
  min-height: 230px;
  background:
    radial-gradient(circle at 86% 50%, rgba(200,74,16,.08) 0 42px, transparent 43px),
    linear-gradient(135deg, rgba(200,74,16,.04), transparent 45%),
    var(--card);
}
:root[data-section="image"] .dropzone::before {
  inset: 18px; border: 1px solid rgba(200,74,16,.15); border-radius: 14px;
  background: rgba(255,255,255,.3); opacity: .9;
}
:root[data-section="image"] .dropzone::after {
  width: 72px; height: 52px; right: 34px; bottom: 30px; border-radius: 10px;
  border: 1px solid rgba(200,74,16,.15);
  background: linear-gradient(135deg, transparent 0 45%, rgba(200,74,16,.12) 46% 54%, transparent 55%);
  opacity: .7;
}

:root[data-section="video"] .dropzone {
  min-height: 250px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.03) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, rgba(225,29,72,.05), transparent 58%),
    var(--card);
}
:root[data-section="video"] .dropzone::before {
  inset: 20px; border: 1px solid rgba(0,0,0,.08);
  background: transparent; opacity: .6;
}

:root[data-section="audio"] .dropzone {
  min-height: 220px;
  background: var(--card);
}
:root[data-section="audio"] .stat { border-width: 2px; }
:root[data-section="audio"] .preset { border-width: 2px; }

:root[data-section="code"] body { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; }
:root[data-section="code"] .dropzone {
  min-height: 210px; text-align: left; padding: 68px 26px 34px;
}
:root[data-section="code"] .dropzone::before {
  left: 0; right: 0; top: 0; height: 42px; background: var(--border); border-bottom: 1px solid var(--border);
}
:root[data-section="code"] .dropzone::after {
  top: 14px; left: 18px; width: 10px; height: 10px; border-radius: 50%;
  background: #ff5f57; box-shadow: 18px 0 #febc2e, 36px 0 #28c840;
}
:root[data-section="code"] .app-title { font-family: "JetBrains Mono", monospace; font-weight: 700; letter-spacing: 1px; }
:root[data-section="code"] .app-subtitle { font-family: "JetBrains Mono", monospace; font-size: 13px; }
:root[data-section="code"] .bar { background: repeating-linear-gradient(90deg, var(--border) 0 4px, transparent 4px 6px); }

:root[data-section="tools"] .dropzone { min-height: 220px; }
:root[data-section="tools"] .tool-tabs { border: 1px solid var(--border); }
:root[data-section="tools"] .tool-tab.active { box-shadow: 0 2px 8px rgba(8,145,178,.2); }

.file-info {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 20px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.file-info::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }

/* ---------- section label ---------- */
.section-label { font-size: 17px; font-weight: 700; margin-bottom: 12px; margin-top: 8px; }

/* ---------- presets ---------- */
.presets { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.presets.row { flex-wrap: nowrap; }
.presets.row .preset { flex: 1; min-width: 0; }
.preset {
  border: 2px solid var(--border); background: var(--card); cursor: pointer;
  border-radius: 14px; padding: 20px 14px; text-align: center; font-family: inherit;
  transition: border-color .15s, background-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 6px;
  min-width: 90px; align-items: center;
}
.preset:hover { border-color: var(--border-2); background: var(--bg); transform: translateY(-1px); }
.preset.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.preset-name { font-size: 17px; font-weight: 700; color: var(--text); }
.preset-hint { font-size: 13px; color: var(--muted); line-height: 1.35; }
.presets.compact { gap: 6px; margin-bottom: 20px; }
.presets.compact .preset { padding: 12px 20px; min-width: 70px; border-radius: 10px; }
.presets.compact .preset-name { font-size: 14px; font-weight: 600; }

/* ---------- big input ---------- */
.big-input {
  width: 100%; height: 56px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); font-size: 20px; font-weight: 600;
  padding: 0 18px; font-family: inherit; transition: border-color .15s;
}
.big-input:focus { outline: none; border-color: var(--primary); }
.big-input::placeholder { color: var(--muted); }
.input-note { font-size: 14px; color: var(--muted); margin-top: 8px; margin-bottom: 24px; }

/* ---------- PNG depth slider ---------- */
.png-depth-wrap { margin-bottom: 8px; }
.png-depth-wrap .section-label { margin-bottom: 8px; }
.png-depth-wrap .slider-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.png-depth-wrap .slider-labels span { text-align: center; flex: 1; }

/* ---------- slider ---------- */
.slider-row { margin-bottom: 28px; }
.slider-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.slider-head .section-label { margin: 0; }
.br-unit { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.fps-input {
  width: 80px; height: 36px; border: 2px solid var(--border); border-radius: 8px;
  font-size: 15px; font-weight: 700; text-align: center; color: var(--primary);
  background: var(--card); padding: 0 6px; margin-left: 8px; outline: none;
  -moz-appearance: textfield;
}
.fps-input::-webkit-outer-spin-button, .fps-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.fps-input:focus { border-color: var(--primary); }
.slider-value {
  font-size: 22px; font-weight: 800; color: var(--primary);
  background: var(--primary-soft); padding: 4px 16px; border-radius: 999px; min-width: 72px; text-align: center;
}
.big-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; border-radius: 999px; cursor: pointer;
  background: transparent; margin: 0; padding: 0;
}
.big-slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hi) var(--pct,50%), var(--border) var(--pct,50%));
}
.big-slider::-moz-range-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hi) var(--pct,50%), var(--border) var(--pct,50%));
}
.big-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: #fff;
  border: 4px solid var(--primary); cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.15); transition: transform .12s;
}
.big-slider::-webkit-slider-thumb:active { transform: scale(1.15); }
.big-slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.slider-labels { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: 8px; font-size: 13px; color: var(--muted); }
.slider-labels > *:nth-child(1) { text-align: left; }
.slider-labels > *:nth-child(2) { text-align: center; }
.slider-labels > *:nth-child(3) { text-align: right; }

/* ---------- toggle ---------- */
.big-toggle {
  display: flex; align-items: center; gap: 14px; cursor: pointer; font-size: 18px; font-weight: 600;
  margin-bottom: 28px; user-select: none;
}
.big-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-box {
  width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--border-2);
  background: var(--card); display: grid; place-items: center; color: #fff; transition: border-color .15s, background-color .15s;
}
.toggle-box .ic-check { opacity: 0; transform: scale(.4); transition: opacity .12s, transform .12s; }
.big-toggle input:checked + .toggle-box { background: var(--primary); border-color: var(--primary); }
.big-toggle input:checked + .toggle-box .ic-check { opacity: 1; transform: scale(1); }

/* ---------- buttons ---------- */
.btn-go {
  width: 100%; height: 64px; border: none; border-radius: 16px; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 22px; font-weight: 700; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: background-color .15s, transform .15s, box-shadow .15s;
}
.btn-go:hover { background: var(--primary-hi); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.btn-go:active { transform: translateY(0); }
.btn-go:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-again {
  width: 100%; height: 52px; border: 2px solid var(--border); border-radius: 14px; cursor: pointer;
  background: var(--card); color: var(--muted); font-size: 17px; font-weight: 600; font-family: inherit;
  margin-top: 10px; transition: border-color .15s, color .15s;
}
.btn-again:hover { border-color: var(--border-2); color: var(--text); }

/* ---------- progress ---------- */
.progress { margin-top: 28px; }
.bar { height: 14px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.progress-text { text-align: center; color: var(--muted); font-size: 16px; margin-top: 14px; font-weight: 500; }

/* ---------- result ---------- */
.result { margin-top: 28px; animation: rise .35s ease; }
.stats { display: flex; align-items: stretch; gap: 10px; margin-bottom: 20px; }
.stat { flex: 1; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px 10px; }
.stat-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-val { font-size: 22px; font-weight: 800; }
.stat-arrow { align-self: center; font-size: 24px; color: var(--muted); }
.stat-saved { background: var(--green-soft); border-color: var(--green); }
.stat-saved .stat-val { color: var(--green); }
.preview { margin-bottom: 20px; text-align: center; }
.preview img, .preview video { display: block; margin: 0 auto; max-width: 100%; max-height: 70vh; min-width: 280px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); }

/* ---------- fps detected ---------- */
.fps-detected { display: inline-flex; align-items: center; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(22,163,74,.15); color: #4ade80; font-size: 12px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; vertical-align: middle; line-height: 1.6; }

/* ---------- slider placeholders ---------- */
.slider-placeholder { display: none; color: var(--muted); font-size: 14px; font-style: italic; opacity: .7; }
.panel:not([data-ready]) .slider-placeholder { display: block; }
.panel:not([data-ready]) .big-slider { opacity: .3; pointer-events: none; }
.panel:not([data-ready]) .slider-head .slider-value,
.panel:not([data-ready]) .br-unit { display: none; }
.panel:not([data-ready]) .slider-labels { display: none; }
.panel:not([data-ready]) .fps-input { display: none; }
.panel:not([data-ready]) .fps-detected { display: none; }

/* ---------- footer ---------- */
.footer { text-align: center; padding: 30px 20px 50px; color: var(--muted); font-size: 15px; }
.footer a { color: var(--primary); text-decoration: none; margin: 0 6px; }
.footer a:hover { text-decoration: underline; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99; background: var(--red); color: #fff; font-size: 17px; font-weight: 600; padding: 14px 24px; border-radius: 12px; box-shadow: 0 8px 24px rgba(220,38,38,.4); animation: rise .2s ease; }

/* ---------- code / text tabs ---------- */
.code-wrap { margin-bottom: 20px; }
.code-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.code-select { height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font-family: inherit; font-size: 15px; padding: 0 12px; cursor: pointer; min-width: 120px; }
.code-select:focus { outline: none; border-color: var(--primary); }
.code-textarea { width: 100%; min-height: 200px; max-height: 60vh; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; padding: 16px; resize: none; line-height: 1.55; tab-size: 4; }
.code-textarea:focus { outline: none; border-color: var(--primary); }
.code-textarea::placeholder { color: var(--muted); opacity: .6; }
.code-compress-slider { margin: 0 0 24px; }

/* ---------- lang popup ---------- */
.lang-popup { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.lang-popup.hidden { display: none; }
.lang-popup-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.lang-popup-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); width: 320px; max-width: 90vw; max-height: 75vh; display: flex; flex-direction: column; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: rise .2s ease; }
.lang-search { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 16px; padding: 0 14px; margin-bottom: 12px; outline: none; flex: none; }
.lang-search:focus { border-color: var(--primary); }
.lang-search::placeholder { color: var(--muted); }
.lang-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lang-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 10px; cursor: pointer; transition: background .1s; border: none; background: transparent; font-family: inherit; text-align: left; color: var(--text); font-size: 16px; }
.lang-item:hover { background: var(--bg); }
.lang-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.lang-item-name { font-weight: 600; }
.lang-item-code { font-size: 12px; color: var(--muted); text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* section theme transitions */
.tab, .preset, .btn-go, .dropzone, .slider-value, .bar-fill, .btn-again, .toggle-box { transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease; }
.big-slider { transition: --pct .3s ease; }
.lang-popup-card { transition: background-color .4s ease; }

/* ---------- touch ---------- */
html { -webkit-tap-highlight-color: transparent; }
button, label, .dropzone, .preset { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input[type="range"] { touch-action: pan-y; }

/* ---------- tablet (768px+) ---------- */
@media (min-width: 768px) {
  .main { max-width: 760px; }
  .app-title { font-size: 36px; }
  .app-subtitle { font-size: 20px; }
  .tab { font-size: 16px; padding: 14px 8px; }
  .dropzone { padding: 60px 32px; }
  .dz-text { font-size: 22px; }
  .preset { padding: 24px 16px; }
  .preset-name { font-size: 19px; }
}

/* ---------- phone landscape / small tablet (480-767px) ---------- */
@media (max-width: 767px) {
  .header { padding: 36px 16px 16px; }
  .app-title { font-size: 28px; }
  .app-subtitle { font-size: 16px; }
  .header-right { top: 16px; right: 16px; gap: 6px; }
  .main { padding: 0 16px 50px; }
  .tab { font-size: 16px; padding: 14px 8px; gap: 6px; }
  .tab .ic { width: 20px; height: 20px; }
  .dropzone { padding: 40px 20px; }
  .dz-text { font-size: 18px; }
  .dz-sub { font-size: 14px; }
  .preset { padding: 16px 10px; }
  .preset-name { font-size: 15px; }
  .preset-hint { font-size: 12px; }
  .btn-go { height: 56px; font-size: 20px; }
  .section-label { font-size: 16px; }
  .slider-value { font-size: 20px; padding: 3px 14px; min-width: 64px; }
  .big-slider::-webkit-slider-thumb { width: 32px; height: 32px; }
  .big-slider::-moz-range-thumb { width: 32px; height: 32px; }
  .big-input { height: 52px; font-size: 18px; }
  .stats { flex-wrap: wrap; }
  .stat { min-width: calc(50% - 5px); padding: 16px 8px; }
  .stat-label { font-size: 12px; }
  .stat-val { font-size: 18px; }
  .stat-arrow { display: none; }
  .preview img, .preview video { min-width: 200px; }
  .toast { font-size: 15px; padding: 12px 20px; left: 16px; right: 16px; transform: none; text-align: center; }
}

/* ---------- small phone (<480px) ---------- */
@media (max-width: 479px) {
  .header { padding: 30px 12px 12px; }
  .app-title { font-size: 24px; }
  .app-subtitle { font-size: 12px; }
  .header-right { top: 10px; right: 10px; gap: 2px; }
  .theme-btn { width: 30px; height: 30px; }
  .theme-btn .ic { width: 16px; height: 16px; }
  .main { padding: 0 12px 40px; }
  .tabs { gap: 2px; padding: 3px; }
  .tab { font-size: 13px; padding: 8px 2px; gap: 3px; flex-direction: column; min-width: 0; }
  .tab .ic { width: 16px; height: 16px; }
  .presets:not(.row) { flex-direction: column; gap: 8px; }
  .dropzone { padding: 32px 16px; border-width: 2px; }
  .dz-text { font-size: 17px; }
  .dz-sub { font-size: 13px; }
  .preset { padding: 14px 12px; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
  .preset-name { font-size: 16px; }
  .preset-hint { font-size: 12px; }
  .btn-go { height: 54px; font-size: 19px; border-radius: 14px; }
  .btn-again { height: 48px; font-size: 16px; }
  .section-label { font-size: 15px; margin-bottom: 10px; }
  .slider-value { font-size: 18px; padding: 3px 12px; min-width: 56px; }
  .slider-labels { font-size: 11px; }
  .big-input { height: 48px; font-size: 17px; }
  .stats { gap: 8px; }
  .stat { min-width: calc(50% - 4px); padding: 12px 6px; border-radius: 10px; }
  .stat-label { font-size: 11px; }
  .stat-val { font-size: 16px; }
  .preview img, .preview video { min-width: 160px; max-height: 50vh; border-radius: 10px; }
  .footer { font-size: 13px; padding: 20px 16px 40px; }
  .toast { font-size: 14px; padding: 10px 16px; }
}

/* ---------- ultra small (<360px) ---------- */
@media (max-width: 359px) {
  .app-title { font-size: 22px; }
  .tab span { display: none; }
  .tab { padding: 14px; }
  .tab .ic { width: 22px; height: 22px; }
  .preset { padding: 12px 10px; }
  .preset-name { font-size: 15px; }
  .preset-hint { font-size: 11px; }
}

/* ---------- control safety net ---------- */
.panel.active { display: block; }
.slider-row, .slider-head, .slider-labels, .big-toggle, .code-wrap, .progress, .result, .stats, .preview {
  visibility: visible;
}
.slider-row {
  display: block;
  min-height: 54px;
}
.big-slider {
  display: block;
  opacity: 1;
  min-height: 28px;
}
.slider-labels {
  display: grid;
}
.big-input, .code-textarea, .code-select, .btn-go, .btn-again {
  opacity: 1;
}
.code-textarea {
  display: block;
}

/* ---------- tools section ---------- */
.tool-tabs {
  display: flex; gap: 6px; padding: 6px; margin-bottom: 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tool-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; padding: 10px 14px; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
  font-family: inherit; transition: background-color .15s, color .15s, box-shadow .15s; white-space: nowrap; flex: 1; min-width: 0;
}
.tool-tab .ic { width: 18px; height: 18px; flex: none; }
.tool-tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.tool-tab:hover:not(.active) { background: var(--bg); color: var(--text); }
.tool-area { display: none; padding: 24px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.tool-area.active { display: block; }
.tool-area .section-label { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.tool-area .dropzone { margin-bottom: 20px; }
.tool-mode-toggle { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.tool-mode { flex: 1; padding: 10px 16px; border: none; background: var(--bg); color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13px; transition: background-color .15s, color .15s; }
.tool-mode.active { background: var(--primary); color: #fff; }
.tool-mode:hover:not(.active) { background: var(--hover); color: var(--text); }
.tool-area .code-textarea { width: 100%; margin-bottom: 12px; min-height: 80px; max-height: 200px; }
.tool-area .btn-go { margin-bottom: 12px; }
.urlencode-result-wrap { position: relative; }
.btn-copy-sm { position: absolute; top: 10px; right: 10px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--muted); font-weight: 600; cursor: pointer; font-size: 12px; transition: background-color .15s, color .15s, border-color .15s; z-index: 2; }
.btn-copy-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
#tool-stats { margin-bottom: 16px; }
#tool-download-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#tool-download-btns .btn-go { flex: none; }

/* ---------- preview overlay ---------- */
.preview-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.85);
  display: none; flex-direction: column; backdrop-filter: blur(6px);
}
.preview-overlay.open { display: flex; }
.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: rgba(0,0,0,.6); border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.preview-toolbar-title {
  font-size: 15px; font-weight: 600; color: #fff; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 40%;
}
.preview-toolbar-actions { display: flex; gap: 6px; }
.preview-btn {
  width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px;
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: 18px;
  display: grid; place-items: center; transition: background-color .15s, border-color .15s; font-family: inherit;
}
.preview-btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }
.preview-btn.close-btn { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.4); }
.preview-btn.close-btn:hover { background: rgba(239,68,68,.4); }
.preview-viewport {
  flex: 1; overflow: hidden; cursor: grab; position: relative; touch-action: none;
  background: #111;
}
.preview-viewport.dragging { cursor: grabbing; }
#preview-content {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
}
#preview-content img { display: block; max-width: none; max-height: none; }
#preview-content svg { display: block; max-width: none; max-height: none; }
.preview-zoom-badge {
  position: absolute; bottom: 16px; right: 16px; padding: 6px 14px;
  background: rgba(0,0,0,.7); color: #fff; border-radius: 8px; font-size: 13px;
  font-weight: 600; pointer-events: none; backdrop-filter: blur(4px);
}
