:root {
  --sky: #20a8f5;
  --sky-light: #75ddff;
  --yellow: #ffde59;
  --cream: #fff7e8;
  --green: #17b964;
  --grass: #15883d;
  --ink: #111111;
  --red: #ff5b5b;
  --blue-dark: #0c4a7b;
  --shadow: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: Chewy, system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.7) 0 7%, transparent 8%),
    linear-gradient(180deg, var(--sky) 0%, var(--sky-light) 44%, #73dc55 45%, var(--grass) 100%);
}

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

button {
  cursor: pointer;
}

code {
  font-family: "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.app-shell {
  min-height: 100dvh;
  padding: 8px clamp(10px, 2.4vw, 28px) 36px;
}

.tool-topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  position: sticky;
  top: 8px;
  z-index: 20;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup img {
  width: min(128px, 31vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(2px 3px 0 var(--ink));
}

.brand-lockup span,
.trust-strip,
.controls button,
.panel,
.start-hint,
.dog-bubble {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
}

.brand-lockup span {
  background: var(--cream);
  border-radius: 10px;
  padding: 5px 10px 3px;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-width: 306px;
  padding: 6px 10px;
  background: var(--cream);
  border-radius: 10px;
}

.trust-strip span {
  min-height: 24px;
}

.trust-strip span:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--yellow);
  border: 2px solid var(--ink);
}

.controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: var(--shadow);
  min-height: 42px;
  padding: 8px 12px 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 6px 6px 0 var(--ink);
}

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

.secondary-button {
  background: var(--cream);
}

.active-nav {
  background: #d9f1ff;
}

.compact-hero {
  max-width: 1180px;
  margin: 18px auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-hero h1 {
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 4px 0 var(--ink);
}

.hero-panel {
  min-height: 310px;
  display: grid;
  place-items: center;
  position: relative;
  margin: 18px auto 22px;
  max-width: 1180px;
}

.start-hint {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(720px, 94vw);
  padding: clamp(18px, 4vw, 34px);
  text-align: center;
  background: rgba(255, 247, 232, 0.92);
  border-radius: 16px;
  transform: rotate(-1deg);
}

.start-hint strong {
  font-family: "Luckiest Guy", Chewy, sans-serif;
  font-size: clamp(52px, 9vw, 116px);
  line-height: 0.86;
  letter-spacing: 0;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 5px 0 var(--ink);
}

.start-hint span {
  font-size: clamp(20px, 3vw, 30px);
}

.mascot-wrap {
  position: absolute;
  right: clamp(4px, 5vw, 54px);
  bottom: 2px;
  display: grid;
  justify-items: center;
  gap: 4px;
  transform: rotate(3deg);
}

.dog-bubble {
  background: var(--cream);
  border-radius: 999px;
  padding: 7px 13px 5px;
}

.mascot-face {
  width: clamp(86px, 12vw, 138px);
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mascot-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.builder-grid,
.draw-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 18px;
  align-items: start;
}

.screen {
  display: none;
  max-width: 1180px;
  margin: 0 auto 18px;
}

.active-screen {
  display: block;
}

.screen > .panel {
  max-width: 820px;
  margin: 0 auto;
}

.reveal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.reveal-layout > .panel {
  max-width: none;
}

.lifecycle-panel {
  max-width: 1180px;
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  background: rgba(255, 247, 232, 0.92);
}

.step-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 2px 2px 0 var(--ink);
  opacity: 0.66;
}

.step-pill span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
}

.step-pill.active {
  background: var(--yellow);
  opacity: 1;
  transform: rotate(-1deg);
}

.step-pill.done {
  background: #c8f7cb;
  opacity: 1;
}

.step-pill:disabled {
  opacity: 0.45;
  transform: none;
}

.panel {
  background: var(--cream);
  border-radius: 12px;
  padding: clamp(14px, 2vw, 22px);
}

.panel-head {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue-dark);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Luckiest Guy", Chewy, sans-serif;
  letter-spacing: 0;
  line-height: 0.95;
}

h1 {
  font-size: clamp(38px, 5vw, 68px);
}

h2 {
  font-size: clamp(32px, 4vw, 54px);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span,
.check-row span {
  font-size: 1.1rem;
}

input,
textarea,
select {
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 10px 12px;
}

input:disabled,
textarea:disabled,
select:disabled {
  background: #eee8d9;
  color: #4d4d4d;
  cursor: not-allowed;
}

textarea {
  min-height: 240px;
  resize: vertical;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.85rem;
}

#verify-input {
  min-height: 130px;
}

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

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 14px;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 2px 2px 0 var(--ink);
}

.check-row input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  box-shadow: none;
}

.hint-box {
  display: grid;
  gap: 3px;
  margin: 10px 0 14px;
  padding: 12px;
  background: #fff0b8;
  border: 3px solid var(--ink);
  border-radius: 10px;
}

.entrant-preview {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 2px 2px 0 var(--ink);
}

.preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-head span,
.proof-card small {
  color: var(--blue-dark);
}

.preview-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 3px solid var(--ink);
  border-radius: 8px;
}

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

.preview-table th,
.preview-table td {
  padding: 8px 10px;
  border-bottom: 2px solid var(--ink);
  text-align: left;
}

.preview-table th:last-child,
.preview-table td:last-child {
  text-align: right;
  width: 92px;
}

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

.proof-copy,
.roll-state,
.verify-copy {
  margin-bottom: 12px;
}

.proof-copy {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #d9f1ff;
}

.roll-state {
  display: grid;
  grid-template-columns: minmax(0, 0.45fr) minmax(0, 1fr);
  gap: 10px;
}

.roll-state > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: white;
  box-shadow: 2px 2px 0 var(--ink);
}

.roll-state span {
  color: var(--blue-dark);
}

.roll-message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: white;
}

.verify-copy {
  margin-top: 0;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff0b8;
}

.high-assurance {
  background: #d9f1ff;
}

.action-row,
.audit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.proof-card {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 2px 2px 0 var(--ink);
}

.proof-card span {
  color: var(--blue-dark);
}

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

.warning {
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff0b8;
}

.warning.strong {
  background: #ffd2d2;
}

.winner-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 0;
  list-style: none;
}

.winner-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

.winner-list .rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: white;
}

.winner-list .winner-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.winner-list .winner-ticket {
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 0.76rem;
}

.verify-result {
  margin: 12px 0 0;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: white;
}

.verify-result.good {
  background: #c8f7cb;
}

.verify-result.bad {
  background: #ffd2d2;
}

@media (max-width: 900px) {
  .tool-topbar {
    grid-template-columns: 1fr;
    position: relative;
    top: 0;
  }

  .trust-strip,
  .controls,
  .brand-lockup {
    justify-content: center;
  }

  .builder-grid,
  .draw-grid,
  .reveal-layout,
  .settings-grid,
  .lifecycle-panel,
  .roll-state {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 280px;
  }

  .compact-hero {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .mascot-wrap {
    position: relative;
    right: auto;
    bottom: auto;
    margin-top: -4px;
  }
}

@media (max-width: 520px) {
  .start-hint strong {
    font-size: 48px;
  }

  .brand-lockup {
    flex-direction: column;
  }

  .trust-strip {
    min-width: 0;
  }

  .winner-list li {
    grid-template-columns: auto 1fr;
  }

  .winner-list .winner-ticket {
    grid-column: 1 / -1;
  }
}
