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

:root {
  --ink: #0e0e0e;
  --ink-2: #3a3a3a;
  --ink-3: #6b6b6b;
  --ink-4: #9e9e9e;
  --surface: #f8f7f4;
  --surface-2: #f1f0ec;
  --surface-3: #e8e7e2;
  --border: #d8d7d2;
  --border-2: #c4c3bd;
  --accent: #1a1a1a;
  --green: #1D9E75;
  --green-bg: #e1f5ee;
  --font-head: 'Syne', sans-serif;
  --font-body: 'Geist', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.logo-mark {
  background: var(--ink);
  color: var(--surface);
  padding: 1px 6px;
  font-size: 0.9rem;
  border-radius: 3px;
  letter-spacing: 0;
}

.logo-name {
  color: var(--ink);
}

.header-tag {
  font-size: 0.75rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ── Hero ── */
.hero {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}

.hero-title em {
  font-style: italic;
  color: var(--ink-3);
}

.hero-sub {
  font-size: 1rem;
  color: var(--ink-3);
  max-width: 52ch;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  border-radius: 99px;
  color: var(--ink-3);
  background: transparent;
  letter-spacing: 0.02em;
}

/* ── Tool Section ── */
.tool-section {
  padding: 3.5rem 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 2rem;
}

/* ── Drop zone ── */
.drop-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  position: relative;
  margin-bottom: 1.25rem;
}

.drop-zone:hover,
.drop-zone.dragover {
  background: var(--surface-2);
  border-color: var(--ink-3);
}

.drop-zone:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.drop-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--ink-4);
}

.drop-icon:first-child {
  display: none;
}

.drop-icon:nth-child(2) {
  display: flex;
}

.drop-title {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.drop-sub {
  font-size: 0.78rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── File Info ── */
.file-info {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 1.25rem;
  background: var(--surface-2);
}

.file-info-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
}

.fi-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.fi-meta {
  font-size: 0.75rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

/* ── Presets ── */
.presets-block {
  margin-bottom: 1.25rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.preset-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-2);
}

.preset-btn.active {
  border-color: var(--ink);
  background: var(--surface-3);
}

.preset-btn.active .preset-name {
  color: var(--ink);
}

.preset-name {
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 2px;
}

.preset-desc {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-4);
  line-height: 1.4;
}

/* ── Settings ── */
.settings-block {
  margin-bottom: 1.5rem;
}

.settings-title {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.setting-row {
  margin-bottom: 1rem;
}

.setting-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.setting-hint {
  font-size: 0.7rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-edge {
  font-size: 0.7rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
  min-width: 20px;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border-2);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.crf-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  min-width: 36px;
  text-align: center;
}

.crf-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.setting-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.setting-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.setting-field select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239e9e9e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.setting-field select:focus {
  border-color: var(--ink-2);
}

.cmd-preview {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.6;
  word-break: break-all;
}

/* ── Button ── */
.compress-btn {
  width: 100%;
  padding: 14px 20px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}

.compress-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.compress-btn:hover:not(:disabled) {
  background: #2a2a2a;
}

.compress-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-arrow {
  font-size: 1rem;
  transition: transform 0.15s;
}

.compress-btn:hover:not(:disabled) .btn-arrow {
  transform: translateX(3px);
}

/* ── Output Panel ── */
.panel-output {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 360px;
}

.output-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  color: var(--ink-4);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

.idle-graphic {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.idle-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.r1 {
  width: 80px;
  height: 80px;
}

.r2 {
  width: 54px;
  height: 54px;
  border-style: dashed;
}

.r3 {
  width: 30px;
  height: 30px;
  background: var(--surface-2);
}

.idle-label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ink-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Progress ── */
.output-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.progress-status {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 0.4s ease;
}

.progress-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-4);
}

.log-box {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-4);
  line-height: 1.7;
  overflow-y: auto;
  max-height: 220px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Result ── */
.output-result {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stat-val {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.stat-val.reduction {
  color: var(--green);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.stat-arrow {
  color: var(--ink-4);
  font-size: 1.2rem;
  text-align: center;
}

.dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.dl-btn:hover {
  background: #2a2a2a;
}

.compress-another {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.compress-another:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ── How strip ── */
.how-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.how-item {
  flex: 1;
  padding: 1.75rem 2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: #fff;
}

.how-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1px;
  background: var(--border);
  color: var(--border);
  font-size: 0;
}

.how-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-4);
  padding-top: 3px;
  min-width: 20px;
}

.how-title {
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.how-desc {
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.55;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--ink-4);
  font-family: var(--font-mono);
}

.site-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-note {
  opacity: 0.7;
}

/* ── Responsive ── */
@media (max-width: 800px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 3rem 0 2rem;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3.5rem);
  }

  .setting-cols {
    grid-template-columns: 1fr 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-arrow {
    display: none;
  }

  .how-strip {
    flex-direction: column;
    border-radius: 8px;
  }

  .how-sep {
    width: 100%;
    height: 1px;
  }

  .site-footer .container {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .footer-note {
    display: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .panel {
    padding: 1.25rem;
  }

  .setting-cols {
    grid-template-columns: 1fr;
  }
}