:root {
  --paper: #fffdf7;
  --paper-soft: #f7f1e4;
  --ink: #174f46;
  --muted: #718783;
  --line: #ddd3b5;
  --green: #4da47f;
  --green-dark: #2a795f;
  --gold: #efb33d;
  --coral: #e9735e;
  --shadow: rgba(61, 74, 56, .16);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 222, 133, .24), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(129, 204, 176, .2), transparent 30%),
    #f8f4e8;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 70px;
}
.loading-card,
.panel {
  border: 3px solid var(--line);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 12px 0 rgba(210, 201, 170, .78), 0 25px 45px var(--shadow);
}
.loading-card { padding: 60px; text-align: center; font-size: 22px; font-weight: 800; }
.eyebrow {
  margin: 0 0 12px;
  color: #8f6c31;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, .92fr);
  gap: 34px;
  align-items: center;
  min-height: 520px;
  padding: 52px;
}
.hero h1 { max-width: 660px; font-size: clamp(48px, 6vw, 70px); line-height: .98; letter-spacing: -.045em; }
.hero__copy > p:not(.eyebrow) { max-width: 610px; margin: 22px 0 26px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.primary-button,
.secondary-button {
  min-height: 54px;
  padding: 14px 22px;
  border: 2px solid transparent;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 900;
  transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.primary-button { color: #fff; background: var(--green); box-shadow: 0 7px 0 var(--green-dark); }
.primary-button:hover { background: #429874; }
.primary-button:active { box-shadow: 0 3px 0 var(--green-dark); transform: translateY(4px); }
.secondary-button { color: var(--ink); border-color: var(--line); background: #fffdf8; }
.secondary-button:hover { border-color: #bfae80; background: #fff8e7; }
.primary-button:focus-visible,
.secondary-button:focus-visible,
.route-card button:focus-visible,
.letter-button:focus-visible,
.answer-slot:focus-visible { outline: 4px solid rgba(239, 179, 61, .48); outline-offset: 3px; }
.progress-pill { padding: 13px 18px; border: 2px solid var(--line); border-radius: 16px; background: #fff; font-weight: 900; }
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 350px;
  overflow: hidden;
  border: 3px solid #c7ddd3;
  border-radius: 31px;
  background: linear-gradient(145deg, #d9f2e6, #fff0c9);
}
.hero-art::before,
.hero-art::after { content: ""; position: absolute; border-radius: 50%; border: 30px solid rgba(255, 255, 255, .5); }
.hero-art::before { width: 230px; height: 230px; left: -90px; top: -90px; }
.hero-art::after { width: 160px; height: 160px; right: -55px; bottom: -65px; }
.hero-art__board {
  z-index: 1;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 24px;
  transform: rotate(-3deg);
}
.hero-art__card {
  display: grid;
  place-items: center;
  width: 120px;
  height: 146px;
  border: 5px solid #fff;
  border-radius: 25px;
  background: #fffdf8;
  box-shadow: 0 12px 20px rgba(45, 88, 69, .18);
  font-size: 64px;
}
.hero-art__plus { color: var(--coral); font-size: 44px; font-weight: 900; }
.routes { margin-top: 52px; }
.section-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin: 0 2px 22px; }
.section-heading h2 { font-size: clamp(34px, 5vw, 50px); line-height: 1; letter-spacing: -.035em; }
.section-heading p { max-width: 420px; margin: 0; color: var(--muted); text-align: right; font-weight: 700; line-height: 1.45; }
.routes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.route-card {
  --route: var(--green);
  display: flex;
  min-height: 360px;
  padding: 26px;
  flex-direction: column;
  border: 3px solid var(--line);
  border-radius: 29px;
  background: var(--paper);
  box-shadow: 0 10px 0 #d9d0b4;
}
.route-card__icon { display: grid; place-items: center; width: 70px; height: 70px; margin-bottom: 24px; border-radius: 21px; background: color-mix(in srgb, var(--route) 18%, white); font-size: 34px; }
.route-card small { color: #8b7042; font-family: Georgia, serif; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.route-card h3 { margin-top: 8px; font-size: 29px; line-height: 1.05; }
.route-card p { margin: 15px 0 22px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.route-card__bar { height: 9px; overflow: hidden; border-radius: 9px; background: #ece8dc; }
.route-card__bar span { display: block; height: 100%; border-radius: inherit; background: var(--route); }
.route-card__stats { display: flex; justify-content: space-between; margin: 9px 0 20px; color: var(--muted); font-size: 13px; font-weight: 800; }
.route-card .primary-button { width: 100%; margin-top: auto; background: var(--route); box-shadow: 0 7px 0 color-mix(in srgb, var(--route) 72%, #194b3b); }
.game-panel { padding: 34px; }
.game-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: end; margin-bottom: 24px; }
.game-top h1 { font-size: clamp(40px, 5vw, 60px); line-height: 1; letter-spacing: -.04em; }
.game-top p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); font-weight: 700; }
.progress-row { display: flex; gap: 14px; align-items: center; }
.progress-track { height: 12px; flex: 1; overflow: hidden; border-radius: 10px; background: #e5e2d8; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--route); }
.progress-row b { min-width: 48px; font-size: 18px; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(350px, .88fr); gap: 24px; }
.rebus-board,
.answer-board { min-width: 0; border: 3px solid var(--line); border-radius: 29px; background: #fffdf8; }
.rebus-board { min-height: 470px; padding: 30px; }
.board-label { color: #7c8e89; font-family: Georgia, serif; font-size: 14px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.task-prompt { margin: 12px 0 26px; font-size: 27px; line-height: 1.2; }
.clue-display { display: flex; min-height: 270px; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; padding: 20px; border: 2px dashed #d9cda9; border-radius: 24px; background: var(--paper-soft); }
.piece-card,
.initial-card,
.change-card {
  display: grid;
  place-items: center;
  min-width: 142px;
  min-height: 165px;
  padding: 18px;
  border: 2px solid #d2ded8;
  border-radius: 23px;
  background: #fff;
  box-shadow: 0 8px 0 rgba(202, 194, 166, .65);
}
.piece-card__emoji,
.initial-card__emoji,
.change-card__emoji { font-size: 62px; line-height: 1; }
.piece-card b { margin-top: 14px; font-size: 26px; letter-spacing: .06em; }
.clue-plus,
.change-arrow { color: var(--route); font-size: 38px; font-weight: 900; }
.change-card { min-width: 180px; }
.change-card b { margin-top: 13px; font-size: 35px; letter-spacing: .08em; }
.change-rule { display: grid; min-width: 145px; place-items: center; gap: 8px; padding: 20px; border-radius: 22px; background: #fff2c9; }
.change-rule span { color: #8f7040; font-size: 14px; font-weight: 800; text-transform: uppercase; }
.change-rule b { font-size: 31px; }
.initial-card { min-width: 118px; min-height: 148px; }
.initial-card__name { min-height: 22px; margin-top: 12px; color: var(--ink); font-weight: 900; opacity: 0; }
.show-names .initial-card__name { opacity: 1; }
.answer-board { padding: 28px; background: #f1f8f1; }
.answer-board h2 { margin: 10px 0 9px; font-size: 31px; }
.answer-board > p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.answer-slots { display: flex; min-height: 72px; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding: 10px 0 20px; }
.answer-slot {
  display: grid;
  place-items: center;
  width: 50px;
  height: 60px;
  padding: 0;
  border: 3px solid #cfdad1;
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 27px;
  font-weight: 900;
}
.answer-slot.locked { border-color: #83bfa6; background: #ddf2e8; cursor: default; }
.letter-bank { display: grid; grid-template-columns: repeat(5, minmax(48px, 1fr)); gap: 10px; padding: 19px; border-radius: 22px; background: #fff; }
.letter-button {
  min-height: 55px;
  border: 2px solid #d7cda9;
  border-radius: 14px;
  color: var(--ink);
  background: #fff9e8;
  cursor: pointer;
  font-size: 25px;
  font-weight: 900;
  box-shadow: 0 4px 0 #d4c69b;
}
.letter-button:hover { border-color: var(--gold); background: #fff3c8; }
.letter-button:active { transform: translateY(2px); box-shadow: 0 2px 0 #d4c69b; }
.letter-button[disabled] { opacity: .28; cursor: default; box-shadow: none; transform: none; }
.game-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 20px; }
.game-actions .primary-button { grid-column: 1 / -1; }
.feedback {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 20px;
  padding: 17px;
  border: 2px solid #dfd5b9;
  border-radius: 20px;
  background: #fff;
}
.feedback[hidden] { display: none; }
.feedback__icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: #fff; background: var(--green); font-size: 25px; font-weight: 900; }
.feedback b { display: block; margin-bottom: 4px; font-size: 18px; }
.feedback p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.feedback.error { border-color: #e8a49b; background: #fff2ef; }
.feedback.error .feedback__icon { background: var(--coral); }
.feedback.hint { border-color: #e9c867; background: #fff8d9; }
.feedback.hint .feedback__icon { color: #725514; background: var(--gold); }
.success-actions { margin-top: 14px; }
.back-row { margin-top: 24px; }
.result {
  padding: 52px;
  text-align: center;
}
.result__icon { display: grid; width: 100px; height: 100px; margin: 0 auto 22px; place-items: center; border-radius: 31px; background: #e0f2e8; font-size: 50px; }
.result h1 { font-size: clamp(44px, 6vw, 68px); line-height: 1; }
.result > p { max-width: 650px; margin: 20px auto 28px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.result__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; max-width: 680px; margin: 0 auto 30px; }
.result__stats div { padding: 20px; border: 2px solid #d2e1d6; border-radius: 19px; background: #f1f8f1; }
.result__stats b { display: block; font-size: 30px; }
.result__stats span { color: var(--muted); font-weight: 800; }
.result__actions { display: flex; flex-wrap: wrap; gap: 13px; justify-content: center; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 310px; }
  .routes-grid { grid-template-columns: 1fr; }
  .route-card { min-height: 0; }
  .game-top, .game-grid { grid-template-columns: 1fr; }
  .progress-row { width: 100%; }
}
@media (max-width: 720px) {
  .app { width: min(1120px, calc(100% - 22px)); padding-top: 12px; }
  .hero, .game-panel, .result { padding: 27px; border-radius: 28px; }
  .hero { min-height: 0; }
  .hero h1 { font-size: 45px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 12px; text-align: left; }
  .rebus-board, .answer-board { padding: 21px; }
  .piece-card, .change-card { min-width: 126px; min-height: 145px; }
  .initial-card { min-width: 100px; }
  .clue-display { padding: 13px; }
}
@media (max-width: 480px) {
  .app { width: min(100% - 14px, 1120px); }
  .hero, .game-panel, .result { padding: 21px 16px; }
  .hero h1 { font-size: 39px; }
  .hero__actions, .result__actions { display: grid; }
  .hero__actions .primary-button, .hero__actions .secondary-button { width: 100%; }
  .hero-art__card { width: 96px; height: 120px; font-size: 51px; }
  .hero-art__board { gap: 7px; padding: 12px; }
  .hero-art__plus { font-size: 34px; }
  .game-top h1 { font-size: 40px; }
  .game-panel { padding-inline: 12px; }
  .rebus-board, .answer-board { padding: 17px 12px; }
  .task-prompt { font-size: 23px; }
  .clue-display { min-height: 230px; gap: 10px; }
  .piece-card, .change-card { min-width: 108px; min-height: 133px; padding: 12px; }
  .piece-card__emoji, .initial-card__emoji, .change-card__emoji { font-size: 47px; }
  .piece-card b { font-size: 21px; }
  .change-rule { min-width: 112px; padding: 14px; }
  .change-rule b { font-size: 25px; }
  .initial-card { min-width: 82px; min-height: 125px; padding: 10px; }
  .initial-card__name { font-size: 12px; }
  .answer-slot { width: 40px; height: 51px; font-size: 23px; }
  .letter-bank { grid-template-columns: repeat(4, 1fr); padding: 13px; }
  .game-actions { grid-template-columns: 1fr; }
  .game-actions .primary-button { grid-column: auto; }
  .result__stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
