:root {
  color-scheme: dark;
  --bg: #111412;
  --panel: #181d1a;
  --panel-strong: #202721;
  --ink: #f5f2e9;
  --muted: #b9c0b4;
  --quiet: #7d887f;
  --line: #334034;
  --accent: #d7b46a;
  --accent-strong: #f0c96f;
  --danger: #ef8f7a;
  --success: #8dd6a5;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(215, 180, 106, 0.1), transparent 32rem),
    linear-gradient(210deg, rgba(86, 132, 96, 0.16), transparent 30rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 28px 0 24px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 0.9;
}

h2 {
  font-size: 1.12rem;
}

.hero-copy {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 10px;
}

.hero-stats div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 29, 26, 0.78);
  box-shadow: var(--shadow);
}

.hero-stats span {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.hero-stats small {
  display: block;
  margin-top: 8px;
  color: var(--quiet);
  font-weight: 700;
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel,
.preview-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 29, 26, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  display: flex;
  min-height: 540px;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.panel-heading,
.section-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  color: #17140c;
  background: var(--accent);
}

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

.secondary-button {
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  border-color: var(--accent);
}

.format-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101410;
}

.format-selector legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.format-selector label {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease;
}

.format-selector input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-selector label:has(input:checked) {
  color: #17140c;
  background: var(--accent);
}

.format-selector label:has(input:focus-visible) {
  outline: 3px solid rgba(215, 180, 106, 0.28);
  outline-offset: 2px;
}

.drop-zone {
  display: grid;
  min-height: 162px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #64705f;
  border-radius: 8px;
  background: #131713;
  color: var(--muted);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

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

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

.drop-title {
  color: var(--ink);
  font-weight: 800;
}

.drop-subtitle,
.file-name,
.status-row {
  color: var(--quiet);
  font-size: 0.92rem;
}

.textarea-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #101410;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 180, 106, 0.14);
}

.input-panel textarea,
.output-panel textarea {
  flex: 1;
}

.output-panel textarea {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.status-row {
  min-height: 24px;
}

.status-row.success {
  color: var(--success);
}

.status-row.warning {
  color: var(--accent-strong);
}

.status-row.error {
  color: var(--danger);
}

.preview-section {
  margin-top: 16px;
  padding: 18px;
}

.preview-table-wrap {
  overflow: auto;
  max-height: 420px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
}

.preview-table th,
.preview-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.preview-table td:first-child,
.preview-table th:first-child {
  width: 64px;
  color: var(--quiet);
}

.preview-table td:last-child {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--accent-strong);
}

.preview-table tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: var(--quiet);
  text-align: center;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding: 18px 0;
  }

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

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel {
    min-height: auto;
  }

  textarea {
    min-height: 190px;
  }
}

@media (max-width: 560px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .preview-table th,
  .preview-table td {
    padding: 10px;
  }
}
