:root {
  --page-bg:
    radial-gradient(circle at 50% -8%, rgba(83, 143, 255, 0.28) 0%, rgba(83, 143, 255, 0) 28%),
    radial-gradient(circle at 18% 12%, rgba(55, 120, 255, 0.22) 0%, rgba(55, 120, 255, 0) 26%),
    linear-gradient(180deg, #08162e 0%, #0d2243 44%, #10294d 100%);
  --board-bg:
    linear-gradient(180deg, rgba(17, 37, 71, 0.94), rgba(12, 26, 51, 0.94)),
    radial-gradient(circle at top, rgba(89, 159, 255, 0.18), rgba(89, 159, 255, 0) 42%);
  --board-shadow: 0 32px 86px rgba(2, 8, 25, 0.55);
  --blue-900: #0d3e96;
  --blue-700: #2b7cf0;
  --blue-500: #55a8ff;
  --blue-300: #9bc7ff;
  --blue-200: #d8ebff;
  --red-700: #df3d2b;
  --red-500: #ff7651;
  --gold-500: #ffc92f;
  --gold-400: #ffd969;
  --green-500: #7ce466;
  --green-700: #28b944;
  --ink: #152c52;
  --ink-soft: #49648c;
  --white: #ffffff;
  --panel-radius: 28px;
  --ui-scale: clamp(0.82, 0.74 + 0.4vw, 1);
  --text-xs: clamp(14px, 13px + 0.22vw, 17px);
  --text-sm: clamp(16px, 14px + 0.28vw, 20px);
  --text-md: clamp(18px, 16px + 0.34vw, 24px);
  --text-lg: clamp(20px, 18px + 0.48vw, 28px);
  --text-xl: clamp(26px, 22px + 0.9vw, 38px);
  --text-hero: clamp(34px, 28px + 1.45vw, 56px);
  --chip-h: clamp(40px, 36px + 0.8vw, 48px);
  --chip-radius: clamp(16px, 14px + 0.35vw, 20px);
  --panel-pad: clamp(14px, 12px + 0.6vw, 24px);
  --board-gap: clamp(12px, 10px + 0.5vw, 18px);
  --font-display: "Baloo 2", "Noto Sans SC", sans-serif;
  --font-ui: "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background: var(--page-bg);
  color: #eef5ff;
}

button,
select,
input {
  font: inherit;
}

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

[hidden] {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at top, rgba(141, 184, 255, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
}

.game-board {
  position: relative;
  width: min(1480px, calc((100vh - 36px) * 16 / 9), 96vw);
  aspect-ratio: 16 / 9;
  padding: 14px;
  border-radius: 36px;
  background: var(--board-bg);
  border: 1px solid rgba(191, 219, 255, 0.24);
  box-shadow: var(--board-shadow);
  overflow: hidden;
}

.game-board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0, rgba(255, 255, 255, 0.03) 7%, transparent 18%, transparent 82%, rgba(255, 255, 255, 0.03) 93%, rgba(255, 255, 255, 0.12) 100%),
    radial-gradient(circle at top, rgba(146, 196, 255, 0.16), rgba(146, 196, 255, 0) 36%);
  pointer-events: none;
}

.game-board::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 30px;
  box-shadow:
    inset 0 0 0 1px rgba(165, 207, 255, 0.12),
    inset 0 -120px 140px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.panel-image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.top-bar,
.playfield,
.footer-strip,
.decor {
  position: relative;
  z-index: 1;
}

.top-bar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: var(--board-gap);
  min-height: 62px;
  padding: 10px 16px;
  border-radius: 26px;
}

.top-bar__left,
.top-bar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.top-bar__center {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-size: var(--text-lg);
  font-weight: 800;
  color: #fff6d5;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.26);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-label {
  color: rgba(255, 248, 214, 0.78);
}

.action-chip,
.timer-chip,
.score-capsule,
.skip-button,
.primary-button,
.secondary-button,
.icon-close,
.results-ribbon,
.badge-card {
  border: none;
  outline: none;
}

