@font-face {
  font-family: "Press Start 2P Local";
  src: url("assets/fonts/PressStart2P-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Silkscreen Local";
  src: url("assets/fonts/Silkscreen-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Silkscreen Local";
  src: url("assets/fonts/Silkscreen-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

:root {
  --orange-bg: #ff9318;
  --orange-bg-2: #ffb238;
  --coral: #ff6540;
  --coral-dark: #e34b27;
  --cream: #fff0dc;
  --cream-2: #ffe0bb;
  --black: #11100d;
  --brown: #8e3f12;
  --pink: #ff6d83;
  --green: #75b843;
  --shadow: rgba(103, 45, 4, 0.28);
  --title-font: "Press Start 2P Local";
  --support-font: "Silkscreen Local";
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--orange-bg);
  color: var(--black);
  font-family: var(--support-font);
}

button {
  font-family: var(--title-font);
}

.sound-toggle {
  position: absolute;
  top: 3.7%;
  right: 1.9%;
  z-index: 30;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--black);
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.26);
  cursor: pointer;
  font-size: clamp(8px, 0.72vw, 13px);
  line-height: 1;
}

.sound-toggle:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--orange-bg) 0%, var(--orange-bg-2) 100%);
  isolation: isolate;
}

.pixel-noise {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.3;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.14) 10px, transparent 10px) 2% 23% / 39px 39px no-repeat,
    linear-gradient(90deg, rgba(255,255,255,0.16) 10px, transparent 10px) 88% 23% / 39px 39px no-repeat,
    linear-gradient(90deg, rgba(213,96,6,0.22) 10px, transparent 10px) 2% 82% / 39px 39px no-repeat,
    linear-gradient(90deg, rgba(213,96,6,0.2) 10px, transparent 10px) 86% 79% / 39px 39px no-repeat;
}

.title-bar {
  position: absolute;
  top: 3.2%;
  left: 6.4%;
  right: 7.6%;
  z-index: 6;
  display: grid;
  grid-template-columns: 8% auto 1fr;
  align-items: center;
  min-height: 13.7%;
  padding: 1.1% 3.4% 1.2% 4.6%;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff704d 0%, #ff5f3d 100%);
  box-shadow: 0 7px 0 rgba(191, 78, 20, 0.18);
}

.title-paw {
  width: 76%;
  min-width: 42px;
  image-rendering: pixelated;
}

.title-bar h1 {
  margin: 0;
  white-space: nowrap;
  font-size: clamp(16px, 2.55vw, 44px);
  font-family: var(--title-font);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.title-dash {
  align-self: end;
  height: 4px;
  margin: 0 0 1.4% 2%;
  background-image: linear-gradient(90deg, var(--black) 55%, transparent 55%);
  background-size: 8px 4px;
}

.cat-mascot {
  position: absolute;
  left: 0.8%;
  top: 20.5%;
  z-index: 5;
  width: 41%;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 0 rgba(122, 63, 11, 0.22));
  animation: catBreath 2.3s steps(2, end) infinite;
  transform-origin: 50% 82%;
}

.quiz-card {
  position: absolute;
  top: 22.3%;
  left: 31.8%;
  z-index: 2;
  width: 60.8%;
  height: 64.2%;
  padding: 2.8% 3.5% 2.1% 5.8%;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--cream) 0%, #fff8ef 50%, var(--cream-2) 100%);
  box-shadow: 0 9px 0 rgba(137, 70, 14, 0.16);
  transition: opacity 160ms ease, transform 160ms ease;
}

.quiz-card.is-changing {
  opacity: 0;
  transform: translateX(16px);
}

.card-topline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.4%;
}

.question-badge {
  display: inline-grid;
  place-items: center;
  min-width: 6.2vw;
  height: 3.7vw;
  max-height: 62px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--black);
  color: #fff;
  font-size: clamp(18px, 2.6vw, 42px);
  font-family: var(--title-font);
  font-weight: 400;
  line-height: 1;
}

.dash-line {
  display: block;
  height: 4px;
  background-image: linear-gradient(90deg, var(--black) 55%, transparent 55%);
  background-size: 8px 4px;
}

.progress {
  font-family: var(--support-font);
  font-size: clamp(10px, 1.25vw, 20px);
}

.question-layout {
  display: block;
  min-height: 36.2%;
  margin-top: 0.2%;
  padding-right: 31%;
}

.question-theme {
  margin: 0 0 2.5%;
  color: var(--coral-dark);
  font-family: var(--support-font);
  font-size: clamp(10px, 1.1vw, 18px);
}

.question-copy h2 {
  margin: 0;
  font-size: clamp(17px, 2.15vw, 36px);
  font-family: var(--title-font);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: 0;
}

