/* ==========================================================================
   Job Fair Quiz – Storybook Watercolor Theme
   Matching Job Fair Explorer – Meet the Jobs
   ========================================================================== */

:root {
  --paper: #FBF8F1;
  --paper-deep: #F3ECE0;
  --paper-card: #FFFDF8;
  --ink: #35322E;
  --ink-soft: #59534B;
  --navy: #2F4562;
  --navy-soft: #E5ECF5;
  --red: #B85D57;
  --red-soft: #F3DFDC;
  --teal: #5D8E86;
  --teal-soft: #DFECE9;
  --ochre: #D4963F;
  --ochre-soft: #F8EBD4;
  --good: #3F8D62;
  --good-soft: #E2F3E9;
  --bad: #C4534D;
  --bad-soft: #F9E3E1;
  --warm-gray: #7D766D;
  --border-ink: #47433D;
  --shadow-sketch: 3px 4px 0 rgba(53, 50, 46, 0.14);
  --radius-sketch: 18px 22px 19px 24px / 22px 18px 23px 19px;
  --radius-pill: 26px 22px 24px 20px / 20px 24px 22px 26px;
  --font-display: "Baloo 2", "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-body: "Nunito", "Baloo 2", ui-rounded, system-ui, -apple-system, sans-serif;
}

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

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

body {
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(180, 164, 136, 0.12) 1px, transparent 1px),
    radial-gradient(rgba(165, 148, 120, 0.08) 1px, transparent 1px);
  background-size: 28px 28px, 44px 44px;
  background-position: 0 0, 14px 18px;
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}

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

.app {
  height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 10px clamp(14px, 2vw, 28px) 14px;
}

/* ==========================================================================
   Top Bar & Storybook Scoreboard (Kid A vs Kid B)
   ========================================================================== */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  box-shadow: var(--shadow-sketch);
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 2.2vw, 34px);
  color: var(--navy);
  letter-spacing: -0.01em;
}

.brand h1 .accent {
  color: var(--red);
}

.brand span {
  margin-top: 3px;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 800;
  color: var(--teal);
  letter-spacing: 0.02em;
}

/* Team A vs Team B Scoreboard */
.score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  min-width: clamp(175px, 15vw, 240px);
  background: var(--paper);
  border: 2.5px solid var(--border-ink);
  border-radius: 20px 24px 21px 19px;
  box-shadow: 2px 3px 0 rgba(53, 50, 46, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.team.a {
  border-color: var(--navy);
}

.team.b {
  border-color: var(--red);
  justify-content: flex-end;
}

.team-avatar {
  height: clamp(48px, 5.4vh, 64px);
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 2px rgba(53, 50, 46, 0.16));
  transition: transform 0.25s ease;
}

