@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --bg-top: #b6ddf8;
  --bg-bottom: #dff2ff;
  --field: #96b95d;
  --field-dark: #6f8e42;
  --frame: #b67a36;
  --frame-dark: #7e4f21;
  --paper: #f7edd0;
  --paper-dark: #ead7a8;
  --ink: #3f2a16;
  --muted: #765d42;
  --accent: #ca7e2f;
  --accent-dark: #925418;
  --screen: #9fc6df;
  --screen-deep: #6f95ae;
  --shadow: 0 8px 0 rgba(126, 79, 33, 0.34), 0 18px 30px rgba(63, 42, 22, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.36) 0, rgba(255, 255, 255, 0) 34%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 220px, rgba(223, 242, 255, 0) 420px),
    linear-gradient(180deg, #b7d07b 0%, var(--field) 38%, var(--field-dark) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 520px, 100% 100%;
}

body {
  min-height: 100vh;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Courier New", monospace;
  background: transparent;
  overflow-x: hidden;
  overflow-y: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 32px),
    linear-gradient(rgba(255,255,255,0.05) 0 2px, transparent 2px 32px);
  opacity: 0.3;
}

h1,
h2,
h3,
.eyebrow,
.panel-kicker,
.step-title,
.result-header span,
.block-label,
.weather-chip,
.certificate-stamp,
.certificate-fields dt,
.stats dt {
  font-family: "Press Start 2P", monospace;
}

p,
pre,
input,
button,
small,
span,
dd {
  margin: 0;
}

.shell {
  width: min(1220px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  height: auto;
  margin: 14px auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.topbar,
.wizard-panel,
.preview-panel {
  position: relative;
  background: linear-gradient(180deg, var(--frame), var(--frame-dark));
  padding: 10px;
  box-shadow: var(--shadow);
}

.topbar::before,
.wizard-panel::before,
.preview-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  background: linear-gradient(180deg, var(--paper), var(--paper-dark));
  border: 3px solid rgba(111, 79, 33, 0.18);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 118px;
}

.topbar > *,
.wizard-panel > *,
.preview-panel > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-size: 0.82rem;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.eyebrow-credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--muted);
  margin-left: 10px;
  white-space: nowrap;
}

.github-pixel {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  image-rendering: pixelated;
  object-fit: contain;
}

h1 {
  font-size: clamp(1.3rem, 2vw, 2rem);
  line-height: 1.4;
  text-align: center;
}

.topbar-note {
  max-width: 28ch;
  text-align: right;
  color: var(--muted);
  line-height: 1.5;
}

.topbar > div {
  flex: 1;
  text-align: center;
  padding-top: 14px;
}

.machine {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 14px;
  min-height: 0;
}

.wizard-panel,
.preview-panel {
  min-height: 0;
}

.wizard-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.wizard-header,
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 8px;
}

.panel-kicker {
  font-size: 0.62rem;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
}

.step-indicator {
  display: flex;
  gap: 8px;
}

.step-dot {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  font-size: 0.58rem;
  background: #fff8e4;
  border: 3px solid rgba(126, 79, 33, 0.2);
  color: var(--muted);
}

.step-dot.is-active {
  background: #ffd47c;
  color: var(--accent-dark);
}

.wizard-form {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 6px 18px 18px;
}

.wizard-step {
  display: none;
  align-content: start;
  gap: 18px;
}

.wizard-step.is-active {
  display: grid;
}

.step-title {
  font-size: 0.92rem;
  line-height: 1.6;
}

.step-copy,
.form-status,
#preview-blurb,
.certificate-subtitle,
.topbar-note {
  color: var(--muted);
}

.field,
.choice-block,
.result-box,
.review-grid,
.mini-ribbon {
  display: grid;
  gap: 10px;
}

.field span,
.block-label {
  font-size: 0.62rem;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
}

input,
button {
  font: inherit;
}

input,
.choice-card,
.review-box,
.result-box pre,
.certificate-card,
.stats div {
  background: rgba(255, 249, 235, 0.9);
  border: 3px solid rgba(126, 79, 33, 0.18);
}

input {
  padding: 14px 12px;
  color: var(--ink);
}

.mini-ribbon,
.review-grid {
  grid-template-columns: repeat(2, 1fr);
}

.mini-ribbon span,
.review-box {
  padding: 10px 12px;
}

.review-grid {
  grid-template-columns: repeat(3, 1fr);
}