.item-preview {
  display: grid;
  place-items: center;
  margin: 0;
  position: absolute;
  top: 11.5%;
  right: 6.8%;
  z-index: 1;
  width: 24%;
}

.item-preview img {
  width: min(13.3vw, 205px);
  height: min(13.3vw, 205px);
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 0 rgba(124, 65, 13, 0.18));
}

.item-preview figcaption {
  margin-top: 4px;
  font-family: var(--support-font);
  font-size: clamp(8px, 0.85vw, 13px);
  text-align: center;
}

.card-divider {
  margin: -0.4% 0 1.8%;
}

.answer-list {
  display: grid;
  gap: min(1.45vh, 14px);
}

.answer-list.is-multi {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: min(1.2vh, 12px);
}

.answer-list.is-multi .answer-button {
  min-height: clamp(38px, 5.2vh, 58px);
  font-size: clamp(12px, 1.55vw, 25px);
}

.answer-button,
.confirm-button,
.start-button,
.victory-actions button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff7049 0%, var(--coral) 100%);
  color: var(--black);
  box-shadow: 0 5px 0 var(--coral-dark);
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.answer-button {
  min-height: clamp(44px, 6.25vh, 78px);
  padding: 0.8% 3%;
  font-size: clamp(13px, 1.55vw, 27px);
  line-height: 1.15;
  text-align: center;
}

.answer-button:hover,
.confirm-button:hover,
.start-button:hover,
.victory-actions button:hover {
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.012);
}

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  overflow: hidden;
  background: var(--orange-bg);
}

.start-screen[hidden] {
  display: none;
}

.start-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.start-gif {
  position: absolute;
  z-index: 1;
  object-fit: cover;
  image-rendering: pixelated;
  pointer-events: none;
}

.start-bigcat {
  display: block;
  position: absolute;
  left: -2.4%;
  top: 53.2%;
  z-index: 2;
  width: 25.4%;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 10px 0 rgba(122, 63, 11, 0.22));
}

.start-gif-title {
  display: none;
}

.start-gif-button {
  display: none;
}

.start-button {
  position: absolute;
  left: 35.5%;
  top: 75.7%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 29%;
  height: 12.4%;
  border: 5px solid #ffffff;
  border-radius: 16px;
  background: linear-gradient(180deg, #ff9b18 0%, #ff7108 72%, #e55700 100%);
  color: var(--black);
  box-shadow:
    inset 0 0 0 4px #ffcf68,
    inset 0 0 0 9px #e95c03,
    0 8px 0 #9f3e00,
    0 14px 0 rgba(111, 42, 0, 0.26);
  cursor: pointer;
  font-size: clamp(24px, 3.5vw, 58px);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.start-button:hover {
  filter: brightness(1.08);
  transform: translateY(-2px) scale(1.01);
}

.start-button:focus-visible {
  outline: 4px dotted var(--black);
  outline-offset: 4px;
}

.answer-button.is-selected {
  outline: 4px solid #ffd45b;
  filter: brightness(1.08);
}

.answer-button.is-correct {
  animation: answerBounce 280ms steps(2, end);
  box-shadow: 0 0 0 4px #ffd45b, 0 5px 0 var(--coral-dark);
}

.answer-button.is-wrong {
  animation: shake 240ms linear;
}

.multi-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 1.7%;
}

.multi-actions[hidden] {
  display: none;
}

.confirm-button {
  min-height: 42px;
  padding: 10px 22px;
  font-size: clamp(12px, 1.25vw, 20px);
}

.confirm-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.multi-counter {
  font-family: var(--support-font);
  font-size: clamp(11px, 1.1vw, 17px);
}

.feedback {
  min-height: 1.5em;
  margin: 1.6% 0 0;
  color: var(--coral-dark);
  font-family: var(--support-font);
  font-size: clamp(11px, 1.2vw, 19px);
}

.collection-bar {
  position: absolute;
  left: 33.2%;
  bottom: 2.3%;
  z-index: 7;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  width: 57.8%;
  height: 9.2%;
  padding: 0.7% 1.4%;
  border: 4px solid rgba(120, 56, 9, 0.2);
  border-radius: 14px;
  background: rgba(255, 239, 216, 0.86);
  box-shadow: 0 5px 0 rgba(140, 69, 8, 0.15);
  pointer-events: none;
}

.collection-label {
  font-family: var(--support-font);
  font-size: clamp(10px, 1vw, 16px);
}

.collection-slots {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  height: 100%;
}

.collection-slot {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: min(5.3vw, 72px);
  height: min(5.3vw, 72px);
  min-width: 0;
  border: 3px dotted rgba(17, 16, 13, 0.45);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.34);
}

.collection-slot img {
  width: 108%;
  height: 108%;
  object-fit: contain;
  image-rendering: pixelated;
}

