/* ==========================================================================
   Are You Sure? - shared styles
   Cheap game show gone wrong. Mobile-first.
   ========================================================================== */

:root {
  --bg: #12122A;
  --bg-raised: #1C1C3D;
  --bg-sunk: #0B0B1E;
  --magenta: #FF2E88;
  --yellow: #FFD60A;
  --cyan: #2DE2E6;
  --red: #FF4D2E;
  --cream: #FFF6E5;
  --cream-dim: #C9C2D9;
  --line: rgba(255, 246, 229, 0.14);

  --font-display: 'Bungee', 'Lilita One', 'Arial Black', Impact, system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --tap: 48px;
  --gutter: 16px;
  --max: 960px;

  --shadow-pop: 0 6px 0 rgba(0, 0, 0, 0.35);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Chip: change --chip-color to recolor his whole face. */
  --chip-color: #FFD60A;
  --chip-ink: #12122A;
  --chip-sclera: #FFFFFF;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--yellow);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.01em;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

/* Layout rules below set display on many elements; never let them beat [hidden]. */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--yellow);
  color: var(--bg);
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px var(--gutter);
  border-bottom: 2px solid var(--line);
  background: rgba(11, 11, 30, 0.6);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--cream);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  white-space: nowrap;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.site-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--cream);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a[aria-current='page'] {
  color: var(--bg);
  background: var(--yellow);
}

@media (max-width: 479px) {
  .site-header {
    justify-content: center;
  }
  .site-nav {
    width: 100%;
  }
  .site-nav ul {
    justify-content: space-between;
  }
  .site-nav li {
    flex: 1 1 0;
  }
  .site-nav a {
    width: 100%;
    justify-content: center;
    padding: 0 6px;
  }
}

/* ---------- Layout ---------- */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
}

.site-footer {
  padding: 16px var(--gutter) 24px;
  text-align: center;
  color: var(--cream-dim);
  font-size: 0.85rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 12px 22px;
  border: 3px solid var(--bg-sunk);
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--cream);
  font: 700 1rem/1.1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.btn-primary {
  background: var(--magenta);
  /* Navy on magenta is 5.2:1; white would only be 3.5:1. */
  color: var(--bg);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}

.btn-huge {
  min-height: 72px;
  padding: 16px 40px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.btn-huge svg {
  width: 28px;
  height: 28px;
}

/* ---------- Stage (spotlights behind content) ---------- */

.stage {
  position: relative;
  isolation: isolate;
}

.stage::before,
.stage::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(40px);
}

.stage::before {
  inset: -10% 10% 30% 10%;
  background: radial-gradient(closest-side, rgba(255, 46, 136, 0.35), transparent);
}

.stage::after {
  inset: 20% 25% -5% 25%;
  background: radial-gradient(closest-side, rgba(45, 226, 230, 0.22), transparent);
}

.spotlights {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.spotlights span {
  position: absolute;
  top: -20vh;
  width: 34vmax;
  height: 130vh;
  background: linear-gradient(to bottom, rgba(255, 214, 10, 0.16), rgba(255, 214, 10, 0));
  clip-path: polygon(45% 0, 55% 0, 100% 100%, 0 100%);
  transform-origin: 50% 0;
}

.spotlights span:nth-child(1) {
  left: -6vmax;
  transform: rotate(-24deg);
}

.spotlights span:nth-child(2) {
  right: -6vmax;
  transform: rotate(24deg);
  background: linear-gradient(to bottom, rgba(255, 46, 136, 0.16), rgba(255, 46, 136, 0));
}

/* Marquee bulbs strip */
.bulbs {
  height: 10px;
  margin: 0 auto;
  max-width: 420px;
  background-image: radial-gradient(circle, var(--yellow) 0 3px, transparent 4px);
  background-size: 20px 10px;
  opacity: 0.85;
}

/* ---------- Home ---------- */

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.home-chip {
  position: relative;
  width: min(68vw, 260px);
  margin-top: 4px;
}

.speech {
  position: relative;
  max-width: 340px;
  margin: 4px auto 6px;
  padding: 12px 16px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
}

.speech::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  background: var(--cream);
  border-left: 3px solid var(--bg-sunk);
  border-top: 3px solid var(--bg-sunk);
  transform: rotate(45deg);
}

