:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #646464;
  --line: #d9d4ca;
  --paper: #fffdf7;
  --panel: #f4f0e8;
  --accent: #e93f33;
  --accent-dark: #b72a22;
  --blue: #2467c4;
  --green: #188b5f;
  --yellow: #ffd139;
  --shadow: 0 18px 50px rgba(41, 35, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 21, 0.035) 1px, transparent 1px),
    #fbf8ef;
  background-size: 28px 28px;
}

.is-hidden {
  display: none !important;
}

button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 16px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

button:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.primary {
  color: #fff;
  background: var(--accent);
}

.start-screen {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: #fffdf7;
}

.start-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--ink);
  padding: 18px clamp(18px, 4vw, 54px);
}

.start-nav strong {
  font-size: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.start-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: clamp(28px, 5vw, 72px);
  width: min(1320px, calc(100vw - 36px));
  margin: 0 auto;
  padding: clamp(42px, 7vw, 92px) 0 28px;
}

.start-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 800;
  letter-spacing: 0;
}

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

.start-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(52px, 7.2vw, 112px);
  line-height: 0.95;
}

.start-lede {
  max-width: 660px;
  margin-bottom: 28px;
  color: #363636;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.35;
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.start-actions span {
  color: var(--muted);
  font-weight: 800;
}

.start-quiz-btn {
  min-height: 64px;
  padding: 0 34px;
  font-size: 24px;
}

.start-gallery,
.stage,
.side-panel {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.start-gallery {
  overflow: hidden;
  background: #fff;
}

.gallery-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--yellow);
  padding: 18px 20px;
}

.gallery-title span {
  color: rgba(21, 21, 21, 0.68);
  font-weight: 900;
}

.gallery-title strong {
  font-size: 26px;
}

.preview-sheet {
  aspect-ratio: 2 / 1;
  margin: 10px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: url("./assets/world-tool-sheet.png") center / cover no-repeat #fff;
}

.dataset-note {
  margin: 0;
  border-top: 2px solid var(--ink);
  padding: 16px 20px 18px;
  color: #303030;
  background: #fffdf7;
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 900;
  line-height: 1.35;
}

.start-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding: 16px clamp(18px, 4vw, 54px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 16px;
  width: min(1440px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 12px 0;
}

.stage {
  min-height: calc(100dvh - 24px);
  padding: 16px;
}

.side-panel {
  align-self: start;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.topbar h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 4.4vw, 58px);
  line-height: 1.02;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #fff;
}

.scoreboard div {
  display: grid;
  min-height: 60px;
  place-items: center;
  border-left: 1px solid var(--ink);
}

.scoreboard div:first-child {
  border-left: 0;
}

.scoreboard span {
  display: block;
  font-size: 23px;
  font-weight: 900;
}

.scoreboard small {
  color: var(--muted);
  font-size: 12px;
}

.prompt-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 12px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 10px 0;
}

.prompt-strip span,
.prompt-strip p {
  color: var(--muted);
}

.prompt-strip strong {
  margin-left: 8px;
  font-size: clamp(26px, 3.4vw, 44px);
  line-height: 1;
}

.prompt-strip p {
  max-width: 430px;
  margin-bottom: 0;
  font-size: 14px;
  font-weight: 800;
}

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

.tool-card {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.tool-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.tool-card.is-selected {
  background: #fff4bf;
  outline: 4px solid var(--blue);
}

.tool-card.is-correct {
  outline: 4px solid var(--green);
}

.tool-card.is-wrong {
  outline: 4px solid var(--accent);
}

.tool-image {
  aspect-ratio: 1 / 1;
  border-bottom: 2px solid var(--ink);
  background-repeat: no-repeat;
}

.tool-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.tool-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tool-title-row strong {
  font-size: 15px;
  line-height: 1.2;
}

.check-mark {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 16px;
  font-weight: 900;
}

.tool-card.is-selected .check-mark {
  color: #fff;
  background: var(--blue);
}

.tool-kind {
  display: none;
  width: fit-content;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.tool-card.is-revealed .tool-kind {
  display: inline-block;
}

.tool-card.is-revealed:not(.is-ai) .tool-kind {
  background: var(--muted);
}

.explanation {
  display: none;
  margin: 0;
  color: #363636;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.tool-card.is-revealed .explanation {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.panel-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.panel-section:first-child {
  padding-top: 0;
  border-top: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.2;
}

.model-status {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rule-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-list span {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.result-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.result-box strong {
  font-size: 24px;
}

.result-box span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
}

.facts dt {
  color: var(--muted);
  font-weight: 800;
}

.facts dd {
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 1120px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .start-hero,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 24px, 1280px);
  }

  .stage {
    min-height: auto;
  }

  .side-panel {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .start-nav,
  .start-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .start-hero {
    width: min(100vw - 20px, 1320px);
    padding-top: 30px;
  }

  .start-copy h1 {
    font-size: clamp(44px, 15vw, 82px);
  }

  .start-lede {
    font-size: 19px;
  }

  .gallery-title,
  .topbar,
  .prompt-strip {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .toolbar button {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .start-nav strong {
    font-size: 18px;
  }

  .start-copy h1,
  .topbar h1 {
    font-size: 40px;
  }

  .prompt-strip strong {
    margin-left: 0;
    font-size: 30px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}
