:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5d6a63;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --line: #d8ddd6;
  --accent: #1f7a65;
  --accent-strong: #145f50;
  --gold: #b57b22;
  --rose: #b05b5b;
  --shadow: 0 20px 60px rgba(23, 32, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 122, 101, 0.14), transparent 35%),
    linear-gradient(315deg, rgba(181, 123, 34, 0.14), transparent 38%),
    var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  border-bottom: 1px solid rgba(216, 221, 214, 0.82);
  background: rgba(247, 245, 239, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px max(16px, calc((100vw - 1180px) / 2));
}

.brand {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tabs a {
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 11px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
}

.nav-tabs a.is-active {
  background: var(--accent);
  color: white;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  align-items: center;
}

.converter {
  width: 100%;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

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

.intro {
  max-width: 760px;
  margin-bottom: 24px;
}

.eyebrow,
.step {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.summary {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-graphic {
  margin: 22px 0 18px;
}

.hero-graphic img {
  display: block;
  width: 100%;
  min-height: 190px;
  max-height: 360px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f3;
  box-shadow: var(--shadow);
}

.visual-banner {
  min-height: 150px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 122, 101, 0.13), transparent 42%),
    linear-gradient(315deg, rgba(181, 123, 34, 0.15), transparent 44%),
    rgba(255, 255, 255, 0.82);
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) 90px minmax(160px, 1fr) minmax(150px, 0.8fr);
  gap: 18px;
  align-items: center;
  padding: 22px;
  box-shadow: var(--shadow);
}

.format-card {
  position: relative;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  align-content: end;
  gap: 6px;
  padding: 16px;
}

.format-card strong {
  overflow-wrap: anywhere;
}

.format-card small {
  color: var(--muted);
  font-weight: 800;
}

.file-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 8px 0 8px;
  background: #f4f7f3;
}

.source-card {
  border-left: 5px solid var(--rose);
}

.output-card {
  border-left: 5px solid var(--accent);
}

.conversion-arrow {
  height: 18px;
  display: grid;
  align-items: center;
}

.conversion-arrow span {
  position: relative;
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.conversion-arrow span::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-top: 4px solid var(--accent);
  border-right: 4px solid var(--accent);
  transform: translateY(-50%) rotate(45deg);
}

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

.format-stack div {
  min-height: 48px;
  border: 1px solid rgba(31, 122, 101, 0.25);
  border-radius: 8px;
  background: #eef7f3;
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 18px;
  padding: 0;
  list-style: none;
}

.flow li {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 13px;
}

.flow strong,
.flow span {
  display: block;
}

.flow strong {
  margin-bottom: 5px;
  font-size: 0.94rem;
}

.flow span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel-heading,
.actions,
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading {
  margin-bottom: 18px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drop-zone {
  min-height: 294px;
  border: 2px dashed #aab6ae;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(31, 122, 101, 0.08), transparent),
    #fbfcfa;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eef7f3;
  transform: translateY(-1px);
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.upload-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-size: 2rem;
  line-height: 1;
}

.drop-title {
  font-weight: 800;
  font-size: 1.1rem;
}

.drop-copy {
  color: var(--muted);
}

.selected-file-pill {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.84rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(31, 122, 101, 0.11), transparent),
    #fbfcfa;
}

.file-meta {
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.file-meta div {
  min-width: 0;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.84rem;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.warning-box {
  margin-top: 14px;
  border-left: 3px solid var(--rose);
  border-radius: 6px;
  background: rgba(176, 91, 91, 0.12);
  color: #7f3939;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-pill {
  min-width: 88px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #eef2ef;
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 800;
}

.status-pill.ready {
  background: rgba(31, 122, 101, 0.13);
  color: var(--accent-strong);
}

.status-pill.error {
  background: rgba(176, 91, 91, 0.15);
  color: #8c3f3f;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.inline-field {
  grid-template-columns: 82px 1fr 48px;
  align-items: center;
}

.inline-field span,
.inline-field output {
  color: var(--muted);
  font-weight: 800;
}

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

select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.text-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.engine-note {
  min-height: 42px;
  margin-bottom: 18px;
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  background: #f4f7f3;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.options-box {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 14px;
}

.options-box h3 {
  margin-bottom: 12px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.check-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.progress-wrap {
  margin-bottom: 18px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebe7;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 180ms ease;
}

.pricing-box {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  border: 1px solid rgba(181, 123, 34, 0.38);
  border-radius: 8px;
  background: #fff8eb;
  padding: 12px;
  color: #735018;
}

.pricing-box strong,
.pricing-box span {
  line-height: 1.35;
}

.pricing-box span {
  font-size: 0.9rem;
}

.compact-price {
  margin: 0 0 14px;
}

.preview-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfa;
}

.preview-head {
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f4f7f3;
}

.preview-head span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.preview {
  min-height: 300px;
  max-height: 420px;
  overflow: auto;
  padding: 16px;
  color: var(--muted);
}

.preview pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.preview img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: white;
  border-radius: 6px;
}

.preview audio,
.preview video {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: 6px;
  background: #17201b;
}

.actions {
  margin-top: 18px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  flex: 1;
  border: 0;
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  background: #aab6ae;
  cursor: not-allowed;
}

.secondary-button {
  min-width: 132px;
  border: 1px solid var(--gold);
  color: #835814;
  background: #fff8eb;
}

.secondary-button.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.share-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.small-button {
  min-height: 38px;
  min-width: auto;
  padding: 0 12px;
  font-size: 0.9rem;
}

.queue-list,
.history-list {
  display: grid;
  gap: 10px;
}

.queue-item,
.history-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
  display: grid;
  gap: 5px;
}

.queue-item strong,
.history-item strong {
  overflow-wrap: anywhere;
}

.queue-item span,
.history-item span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.matrix {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 22px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.matrix article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.storefront-grid article {
  display: grid;
  gap: 10px;
}

.connect-subscription-panel {
  margin-top: 18px;
}

.matrix h3 {
  margin-bottom: 8px;
  color: var(--accent-strong);
}

.matrix p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .app-shell {
    width: min(100% - 24px, 640px);
    padding: 24px 0;
    align-items: start;
  }

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

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

  .visual-banner {
    grid-template-columns: 1fr;
  }

  .conversion-arrow {
    transform: rotate(90deg);
  }

  .screen-heading {
    display: grid;
  }

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

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

  .drop-zone {
    min-height: 220px;
  }

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

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