.title {
  margin: 8px 0 0;
  font-size: clamp(2.4rem, 13vw, 4.6rem);
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--magenta), 6px 6px 0 var(--bg-sunk);
  transform: rotate(-2deg);
}

.tagline {
  max-width: 34ch;
  margin: 6px auto 18px;
  color: var(--cream-dim);
  font-size: 1.05rem;
}

.home-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.home-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

@media (min-width: 720px) {
  .home {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-areas:
      'chip title'
      'chip actions';
    column-gap: 40px;
    align-items: center;
    text-align: left;
    padding-top: 24px;
  }
  .home-host {
    grid-area: chip;
  }
  .home-head {
    grid-area: title;
    align-self: end;
  }
  .home-actions {
    grid-area: actions;
    align-self: start;
    align-items: flex-start;
  }
  .home-chip {
    width: 300px;
  }
  .tagline {
    margin-left: 0;
  }
  .home-links {
    justify-content: flex-start;
  }
  .home-head .bulbs {
    margin-left: 0;
  }
}

/* ---------- Generic cards (placeholder pages for now) ---------- */

.card {
  padding: 20px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
}

.page-title {
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  color: var(--yellow);
}

/* ==========================================================================
   Play
   ========================================================================== */

.play {
  padding-top: 12px;
  /* Answers that quit (hinge) fall out of view instead of stretching the page. */
  overflow: clip;
}

.game {
  --cat-color: var(--cyan);
  position: relative;
}

.challenge-banner {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 14px;
  border: 2px solid var(--yellow);
  border-radius: 999px;
  background: rgba(255, 214, 10, 0.12);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.play-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--tap);
  margin-bottom: 8px;
}

.play-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.play-cat::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cat-color);
  box-shadow: 0 0 10px var(--cat-color);
}

.play-progress {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--yellow);
}

.play-score {
  color: var(--cream-dim);
  font-weight: 600;
  min-width: 5.5em;
  text-align: right;
}

.play-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-host {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-chip {
  flex: none;
  width: 92px;
}

/* On phones the bubble sits to the right of Chip and points at him. */
.play-line {
  flex: 1;
  margin: 0;
  min-height: 3.2em;
  display: flex;
  align-items: center;
  font-size: 0.98rem;
  transition: opacity 0.2s ease;
}

.play-line::before {
  top: 50%;
  left: -12px;
  margin: -10px 0 0;
  transform: rotate(-45deg);
}

.play-line.is-empty {
  opacity: 0;
}

.question-card {
  padding: 18px 18px 22px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop), 0 0 0 2px var(--line) inset;
  transition: border-color 0.4s ease;
}