.team-info {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.team.b .team-info {
  text-align: right;
}

.team .nm {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(14px, 1.2vw, 18px);
  letter-spacing: 0.03em;
}

.team.a .nm { color: var(--navy); }
.team.b .nm { color: var(--red); }

.team .role {
  font-size: clamp(11px, 0.95vw, 14px);
  font-weight: 800;
  color: var(--warm-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.team .pts {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 3.2vw, 48px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.team.b .pts {
  margin-left: 0;
  margin-right: auto;
}

.team.a .pts { color: var(--navy); }
.team.b .pts { color: var(--red); }

.team.answering.a {
  background: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(212, 150, 63, 0.55), 3px 5px 0 rgba(47, 69, 98, 0.2);
  transform: translateY(-2px);
}

.team.answering.b {
  background: var(--red-soft);
  box-shadow: 0 0 0 3px rgba(212, 150, 63, 0.55), 3px 5px 0 rgba(184, 93, 87, 0.2);
  transform: translateY(-2px);
}

.team.answering .team-avatar {
  animation: kidBounce 1.1s ease-in-out infinite;
}

@keyframes kidBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

.team .pts.bump {
  animation: bump 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes bump {
  35% { transform: scale(1.42); }
  100% { transform: scale(1); }
}

.vs {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--warm-gray);
}

/* Header Tools */
.tools {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.tool {
  background: var(--paper);
  border: 2px solid var(--border-ink);
  color: var(--ink);
  border-radius: 13px 16px 14px 15px;
  padding: 6px 11px;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.05vw, 15px);
  font-weight: 700;
  box-shadow: 2px 2px 0 rgba(53, 50, 46, 0.13);
  transition: transform 0.12s ease, background 0.15s ease;
}

.tool:hover {
  background: var(--ochre-soft);
  transform: translateY(-1px);
}

.tool:active {
  transform: translateY(1px);
}

.tool.warn {
  border-color: var(--red);
  color: var(--red);
  background: #FFF7F6;
}

.tool.warn:hover {
  background: var(--red-soft);
}

/* ==========================================================================
   Main Board & 8 3D-Flipping Storybook Booth Tiles
   ========================================================================== */
.stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.turn {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-card);
  color: var(--ink);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-pill);
  padding: 5px 20px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 1.35vw, 22px);
  box-shadow: var(--shadow-sketch);
}

.turn .chip {
  display: inline-block;
  padding: 1px 12px;
  border-radius: 999px;
  color: #FFFDF8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9em;
  border: 2px solid var(--border-ink);
}

.turn .chip.a { background: var(--navy); }
.turn .chip.b { background: var(--red); }

.board {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper-deep);
  border: 3px solid var(--border-ink);
  border-radius: 26px 30px 28px 24px / 24px 28px 26px 30px;
  box-shadow: 5px 6px 0 rgba(53, 50, 46, 0.14);
  padding: clamp(28px, 3.6vh, 44px) clamp(16px, 1.8vw, 26px) clamp(14px, 1.6vw, 22px);
  overflow: hidden;
}

.bunting {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: clamp(32px, 4.2vh, 48px);
  pointer-events: none;
  z-index: 2;
}

.grid {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: clamp(12px, 1.4vw, 20px);
}

.cell {
  perspective: 1200px;
  min-height: 120px;
}

.flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.28, 1.35, 0.48, 1);
}

.cell.solved .flip {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 20px 24px 22px 18px / 18px 22px 20px 24px;
  border: 2.5px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}

