:root {
  --paper: #090909;
  --paper-strong: #111111;
  --ink: #f2ebdd;
  --muted: #c7bcaa;
  --line: rgba(242, 235, 221, 0.18);
  --line-strong: rgba(242, 235, 221, 0.88);
  --accent: #f2ebdd;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Poppins", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 248, 234, 0.08), transparent 24%),
    radial-gradient(circle at top left, rgba(255, 248, 234, 0.04), transparent 28%),
    linear-gradient(180deg, #060606 0%, var(--paper) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line-strong);
}

.wordmark {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.8;
}

.header-meta {
  max-width: 360px;
  padding-top: 6px;
}

.header-meta p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
}

.ticker {
  margin: 14px 0 28px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  gap: 28px;
  min-width: 100%;
  padding: 12px 0;
  animation: ticker-scroll 22s linear infinite;
}

.ticker-track span {
  position: relative;
  padding-right: 28px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ticker-track span::after {
  content: "/";
  position: absolute;
  right: 0;
  top: 0;
}

.hero {
  padding: 14px 0 34px;
  border-bottom: 1px solid var(--line);
}

.hero-kicker,
.results-header,
.stage-header,
.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.field-label,
.status-label,
.notes-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-note {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
}

h1,
h2,
.result-card h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.06em;
}

h1 {
  max-width: 10ch;
  margin-top: 18px;
  font-size: clamp(3.9rem, 9vw, 8.8rem);
  line-height: 0.9;
  text-transform: uppercase;
}

h1 em {
  font-style: italic;
}

h2 {
  font-size: clamp(1.9rem, 3vw, 2.9rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.intro {
  max-width: 58ch;
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 0;
  margin-top: 26px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
}

.panel {
  position: relative;
  background: transparent;
}

.controls,
.stage-panel,
.results-shell {
  padding: 24px;
}

.controls {
  border-right: 1px solid var(--line-strong);
}

.field-group + .field-group,
.field-row + .primary-button,
.primary-button + .status-card,
.status-card + .notes-card {
  margin-top: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 14px;
  margin-top: 18px;
}

input[type="file"],
textarea,
select {
  width: 100%;
  padding: 14px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

select option {
  color: #111111;
}

input[type="file"] {
  padding-bottom: 8px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

textarea::placeholder {
  color: rgba(242, 235, 221, 0.45);
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.primary-button,
.ghost-button,
.copy-button {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-button {
  width: 100%;
  padding: 14px 18px;
  background: var(--ink);
  color: #0d0d0d;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ghost-button,
.copy-button {
  padding: 11px 14px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.primary-button:hover,
.ghost-button:hover,
.copy-button:hover {
  transform: translateY(-2px);
  background: var(--ink);
  color: #0d0d0d;
}

.status-card,
.notes-card {
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

.status-card p:last-child,
.notes-card ul {
  margin-bottom: 0;
}

.notes-card ul {
  margin-top: 10px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.stage-panel {
  min-height: 100%;
}

.stage-frame {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(45deg, rgba(242, 235, 221, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(242, 235, 221, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(242, 235, 221, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(242, 235, 221, 0.05) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.results-shell {
  margin-top: 0;
  border: 1px solid var(--line-strong);
  border-top: 0;
  background: transparent;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.empty-state,
.result-card {
  min-height: 100%;
  padding: 20px 24px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

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

.result-header-row,
.result-familyline,
.result-cta,
.result-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.result-header-row {
  margin-bottom: 22px;
}

.result-familyline {
  flex: 1;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.result-cta {
  align-items: center;
}

.rank-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.result-card h3 {
  font-size: 1.35rem;
  line-height: 0.95;
}

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

.result-score {
  white-space: nowrap;
}

.result-preview {
  flex: 1;
  min-height: 130px;
  padding: 8px 0 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
  display: flex;
  align-items: center;
}

.slides-note {
  margin: 0;
  max-width: 16ch;
  font-size: 0.76rem;
  line-height: 1.45;
  text-transform: uppercase;
}

@keyframes ticker-scroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-33%);
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1380px);
    padding-top: 18px;
  }

  .site-header,
  .hero-kicker,
  .stage-header,
  .results-header,
  .result-header-row,
  .result-familyline,
  .result-cta,
  .result-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-meta {
    max-width: none;
    padding-top: 0;
  }

  .header-meta p,
  .result-score,
  .slides-note {
    text-align: left;
  }

  .result-preview {
    min-height: 96px;
    font-size: clamp(1.7rem, 11vw, 3rem);
  }

  h1 {
    max-width: 100%;
    font-size: clamp(3.2rem, 18vw, 5.2rem);
  }

  .controls,
  .stage-panel,
  .results-shell {
    padding: 18px;
  }
}
