:root {
  color-scheme: dark;
  --bg: #020617;
  --panel: #0f172a;
  --panel-soft: #111c31;
  --line: #23314a;
  --text: #f8fafc;
  --muted: #9aa9bd;
  --cyan: #00a8e8;
  --cyan-dark: #0284c7;
  --amber: #f59e0b;
  --green: #34d399;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 50% -20%, rgba(0,168,232,.10), transparent 34%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, input { font: inherit; }

a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.98);
  color: #0f172a;
  border-bottom: 1px solid #dbe4ef;
  box-shadow: 0 8px 28px rgba(2,6,23,.10);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #0f1d34;
  color: var(--cyan);
  font-size: 30px;
  line-height: 1;
}

.brand-copy strong {
  display: block;
  font-size: 18px;
  letter-spacing: -.03em;
}

.brand-copy em { color: var(--cyan); font-style: normal; }

.brand-copy small {
  display: block;
  margin-top: 1px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.header-action {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.header-action:hover { border-color: var(--cyan); color: #0369a1; }

.page-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: #a8b7ca;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover { color: var(--cyan); }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(15,23,42,.96), rgba(12,27,49,.96));
  border: 1px solid var(--line);
  border-radius: 18px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -.035em;
}

.hero p {
  max-width: 700px;
  margin: 10px 0 0;
  color: #b7c4d6;
  font-size: 14px;
}

.privacy-badge {
  display: grid;
  place-items: center;
  min-width: 148px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid rgba(52,211,153,.28);
  border-radius: 14px;
  background: rgba(6,78,59,.16);
  color: #a7f3d0;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.privacy-badge span { display: block; font-size: 25px; }

.tool-card {
  padding: clamp(18px, 4vw, 30px);
  background: rgba(15,23,42,.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,.22);
}

.drop-zone {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 2px dashed #334155;
  border-radius: 16px;
  background: rgba(2,6,23,.52);
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--cyan);
  background: rgba(0,168,232,.07);
  transform: translateY(-1px);
}

.drop-zone.has-file { min-height: 160px; }

.drop-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 13px;
  border: 1px solid rgba(0,168,232,.30);
  border-radius: 16px;
  background: rgba(0,168,232,.10);
  color: #38bdf8;
  font-size: 29px;
}

.drop-zone strong { display: block; font-size: 17px; }

.drop-zone small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.select-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 16px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: var(--cyan);
  color: #02111e;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.file-summary {
  display: none;
  grid-template-columns: 64px 1fr auto;
  gap: 13px;
  align-items: center;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #091224;
}

.file-summary.is-visible { display: grid; }

.file-thumb {
  width: 64px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  background: #020617;
}

.file-meta { min-width: 0; }
.file-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.file-meta small { color: var(--muted); font-size: 11px; }

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(251,113,133,.28);
  border-radius: 8px;
  background: rgba(136,19,55,.15);
  color: #fda4af;
  cursor: pointer;
}

.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.quality-option {
  position: relative;
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #091224;
  cursor: pointer;
}

.quality-option:has(input:checked) {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0,168,232,.25);
  background: rgba(0,168,232,.07);
}

.quality-option input { position: absolute; opacity: 0; pointer-events: none; }
.quality-option strong { display: block; font-size: 13px; }
.quality-option span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.quality-option b { color: #7dd3fc; font-size: 10px; text-transform: uppercase; }

.process-button {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(90deg, var(--cyan), #38bdf8);
  color: #02111e;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,168,232,.17);
}

.process-button:hover { filter: brightness(1.08); }
.process-button:disabled { cursor: wait; opacity: .58; }

.status-box {
  display: none;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #091224;
}

.status-box.is-visible { display: block; }
.status-box.is-error { border-color: rgba(251,113,133,.45); color: #fecdd3; }
.status-text { display: flex; justify-content: space-between; gap: 15px; color: #cad5e3; font-size: 11px; }

.progress-track {
  height: 7px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #1e293b;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width .2s ease;
}

.progress-track.is-indeterminate .progress-bar {
  width: 34%;
  animation: loading 1.1s ease-in-out infinite;
}

@keyframes loading { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

.result {
  display: none;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.result-header h2 { margin: 0; font-size: 17px; }
.result-header span { color: var(--green); font-size: 11px; font-weight: 800; }

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

.preview-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #091224;
}

.preview-media {
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #111827;
}

.preview-media.checkerboard {
  background-color: #d8dee9;
  background-image: linear-gradient(45deg,#b8c0cc 25%,transparent 25%),linear-gradient(-45deg,#b8c0cc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b8c0cc 75%),linear-gradient(-45deg,transparent 75%,#b8c0cc 75%);
  background-size: 24px 24px;
  background-position: 0 0,0 12px,12px -12px,-12px 0;
}

.preview-media img { display: block; max-width: 100%; max-height: 430px; object-fit: contain; }
.preview-card figcaption { padding: 9px 12px; color: #cbd5e1; font-size: 11px; font-weight: 800; }

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.download-button,
.secondary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.download-button { flex: 1; border: 0; background: var(--green); color: #032018; }
.secondary-button { border: 1px solid var(--line); background: #111c31; color: #dbe7f5; }

.content-section {
  margin-top: 22px;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15,23,42,.84);
}

.content-section h2 { margin: 0 0 12px; font-size: 21px; }
.content-section h3 { margin: 22px 0 7px; font-size: 15px; }
.content-section p, .content-section li { color: #b7c4d6; font-size: 13px; }
.content-section ol { padding-left: 20px; }
.content-section details { padding: 13px 0; border-top: 1px solid var(--line); }
.content-section summary { cursor: pointer; font-size: 13px; font-weight: 800; }

.site-footer {
  padding: 26px 16px;
  border-top: 1px solid #172338;
  color: #7f90a7;
  text-align: center;
  font-size: 11px;
}

.site-footer a { color: #a9b8cb; }

@media (max-width: 700px) {
  .header-inner { width: min(100% - 20px, 1180px); min-height: 62px; }
  .brand-icon { width: 38px; height: 38px; font-size: 25px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy small { display: none; }
  .header-action { padding: 0 10px; font-size: 10px; }
  .page-shell { width: min(100% - 20px, 1040px); padding-top: 18px; }
  .hero { grid-template-columns: 1fr; padding: 18px; }
  .privacy-badge { min-height: auto; grid-template-columns: auto 1fr; justify-content: start; text-align: left; }
  .privacy-badge span { margin-right: 8px; font-size: 20px; }
  .settings, .comparison { grid-template-columns: 1fr; }
  .drop-zone { min-height: 210px; padding: 20px 14px; }
  .preview-media { min-height: 220px; }
  .result-actions { flex-direction: column; }
}