.collection-slot.is-filled {
  border-style: solid;
  background: #fff9ef;
  animation: collectPop 360ms steps(2, end);
}

.sparkle-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 12;
}

.sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff7b1;
  box-shadow:
    10px 0 #fff,
    -10px 0 #fff,
    0 10px #fff,
    0 -10px #fff,
    0 0 0 4px rgba(255, 101, 64, 0.45);
  animation: sparkle 520ms steps(4, end) forwards;
}

.victory-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: block;
  padding: 0;
  background: var(--orange-bg);
}

.victory-screen[hidden] {
  display: none;
}

.victory-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.victory-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.victory-stage.use-css-fallback::before {
  content: "";
  position: absolute;
  left: 11.5%;
  top: 7.3%;
  z-index: 0;
  width: 77%;
  height: 85.6%;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--cream) 0%, #fff8ef 100%);
  box-shadow: 0 10px 0 rgba(130, 63, 7, 0.2);
}

.victory-catinbox {
  position: absolute;
  left: 5.6%;
  top: 30.1%;
  z-index: 2;
  width: 35%;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 0 rgba(122, 63, 11, 0.18));
  animation: catBreath 2.4s steps(2, end) infinite;
  transform-origin: 50% 86%;
}

.victory-fallback-copy {
  display: none;
}

.victory-stage.use-css-fallback .victory-fallback-copy {
  display: grid;
  position: absolute;
  left: 39%;
  top: 14.5%;
  z-index: 1;
  width: 43%;
  place-items: center;
  text-align: center;
}

.victory-fallback-copy h2 {
  margin: 0 0 16%;
  font-family: var(--title-font);
  font-size: clamp(28px, 4.1vw, 66px);
  font-weight: 400;
  line-height: 1.18;
}

.victory-fallback-copy span,
.victory-fallback-copy strong {
  font-family: var(--title-font);
  font-size: clamp(16px, 1.7vw, 30px);
  font-weight: 400;
  line-height: 1.2;
}

.victory-score-panel {
  position: absolute;
  left: 46.6%;
  top: 59.2%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 8.3%;
  height: 10.8%;
  color: var(--black);
  text-align: center;
  pointer-events: none;
}

.victory-score-panel strong {
  font-family: var(--title-font);
  font-size: clamp(46px, 5.1vw, 84px);
  font-weight: 400;
  line-height: 1;
}

.victory-actions {
  position: absolute;
  left: 32.7%;
  top: 79.6%;
  z-index: 4;
  display: grid;
  grid-template-columns: 0.95fr 1.12fr 1fr;
  gap: 1.25%;
  width: 52.5%;
  height: 10.3%;
}

.victory-actions button {
  min-width: 0;
  min-height: 100%;
  padding: 0 7%;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff7049 0%, var(--coral) 100%);
  color: var(--black);
  font-size: clamp(9px, 1.1vw, 18px);
  line-height: 1.22;
  box-shadow: 0 5px 0 var(--coral-dark);
  -webkit-tap-highlight-color: transparent;
}

.victory-actions button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px) scale(1.01);
}

.victory-actions button:focus-visible {
  outline: 4px dotted var(--black);
  outline-offset: 4px;
}

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

@keyframes catBreath {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.012, 0.992);
  }
}

@keyframes answerBounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-7px);
  }

  50% {
    transform: translateX(6px);
  }

  75% {
    transform: translateX(-4px);
  }
}

@keyframes collectPop {
  0% {
    transform: scale(0.85);
  }

  70% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(0deg);
  }

  40% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.8) rotate(45deg);
  }
}

@media (max-aspect-ratio: 4 / 3) {
  body {
    align-items: start;
  }

  .game-shell {
    width: 100vw;
  }
}