.question-number {
  margin: 0 0 6px;
  color: var(--cat-color);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-prompt {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(1.25rem, 5.4vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: 0;
  outline: none;
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.answer {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px 10px 10px;
  border: 3px solid var(--bg-sunk);
  border-radius: 16px;
  background: var(--bg-raised);
  color: var(--cream);
  font: 600 1.05rem/1.25 var(--font-body);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.2s ease, transform 0.1s ease;
}

.answer:active:not(:disabled) {
  transform: translateY(3px);
}

.answer:disabled {
  cursor: default;
  color: var(--cream);
  /* Revealed answers take no input. This also lets taps pass through answers
     that are falling off the screen (hinge) onto the Next button below. */
  pointer-events: none;
}

/* Hover is only a gentle highlight; it never reveals anything. */
@media (hover: hover) and (pointer: fine) {
  .answer:hover:not(:disabled) {
    background: #26264F;
  }
}

.answer-key {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-sunk);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.answer-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.answer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.answer-tags:empty {
  display: none;
}

.answer.is-selected {
  border-color: var(--yellow);
  background: #2A2A55;
}

.answer.is-correct,
.answer.is-graded-right {
  border-color: var(--cyan);
  background: rgba(45, 226, 230, 0.14);
}

.answer.is-wrong {
  border-color: var(--red);
  background: rgba(255, 77, 46, 0.16);
}

.answer.is-dim {
  opacity: 0.5;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px 2px 6px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--bg);
}

.tag .icon {
  width: 14px;
  height: 14px;
}

.tag-correct {
  background: var(--cyan);
}

.tag-wrong {
  background: var(--red);
}

.tag-graded {
  background: var(--yellow);
}

.tag-pick {
  background: transparent;
  color: var(--cream);
  box-shadow: inset 0 0 0 2px var(--cream-dim);
}

.answer-hint {
  margin: 2px 0 0;
  color: var(--cream-dim);
  font-size: 0.88rem;
  text-align: center;
}

.hint-desktop,
:root[data-input='desktop'] .hint-touch {
  display: none;
}

:root[data-input='desktop'] .hint-desktop {
  display: inline;
}

/* Too Eager tell: after 2 seconds the border lifts a little. Every question. */
.question-card.is-settled {
  border-color: #3A3A6E;
}

/* Too Slow tell: at 6 seconds the border shifts again, toward a dusky plum. Every question. */
.question-card.is-late {
  border-color: #5E2F58;
}

.rule-banner {
  position: relative;
  padding: 12px 14px 12px 16px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius-sm);
  background: var(--yellow);
  color: var(--bg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  transform: rotate(-1deg);
}

.rule-banner::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  border-radius: 9px 0 0 9px;
  background: repeating-linear-gradient(-45deg, var(--bg) 0 6px, var(--yellow) 6px 12px);
}

.rule-banner-title {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--bg);
}

.rule-banner-text {
  margin: 0;
  font-weight: 600;
}

.rule-banner-quote {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 2px dashed rgba(18, 18, 42, 0.35);
  font-weight: 700;
  font-style: italic;
}

.reveal {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--bg-sunk);
}

.reveal-result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.reveal-result .icon {
  width: 30px;
  height: 30px;
}

.reveal-result.is-right {
  color: var(--cyan);
}

.reveal-result.is-wrong {
  color: var(--red);
}

.reveal-detail {
  margin: 0;
  color: var(--cream);
}

.btn-next {
  width: 100%;
  min-height: 56px;
  margin-top: 4px;
  font-size: 1.1rem;
}

/* "Are you sure?" sheet (touch only). */
.confirm {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 6, 18, 0.55);
}

.confirm-sheet {
  width: 100%;
  max-width: 520px;
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  border-top: 4px solid var(--magenta);
  border-radius: 24px 24px 0 0;
  background: var(--bg-raised);
  text-align: center;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.confirm-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--yellow);
}

.confirm-choice {
  margin: 0 0 16px;
  font-weight: 700;
  font-size: 1.15rem;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn {
  flex: 1;
  min-height: 60px;
  font-size: 1.1rem;
}

.receipts-title {
  margin: 24px 0 10px;
  font-size: 1.2rem;
  color: var(--yellow);
  text-align: left;
}

.receipts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.receipt {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 5px solid var(--cyan);
  background: var(--bg-sunk);
}

.receipt.is-wrong {
  border-left-color: var(--red);
}

.receipt-mark {
  flex: none;
  padding-top: 2px;
  color: var(--cyan);
}

.receipt.is-wrong .receipt-mark {
  color: var(--red);
}

.receipt-mark .icon {
  width: 20px;
  height: 20px;
}

.receipt-body {
  min-width: 0;
}

.receipt-body p {
  margin: 0;
}

.receipt-q {
  font-weight: 700;
}

.receipt-n {
  color: var(--yellow);
}

.receipt-line {
  overflow-wrap: anywhere;
}

.receipt-meta {
  color: var(--cream-dim);
  font-size: 0.85rem;
}

/* What Chip said before the question, and what it pointed at. */
.receipt-chip {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 3px solid var(--yellow);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 214, 10, 0.07);
}