/* Front of Unsolved Ticket Tile */
.tile {
  width: 100%;
  height: 100%;
  color: #FFFDF8;
  font-family: var(--font-display);
  box-shadow: 4px 5px 0 rgba(53, 50, 46, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  overflow: hidden;
}

.tile:hover:not(:disabled) {
  transform: translateY(-4px) rotate(-0.8deg);
  box-shadow: 6px 8px 0 rgba(53, 50, 46, 0.22);
  filter: brightness(1.03);
}

.tile:active:not(:disabled) {
  transform: translateY(1px);
}

.tile.def {
  background: linear-gradient(160deg, #6A9D94 0%, #52827A 100%);
}

.tile.gap {
  background: linear-gradient(160deg, #DDA14B 0%, #C78732 100%);
}

/* Hand-drawn inner stitched ticket frame */
.tile-inner-border {
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(255, 253, 248, 0.55);
  border-radius: 14px;
  pointer-events: none;
}

/* Ticket-stub side notches blending into the paper board */
.tile::before,
.tile::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 2.5px solid var(--border-ink);
}

.tile::before { left: -14px; }
.tile::after  { right: -14px; }

.tile .num {
  font-size: clamp(46px, 5.4vw, 86px);
  font-weight: 800;
  line-height: 0.95;
  text-shadow: 2px 4px 0 rgba(53, 50, 46, 0.22);
  position: relative;
  z-index: 2;
}

.tile .kind {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(13px, 1.15vw, 18px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(53, 50, 46, 0.2);
  padding: 2px 14px;
  border-radius: 999px;
  margin-top: 6px;
  position: relative;
  z-index: 2;
}

/* Back of Solved Storybook Booth Card */
.booth {
  transform: rotateY(180deg);
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 3px 4px 0 rgba(53, 50, 46, 0.14);
  overflow: hidden;
  padding: 26px 10px 8px;
  justify-content: space-between;
}

/* Colorful Watercolor Striped Awning (4 alternating colors matching map_bg.png) */
.booth .awning {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  border-bottom: 2px solid var(--border-ink);
}

.booth.awning-0 .awning { background: repeating-linear-gradient(90deg, var(--navy) 0 18px, #FFFDF8 18px 36px); }
.booth.awning-1 .awning { background: repeating-linear-gradient(90deg, var(--red) 0 18px, #FFFDF8 18px 36px); }
.booth.awning-2 .awning { background: repeating-linear-gradient(90deg, var(--teal) 0 18px, #FFFDF8 18px 36px); }
.booth.awning-3 .awning { background: repeating-linear-gradient(90deg, var(--ochre) 0 18px, #FFFDF8 18px 36px); }

.booth .portrait-img {
  height: clamp(92px, 15.5vh, 152px);
  width: auto;
  max-width: 86%;
  object-fit: contain;
  margin-top: 2px;
  filter: drop-shadow(0 3px 2px rgba(53, 50, 46, 0.14));
}

.booth .w {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 1.55vw, 24px);
  line-height: 1.1;
  color: var(--navy);
  margin-top: 2px;
}

.booth .owner {
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 800;
  color: var(--warm-gray);
}

.booth .owner.team-a { color: var(--navy); }
.booth .owner.team-b { color: var(--red); }

.booth .mini-stamp {
  position: absolute;
  right: 8px;
  top: 26px;
  width: clamp(32px, 3.4vw, 48px);
  height: auto;
  opacity: 0.9;
  transform: rotate(10deg);
  pointer-events: none;
}

.stress b {
  color: var(--red);
  font-weight: 800;
}

/* ==========================================================================
   Overlays & Question Modal
   ========================================================================== */
.ov {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.ov.show {
  display: flex;
}

.ov.dim {
  background: rgba(47, 69, 98, 0.46);
  backdrop-filter: blur(4px);
}

.q {
  width: min(1160px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--border-ink);
  border-radius: 26px 30px 28px 24px / 24px 28px 26px 30px;
  padding: clamp(18px, 2.2vw, 32px);
  box-shadow: 7px 9px 0 rgba(35, 32, 28, 0.24);
  display: grid;
  gap: clamp(14px, 1.6vw, 22px);
  animation: pop 0.3s cubic-bezier(0.22, 1.35, 0.45, 1);
}

@keyframes pop {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
}

.qhead {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(15px, 1.3vw, 19px);
  color: #FFFDF8;
  border: 2px solid var(--border-ink);
  border-radius: var(--radius-pill);
  padding: 4px 15px;
}

.badge.def { background: var(--teal); }
.badge.gap { background: var(--ochre); }
.badge.n   { background: var(--navy); }

.qhead .who {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(16px, 1.35vw, 20px);
  color: var(--ink-soft);
}

.clue {
  margin: 0;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  padding: clamp(14px, 1.8vw, 24px) clamp(18px, 2.2vw, 28px);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 2.7vw, 42px);
  line-height: 1.26;
  text-wrap: balance;
  box-shadow: var(--shadow-sketch);
}

.blank {
  display: inline-block;
  min-width: 3.1em;
  border-bottom: 4px dashed var(--red);
  background: var(--ochre-soft);
  border-radius: 8px;
  margin: 0 0.12em;
  vertical-align: baseline;
  height: 0.9em;
}

.readas {
  font-size: 0.54em;
  color: var(--warm-gray);
  font-style: italic;
  font-weight: 700;
  white-space: nowrap;
}

/* 4 Multiple Choice Options */
.opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 1.3vw, 18px);
}

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: 20px 24px 21px 19px;
  padding: 13px 18px;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 800;
  color: var(--ink);
  box-shadow: 3px 4px 0 rgba(53, 50, 46, 0.14);
  transition: transform 0.14s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.3s ease;
}

.opt:hover:not(:disabled) {
  transform: translateY(-3px);
  background: var(--ochre-soft);
  border-color: var(--navy);
}

.opt .k {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 14px;
  background: var(--navy);
  color: #FFFDF8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.72em;
  line-height: 1;
  border: 2px solid var(--border-ink);
}

.opt .k small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.44em;
  font-weight: 700;
  opacity: 0.9;
  margin-top: 2px;
}

.opt:disabled {
  cursor: default;
}

.opt.picked {
  border-color: var(--ochre);
  background: var(--ochre-soft);
  box-shadow: 0 0 0 3px rgba(212, 150, 63, 0.45);
}

.opt.right {
  border-color: var(--good);
  background: var(--good-soft);
}

.opt.right .k {
  background: var(--good);
}

.opt.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  animation: shake 0.48s;
}

.opt.wrong .k {
  background: var(--bad);
}

.opt.fade {
  opacity: 0.4;
}

@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.hint {
  font-weight: 700;
  color: var(--warm-gray);
  font-size: clamp(14px, 1.25vw, 19px);
  text-align: center;
}

/* Storybook Result Panel inside Question Modal */
.result {
  display: none;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  background: var(--ochre-soft);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  padding: 14px 20px;
  box-shadow: var(--shadow-sketch);
}

.result.show {
  display: grid;
  animation: pop 0.3s ease;
}

.result-portrait-wrap {
  width: clamp(92px, 10vw, 132px);
  height: clamp(92px, 10vw, 132px);
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: 18px 22px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.result-portrait {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.result-word-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.result .word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.2vw, 48px);
  line-height: 1.05;
  color: var(--navy);
}

.result .ipa {
  font-size: clamp(18px, 1.7vw, 25px);
  font-weight: 700;
  color: var(--teal);
}

.result .sent {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.55vw, 24px);
  font-weight: 700;
  margin-top: 4px;
  color: var(--ink);
}

.result .sent u {
  text-decoration-thickness: 3.5px;
  text-decoration-color: var(--good);
  font-weight: 800;
  color: var(--navy);
}

.result .focus {
  font-size: clamp(14px, 1.25vw, 18px);
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: 4px;
}

.qfoot {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn {
  border: 2.5px solid var(--border-ink);
  border-radius: 16px 20px 17px 19px;
  padding: 10px 22px;
  font-family: var(--font-display);
  font-size: clamp(16px, 1.4vw, 22px);
  font-weight: 800;
  box-shadow: 3px 3px 0 rgba(53, 50, 46, 0.16);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(1px);
}

.btn.main {
  background: var(--ochre);
  color: #FFFDF8;
}

.btn.soft {
  background: var(--paper-card);
  color: var(--ink);
}

.btn[hidden] {
  display: none;
}

/* ==========================================================================
   3-2-1 Countdown & Storybook Gift / Feedback Reveal
   ========================================================================== */
.count {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: min(44vh, 38vw);
  line-height: 1;
  color: var(--ochre);
  -webkit-text-stroke: 5px var(--border-ink);
  text-shadow: 8px 10px 0 rgba(47, 69, 98, 0.35);
}

.count.go {
  animation: zoom 1s ease-out;
}

@keyframes zoom {
  0%   { transform: scale(2.0); opacity: 0; }
  25%  { transform: scale(1); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: scale(0.72); opacity: 0; }
}

.reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 24px 34px;
  background: var(--paper);
  border: 3px solid var(--border-ink);
  border-radius: 28px 32px 30px 26px;
  box-shadow: 8px 10px 0 rgba(35, 32, 28, 0.25);
  max-width: min(640px, 92vw);
}

.reveal .msg {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 3.6vw, 50px);
  color: var(--navy);
  line-height: 1.1;
}

.reveal .msg.good { color: var(--good); }
.reveal .msg.miss { color: var(--red); }

.reveal .sub {
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 700;
  color: var(--ink);
}

.gift {
  width: min(250px, 34vw);
  height: auto;
  overflow: visible;
}

.gift .lid {
  transform-origin: 150px 115px;
}

.gift.drop {
  animation: drop 0.6s cubic-bezier(0.3, 1.35, 0.5, 1);
}

.gift.wiggle {
  animation: wiggle 0.45s 2;
}

.gift.open .lid {
  animation: lidoff 0.65s forwards cubic-bezier(0.3, 1.2, 0.5, 1);
}

@keyframes drop {
  from { transform: translateY(-55vh); }
}

@keyframes wiggle {
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

@keyframes lidoff {
  to { transform: translate(65px, -135px) rotate(26deg); opacity: 0; }
}

.prize {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: rise 0.55s cubic-bezier(0.25, 1.4, 0.45, 1);
}

.prize.show {
  display: flex;
}

.prize-visual {
  position: relative;
  width: clamp(140px, 20vh, 210px);
  height: clamp(140px, 20vh, 210px);
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: 24px 28px 26px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.prize-visual img.prize-portrait {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.prize-visual img.prize-stamp {
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 72px;
  height: 72px;
  object-fit: contain;
  transform: rotate(-10deg);
}

.prize .w {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.6vw, 50px);
  color: var(--navy);
  background: var(--ochre-soft);
  border: 2.5px solid var(--border-ink);
  padding: 2px 24px;
  border-radius: var(--radius-pill);
}

@keyframes rise {
  from { transform: translateY(45px) scale(0.5); opacity: 0; }
}

.sad-portrait-wrap {
  width: clamp(140px, 20vh, 200px);
  height: clamp(140px, 20vh, 200px);
  background: var(--paper-card);
  border: 2.5px dashed var(--warm-gray);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  animation: sadin 0.55s cubic-bezier(0.3, 1.35, 0.5, 1);
}

.sad-portrait-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@keyframes sadin {
  from { transform: scale(0.5) rotate(-8deg); opacity: 0; }
}

/* ==========================================================================
   End Celebration Modal (with Kid A, Kid B & 8 Clickable Job Portraits)
   ========================================================================== */
.end {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--border-ink);
  border-radius: 26px 30px 28px 24px;
  padding: clamp(18px, 2.4vw, 32px);
  text-align: center;
  display: grid;
  gap: 12px;
  width: min(1040px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 8px 10px 0 rgba(35, 32, 28, 0.25);
  animation: pop 0.35s ease;
}

.end-stars {
  font-size: clamp(20px, 2vw, 30px);
  color: var(--ochre);
  letter-spacing: 6px;
}

.end h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 4vw, 54px);
  margin: 0;
  color: var(--navy);
  line-height: 1.08;
}

.final-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.final-team {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  background: var(--paper-card);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(22px, 2.4vw, 34px);
}

.final-team.a { color: var(--navy); border-color: var(--navy); }
.final-team.b { color: var(--red); border-color: var(--red); }

.final-team img {
  height: clamp(46px, 6vh, 64px);
  width: auto;
  object-fit: contain;
}

.final-dash {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  color: var(--warm-gray);
}

.end-lead {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 1.7vw, 26px);
  font-weight: 800;
  color: var(--ink);
}

.end-sub {
  margin: 0;
  font-size: clamp(14px, 1.25vw, 18px);
  font-weight: 700;
  color: var(--warm-gray);
}

.end-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.end-job-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: var(--paper-card);
  border: 2px solid var(--border-ink);
  border-radius: 16px 19px 17px 15px;
  box-shadow: 2px 3px 0 rgba(53, 50, 46, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
}

.end-job-btn:hover {
  background: var(--ochre-soft);
  transform: translateY(-3px);
}

.end-job-btn img {
  height: clamp(64px, 9.5vh, 102px);
  width: auto;
  object-fit: contain;
}

.end-job-btn span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(14px, 1.2vw, 18px);
  color: var(--navy);
}

.end-actions {
  margin-top: 4px;
}

/* Confetti Canvas & Toast */
#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 35;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--navy);
  color: #FFFDF8;
  border: 2px solid var(--border-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sketch);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.toast.show {
  opacity: 1;
}

/* ==========================================================================
   Intro / How to Play Slide (Shown before starting the quiz)
   ========================================================================== */
.intro-ov {
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(180, 164, 136, 0.14) 1px, transparent 1px),
    radial-gradient(rgba(165, 148, 120, 0.09) 1px, transparent 1px);
  background-size: 28px 28px, 44px 44px;
  background-position: 0 0, 14px 18px;
  z-index: 30;
}

