:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f4f5f0;
  color: #182023;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(58, 142, 200, 0.16), transparent 30rem),
    linear-gradient(135deg, #f7f2df 0%, #eef5f2 52%, #f5f7fb 100%);
}

button {
  font: inherit;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.play-area {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
}

.topbar,
.score-strip,
.question-layout,
.ladder {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(24, 32, 35, 0.1);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(37, 41, 36, 0.1);
}

.topbar {
  min-height: 96px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.title-block p {
  margin: 8px 0 0;
  color: #536066;
  font-weight: 700;
}

.avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #52b788, #2d6a4f);
  border: 4px solid #fefcf4;
  display: grid;
  place-items: center;
}

.avatar-face {
  width: 40px;
  display: flex;
  justify-content: space-between;
}

.avatar-face span {
  width: 9px;
  height: 14px;
  border-radius: 999px;
  background: #10251c;
}

.avatar-badge {
  position: absolute;
  z-index: 2;
  left: -10px;
  top: 10px;
  width: 0;
  height: 0;
  opacity: 0;
}

.avatar-badge.earned {
  width: 34px;
  height: 34px;
  opacity: 1;
  background: #cf2e2e;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}

.icon-button {
  min-width: 78px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fdfdf8;
  background: #253139;
  cursor: pointer;
  font-weight: 800;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
}

.star-count {
  min-height: 72px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #f8faf6;
  border: 1px solid rgba(24, 32, 35, 0.08);
}

.star-count span,
.ladder span {
  width: 30px;
  height: 30px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
}

.star-count strong {
  font-size: 1.65rem;
}

.star-count small {
  grid-column: 2;
  color: #536066;
  font-weight: 800;
}

.blue span {
  background: #2776d2;
}

.yellow span {
  background: #f0bf24;
}

.silver span {
  background: #a8b2bd;
}

.red span {
  background: #cf2e2e;
}

.question-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(310px, 0.8fr);
  gap: 18px;
  padding: 18px;
}

.shape-stage {
  min-height: 430px;
  display: grid;
  grid-template-rows: auto 1fr;
  place-items: center;
  background: linear-gradient(180deg, #ffffff, #edf3f5);
  border-radius: 8px;
  border: 1px solid rgba(24, 32, 35, 0.08);
  overflow: hidden;
}

.shape-name {
  width: 100%;
  padding: 18px;
  text-align: center;
  color: #2e3b40;
  font-weight: 900;
  font-size: clamp(1.2rem, 2.4vw, 2rem);
}

.shape-art {
  position: relative;
  width: min(55vw, 320px);
  height: min(55vw, 320px);
  display: grid;
  place-items: center;
}

.shape-art::before,
.shape-art::after,
.shape-art i {
  content: "";
  position: absolute;
  display: block;
}

.triangle::before {
  width: 82%;
  height: 72%;
  background: #f26d50;
  clip-path: polygon(50% 5%, 95% 92%, 5% 92%);
}

.square::before {
  width: 72%;
  height: 72%;
  background: #2776d2;
  border-radius: 6px;
}

.pentagon::before {
  width: 78%;
  height: 78%;
  background: #52b788;
  clip-path: polygon(50% 3%, 96% 37%, 78% 94%, 22% 94%, 4% 37%);
}

.hexagon::before {
  width: 82%;
  height: 72%;
  background: #7b5cc9;
  clip-path: polygon(25% 3%, 75% 3%, 98% 50%, 75% 97%, 25% 97%, 2% 50%);
}

.cube i:nth-of-type(1) {
  width: 58%;
  height: 58%;
  left: 18%;
  top: 30%;
  background: #f0bf24;
  transform: skewY(0deg);
}

.cube i:nth-of-type(2) {
  width: 58%;
  height: 34%;
  left: 29%;
  top: 15%;
  background: #f7d56f;
  transform: skewX(-35deg);
}

.cube i:nth-of-type(3) {
  width: 22%;
  height: 58%;
  left: 76%;
  top: 30%;
  background: #c89719;
  transform: skewY(-45deg);
}

.pyramid i:nth-of-type(1) {
  width: 84%;
  height: 38%;
  left: 8%;
  top: 58%;
  background: #a8b2bd;
  clip-path: polygon(17% 15%, 78% 15%, 100% 55%, 34% 87%);
}

.pyramid i:nth-of-type(2) {
  width: 78%;
  height: 70%;
  left: 12%;
  top: 12%;
  background: #5db9d6;
  clip-path: polygon(50% 0%, 94% 80%, 28% 80%);
}

.pyramid i:nth-of-type(3) {
  width: 55%;
  height: 70%;
  left: 37%;
  top: 12%;
  background: #2a84a0;
  clip-path: polygon(24% 0%, 100% 80%, 0% 80%);
}

.prism i:nth-of-type(1) {
  width: 48%;
  height: 62%;
  left: 14%;
  top: 22%;
  background: #dc6bad;
  clip-path: polygon(12% 8%, 94% 50%, 12% 92%);
}

.prism i:nth-of-type(2) {
  width: 48%;
  height: 62%;
  left: 38%;
  top: 22%;
  background: #b44f8e;
  clip-path: polygon(12% 8%, 94% 50%, 12% 92%);
}

.prism i:nth-of-type(3) {
  width: 42%;
  height: 54%;
  left: 32%;
  top: 26%;
  background: rgba(255, 255, 255, 0.28);
  transform: skewY(27deg);
}

.quiz-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 430px;
}

.question-text {
  min-height: 86px;
  display: grid;
  align-items: center;
  padding: 18px;
  color: #162126;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 950;
  line-height: 1.05;
}

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

.answer-button {
  min-height: 104px;
  border: 0;
  border-radius: 8px;
  color: #182023;
  background: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(24, 32, 35, 0.12);
  cursor: pointer;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 950;
}

.answer-button:hover {
  box-shadow: inset 0 0 0 4px #2776d2;
}

.answer-button.correct {
  color: #0d3425;
  background: #a8efc2;
  box-shadow: inset 0 0 0 4px #2d6a4f;
}

.answer-button.wrong {
  color: #4d1010;
  background: #ffd1d1;
  box-shadow: inset 0 0 0 4px #cf2e2e;
}

.feedback {
  min-height: 48px;
  color: #314047;
  font-weight: 900;
  display: grid;
  align-items: center;
}

.ladder {
  min-height: 74px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  color: #536066;
  font-weight: 800;
}

.ladder div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  text-align: center;
}

.ladder span {
  width: 18px;
  height: 18px;
  background: #2776d2;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 780px) {
  .game-shell {
    padding: 10px;
    place-items: stretch;
  }

  .play-area {
    min-height: calc(100vh - 20px);
    gap: 10px;
  }

  .topbar {
    grid-template-columns: auto 1fr;
  }

  .icon-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .score-strip,
  .question-layout,
  .ladder {
    grid-template-columns: 1fr 1fr;
  }

  .question-layout {
    padding: 10px;
  }

  .shape-stage,
  .quiz-panel {
    min-height: 320px;
  }

  .shape-art {
    width: min(76vw, 280px);
    height: min(76vw, 280px);
  }

  .question-text {
    min-height: 64px;
  }

  .answer-button {
    min-height: 82px;
  }
}

@media (max-width: 470px) {
  .score-strip,
  .question-layout,
  .ladder {
    grid-template-columns: 1fr;
  }

  .shape-stage,
  .quiz-panel {
    min-height: auto;
  }

  .shape-art {
    width: min(78vw, 230px);
    height: min(78vw, 230px);
  }
}