.receipt-chip-said {
  font-style: italic;
  overflow-wrap: anywhere;
}

.receipt-chip-meant {
  color: var(--yellow);
  font-weight: 700;
  font-size: 0.85rem;
}

.receipt-chip.is-decoy {
  border-left-color: var(--line);
  background: rgba(255, 246, 229, 0.04);
}

.receipt-chip.is-decoy .receipt-chip-meant {
  color: var(--cream-dim);
}

.play-error {
  text-align: center;
}

@media (min-width: 900px) {
  .play-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
    align-items: start;
  }
  .play-host {
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 16px;
  }
  .play-chip {
    width: 220px;
  }
  .play-line {
    width: 100%;
    min-height: 4.6em;
    justify-content: center;
    text-align: center;
  }
  .play-line::before {
    top: -12px;
    left: 50%;
    margin: 0 0 0 -10px;
    transform: rotate(45deg);
  }
  .answers {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Shared page bits
   ========================================================================== */

.lede {
  max-width: 60ch;
  margin: -4px 0 20px;
  color: var(--cream-dim);
  font-size: 1.05rem;
}

.empty-state {
  text-align: center;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 6px;
  border: 2px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: var(--bg-sunk);
  font: 700 0.9em/1.5 var(--font-body);
  text-align: center;
}

.plain-card,
.rule-card {
  margin-bottom: 16px;
  padding: 18px 18px 6px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.plain-card h2,
/* Every mutation gets the same neutral border. */
.rule-card-mutation {
  --rule-color: var(--cream-dim);
}

.rule-card h2 {
  font-size: 1.3rem;
  color: var(--yellow);
}

.plain-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

/* ==========================================================================
   Categories
   ========================================================================== */

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

.cat-loading {
  grid-column: 1 / -1;
  color: var(--cream-dim);
}

.cat-card {
  --cat-color: var(--cyan);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 120px;
  padding: 14px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--cream);
  text-decoration: none;
  box-shadow: var(--shadow-pop), inset 0 -4px 0 var(--cat-color);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
}

.cat-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 -4px 0 var(--cat-color);
}

.cat-glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--cat-color);
  color: var(--bg);
}

.cat-icon {
  width: 28px;
  height: 28px;
}

.cat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cat-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.cat-meta {
  color: var(--cream-dim);
  font-size: 0.85rem;
  font-weight: 600;
}

.cat-card-mixed {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  min-height: 88px;
  background: linear-gradient(135deg, rgba(255, 46, 136, 0.28), rgba(45, 226, 230, 0.18)), var(--bg-raised);
}

.cat-card-mixed .cat-name {
  font-size: 1.35rem;
}

@media (min-width: 640px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .cat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ==========================================================================
   How to play
   ========================================================================== */

.rule-card {
  --rule-color: var(--cyan);
  border-left: 8px solid var(--rule-color);
}

.rule-card h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--cream);
}

.rule-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rule-color);
  color: var(--bg);
  font: 700 0.75rem/1.6 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rule-example {
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--cream-dim);
}

.input-modes {
  display: grid;
  gap: 4px 20px;
}

@media (min-width: 900px) {
  .input-modes {
    grid-template-columns: repeat(3, 1fr);
  }
}

.rules-cta {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ==========================================================================
   Results
   ========================================================================== */

.calc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 60vh;
  text-align: center;
  cursor: pointer;
}

.calc-spinner {
  width: 72px;
  height: 72px;
  border: 8px solid var(--bg-raised);
  border-top-color: var(--magenta);
  border-right-color: var(--yellow);
  border-radius: 50%;
}

.calc-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--yellow);
}

.calc-skip {
  margin: 0;
  color: var(--cream-dim);
  font-size: 0.9rem;
}