.action-chip,
.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: var(--chip-h);
  padding: 0 clamp(14px, 12px + 0.5vw, 18px);
  border-radius: var(--chip-radius);
  background:
    linear-gradient(180deg, rgba(66, 140, 248, 0.94), rgba(29, 85, 190, 0.94));
  color: #ffffff;
  font-size: var(--text-md);
  font-weight: 800;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.24),
    0 10px 18px rgba(6, 22, 53, 0.18);
  white-space: nowrap;
}

.action-chip {
  cursor: pointer;
}

.action-chip img,
.timer-chip img,
.footer-strip img,
.energy-panel__status img {
  width: clamp(22px, 20px + 0.35vw, 28px);
  height: clamp(22px, 20px + 0.35vw, 28px);
  object-fit: contain;
  flex: 0 0 auto;
}

.score-capsule {
  min-width: clamp(116px, 100px + 2vw, 150px);
  height: calc(var(--chip-h) + 2px);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 clamp(14px, 12px + 0.5vw, 18px);
  border-radius: calc(var(--chip-radius) + 1px);
  color: #ffffff;
  font-size: var(--text-md);
  font-weight: 800;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.score-capsule__label {
  min-width: 0;
  opacity: 0.95;
  white-space: nowrap;
}

.playfield {
  display: grid;
  grid-template-columns: minmax(220px, 248px) 1fr minmax(220px, 248px);
  gap: var(--board-gap);
  min-height: calc(100% - 138px);
  margin-top: 10px;
}

.shelf {
  display: flex;
  flex-direction: column;
  padding: 10px 14px 14px;
  border-radius: 28px;
  min-height: 0;
}

.shelf__title {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 18px;
  color: #ffffff;
  font-size: clamp(18px, 16px + 0.55vw, 24px);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
}

.shelf__slots {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.shelf-slot {
  position: relative;
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  gap: 10px;
  min-height: clamp(112px, 102px + 0.9vw, 124px);
  padding: 12px 12px 12px 10px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(118, 71, 18, 0.9), rgba(89, 52, 14, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  border: 2px solid rgba(255, 240, 196, 0.18);
  box-shadow:
    inset 0 6px 14px rgba(255, 255, 255, 0.08),
    inset 0 -10px 22px rgba(0, 0, 0, 0.22),
    0 18px 22px rgba(0, 0, 0, 0.18);
}

.shelf-slot::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255, 219, 129, 0.18);
  pointer-events: none;
}

.shelf-slot.is-active {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 0 0 3px rgba(255, 232, 116, 0.22),
    0 0 32px rgba(255, 220, 103, 0.45),
    inset 0 0 34px rgba(255, 224, 125, 0.26),
    0 18px 24px rgba(0, 0, 0, 0.22);
}

.shelf-slot__badge {
  width: clamp(42px, 40px + 0.4vw, 48px);
  height: clamp(42px, 40px + 0.4vw, 48px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(24px, 22px + 0.45vw, 28px);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.shelf-slot__badge--red {
  background: radial-gradient(circle at 30% 30%, #ffb28a 0%, #ff5d41 35%, #d72813 100%);
}

.shelf-slot__badge--blue {
  background: radial-gradient(circle at 30% 30%, #8fd8ff 0%, #3b88ff 35%, #1553db 100%);
}

.shelf-slot__toy-wrap {
  position: relative;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shelf-slot__toy-wrap::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  background: radial-gradient(circle, rgba(255, 235, 158, 0.34), rgba(255, 235, 158, 0));
}

.shelf-slot__toy {
  position: relative;
  max-height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.24));
}

.center-stage {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 12px;
  min-width: 0;
  padding-top: 4px;
}

.call-banner {
  justify-self: center;
  width: min(100%, 1040px);
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px clamp(34px, 28px + 1.4vw, 56px);
  border-radius: 28px;
  color: #fffced;
  font-family: var(--font-display);
  font-size: clamp(26px, 22px + 1vw, 36px);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 5px 16px rgba(46, 19, 0, 0.42);
}

.call-banner img {
  width: clamp(28px, 24px + 0.7vw, 36px);
  height: clamp(28px, 24px + 0.7vw, 36px);
  flex: 0 0 auto;
}

.call-banner__text {
  min-width: 0;
  max-width: 86%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-banner__text span {
  color: #fff3a8;
}

.prompt-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(132px, 180px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 0.8vw + 8px, 20px);
  min-height: clamp(250px, 31vh, 320px);
  padding: clamp(16px, 1vw + 12px, 24px) clamp(18px, 1.1vw + 14px, 30px);
  border-radius: 36px;
  overflow: hidden;
}

.prompt-panel::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 28px;
  box-shadow: inset 0 0 0 3px rgba(31, 112, 233, 0.14);
  pointer-events: none;
}

.prompt-panel__toy-wrap {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  min-height: 152px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}

.toy-glow {
  position: absolute;
  width: min(220px, 100%);
  height: min(220px, 100%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 231, 127, 0.66), rgba(255, 231, 127, 0));
  filter: blur(12px);
  opacity: 0.62;
}

.prompt-panel__toy {
  position: relative;
  width: min(180px, 100%);
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 16px 18px rgba(29, 77, 123, 0.2));
  transform-origin: center bottom;
}