.review-box span {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.review-box strong {
  display: block;
  font-family: "Press Start 2P", monospace;
  font-size: 0.62rem;
  line-height: 1.6;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice-card {
  padding: 14px 12px;
  text-align: left;
  box-shadow: 0 4px 0 rgba(126, 79, 33, 0.16);
  cursor: pointer;
}

.choice-card strong {
  display: block;
  font-family: "Press Start 2P", monospace;
  font-size: 0.58rem;
  line-height: 1.6;
}

.choice-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.choice-card.is-active {
  background: linear-gradient(180deg, #ffe3a0, #f6c56c);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
}

.nav-button,
.primary-button,
.result-header button {
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border: 3px solid rgba(126, 79, 33, 0.14);
  color: #fff8e5;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(126, 79, 33, 0.3);
}

.nav-button[disabled] {
  opacity: 0.5;
  cursor: default;
}

.result-box {
  align-content: start;
}

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

.result-header span {
  font-size: 0.62rem;
  line-height: 1.6;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 14px;
  line-height: 1.6;
  min-height: 84px;
}

.compact pre {
  min-height: 64px;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}

.weather-chip {
  font-size: 0.58rem;
  padding: 10px 12px;
  background: rgba(255, 250, 236, 0.9);
  border: 3px solid rgba(126, 79, 33, 0.18);
}

.preview-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 12px;
  padding: 10px 18px 18px;
}

.preview-stage {
  min-height: 276px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--screen) 0%, #d9e9f2 56%, #9db55f 56%, #769042 100%);
  border: 4px solid var(--screen-deep);
}

.preview-card[data-theme="classic"] .preview-stage {
  background: linear-gradient(180deg, #abcde2 0%, #d9e9f2 56%, #9db55f 56%, #769042 100%);
  border-color: #698da0;
}

.preview-card[data-theme="sunrise"] .preview-stage {
  background: linear-gradient(180deg, #ffd6bf 0%, #ffe9d6 56%, #e5a86d 56%, #cf8d55 100%);
  border-color: #d99674;
}

.preview-card[data-theme="forest"] .preview-stage {
  background: linear-gradient(180deg, #c8dfb8 0%, #edf5dc 56%, #7eaa63 56%, #67884f 100%);
  border-color: #72906a;
}

.preview-stage img {
  width: min(100%, 340px);
  image-rendering: pixelated;
}

.preview-copy {
  text-align: center;
}

.preview-copy h2 {
  font-size: clamp(1.4rem, 2vw, 2.4rem);
}

.preview-copy p {
  margin-top: 8px;
}

.preview-status-panel {
  display: grid;
  grid-template-columns: 1.45fr 0.75fr;
  gap: 10px;
}

.health-card,
.status-card {
  padding: 12px;
  min-width: 0;
}

.status-label {
  font-family: "Press Start 2P", monospace;
  font-size: 0.54rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.health-meter {
  margin-top: 10px;
  width: 100%;
  height: 18px;
  padding: 2px;
  background: #6f95ae;
  border: 2px solid rgba(63, 42, 22, 0.35);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.health-meter-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #5c9f45 0%, #94d166 100%);
  transition: width 180ms ease;
}

.health-value {
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.status-value {
  margin-top: 12px;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: capitalize;
}

.certificate-shell {
  display: none;
  padding: 0 18px 18px;
}

.certificate-shell:not(.is-hidden) {
  display: block;
}

.certificate-shell .panel-kicker {
  margin-bottom: 12px;
}

.certificate-card {
  padding: 16px;
}

.certificate-stamp {
  font-size: 0.58rem;
  color: var(--accent-dark);
  letter-spacing: 0.08em;
}

.certificate-card h3 {
  margin-top: 10px;
  font-size: 1.35rem;
}

.certificate-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.certificate-fields div {
  padding: 10px;
  background: rgba(255,255,255,0.5);
  border: 2px solid rgba(126, 79, 33, 0.16);
}

.certificate-fields dt {
  font-size: 0.52rem;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.certificate-fields dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.4;
}

.certificate-note {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.is-hidden {
  display: none;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
  }

  .machine,
  .topbar,
  .choice-grid,
  .review-grid,
  .mini-ribbon,
  .stats,
  .certificate-fields {
    grid-template-columns: 1fr;
  }

  .topbar,
  .preview-header,
  .wizard-nav,
  .result-header {
    align-items: start;
    flex-direction: column;
  }
}