.intro-card {
  position: relative;
  width: min(1160px, 95vw);
  max-height: 94vh;
  overflow-y: auto;
  background: var(--paper-card);
  border: 3px solid var(--border-ink);
  border-radius: 28px 32px 30px 26px / 26px 30px 28px 32px;
  box-shadow: 7px 9px 0 rgba(53, 50, 46, 0.16);
  padding: clamp(34px, 4.4vh, 52px) clamp(20px, 2.8vw, 38px) clamp(20px, 2.4vh, 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2vh, 22px);
  animation: pop 0.35s cubic-bezier(0.22, 1.25, 0.45, 1);
}

.intro-bunting {
  height: clamp(30px, 3.8vh, 44px);
}

.intro-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.intro-tag {
  display: inline-block;
  padding: 3px 16px;
  background: var(--teal-soft);
  color: #28574E;
  border: 2px solid var(--teal);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(13px, 1.15vw, 16px);
  letter-spacing: 0.07em;
}

.intro-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 3.8vw, 54px);
  line-height: 1.05;
  color: var(--navy);
}

.intro-title .accent {
  color: var(--red);
}

.intro-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  flex-wrap: wrap;
}

.intro-team {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px;
  background: var(--paper);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-pill);
  box-shadow: 2px 3px 0 rgba(53, 50, 46, 0.12);
}