.prompt-panel__toy.is-flying {
  animation: toy-fly-in 700ms ease both;
}

.prompt-panel__text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 0 2px;
  z-index: 2;
}

.prompt-panel__type {
  color: #4e7ed3;
  font-size: clamp(16px, 14px + 0.3vw, 20px);
  font-weight: 800;
  line-height: 1.2;
}

.prompt-panel__sentence {
  min-height: clamp(68px, 62px + 0.9vw, 94px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  align-content: center;
  gap: clamp(8px, 0.5vw + 6px, 12px);
  font-family: var(--font-display);
  font-size: clamp(18px, 16px + 1vw, 34px);
  font-weight: 800;
  line-height: 1.08;
  color: #11223f;
  overflow-wrap: anywhere;
}

.prompt-panel__sentence > span {
  min-width: 0;
  max-width: 100%;
}

.prompt-word,
.prompt-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(108px, 98px + 2.6vw, 184px);
  min-height: clamp(48px, 44px + 0.8vw, 64px);
  max-width: 100%;
  padding: 2px clamp(14px, 12px + 0.6vw, 20px);
  border-radius: 20px;
  border: 3px solid #2a71e8;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 24px rgba(61, 129, 255, 0.12);
  line-height: 1;
  font-size: inherit;
  flex: 0 1 auto;
}

.prompt-blank {
  color: #76aef8;
  letter-spacing: 4px;
}

.prompt-word {
  color: #d72d22;
}

.prompt-panel__word {
  min-height: 24px;
  max-width: min(100%, 560px);
  font-size: clamp(14px, 13px + 0.38vw, 18px);
  font-weight: 700;
  line-height: 1.3;
  color: #ea7328;
  overflow-wrap: anywhere;
}

.prompt-panel__word.is-visible {
  animation: fade-pop 560ms ease both;
}