.results-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.results-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.results-chip {
  width: min(52vw, 200px);
}

.results-line {
  margin: 4px 0 0;
}

.results-cat {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
}

.results-score {
  margin: 0;
  font-size: clamp(4rem, 24vw, 6.5rem);
  color: var(--yellow);
  text-shadow: 4px 4px 0 var(--magenta), 8px 8px 0 var(--bg-sunk);
}

/* The crash shakes these from inside; clip (not hidden) so they never become scrollable. */
.results,
.site-header {
  overflow-x: clip;
}

/* "Shrinking Brain" card: in normal flow at the top of the results page. */
.thumb-card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border: 6px solid #12122A;
  border-radius: 22px;
  overflow: hidden;
  background: #12122A;
  box-shadow: var(--shadow-pop), 0 0 0 2px var(--line);
  transform-origin: 50% 100%;
}

.thumb-svg {
  display: block;
  width: 100%;
  height: auto;
}

#score {
  display: inline-block;
}

.results-of {
  font-size: 0.45em;
  color: var(--cream);
  text-shadow: none;
}

.challenge-strip {
  --ch-color: var(--yellow);
  width: 100%;
  max-width: 560px;
  padding: 14px 16px;
  border: 3px solid var(--ch-color);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.challenge-strip.is-win {
  --ch-color: var(--cyan);
}

.challenge-strip.is-lose {
  --ch-color: var(--red);
}

.challenge-strip p {
  margin: 0;
}

.challenge-vs {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.challenge-vs-word {
  color: var(--cream-dim);
  font-size: 0.85em;
}

.challenge-outcome {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 !important;
  padding: 2px 12px 2px 8px;
  border-radius: 999px;
  background: var(--ch-color);
  color: var(--bg);
  font-weight: 700;
}

.challenge-outcome .icon {
  width: 18px;
  height: 18px;
}

.challenge-line {
  color: var(--cream);
  font-weight: 600;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 560px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.results-stats li,
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-size: 0.82rem;
  color: var(--cream-dim);
  line-height: 1.25;
}

.results-stats strong,
.stat-tile strong {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--cream);
}

.results-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.run-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  color: var(--cream-dim);
  font-size: 0.9rem;
}

.run-code strong {
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.06em;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.share-card {
  width: 100%;
  max-width: 420px;
  padding: 18px;
  border: 3px solid var(--bg-sunk);
  border-radius: var(--radius);
  background: var(--cream);
  color: var(--bg);
  box-shadow: var(--shadow-pop);
  transform: rotate(-1deg);
}

.share-kicker {
  margin: 0;
  font-family: var(--font-display);
  /* Deeper than --magenta so it reads on the cream card (5.3:1). */
  color: #C4166A;
}

.share-score {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.share-marks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin-bottom: 10px;
}

.mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: var(--bg);
}

.mark .icon {
  width: 16px;
  height: 16px;
}

.mark.is-right {
  background: var(--cyan);
}

.mark.is-wrong {
  background: var(--red);
}

.share-text {
  font-weight: 700;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* A secondary button that reads on the cream share card. */
.btn-ghost-dark {
  background: transparent;
  border-color: var(--bg);
  color: var(--bg);
  box-shadow: none;
}

.share-status {
  min-height: 1.5em;
  margin: 8px 0 0;
  font-weight: 600;
}

.results-receipts {
  width: 100%;
  max-width: 720px;
  text-align: left;
}

.receipts-lede {
  margin: -4px 0 12px;
  color: var(--cream-dim);
}

/* ==========================================================================
   Rule Codex
   ========================================================================== */

.codex-progress {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--yellow);
}

.codex-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--cream-dim);
}

.codex-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .codex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.codex-card {
  --codex-accent: var(--line);
  padding: 16px;
  border: 3px solid var(--bg-sunk);
  border-left: 8px solid var(--codex-accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-pop);
}

.codex-card.is-hidden {
  border-left-color: #3A3A6E;
  background: var(--bg-sunk);
}