.intro-team.a {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.intro-team.b {
  border-color: var(--red);
  background: var(--red-soft);
  text-align: right;
}

.intro-team img {
  height: clamp(54px, 7.2vh, 78px);
  width: auto;
  object-fit: contain;
}

.intro-team strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.05;
}

.intro-team.a strong { color: var(--navy); }
.intro-team.b strong { color: var(--red); }

.intro-team span {
  display: block;
  font-size: clamp(13px, 1.15vw, 17px);
  font-weight: 800;
  color: var(--ink-soft);
}

.intro-vs {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 1.8vw, 28px);
  color: var(--warm-gray);
}

.intro-steps {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.3vw, 18px);
}

.intro-step {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--border-ink);
  border-radius: var(--radius-sketch);
  padding: 16px 14px 14px;
  box-shadow: 3px 4px 0 rgba(53, 50, 46, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid var(--border-ink);
  color: #FFFDF8;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-1 .step-num { background: var(--navy); }
.step-2 .step-num { background: var(--ochre); }
.step-3 .step-num { background: var(--red); }
.step-4 .step-num { background: var(--teal); }

.intro-step h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(18px, 1.55vw, 24px);
  color: var(--navy);
  line-height: 1.15;
}

.intro-step p {
  margin: 0;
  font-size: clamp(15px, 1.25vw, 19px);
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.32;
}

.intro-step small {
  font-size: 0.9em;
  color: var(--warm-gray);
}

.score-good { color: var(--good); font-weight: 800; }
.score-miss { color: var(--red); font-weight: 800; }

.intro-footer {
  margin-top: 2px;
}

.ready-btn {
  padding: 13px 48px;
  font-size: clamp(22px, 2.2vw, 32px);
  background: var(--red);
  color: #FFFDF8;
  border: 3px solid var(--border-ink);
  border-radius: var(--radius-pill);
  box-shadow: 4px 5px 0 rgba(53, 50, 46, 0.22);
  letter-spacing: 0.03em;
}

.ready-btn:hover {
  background: #C66862;
  transform: translateY(-3px) scale(1.03);
}

/* ==========================================================================
   Responsive (Laptop & Tablet)
   ========================================================================== */
@media (max-width: 1024px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .tools { justify-content: center; }
  .intro-steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: none; }
  .cell { min-height: 145px; }
  .opts { grid-template-columns: 1fr; }
  .end-gallery { grid-template-columns: repeat(2, 1fr); }
  .result { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .intro-steps { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