.prompt-panel__support {
  min-height: 22px;
  max-width: min(100%, 560px);
  color: #5f7598;
  font-size: clamp(13px, 12px + 0.34vw, 17px);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.prompt-panel__rewards {
  position: absolute;
  right: clamp(26px, 6vw, 96px);
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transform: translateX(0);
  opacity: 0;
  pointer-events: none;
}

.prompt-panel__rewards.is-bursting {
  animation: reward-burst 850ms ease both;
}

.prompt-panel__rewards img {
  width: clamp(38px, 34px + 0.7vw, 48px);
  height: clamp(38px, 34px + 0.7vw, 48px);
  filter: drop-shadow(0 10px 16px rgba(253, 167, 14, 0.26));
}

.round-timer,
.energy-panel {
  border-radius: 28px;
  padding: 14px clamp(18px, 16px + 0.6vw, 22px);
}

.round-timer {
  display: grid;
  grid-template-columns: minmax(96px, 116px) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}

.round-timer__label,
.round-timer__value {
  min-width: 0;
  color: #ffffff;
  font-size: clamp(16px, 14px + 0.35vw, 20px);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
}

.round-timer__track,
.energy-progress__track {
  width: 100%;
  height: clamp(28px, 24px + 0.7vw, 34px);
  padding: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.round-timer__fill,
.energy-progress__fill {
  height: 100%;
  border-radius: 14px;
  background: linear-gradient(90deg, #4dd04f 0%, #74ef75 60%, #b4ff8c 100%);
  transition: width 180ms linear;
}

.energy-panel {
  display: grid;
  gap: 6px;
  padding: 2px 0 0;
  background: none !important;
  background-image: none !important;
  border-radius: 0;
  box-shadow: none;
}

.energy-panel__header,
.energy-panel__status,
.energy-progress__meta,
.footer-strip__item,
.modal__header,
.modal__footer,
.results-scoreline,
.results-score,
.results-badges,
.badge-card {
  display: flex;
  align-items: center;
}

.energy-panel__header {
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px;
}

.energy-panel__status {
  min-width: 0;
  gap: 10px;
  color: #ffffff;
  font-size: clamp(16px, 15px + 0.35vw, 20px);
  font-weight: 800;
  line-height: 1.2;
}

.skip-button,
.primary-button,
.secondary-button {
  min-height: clamp(42px, 38px + 0.7vw, 48px);
  padding: 0 clamp(18px, 16px + 0.8vw, 24px);
  border-radius: 18px;
  cursor: pointer;
  font-size: clamp(18px, 16px + 0.4vw, 22px);
  font-weight: 800;
  white-space: nowrap;
  transition: transform 140ms ease, filter 140ms ease;
}

.skip-button:hover,
.primary-button:hover,
.secondary-button:hover,
.icon-close:hover,
.action-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.skip-button,
.primary-button {
  background: linear-gradient(180deg, #ffd54f, #f6b51d);
  color: #8f3600;
  box-shadow: 0 10px 18px rgba(255, 184, 50, 0.26);
}

.secondary-button {
  background: linear-gradient(180deg, #78bfff, #3679f2);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(36, 109, 224, 0.22);
}

.energy-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 52px;
  padding: 4px 2px;
}

.energy-bar {
  flex: 1;
  min-width: 3px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #62e15d 0%, #2abe38 54%, #ffeb36 54%, #ffb100 100%);
  box-shadow: 0 8px 12px rgba(8, 73, 27, 0.16);
  transform-origin: center bottom;
  transition: height 90ms linear, filter 90ms linear;
}

.energy-bar.is-hot {
  filter: drop-shadow(0 0 10px rgba(255, 220, 64, 0.7));
}

.speaker-button {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(180deg, #78bfff, #3679f2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(36, 109, 224, 0.22);
  transition: transform 140ms ease;
}

.speaker-button:hover {
  transform: scale(1.08);
}

.speaker-button svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.combo-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffd54f, #f6b51d);
  color: #8f3600;
  font-size: var(--text-sm);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(255, 184, 50, 0.32);
  white-space: nowrap;
  justify-self: center;
}

.combo-badge.is-active {
  display: inline-flex;
  animation: combo-pop 400ms ease;
}

.energy-progress {
  display: grid;
  gap: 6px;
}

.energy-progress__meta {
  justify-content: space-between;
  gap: 12px;
  color: #fff8d5;
  font-size: clamp(14px, 13px + 0.28vw, 17px);
  font-weight: 700;
  line-height: 1.25;
}

.mic-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.mic-permission p {
  margin: 0;
  font-size: clamp(16px, 15px + 0.3vw, 18px);
  line-height: 1.35;
}

.mic-permission button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue-900);
  font-size: clamp(16px, 15px + 0.3vw, 18px);
  font-weight: 700;
  cursor: pointer;
}

.footer-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: auto;
  margin-top: 2px;
  padding: 8px 16px 10px;
  border-radius: 24px;
}

.footer-strip__item {
  flex: 1 1 420px;
  min-width: 0;
  gap: 10px;
  color: #f0f6ff;
  font-size: clamp(14px, 13px + 0.3vw, 17px);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.footer-strip__item span {
  min-width: 0;
  white-space: normal;
}

.decor {
  position: absolute;
  bottom: 86px;
  z-index: 0;
  opacity: 0.85;
}

.decor img {
  width: 102px;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.22));
}