@media (max-width: 760px) {
  .title-bar {
    border-radius: 9px;
  }

  .quiz-card {
    border-radius: 14px;
  }

  .answer-list {
    gap: 6px;
  }

  .collection-bar {
    gap: 8px;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
  }

  body {
    place-items: center;
  }

  .game-shell {
    position: relative;
    top: auto;
    left: auto;
    width: 100vw;
    height: 100dvh;
    min-height: 680px;
    max-width: none;
    aspect-ratio: auto;
    transform: none;
  }

  .sound-toggle {
    top: 10.8%;
    right: 3%;
    min-height: 32px;
    padding: 8px 9px;
    border-radius: 8px;
    font-size: 8px;
  }

  .title-bar {
    top: 1.8%;
    left: 3%;
    right: 3%;
    grid-template-columns: 13% 1fr;
    min-height: 8.8%;
    padding: 2.2% 3%;
    border-radius: 10px;
  }

  .title-paw {
    width: 76%;
    min-width: 28px;
  }

  .title-bar h1 {
    white-space: normal;
    font-size: clamp(10px, 3.2vw, 17px);
    line-height: 1.35;
  }

  .title-dash {
    display: none;
  }

  .cat-mascot {
    left: 2%;
    top: 13.2%;
    width: 38%;
    z-index: 5;
  }

  .quiz-card {
    top: 22.5%;
    left: 7%;
    width: 89%;
    height: 55.8%;
    padding: 4.6% 4.5% 3.8% 8.5%;
    border-radius: 15px;
  }

  .card-topline {
    gap: 8px;
    padding-left: 24%;
  }

  .question-badge {
    min-width: 58px;
    height: 38px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 18px;
  }

  .dash-line {
    height: 3px;
    background-size: 7px 3px;
  }

  .progress {
    font-size: 12px;
  }

  .question-layout {
    min-height: 30%;
    margin-top: 4%;
    padding-right: 34%;
  }

  .question-theme {
    margin-bottom: 7px;
    font-size: 11px;
  }

  .question-copy h2 {
    font-size: clamp(14px, 4vw, 20px);
    line-height: 1.3;
  }

  .item-preview {
    top: 15%;
    right: 4%;
    width: 31%;
  }

  .item-preview img {
    width: min(24vw, 96px);
    height: min(24vw, 96px);
  }

  .item-preview figcaption {
    font-size: 9px;
  }

  .card-divider {
    margin: 1% 0 4%;
  }

  .answer-list {
    gap: 9px;
  }

  .answer-list.is-multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .answer-button,
  .answer-list.is-multi .answer-button {
    min-height: 48px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: clamp(11px, 3.2vw, 15px);
    line-height: 1.25;
  }

  .answer-list.is-multi .answer-button {
    min-height: 42px;
    padding: 7px 6px;
    font-size: clamp(9px, 2.7vw, 13px);
  }

  .answer-list.is-multi .answer-button:nth-child(5) {
    grid-column: 1 / -1;
  }

  .multi-actions {
    margin-top: 8px;
    gap: 10px;
  }

  .confirm-button {
    min-height: 36px;
    padding: 9px 14px;
    border-radius: 9px;
    font-size: 11px;
  }

  .multi-counter,
  .feedback {
    font-size: 12px;
  }

  .collection-bar {
    left: 5%;
    bottom: 20.5%;
    width: 90%;
    height: 6.8%;
    gap: 8px;
    padding: 1.2% 2%;
    border-radius: 11px;
  }

  .collection-label {
    font-size: 10px;
  }

  .collection-slots {
    gap: 4px;
  }

  .collection-slot {
    width: min(11vw, 44px);
    height: min(11vw, 44px);
    border-width: 2px;
    border-radius: 7px;
  }

  .start-cover {
    position: absolute;
    left: 0;
    top: 5%;
    width: 100%;
    height: 60%;
    object-fit: contain;
  }

  .start-bigcat {
    left: -2%;
    top: 55%;
    width: 34%;
  }

  .start-button {
    left: 23%;
    top: 75%;
    width: 54%;
    height: 9%;
    border-width: 4px;
    border-radius: 12px;
    font-size: clamp(22px, 8vw, 36px);
    box-shadow:
      inset 0 0 0 3px #ffcf68,
      inset 0 0 0 7px #e95c03,
      0 6px 0 #9f3e00,
      0 11px 0 rgba(111, 42, 0, 0.26);
  }

  .victory-bg {
    display: none;
  }

  .victory-stage::before {
    content: "";
    position: absolute;
    left: 5%;
    top: 17%;
    width: 90%;
    height: 62%;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--cream) 0%, #fff8ef 100%);
    box-shadow: 0 8px 0 rgba(130, 63, 7, 0.18);
  }

  .victory-catinbox {
    left: 3%;
    top: 25%;
    width: 43%;
  }

  .victory-stage .victory-fallback-copy {
    display: grid;
    position: absolute;
    left: 38%;
    top: 21%;
    z-index: 3;
    width: 54%;
    text-align: center;
    place-items: center;
  }

  .victory-fallback-copy h2 {
    margin: 0 0 20px;
    font-size: clamp(18px, 5vw, 26px);
    line-height: 1.25;
  }

  .victory-fallback-copy span,
  .victory-fallback-copy strong {
    font-size: clamp(12px, 3vw, 15px);
  }

  .victory-score-panel {
    left: 54%;
    top: 43%;
    width: 16%;
    height: 10%;
  }

  .victory-score-panel strong {
    font-size: clamp(42px, 14vw, 64px);
  }

  .victory-actions {
    left: 8%;
    top: 66%;
    width: 84%;
    height: 8%;
    gap: 6px;
  }

  .victory-actions button {
    padding: 0 6px;
    border-radius: 9px;
    font-size: clamp(7px, 2.2vw, 11px);
  }
}
