:root {
  --ink: #151217;
  --paper: #fff8ea;
  --muted: #756b65;
  --line: #2b2528;
  --mint: #5ee6a8;
  --coral: #ff6b6b;
  --yellow: #f6d860;
  --blue: #39d0ff;
  --violet: #9b7cff;
  --shadow: rgba(21, 18, 23, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 18, 23, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(21, 18, 23, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: 22px;
  align-items: center;
}

.hero {
  padding: 20px 0;
}

.eyebrow,
.panel-label,
.question-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(42px, 8vw, 104px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  font-size: 28px;
  line-height: 1.08;
}

.hero-copy {
  max-width: 620px;
  color: #453d39;
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-button,
.ghost-button,
.option-button {
  min-height: 48px;
  border: 3px solid var(--line);
  border-radius: 8px;
  box-shadow: 5px 5px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.primary-button {
  padding: 0 22px;
  background: var(--mint);
  font-weight: 900;
}

.ghost-button {
  padding: 0 18px;
  background: #ffffff;
  font-weight: 800;
}

.primary-button:hover,
.ghost-button:hover,
.option-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.primary-button:disabled:hover,
.ghost-button:disabled:hover {
  transform: none;
  box-shadow: 5px 5px 0 var(--ink);
}

.machine,
.hatch-flow,
.result {
  border: 4px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 10px 10px 0 var(--shadow);
}

.machine {
  overflow: hidden;
}

.screen {
  position: relative;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 30% 20%, rgba(94, 230, 168, 0.22), transparent 32%),
    radial-gradient(circle at 70% 80%, rgba(255, 107, 107, 0.18), transparent 30%),
    #17131f;
  display: grid;
  place-items: center;
  border-bottom: 4px solid var(--line);
}

.scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 2px,
    transparent 2px,
    transparent 8px
  );
  mix-blend-mode: screen;
}

#vexCanvas {
  width: min(82%, 400px);
  height: min(82%, 400px);
  image-rendering: pixelated;
}

.machine-panel,
.result {
  padding: 18px;
}

.machine-panel {
  display: grid;
  gap: 16px;
  background: #fff8ea;
}

.machine-panel strong,
.result strong {
  display: block;
  overflow-wrap: anywhere;
}

#dailyLine {
  margin-bottom: 0;
  color: #30292b;
  line-height: 1.45;
}

.hatch-flow,
.result {
  grid-column: 1 / -1;
  padding: 22px;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-track {
  width: min(240px, 45vw);
  height: 12px;
  border: 2px solid var(--line);
  background: #ffffff;
}

.progress-track span {
  display: block;
  width: 20%;
  height: 100%;
  background: var(--coral);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.option-button {
  min-height: 92px;
  padding: 14px;
  background: #ffffff;
  text-align: left;
}

.option-button strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.option-button span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

.result-header h2 {
  margin-bottom: 0;
}

.rarity-pill {
  padding: 10px 12px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--yellow);
  font-weight: 900;
  white-space: nowrap;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.result-grid > div {
  min-height: 84px;
  padding: 14px;
  border: 3px solid var(--line);
  background: #ffffff;
}

.trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.trait-list li {
  padding: 9px 11px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 26px 0;
  }

  .machine {
    order: -1;
  }

  h1 {
    font-size: clamp(40px, 15vw, 72px);
  }

  .option-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-header,
  .question-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .rarity-pill {
    width: max-content;
    max-width: 100%;
    white-space: normal;
  }
}
