:root {
  --bg: #0f1418;
  --bg-elevated: rgba(18, 27, 34, 0.9);
  --bg-panel: rgba(16, 24, 31, 0.76);
  --line: rgba(147, 174, 186, 0.18);
  --text: #f4efe8;
  --muted: #9db0bb;
  --accent: #7de1d1;
  --accent-strong: #e58b55;
  --success: #8ddf8b;
  --warning: #ffbe63;
  --danger: #ff7676;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(125, 225, 209, 0.2), transparent 32%),
    radial-gradient(circle at top right, rgba(229, 139, 85, 0.18), transparent 30%),
    linear-gradient(180deg, #11181e 0%, #0a0f13 100%);
}

button,
input,
select {
  font: inherit;
}

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

.hero,
.panel {
  opacity: 0;
  transform: translateY(18px);
  animation: rise 700ms ease forwards;
}

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(25, 36, 45, 0.85), rgba(13, 21, 28, 0.82));
  box-shadow: var(--shadow);
  border-radius: 24px;
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 34px;
}

.hero-card {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
  max-width: 9ch;
}

.hero-text,
.panel-heading p,
.instruction-list,
.hint-block p,
.hero-list,
.meta-label {
  color: var(--muted);
}

.hero-text {
  max-width: 56ch;
  margin: 16px 0 0;
  font-size: 1.03rem;
  line-height: 1.6;
}

.hero-stat-label {
  margin: 0 0 18px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
}

.hero-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

.panel {
  padding: 28px;
}

.upload-panel,
.diagnostics-panel,
.outputs-panel {
  grid-column: 1;
}

.instruction-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  animation-delay: 80ms;
}

.diagnostics-panel {
  animation-delay: 120ms;
}

.outputs-panel {
  grid-column: 1 / span 2;
  animation-delay: 160ms;
}

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

.panel-heading h2 {
  font-size: 1.4rem;
}

.panel-heading p {
  margin: 0;
  max-width: 40ch;
  line-height: 1.5;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 184px;
  border-radius: 22px;
  border: 1px dashed rgba(125, 225, 209, 0.38);
  background:
    linear-gradient(135deg, rgba(125, 225, 209, 0.08), rgba(229, 139, 85, 0.09)),
    rgba(7, 14, 18, 0.55);
  cursor: pointer;
  text-align: center;
  padding: 20px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dropzone:hover,
.dropzone:focus-within {
  transform: translateY(-2px);
  border-color: rgba(125, 225, 209, 0.6);
}

.dropzone.is-dragging {
  transform: translateY(-2px) scale(1.01);
  border-color: rgba(229, 139, 85, 0.7);
  background:
    linear-gradient(135deg, rgba(125, 225, 209, 0.14), rgba(229, 139, 85, 0.16)),
    rgba(7, 14, 18, 0.7);
}

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

.dropzone-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.dropzone-subtitle {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.95rem;
}

.field select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 22, 0.8);
  color: var(--text);
  padding: 13px 14px;
}

.meta-strip,
.score-band {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 14, 19, 0.55);
}

.score-band {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(229, 139, 85, 0.2);
  border-radius: 18px;
  background: rgba(229, 139, 85, 0.08);
}

.meta-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
}

.instruction-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 14px;
  line-height: 1.65;
}

.tooltip-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(125, 225, 209, 0.35);
  border-radius: 999px;
  background: rgba(125, 225, 209, 0.08);
  color: var(--text);
  padding: 2px 9px;
  margin: 0 3px;
  cursor: help;
}

.tooltip-chip::after {
  content: "?";
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(125, 225, 209, 0.18);
  font-size: 0.74rem;
  color: var(--accent);
}

.hint-block {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(229, 139, 85, 0.08);
  border: 1px solid rgba(229, 139, 85, 0.2);
}

.hint-block-secondary {
  background: rgba(125, 225, 209, 0.08);
  border-color: rgba(125, 225, 209, 0.2);
}

.contract-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  line-height: 1.55;
  color: var(--muted);
}

.contract-list code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--text);
  background: rgba(7, 13, 18, 0.8);
  border: 1px solid rgba(147, 174, 186, 0.16);
  border-radius: 8px;
  padding: 2px 6px;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 18px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(125, 225, 209, 0.08);
  border: 1px solid rgba(125, 225, 209, 0.18);
  color: var(--text);
}

.signal-list {
  margin: 12px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  line-height: 1.55;
}

.signal-list li.good::marker {
  color: var(--success);
}

.signal-list li.warn::marker {
  color: var(--warning);
}

.signal-list li.bad::marker {
  color: var(--danger);
}

.output-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.debug-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(8, 14, 19, 0.55);
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 12px;
}

.debug-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.debug-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.debug-output {
  min-height: 180px;
  max-height: 280px;
  font-size: 0.84rem;
}

.action-button {
  border: 1px solid rgba(125, 225, 209, 0.36);
  background: linear-gradient(180deg, rgba(125, 225, 209, 0.18), rgba(125, 225, 209, 0.08));
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(125, 225, 209, 0.62);
}

.action-button.ghost {
  background: transparent;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(8, 14, 19, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.tab.is-active {
  color: var(--text);
  border-color: rgba(229, 139, 85, 0.4);
  background: rgba(229, 139, 85, 0.12);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

pre {
  margin: 0;
  min-height: 420px;
  max-height: 680px;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(7, 13, 18, 0.92);
  padding: 20px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92rem;
  line-height: 1.58;
  white-space: pre-wrap;
}

.tooltip {
  position: fixed;
  inset: auto auto 0 0;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(250, 243, 232, 0.96);
  color: #10161c;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  font-size: 0.88rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 20;
}

.tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .instruction-panel,
  .outputs-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 20px;
  }

  .inline-grid,
  .meta-strip,
  .upload-summary,
  .score-band,
  .diagnostics-grid {
    grid-template-columns: 1fr;
  }

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

  .output-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .debug-header {
    flex-direction: column;
  }

  .debug-actions {
    width: 100%;
    flex-direction: column;
  }

  .action-button {
    width: 100%;
  }

  pre {
    min-height: 320px;
  }
}