.decor--plant-left {
  left: 16px;
}

.decor--plant-right {
  right: 16px;
}

.decor--blocks-left {
  left: 120px;
}

.decor--blocks-right {
  right: 120px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(76, 132, 255, 0.24), rgba(76, 132, 255, 0) 28%),
    rgba(4, 13, 29, 0.74);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: #ffffff;
  font-size: var(--text-lg);
  font-weight: 700;
}

.loading-screen__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffd54f;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal {
  width: min(660px, 92vw);
  border-radius: 34px;
  padding: clamp(22px, 20px + 1vw, 30px);
  color: #264a77;
  background-color: rgba(255, 251, 237, 0.9);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.32);
}

.modal--results {
  position: relative;
  width: min(700px, 92vw);
  padding-top: 56px;
  text-align: center;
  overflow: hidden;
}

.modal__header {
  justify-content: space-between;
  gap: 18px;
}

.modal__header h2 {
  margin: 0;
  font-size: clamp(30px, 26px + 0.9vw, 38px);
  font-family: var(--font-display);
  line-height: 1.1;
}

.icon-close {
  width: clamp(40px, 36px + 0.6vw, 46px);
  height: clamp(40px, 36px + 0.6vw, 46px);
  border-radius: 50%;
  padding: 7px;
  background: rgba(255, 116, 78, 0.18);
  cursor: pointer;
  flex: 0 0 auto;
}

.icon-close--corner {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.icon-close img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal__body {
  display: grid;
  gap: 12px;
  padding: 16px 10px 18px;
  width: min(100%, 548px);
  margin: 0 auto;
}

.modal__body--stack p {
  margin: 0;
  font-size: clamp(19px, 17px + 0.55vw, 24px);
  line-height: 1.6;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(122px, 146px) minmax(0, 1fr) minmax(34px, 42px);
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  font-size: clamp(16px, 14px + 0.4vw, 20px);
  font-weight: 700;
}

.setting-row > span:first-child {
  line-height: 1.2;
}

.setting-row select,
.setting-row input {
  width: 100%;
}

.setting-row select {
  height: clamp(42px, 40px + 0.45vw, 48px);
  padding: 0 12px;
  border: 2px solid rgba(42, 113, 232, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #183969;
}

.setting-row--slider input {
  accent-color: #2d79ef;
}

.setting-row strong {
  min-width: 2.8ch;
  text-align: right;
  font-size: clamp(16px, 14px + 0.38vw, 20px);
}

.modal__footer {
  justify-content: flex-end;
  gap: 14px;
  width: min(100%, 548px);
  margin: 0 auto;
  padding: 0 10px 4px;
}

.modal__footer--split {
  justify-content: center;
}

#settingsModal .modal__body,
#settingsModal .modal__footer {
  width: min(100%, 516px);
}

#settingsModal .setting-row {
  padding: 0 14px;
}

#settingsModal .modal__footer {
  justify-content: center;
  padding-bottom: 8px;
}

.results-fireworks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.results-fireworks img {
  position: absolute;
  width: 180px;
  opacity: 0.9;
  animation: float-spark 3.4s ease-in-out infinite;
}

.results-fireworks img:first-child {
  top: 20px;
  left: 12px;
}

.results-fireworks img:last-child {
  top: 44px;
  right: 24px;
  width: 160px;
  animation-delay: 600ms;
}

