:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --panel: #ffffff;
  --ink: #2c3e50;
  --text: #333333;
  --muted: #7f8c8d;
  --line: #e2e8f0;
  --line-strong: #d5dde8;
  --accent: #ffc000;
  --accent-soft: #fff8dd;
  --accent-hover: #f2b400;
  --success: #10b981;
  --danger: #ef4444;
  --navy: #34495e;
  --shadow: 0 20px 50px rgba(44, 62, 80, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
  background: rgba(248, 249, 250, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  height: 48px;
}

.brand img {
  width: 190px;
  height: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--navy);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-links a:hover {
  background: #edf2f7;
}

.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.hero {
  max-width: 760px;
  margin: 0 auto 34px;
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: #9a7500;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 4.7rem);
  line-height: 1;
  font-weight: 850;
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 800;
}

.hero-copy {
  max-width: 620px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

.converter {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: stretch;
}

.upload-panel,
.settings-panel,
.file-stage,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.upload-panel {
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 380px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: clamp(24px, 5vw, 44px);
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf6 100%);
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 18px 40px rgba(255, 192, 0, 0.14);
  transform: translateY(-2px);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 16px 30px rgba(255, 192, 0, 0.28);
}

.upload-icon svg {
  width: 34px;
  height: 34px;
}

.drop-title {
  color: var(--ink);
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  font-weight: 850;
}

.drop-subtitle {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.5;
}

.drop-button {
  display: inline-grid;
  min-height: 46px;
  margin-top: 8px;
  place-items: center;
  padding: 0 20px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  margin-top: 16px;
}

#statusText,
#selectionSummary,
#resultSummary {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: clamp(18px, 3vw, 26px);
}

.panel-heading {
  display: grid;
  gap: 2px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fafc;
}

.mode-tab {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.mode-tab.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(44, 62, 80, 0.08);
}

.controls {
  display: grid;
  gap: 18px;
}

.control-group {
  display: grid;
  gap: 9px;
}

.control-group label,
.toggle {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

select:focus,
input[type="range"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(255, 192, 0, 0.36);
  outline-offset: 2px;
}

.quality-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

output {
  color: #9a7500;
  font-weight: 850;
}

input[type="range"] {
  width: 100%;
  min-height: 42px;
  accent-color: var(--accent);
}

.toggle {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.progress-wrap {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.ghost-button,
.primary-button,
.zip-button,
.download-button {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 850;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.ghost-button {
  padding: 0 16px;
  background: #edf2f7;
  color: var(--navy);
}

.ghost-button:hover:not(:disabled) {
  background: #e2e8f0;
}

.zip-button {
  white-space: nowrap;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
}

.zip-button:hover:not(:disabled) {
  background: var(--navy);
  box-shadow: 0 14px 26px rgba(44, 62, 80, 0.16);
  transform: translateY(-1px);
}

.primary-button {
  width: 100%;
  padding: 0 20px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 14px 30px rgba(255, 192, 0, 0.24);
}

.primary-button:hover:not(:disabled),
.download-button:hover {
  background: var(--accent-hover);
  box-shadow: 0 18px 34px rgba(255, 192, 0, 0.3);
  transform: translateY(-1px);
}

.ghost-button:disabled,
.primary-button:disabled,
.zip-button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
  box-shadow: none;
}

.file-stage,
.results {
  margin-top: 22px;
  padding: clamp(18px, 3vw, 26px);
}

.stage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 12px;
  text-align: right;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.file-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.file-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
}

.file-name,
.result-title {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  font-weight: 850;
}

.file-meta,
.result-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-list {
  display: grid;
  gap: 12px;
}

.result-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.preview {
  width: 76px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
}

.saving {
  color: var(--success);
  font-weight: 850;
}

.warning {
  color: var(--danger);
  font-weight: 850;
}

.download-button {
  display: inline-grid;
  min-width: 112px;
  place-items: center;
  padding: 0 16px;
  background: var(--accent);
  color: var(--ink);
  text-decoration: none;
}

@media (max-width: 840px) {
  .site-header,
  .app-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    position: static;
  }

  .brand img {
    width: 158px;
  }

  .nav-links {
    display: none;
  }

  .app-shell {
    padding-top: 28px;
  }

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

  .dropzone {
    min-height: 320px;
  }

  .stage-heading,
  .status-row,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .site-header,
  .app-shell {
    width: min(100% - 18px, 1120px);
  }

  .result-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .preview {
    width: 64px;
    height: 52px;
  }

  .download-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .zip-button {
    width: 100%;
  }
}
