:root {
  color-scheme: light;
  --ink: #203247;
  --muted: #667386;
  --paper: #fffaf1;
  --panel: #ffffff;
  --sun: #ffd166;
  --mint: #36c9a3;
  --sky: #57b8ff;
  --berry: #ef476f;
  --leaf: #2fbf71;
  --grape: #7f5af0;
  --line: rgba(32, 50, 71, .14);
  --shadow: 0 16px 35px rgba(32, 50, 71, .16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(87, 184, 255, .38), transparent 34%),
    linear-gradient(315deg, rgba(255, 209, 102, .55), transparent 36%),
    #fff4df;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  overflow-x: hidden;
}

button {
  color: inherit;
  font: inherit;
}

.app {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.topbar,
.score-strip,
.play-panel {
  background: rgba(255, 255, 255, .84);
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 86px;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
.category-title,
.score-label {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(1.45rem, 6vw, 3rem);
  line-height: 1;
}

.icon-button,
.speak-button {
  border: 0;
  border-radius: 8px;
  background: var(--sun);
  box-shadow: inset 0 -5px rgba(32, 50, 71, .12);
  cursor: pointer;
  touch-action: manipulation;
}

.icon-button {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  font-size: 1.55rem;
}

.sound-tools {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.volume-control {
  width: min(126px, 32vw);
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.volume-control input {
  width: 100%;
  accent-color: var(--berry);
}

.score-strip {
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.score-strip div {
  min-width: 0;
  border-radius: 8px;
  background: #f3fbff;
  padding: 10px 8px;
  text-align: center;
}

.score-strip strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1;
}

.category-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-height: 58px;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 18px rgba(32, 50, 71, .1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.tab[aria-selected="true"] {
  background: #203247;
  color: white;
}

.play-panel {
  border-radius: 8px;
  padding: clamp(14px, 4vw, 28px);
  display: grid;
  gap: clamp(12px, 3vw, 20px);
}

.prompt-wrap {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.speak-button {
  width: 62px;
  height: 62px;
  font-size: 1.35rem;
}

h2 {
  margin: 2px 0 0;
  font-size: clamp(1.45rem, 7vw, 3.6rem);
  line-height: 1.05;
}

.mascot-card {
  position: relative;
  min-height: clamp(132px, 30vh, 280px);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(120deg, rgba(54, 201, 163, .28), rgba(87, 184, 255, .28)),
    #fffdf7;
  border: 2px dashed rgba(32, 50, 71, .2);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.mascot-card.drop-ready {
  border-color: var(--leaf);
  box-shadow: 0 0 0 8px rgba(47, 191, 113, .16), var(--shadow);
  transform: scale(1.015);
}

.drop-hint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(32, 50, 71, .82);
  color: white;
  font-size: .78rem;
  font-weight: 900;
  pointer-events: none;
}

.prompt-visual {
  max-width: 100%;
  line-height: 1;
  font-size: clamp(4rem, 28vw, 11rem);
  font-weight: 1000;
  text-align: center;
  filter: drop-shadow(0 8px rgba(32, 50, 71, .1));
}

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

.answer {
  min-height: 92px;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
  box-shadow: 0 8px 0 rgba(32, 50, 71, .1), 0 16px 24px rgba(32, 50, 71, .11);
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  text-align: left;
  touch-action: none;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.answer:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 rgba(32, 50, 71, .1), 0 10px 18px rgba(32, 50, 71, .1);
}

.answer.dragging {
  opacity: .72;
  transform: scale(.96);
}

.drag-ghost {
  position: fixed;
  z-index: 30;
  width: min(220px, 58vw);
  min-height: 82px;
  border-radius: 8px;
  pointer-events: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  box-shadow: 0 18px 40px rgba(32, 50, 71, .24);
}

.answer-icon {
  width: clamp(48px, 14vw, 70px);
  height: clamp(48px, 14vw, 70px);
  border-radius: 8px;
  background: #f1fbf7;
  display: grid;
  place-items: center;
  font-size: clamp(2rem, 10vw, 3.1rem);
}

.answer-text {
  min-width: 0;
  font-size: clamp(1rem, 4.6vw, 1.5rem);
  font-weight: 1000;
  overflow-wrap: anywhere;
}

.answer.correct {
  outline: 4px solid var(--leaf);
  background: #effff4;
}

.answer.wrong {
  outline: 4px solid var(--berry);
  background: #fff2f5;
}

.feedback {
  min-height: 44px;
  border-radius: 8px;
  padding: 12px;
  background: #203247;
  color: white;
  font-size: clamp(1rem, 4.5vw, 1.3rem);
  font-weight: 900;
  text-align: center;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.ribbon {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 12px;
  height: 36px;
  border-radius: 3px;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--turn));
  animation: ribbonBlast 900ms cubic-bezier(.12, .82, .22, 1) forwards;
}

@keyframes ribbonBlast {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--turn)) scale(.5);
  }

  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--x)), calc(-50% + var(--y)))
      rotate(calc(var(--turn) + 460deg))
      scale(1);
  }
}

@media (min-width: 760px) {
  .app {
    grid-template-columns: 310px minmax(0, 1fr);
    align-content: start;
    padding: 24px;
  }

  .topbar,
  .score-strip,
  .category-tabs {
    grid-column: 1;
  }

  .play-panel {
    grid-column: 2;
    grid-row: 1 / span 4;
    min-height: calc(100vh - 48px);
  }

  .category-tabs {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
  }

  .answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  .topbar {
    align-items: flex-start;
  }

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

  .answer {
    min-height: 76px;
  }
}