.results-ribbon {
  width: min(340px, 100%);
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 26px;
  font-family: var(--font-display);
  font-size: clamp(28px, 24px + 0.9vw, 34px);
  font-weight: 800;
  color: #fffef0;
  text-shadow: 0 4px 10px rgba(146, 34, 0, 0.3);
}

.results-title {
  margin-top: 16px;
  font-size: clamp(42px, 34px + 1.4vw, 58px);
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  color: #d6271f;
}

.results-scoreline {
  justify-content: center;
  gap: clamp(18px, 14px + 1vw, 34px);
  margin-top: 18px;
}

.results-score {
  flex-direction: column;
  gap: 8px;
  min-width: 146px;
  padding: 16px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 20px rgba(40, 115, 224, 0.12);
}

.results-score span {
  font-size: clamp(20px, 18px + 0.5vw, 24px);
  font-weight: 700;
}

.results-score strong {
  font-size: clamp(34px, 30px + 0.9vw, 44px);
  font-family: var(--font-display);
}

.results-badges {
  flex-direction: column;
  gap: 16px;
  margin: 24px 0 30px;
}

.badge-card {
  justify-content: center;
  gap: 16px;
  min-height: 82px;
  padding: 0 20px;
  border-radius: 26px;
  background: rgba(255, 252, 235, 0.9);
  box-shadow: 0 10px 18px rgba(255, 174, 31, 0.12);
}

.badge-card img {
  width: clamp(46px, 42px + 0.7vw, 54px);
  height: clamp(46px, 42px + 0.7vw, 54px);
  object-fit: contain;
}

.badge-card div {
  display: grid;
  justify-items: start;
  gap: 2px;
}

.badge-card strong {
  font-size: clamp(20px, 18px + 0.5vw, 24px);
}

.badge-card span {
  font-size: clamp(17px, 16px + 0.35vw, 20px);
  color: #8f6433;
}

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

.is-shaking {
  animation: shake-panel 420ms ease;
}

.status-success {
  color: #bffba3;
}

.status-fail {
  color: #ffd69b;
}

@keyframes toy-fly-in {
  0% {
    opacity: 0;
    transform: translate(-100px, 40px) scale(0.45) rotate(-16deg);
  }
  70% {
    opacity: 1;
    transform: translate(8px, -10px) scale(1.05) rotate(8deg);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
}

@keyframes reward-burst {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.6);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-42px) scale(1.16);
  }
}

@keyframes fade-pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shake-panel {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@keyframes float-spark {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-12px) rotate(6deg);
  }
}

@keyframes combo-pop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1400px) {
  .game-board {
    min-height: 680px;
  }

  .playfield {
    grid-template-columns: 218px 1fr 218px;
  }

  .prompt-panel {
    min-height: 400px;
  }
}

@media (max-width: 1180px) {
  .page-shell {
    padding: 12px;
  }

  .game-board {
    width: 100%;
    min-height: 760px;
    aspect-ratio: auto;
  }

  .top-bar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .top-bar__left,
  .top-bar__right,
  .top-bar__center {
    justify-content: center;
    flex-wrap: wrap;
  }

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

  .center-stage {
    order: -1;
  }

  .prompt-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .prompt-panel__toy-wrap {
    width: 100%;
    min-height: 180px;
    margin-top: 8px;
  }

  .prompt-panel__text {
    align-items: center;
    width: 100%;
    padding: 4px 8px 10px;
  }

  .prompt-panel__sentence {
    justify-content: center;
  }

  .prompt-panel__rewards {
    right: 50%;
    transform: translateX(50%);
  }

  .shelf {
    min-height: auto;
  }

  .shelf__slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .footer-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .decor {
    display: none;
  }
}

@media (max-width: 760px) {
  .overlay {
    padding: 12px;
  }

  .modal {
    width: min(96vw, 680px);
    padding: 20px;
  }

  .setting-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .setting-row strong {
    justify-self: end;
  }

  .modal__footer,
  .modal__footer--split {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .modal__footer button {
    flex: 1 1 180px;
  }
}