.codex-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.codex-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--cream);
}

.codex-card.is-hidden .codex-name {
  color: #6A6A9E;
}

.codex-plain-badge {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--cyan);
  color: var(--bg);
  font: 700 0.75rem/1.6 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.codex-card p {
  margin: 0 0 6px;
}

.codex-card p:last-child {
  margin-bottom: 0;
}

.codex-card.is-hidden .codex-desc {
  color: var(--cream-dim);
}

.codex-spot {
  color: var(--cream-dim);
}

.codex-spot strong {
  color: var(--cream);
}

.codex-mastery {
  color: var(--codex-accent);
  font-weight: 700;
}

.codex-hints-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunk);
}

.codex-hints-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
}

.codex-hints {
  display: grid;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-style: italic;
}

.codex-hints-count,
.codex-hints-none {
  color: var(--cream-dim);
  font-size: 0.85rem;
}

.receipts-codex {
  margin: 14px 0 0;
  text-align: center;
}

.codex-reset {
  margin-top: 16px;
}

/* ==========================================================================
   Stats
   ========================================================================== */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.stat-tile {
  padding: 14px;
  font-size: 0.88rem;
}

.stat-tile strong {
  font-size: 2rem;
}

.stat-tile-hot strong {
  color: var(--magenta);
}

@media (min-width: 720px) {
  .stat-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.burn-list,
.cat-stats {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.burn-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.burn-list li:last-child {
  border-bottom: 0;
}

.cat-stat {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-areas: 'glyph name' 'glyph nums';
  column-gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.cat-stat:last-child {
  border-bottom: 0;
}

.cat-stat .cat-glyph {
  grid-area: glyph;
}

.cat-stat-name {
  grid-area: name;
  font-weight: 700;
}

.cat-stat-nums {
  grid-area: nums;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  color: var(--cream-dim);
  font-size: 0.88rem;
}

.cat-stat-nums strong {
  color: var(--cream);
}

.stats-reset {
  text-align: center;
}

/* ==========================================================================
   Chip
   A flat round face. Expressions set CSS variables on the root svg; parts read
   them with transitions so changes are smooth. Gaze is set inline by chip.js.
   The squash-and-stretch bounce keyframes live in animations.css.
   ========================================================================== */

.chip {
  width: 100%;
  height: auto;
  overflow: visible;

  --lid: 26px;
  --eye-scale: 1;
  --pupil: 1;
  --bl-y: 3px;
  --bl-r: 4deg;
  --br-y: -12px;
  --br-r: -8deg;
}

.chip-body {
  transform-box: view-box;
  transform-origin: 120px 256px;
}

.chip-head {
  fill: var(--chip-color);
  stroke: var(--chip-ink);
  stroke-width: 6;
}

.chip-shine {
  fill: none;
  stroke: #fff;
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0.9;
}

.chip-sclera {
  fill: var(--chip-sclera);
}

.chip-eye-outline {
  fill: none;
  stroke: var(--chip-ink);
  stroke-width: 6;
}

.chip-eye {
  transform-box: view-box;
  transform: scale(var(--eye-scale));
  transition: transform 0.28s var(--ease-pop);
}

.chip-eye-l {
  transform-origin: 86px 148px;
}

.chip-eye-r {
  transform-origin: 154px 148px;
}

.chip-gaze {
  transition: transform 0.12s ease-out;
}

.chip-pupil {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--pupil));
  transition: transform 0.3s ease;
}

.chip-pupil-dot {
  fill: #000;
}

.chip-glint {
  fill: #fff;
}

/* The lid is the face color, so a lowered lid reads as a flat-topped eye. */
.chip-lid {
  fill: var(--chip-color);
  stroke: var(--chip-ink);
  stroke-width: 7;
  transform: translateY(var(--lid));
  transition: transform 0.25s ease;
}

.chip.is-blinking .chip-lid {
  transform: translateY(64px);
  transition-duration: 0.06s;
}

.chip-brow {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.28s var(--ease-pop);
}

.chip-brow path {
  fill: none;
  stroke: var(--chip-ink);
  stroke-width: 10;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.16s ease;
}

/* Height (y) and tilt (r) come from the expression variables. */
.chip-brow-l {
  transform: translateY(var(--bl-y)) rotate(var(--bl-r));
}

.chip-brow-r {
  transform: translateY(var(--br-y)) rotate(var(--br-r));
}

/* Brow shapes: arch by default, flat or high arch where an expression asks. */
.chip [data-brow='arch'],
.chip[data-expr='smug'] .chip-brow-l [data-brow='flat'],
.chip[data-expr='judging'] .chip-brow-l [data-brow='flat'],
.chip[data-expr='dead'] [data-brow='flat'],
.chip[data-expr='gleeful'] [data-brow='high'] {
  opacity: 1;
}

.chip[data-expr='smug'] .chip-brow-l [data-brow='arch'],
.chip[data-expr='judging'] .chip-brow-l [data-brow='arch'],
.chip[data-expr='dead'] [data-brow='arch'],
.chip[data-expr='gleeful'] [data-brow='arch'] {
  opacity: 0;
}

.chip-mouth {
  fill: none;
  stroke: var(--chip-ink);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.chip-grin {
  fill: var(--chip-ink);
  stroke: none;
}

.chip-grin-outline {
  fill: none;
  stroke-width: 7;
}

.chip-tongue {
  fill: var(--magenta);
  stroke: none;
}

/* Expressions */

.chip[data-expr='smug'] [data-mouth='smirk'],
.chip[data-expr='impressed'] [data-mouth='small'],
.chip[data-expr='dead'] [data-mouth='flat'],
.chip[data-expr='gleeful'] [data-mouth='grin'],
.chip[data-expr='judging'] [data-mouth='flat'] {
  opacity: 1;
}

.chip[data-expr='impressed'] {
  --lid: 0px;
  --eye-scale: 1.12;
  --pupil: 0.85;
  --bl-y: -12px;
  --bl-r: -4deg;
  --br-y: -12px;
  --br-r: 4deg;
}

.chip[data-expr='dead'] {
  --lid: 10px;
  --pupil: 0.32;
  --bl-y: 2px;
  --bl-r: 0deg;
  --br-y: 2px;
  --br-r: 0deg;
}

.chip[data-expr='gleeful'] {
  --lid: 4px;
  --eye-scale: 1.04;
  --pupil: 1.05;
  --bl-y: -10px;
  --bl-r: -6deg;
  --br-y: -10px;
  --br-r: 6deg;
}

.chip[data-expr='judging'] {
  --lid: 22px;
  --pupil: 0.9;
  --bl-y: 6px;
  --bl-r: 14deg;
  --br-y: -4px;
  --br-r: -2deg;
}

/* Judging: the pupils slide off to one side and ignore the pointer. */
.chip[data-expr='judging'] .chip-gaze {
  transform: translate(-13px, 3px) !important;
  transition: transform 0.9s ease-in-out;
}

/* Accessories */

.chip-acc path,
.chip-acc rect,
.chip-acc circle,
.chip-acc ellipse,
.chip-acc polygon {
  stroke: var(--chip-ink);
  stroke-width: 6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Magenta with yellow trim so the crown does not melt into a yellow head. */
.acc-crown {
  fill: var(--magenta);
}

.acc-crown-band,
.acc-tip {
  fill: var(--yellow);
}

.acc-jewel {
  stroke-width: 3 !important;
}

.acc-jewel-m {
  fill: var(--cyan);
}

.acc-jewel-c {
  fill: var(--magenta);
}

@media (prefers-reduced-motion: reduce) {
  .chip-eye,
  .chip-pupil,
  .chip-brow,
  .chip-lid,
  .chip-gaze {
    transition-duration: 0.01s !important;
  }
  .btn {
    transition: none;
  }
}
