*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #FFF5E6;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #FFF5E6;
}

/* Hidden by default on mobile — shown in widescreen query */
#desktop-footer {
  display: none;
}

/* Narrow landscape (phones in landscape): fill viewport */
@media (orientation: landscape) and (max-width: 767px) {
  #app {
    max-width: 100vw;
    max-height: 100vh;
  }
}

/* Widescreen/Desktop: show game inside a phone mockup */
@media (min-width: 768px) and (orientation: landscape) {
  body {
    background: #1a1a2e url('/static/assets/widescreen_background.png') center / cover no-repeat;
  }

  #app {
    flex: none;
    width: auto;
    max-width: none;
    height: 92dvh;
    max-height: 860px;
    aspect-ratio: 9 / 19.5;
    border-radius: 44px;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.08),
      0 0 0 8px #1a1a2e,
      0 24px 80px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 101;
  }

  /* ─── Desktop Footer ─── */
  #desktop-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 32px;
    background: rgba(26, 26, 46, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    z-index: 100;
  }

  .footer-left {
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .footer-impressum-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 6px 16px;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
  }

  .footer-impressum-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.4);
  }
}

/* ─── Impressum Modal ─── */
.impressum-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.impressum-overlay.active {
  display: flex;
}

.impressum-content {
  background: white;
  border-radius: 20px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 90%;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  animation: impressumFadeIn 0.25s ease-out;
}

@keyframes impressumFadeIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.impressum-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #A09080;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.impressum-close:hover {
  color: #5D4E37;
}

.impressum-content h2 {
  font-size: 1.4rem;
  color: #5D4E37;
  margin-bottom: 1rem;
}

.impressum-content p {
  font-size: 0.95rem;
  color: #5D4E37;
  line-height: 1.6;
  margin-bottom: 0.4rem;
}

.impressum-content a {
  color: #7EC8E3;
  text-decoration: none;
}

.impressum-content a:hover {
  text-decoration: underline;
}

.impressum-content hr {
  border: none;
  border-top: 1px solid #E0D5C7;
  margin: 1rem 0 0.6rem;
}

.impressum-small {
  font-size: 0.8rem;
  color: #A09080;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ─── Menu ─── */
#screen-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 245, 230, 0.3);
}

#screen-menu {
  background: url('/static/assets/title_screen.png') center / cover no-repeat;
  text-align: center;
  padding: 2rem;
}

#screen-menu h1 {
  font-size: 2.5rem;
  color: #78C2A0;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 20px;
}

#screen-menu .subtitle {
  position: relative;
}

#screen-menu .menu-btn {
  position: relative;
}

#screen-menu .subtitle {
  font-size: 1.2rem;
  color: #8B7355;
  margin-bottom: 2rem;
}

.menu-btn {
  background: #7EC8E3;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 1.2rem 3rem;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 #5A9EB8, 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  min-width: 200px;
}

.menu-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #5A9EB8, 0 3px 6px rgba(0,0,0,0.15);
}

.menu-btn-secondary {
  background: #E8D5B7;
  box-shadow: 0 4px 0 #C9B89A, 0 6px 12px rgba(0,0,0,0.15);
  margin-top: 0.8rem;
}

.menu-btn-secondary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C9B89A, 0 3px 6px rgba(0,0,0,0.15);
}

/* ─── Character Select ─── */
#screen-character-select {
  background: linear-gradient(180deg, #E8F5E9 0%, #FFF5E6 100%);
  padding: 1.5rem;
}

#screen-character-select h2 {
  font-size: 1.7rem;
  color: #5D4E37;
  margin-bottom: 1.5rem;
  text-align: center;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  width: 100%;
  max-width: 360px;
  margin-bottom: 1.5rem;
}

.char-card {
  aspect-ratio: 1;
  background: white;
  border: 3px solid #E0D5C7;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  padding: 0.5rem;
  touch-action: manipulation;
}

.char-card:active {
  transform: scale(0.95);
}

.char-card.selected {
  border-color: #7EC8E3;
  box-shadow: 0 0 0 3px rgba(126, 200, 227, 0.3);
}

.char-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.char-select-btn {
  background: #F7C948;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 1rem 2.5rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 #C9A133, 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  min-width: 180px;
}

.char-select-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C9A133, 0 3px 6px rgba(0,0,0,0.15);
}

.char-select-btn:disabled {
  opacity: 0.5;
  box-shadow: 0 2px 0 #C9A133;
  transform: translateY(2px);
}

/* ─── Adventure Map ─── */
#screen-map::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 245, 230, 0.6);
}

#screen-map {
  background: url('/static/assets/bg_main_menu.jpg') center / cover no-repeat;
  padding: 1.5rem;
}

#screen-map .map-header {
  position: relative;
}

#screen-map .adventure-list {
  position: relative;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

.map-header h2 {
  font-size: 1.3rem;
  color: #5D4E37;
}

.star-display {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 1rem;
  color: #5D4E37;
  font-weight: 600;
}

.star-display img {
  width: 22px;
  height: 22px;
}

.adventure-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 420px;
  overflow-y: auto;
  flex: 1;
  padding: 0 0.5rem 0.5rem;
}

.adventure-card {
  background: white;
  border-radius: 18px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 82px;
}

.adventure-card:active {
  transform: scale(0.98);
}

.adventure-card.placeholder {
  opacity: 0.25;
  pointer-events: none;
  border: 2px dashed #D0C5B7;
  box-shadow: none;
}

.adventure-card .icon {
  width: 68px;
  height: 68px;
  background: #E8F5E9;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.adventure-card .icon img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.adventure-card .info {
  flex: 1;
  min-width: 0;
}

.adventure-card .info h3 {
  font-size: 1.15rem;
  color: #5D4E37;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adventure-card .info p {
  font-size: 0.9rem;
  color: #A09080;
}

.adventure-card .status {
  font-size: 1.4rem;
  color: #8BC34A;
  font-weight: 600;
  flex-shrink: 0;
}

.adventure-card .status.incomplete {
  color: #E0D5C7;
}

/* ─── Dialogue ─── */
#screen-dialogue {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.dialogue-overlay {
  position: absolute;
  inset: 0;
  padding: 1rem 0.75rem 0;
  display: flex;
  flex-direction: column;
}

.dialogue-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 0.5rem;
}

.dialogue-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.dialogue-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.dialogue-row.fading {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.dialogue-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid white;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: 0.25rem;
  background: white;
}

.dialogue-bubble {
  background: white;
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 0.9rem 1.2rem;
  font-size: 1.15rem;
  color: #5D4E37;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  max-width: 85%;
}

.dialogue-hint {
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  margin-top: 0.75rem;
  padding-bottom: 1.2rem;
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ─── Choice ─── */
#screen-choice {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.choice-content {
  background: rgba(255, 245, 230, 0.95);
  border-radius: 24px;
  padding: 2rem;
  margin: 1.5rem;
  text-align: center;
  max-width: 360px;
}

.choice-content h2 {
  font-size: 1.6rem;
  color: #5D4E37;
  margin-bottom: 1.5rem;
}

.choice-btn {
  border: none;
  border-radius: 20px;
  padding: 1.2rem 2rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.8rem;
  transition: transform 0.1s;
  touch-action: manipulation;
}

.choice-btn:active {
  transform: scale(0.97);
}

.choice-btn.yes {
  background: #8BC34A;
  color: white;
  box-shadow: 0 4px 0 #6FA33A, 0 4px 8px rgba(0,0,0,0.12);
}

.choice-btn.no {
  background: #E0D5C7;
  color: #8B7355;
  box-shadow: 0 4px 0 #C4B8A8, 0 4px 8px rgba(0,0,0,0.12);
}

.choice-btn.tutorial {
  background: #7EC8E3;
  color: white;
  box-shadow: 0 4px 0 #5A9EB8, 0 4px 8px rgba(0,0,0,0.12);
}

/* ─── Nut Guide ─── */
.nut-guide {
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.2rem;
  text-align: center;
}

.nut-guide-intro {
  font-size: 1rem;
  color: #5D4E37;
  margin-bottom: 1rem;
}

/* Pattern row */
.nut-guide-pattern-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.nut-guide-pattern-slot {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nut-guide-pattern-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.2rem;
}

.nut-guide-pattern-given {
  background: #E8F5E9;
  border: 3px solid #A5D6A7;
}

.nut-guide-pattern-empty {
  background: #FFF5E6;
  border: 3px dashed #E8A87C;
  font-size: 1.5rem;
  font-weight: 700;
  color: #E8A87C;
}

/* Arrow explanation */
.nut-guide-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
}

.nut-guide-arrow-text {
  background: #FFF8E1;
  color: #E8A87C;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
}

/* Choice row (all 10 nuts) */
.nut-guide-choice-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  max-width: 320px;
  margin: 0 auto 0.6rem;
}

.nut-guide-choice-slot {
  width: 100%;
  aspect-ratio: 1;
  background: white;
  border: 2px solid #C4B8A8;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nut-guide-choice-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.15rem;
}

.nut-guide-choice-answer {
  border: 3px solid #388E3C;
  background: #C8E6C9;
  box-shadow: 0 0 0 2px #388E3C;
}

/* Answer label */
.nut-guide-answer-label {
  font-size: 0.9rem;
  color: #5D4E37;
  margin-bottom: 1rem;
}

.nut-guide-answer-badge {
  display: inline-block;
  background: #388E3C;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  vertical-align: middle;
}

/* Rules list */
.nut-guide-rules {
  text-align: left;
  background: rgba(255,255,255,0.5);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}

.nut-guide-rules p {
  font-size: 0.85rem;
  color: #5D4E37;
  line-height: 1.5;
  margin-bottom: 0.3rem;
}

.nut-guide-rule-icon {
  font-weight: 700;
  color: #E8A87C;
}

/* ─── Guide Visuals (shared across game guides) ─── */
.guide-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.guide-visual-arrow {
  font-size: 1.5rem;
  color: #E8A87C;
  font-weight: 700;
}

/* Puzzle guide */
.guide-puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 3px;
}

.guide-puzzle-tile {
  width: 52px;
  height: 52px;
  background: #8BC34A;
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-puzzle-empty {
  background: #E0D5C7;
  color: transparent;
}

.guide-puzzle-move {
  background: #FF8A65;
}

/* Math guide */
.guide-math-card {
  background: white;
  border-radius: 16px;
  padding: 0.8rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.guide-math-eq-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.guide-math-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: #5D4E37;
}

.guide-math-op {
  font-size: 1.1rem;
  font-weight: 700;
  color: #A09080;
}

.guide-math-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.guide-math-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #FFF5E6;
  border: 2px dashed #E8A87C;
  border-radius: 8px;
  color: #E8A87C;
}

.guide-math-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.guide-math-btn2 {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #5D4E37;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFF8E1;
}

.guide-math-btn2-ok {
  background: #C8E6C9;
  box-shadow: 0 3px 0 #6FA33A, 0 0 0 2px #8BC34A;
}

/* Letter guide */
.guide-letter-sentence {
  font-size: 1rem;
  color: #5D4E37;
  background: rgba(255,255,255,0.7);
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  margin-bottom: 0.3rem;
}

.guide-letter-scrambled {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.guide-letter-tile {
  width: 36px;
  height: 36px;
  background: white;
  border: 2px solid #C4B8A8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #5D4E37;
}

.guide-letter-correct {
  border-color: #8BC34A;
  background: #E8F5E9;
}

.guide-letter-ok {
  font-size: 0.9rem;
  font-weight: 700;
  color: #8BC34A;
}

/* Wall guide */
.guide-wall-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.guide-wall-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.guide-wall-stone {
  width: 52px;
  height: 36px;
  background: #D7CCC8;
  border: 2px solid #A1887F;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-wall-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #5D4E37;
}

.guide-wall-top {
  background: #E8A87C;
  border-color: #C98A62;
}

.guide-wall-hint {
  font-size: 0.9rem;
  font-weight: 700;
  color: #8BC34A;
  margin-top: 0.2rem;
}

/* Clock guide */
.guide-clock-wrap {
  margin-bottom: 0.5rem;
}

.guide-clock-face-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.guide-clock-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: 2px;
}

.guide-clock-h {
  width: 4px;
  height: 32px;
  background: #5D4E37;
}

.guide-clock-m {
  width: 2.5px;
  height: 46px;
  background: #E8A87C;
}

.guide-clock-answers {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.4rem;
}

.guide-clock-btn {
  padding: 0.3rem 0.6rem;
  border: 2px solid #C4B8A8;
  border-radius: 10px;
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5D4E37;
}

.guide-clock-btn-right {
  border-color: #8BC34A;
  background: #E8F5E9;
  box-shadow: 0 0 0 2px #8BC34A;
}

/* ─── Puzzle ─── */
#screen-puzzle {
  background: #FFF5E6;
  padding: 1rem;
}

#screen-puzzle h2 {
  font-size: 1.5rem;
  color: #5D4E37;
  margin-bottom: 1rem;
  text-align: center;
}

.puzzle-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  background: #E0D5C7;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px #D0C5B7;
}

.puzzle-tile {
  position: absolute;
  border: 2px solid white;
  cursor: pointer;
  transition: left 0.15s ease, top 0.15s ease;
  touch-action: manipulation;
  background-size: cover;
}

.puzzle-tile.empty {
  opacity: 0;
  pointer-events: none;
}

.puzzle-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  margin-top: 1rem;
}

.puzzle-moves {
  font-size: 1.15rem;
  color: #8B7355;
}

.puzzle-shuffle-btn {
  background: #F7C948;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.6rem 1.4rem;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 0 #C9A133;
  transition: transform 0.1s;
  touch-action: manipulation;
}

.puzzle-shuffle-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #C9A133;
}

/* ─── Reward ─── */
#screen-reward {
  background: rgba(0,0,0,0.6);
  z-index: 10;
}

.reward-content {
  background: white;
  border-radius: 24px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 320px;
  animation: rewardPop 0.5s ease-out;
}

@keyframes rewardPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.reward-content h2 {
  font-size: 1.7rem;
  color: #5D4E37;
  margin-bottom: 1rem;
}

.reward-stars {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reward-stars img {
  width: 60px;
  height: 60px;
  animation: starBurst 0.6s ease-out;
}

.reward-stars img:nth-child(2) { animation-delay: 0.15s; }
.reward-stars img:nth-child(3) { animation-delay: 0.3s; }

@keyframes starBurst {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.reward-content p {
  font-size: 1.15rem;
  color: #8B7355;
  margin-bottom: 1.5rem;
}

.reward-tap-hint {
  color: #A09080;
  font-size: 0.95rem;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #5D4E37;
  color: white;
  padding: 0.8rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.4s ease;
  opacity: 0.95;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ─── Sparkle Canvas ─── */
#sparkle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ─── Load Screen ─── */
#screen-load {
  background: linear-gradient(180deg, #E8F5E9 0%, #FFF5E6 100%);
  padding: 1.5rem;
}

#screen-load h2 {
  font-size: 1.7rem;
  color: #5D4E37;
  margin-bottom: 1.5rem;
  text-align: center;
}

.save-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 400px;
  overflow-y: auto;
  flex: 1;
  padding-bottom: 1rem;
}

.save-card {
  background: white;
  border-radius: 20px;
  padding: 1rem 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.15s;
}

.save-card:active {
  transform: scale(0.98);
}

.save-avatar {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
  background: #E8F5E9;
  padding: 0.3rem;
  flex-shrink: 0;
}

.save-info {
  flex: 1;
}

.save-name {
  font-size: 1.2rem;
  color: #5D4E37;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.save-stars {
  font-size: 1rem;
  color: #A09080;
}

.save-delete-btn {
  background: #F5E6E0;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: #C98A62;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: transform 0.1s;
}

.save-delete-btn:active {
  transform: scale(0.9);
}

/* ─── Name Input ─── */
.name-input-wrap {
  width: 100%;
  max-width: 360px;
  margin-bottom: 1rem;
}

.char-name-input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 3px solid #E0D5C7;
  border-radius: 20px;
  font-size: 1.4rem;
  color: #5D4E37;
  background: white;
  outline: none;
  text-align: center;
  font-family: inherit;
  font-weight: 600;
  transition: border-color 0.2s;
}

.char-name-input:focus {
  border-color: #7EC8E3;
  box-shadow: 0 0 0 3px rgba(126, 200, 227, 0.2);
}

.char-name-input::placeholder {
  color: #C4B8A8;
}

/* ─── Mute Button ─── */
.mute-btn {
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  touch-action: manipulation;
  transition: transform 0.1s;
}

.mute-btn:active {
  transform: scale(0.9);
}

/* ─── Locked Adventure ─── */
.adventure-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
  cursor: default;
  pointer-events: none;
}

/* ─── Utilities ─── */
.back-btn {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  touch-action: manipulation;
}

.static-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ─── Exit Confirm ─── */
.exit-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

.exit-confirm-box {
  background: white;
  border-radius: 24px;
  padding: 2rem;
  margin: 1.5rem;
  text-align: center;
  max-width: 300px;
}

.exit-confirm-box p {
  font-size: 1.2rem;
  color: #5D4E37;
  margin-bottom: 0.3rem;
}

.exit-confirm-sub {
  font-size: 0.9rem;
  color: #A09080;
  margin-bottom: 1.5rem;
}

.exit-confirm-btns {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
}

.exit-confirm-yes, .exit-confirm-no {
  border: none;
  border-radius: 16px;
  padding: 0.7rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.exit-confirm-yes {
  background: #E8A87C;
  color: white;
  box-shadow: 0 3px 0 #C98A62;
}

.exit-confirm-no {
  background: #7EC8E3;
  color: white;
  box-shadow: 0 3px 0 #5A9EB8;
}

/* ─── Math Game ─── */
#screen-math-game {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.math-game-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
}

.math-progress {
  font-size: 1rem;
  color: #5D4E37;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.math-equation {
  background: rgba(255,255,255,0.9);
  border-radius: 24px;
  padding: 1.5rem 1rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.math-equation-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.math-num {
  font-size: 3rem;
  font-weight: 800;
  color: #5D4E37;
  min-width: 40px;
  text-align: center;
  line-height: 1;
}

.math-unknown {
  color: #E8A87C;
}

.math-op {
  font-size: 2.2rem;
  font-weight: 700;
  color: #8B7355;
}

.math-fish-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.math-answers {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 380px;
  width: 100%;
}

.math-answer-btn {
  width: 100px;
  height: 100px;
  border: none;
  border-radius: 20px;
  font-size: 2.2rem;
  font-weight: 800;
  color: #5D4E37;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 6px 12px rgba(0,0,0,0.1);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(255,255,255,0.3);
  background-size: cover;
  background-position: center;
}

.math-answer-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.1);
}

.math-answer-btn.correct {
  box-shadow: 0 0 0 4px #8BC34A, 0 4px 0 rgba(0,0,0,0.15);
}

.math-answer-btn.wrong {
  box-shadow: 0 0 0 4px #E8A87C, 0 4px 0 rgba(0,0,0,0.15);
  opacity: 0.6;
}

.math-feedback {
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.math-feedback-text {
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0.5rem 1.5rem;
  border-radius: 16px;
  text-align: center;
}

.math-feedback-text.correct {
  background: rgba(139, 195, 74, 0.9);
  color: white;
}

.math-feedback-text.wrong {
  background: rgba(232, 168, 124, 0.9);
  color: white;
}

.math-retry {
  text-align: center;
  background: rgba(255,255,255,0.95);
  border-radius: 24px;
  padding: 2rem;
  max-width: 320px;
}

.math-retry h2 {
  font-size: 1.7rem;
  color: #5D4E37;
  margin-bottom: 0.8rem;
}

.math-retry p {
  font-size: 1.15rem;
  color: #8B7355;
  margin-bottom: 0.5rem;
}

.math-retry-btn {
  background: #F7C948;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 1rem 2.5rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 #C9A133, 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  margin-top: 1.2rem;
}

.math-retry-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C9A133, 0 3px 6px rgba(0,0,0,0.15);
}

/* ─── Pagination ─── */
.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem 0;
  flex-shrink: 0;
}

.page-btn {
  background: rgba(255,255,255,0.85);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  touch-action: manipulation;
  color: #5D4E37;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.page-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.page-info {
  font-size: 1rem;
  color: #8B7355;
  font-weight: 600;
  min-width: 3rem;
  text-align: center;
}

/* ─── Letter Game ─── */
#screen-letter {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0.5rem;
}

.letter-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 1rem 0.8rem;
}

.letter-round-info {
  text-align: center;
  font-size: 1.4rem;
  color: #8B7355;
  font-weight: 700;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.letter-sentences {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  padding: 0.3rem 0.8rem;
}

.letter-sentence {
  font-size: 1.5rem;
  line-height: 1.7;
  color: #5D4E37;
  opacity: 0.4;
  transition: opacity 0.35s;
}

.letter-sentence.active {
  opacity: 1;
}

.letter-blank {
  display: inline-block;
  min-width: 4rem;
  border-bottom: 4px solid #8BC34A;
  margin: 0 0.3rem;
  text-align: center;
  font-weight: 700;
  color: #5D4E37;
  letter-spacing: 0.15em;
}

.letter-blank.complete {
  border-bottom-color: #5D4E37;
  color: #5D4E37;
}

.letter-buttons {
  flex-shrink: 0;
  margin-top: 0.8rem;
  text-align: center;
}

.letter-word-label {
  font-size: 0.95rem;
  color: #A09080;
  margin-bottom: 0.6rem;
}

.letter-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.8rem;
}

.letter-tile {
  width: 68px;
  height: 68px;
  background: white;
  border: 3px solid #7EC8E3;
  border-radius: 16px;
  font-size: 2rem;
  font-weight: 700;
  color: #5D4E37;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.letter-tile:active {
  transform: scale(0.92);
}

.letter-tile.placed {
  background: #E8F5E9;
  border-color: #8BC34A;
  color: #8BC34A;
  cursor: default;
  pointer-events: none;
  opacity: 0.5;
}

.letter-tile.wrong {
  animation: letterShake 0.35s ease;
  border-color: #E88060;
  background: #FFF0E8;
}

@keyframes letterShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.letter-round-complete {
  text-align: center;
  padding: 2rem;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  margin: auto;
  max-width: 320px;
}

.letter-round-complete p {
  font-size: 1.2rem;
  color: #5D4E37;
  margin-top: 0.5rem;
}

.math-continue-btn {
  background: #8BC34A;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 #6FA33A, 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s;
  touch-action: manipulation;
  width: 100%;
  max-width: 260px;
}

.math-continue-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6FA33A, 0 3px 6px rgba(0,0,0,0.15);
}

.math-continue-btn-secondary {
  background: #E0D5C7 !important;
  box-shadow: 0 4px 0 #C4B8A8, 0 6px 12px rgba(0,0,0,0.15) !important;
  color: #8B7355 !important;
}

.math-continue-btn-secondary:active {
  transform: translateY(4px) !important;
  box-shadow: 0 2px 0 #C4B8A8, 0 3px 6px rgba(0,0,0,0.15) !important;
}

.math-round-stars {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.math-round-stars img {
  width: 48px;
  height: 48px;
}

/* ─── Wall Game ─── */
#screen-wall {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.wall-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 1rem 0.8rem;
}

.wall-round-info {
  text-align: center;
  font-size: 1.2rem;
  color: #5D4E37;
  font-weight: 700;
  margin-bottom: 1rem;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  flex-shrink: 0;
}

.wall-pyramid {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1rem 0;
}

.wall-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.wall-stone {
  width: 76px;
  height: 60px;
  background: linear-gradient(135deg, #C9B89A, #B8A48A);
  border-radius: 10px;
  border: 3px solid #A09080;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.15);
}

.wall-stone.given {
  background: linear-gradient(135deg, #A09080, #8B7355);
  border-color: #7A6550;
  cursor: default;
}

.wall-stone.empty {
  background: linear-gradient(135deg, #D5C8B8, #C4B8A8);
  border-color: #B8A890;
  cursor: pointer;
  color: #5D4E37;
}

.wall-stone.empty.active {
  box-shadow: 0 0 0 4px #7EC8E3, inset 0 -3px 0 rgba(0,0,0,0.15);
  border-color: #7EC8E3;
  transform: scale(1.05);
}

.wall-stone.wrong {
  animation: letterShake 0.5s ease;
  border-color: #E88060 !important;
  box-shadow: 0 0 0 4px #E88060 !important;
}

.wall-stone.correct-flash {
  background: linear-gradient(135deg, #8BC34A, #6FA33A) !important;
  border-color: #5A8A2A !important;
  animation: wallPop 0.3s ease-out;
}

.wall-stone.collapsing {
  animation: wallCollapse 0.4s ease-out forwards;
}

@keyframes wallPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes wallCollapse {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  40% { transform: scale(1.1) rotate(3deg); opacity: 0.8; }
  100% { transform: scale(0) rotate(8deg); opacity: 0; }
}

.wall-round-complete {
  text-align: center;
  padding: 2rem;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  margin: auto;
  max-width: 320px;
}

.wall-round-complete p {
  font-size: 1.2rem;
  color: #5D4E37;
  margin-top: 0.5rem;
}

/* ─── Wall Numpad ─── */
.wall-numpad {
  flex-shrink: 0;
  padding: 0.5rem 0;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  max-width: 300px;
  margin: 0 auto;
}

.numpad-btn {
  height: 56px;
  border: none;
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  background: white;
  color: #5D4E37;
  box-shadow: 0 3px 0 #D0C5B7, 0 3px 6px rgba(0,0,0,0.1);
  transition: transform 0.08s, box-shadow 0.08s;
}

.numpad-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #D0C5B7, 0 2px 4px rgba(0,0,0,0.1);
}

.numpad-del {
  background: #F5E6E0;
  color: #C98A62;
  box-shadow: 0 3px 0 #DCC0B0;
}

.numpad-ok {
  background: #8BC34A;
  color: white;
  box-shadow: 0 3px 0 #6FA33A;
  font-size: 1.8rem;
}

/* ─── Clock Game ─── */
#screen-clock {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 1rem 0.8rem;
}

.clock-info {
  text-align: center;
  font-size: 1.2rem;
  color: #5D4E37;
  font-weight: 700;
  margin-bottom: 0.8rem;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  flex-shrink: 0;
}

.clock-watch-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.5rem 0;
}

.clock-canvas {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background: white;
}

.clock-answers {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 320px;
  padding: 0.5rem 0 1rem;
}

.clock-answer-btn {
  background: white;
  border: 3px solid #C4B8A8;
  border-radius: 16px;
  padding: 0.9rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #5D4E37;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
  box-shadow: 0 3px 0 #C4B8A8, 0 3px 6px rgba(0,0,0,0.08);
}

.clock-answer-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #C4B8A8, 0 2px 4px rgba(0,0,0,0.08);
}

.clock-answer-btn.correct {
  border-color: #8BC34A;
  background: #E8F5E9;
  box-shadow: 0 3px 0 #6FA33A;
}

.clock-answer-btn.wrong {
  border-color: #E88060;
  background: #FFF0E8;
  box-shadow: 0 3px 0 #C98A62;
  animation: letterShake 0.4s ease;
}

.clock-round-complete {
  text-align: center;
  padding: 2rem;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  margin: auto;
  max-width: 320px;
}

.clock-round-complete p {
  font-size: 1.2rem;
  color: #5D4E37;
  margin-top: 0.5rem;
}

/* ─── Nut Game ─── */
#screen-nut {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.nut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 1rem 0.8rem;
}

.nut-info {
  text-align: center;
  font-size: 1.2rem;
  color: #5D4E37;
  font-weight: 700;
  margin-bottom: 0.8rem;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  flex-shrink: 0;
}

.nut-sequence {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 0.5rem;
}

.nut-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.nut-slot {
  width: 70px;
  height: 70px;
  background: white;
  border-radius: 16px;
  border: 3px solid #C4B8A8;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 1.5rem;
  font-weight: 700;
  color: #5D4E37;
}

.nut-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.3rem;
}

.nut-slot-empty {
  background: #FFF5E6;
  border-color: #E8A87C;
  border-style: dashed;
  font-size: 2rem;
  color: #E8A87C;
}

.nut-slot-correct {
  border-color: #8BC34A;
  background: #E8F5E9;
  animation: nutPop 0.3s ease-out;
}

@keyframes nutPop {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.nut-hint {
  font-size: 1.1rem;
  color: #5D4E37;
  background: rgba(255,255,255,0.85);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  margin-bottom: 0.8rem;
  flex-shrink: 0;
}

.nut-choices {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  padding: 0.5rem 0;
}

.nut-choice-btn {
  width: 100%;
  aspect-ratio: 1;
  background: white;
  border: 3px solid #C4B8A8;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  box-shadow: 0 3px 0 #C4B8A8, 0 3px 6px rgba(0,0,0,0.1);
  transition: transform 0.08s, box-shadow 0.08s;
  touch-action: manipulation;
}

.nut-choice-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #C4B8A8, 0 2px 4px rgba(0,0,0,0.1);
}

.nut-choice-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nut-choice-btn.correct {
  border-color: #8BC34A;
  box-shadow: 0 3px 0 #6FA33A;
  background: #E8F5E9;
}

.nut-choice-btn.wrong {
  border-color: #E88060;
  box-shadow: 0 3px 0 #C98A62;
  background: #FFF0E8;
  animation: letterShake 0.35s ease;
}

.nut-feedback {
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.nut-feedback.correct {
  color: #8BC34A;
}

.nut-feedback.wrong {
  color: #E88060;
}

.nut-round-complete {
  text-align: center;
  padding: 2rem;
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  margin: auto;
  max-width: 320px;
}

.nut-round-complete p {
  font-size: 1.2rem;
  color: #5D4E37;
  margin-top: 0.5rem;
}

/* ─── Fruit Game ─── */
#screen-fruit {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.fruit-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  height: 100%;
  padding: 1rem 0.5rem;
}

.fruit-header {
  text-align: center;
  font-size: 1.2rem;
  color: #5D4E37;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.85);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  flex-shrink: 0;
}

.fruit-question {
  background: rgba(255,255,255,0.92);
  border-radius: 16px;
  padding: 0.5rem 1.2rem;
  margin-bottom: 0.3rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #5D4E37;
  text-align: center;
  flex-shrink: 0;
  max-width: 380px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.fruit-trees {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex: 1;
  width: 100%;
  padding: 0.3rem 0;
}

.fruit-tree-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 60%;
  max-width: 260px;
}

.fruit-tree-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fruit-tree-wrap img.tree-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fruit-apple {
  position: absolute;
  width: 16%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
}

.fruit-tree-label {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: #5D4E37;
  margin-top: 0.2rem;
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 0.1rem 0.8rem;
  flex-shrink: 0;
}

.fruit-equation {
  background: rgba(255,255,255,0.95);
  border-radius: 24px;
  padding: 1rem 1.5rem;
  margin-bottom: 0.8rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  text-align: center;
  flex-shrink: 0;
}

.fruit-equation-text {
  font-size: 2.2rem;
  font-weight: 800;
  color: #5D4E37;
  letter-spacing: 0.05em;
}

.fruit-equation-text .fruit-num {
  font-size: 2.5rem;
}

.fruit-equation-text .fruit-op {
  color: #8B7355;
  margin: 0 0.2rem;
}

.fruit-equation-text .fruit-q {
  color: #E8A87C;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: #FFF5E6;
  border: 3px dashed #E8A87C;
  border-radius: 12px;
  margin: 0 0.1rem;
  vertical-align: middle;
  font-size: 2rem;
}

.fruit-answers {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.3rem 0;
  width: 100%;
  max-width: 380px;
}

.fruit-answer-btn {
  width: 90px;
  height: 90px;
  border: none;
  border-radius: 20px;
  font-size: 2rem;
  font-weight: 800;
  color: #5D4E37;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 6px 12px rgba(0,0,0,0.1);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(255,255,255,0.3);
  background: #FFF8E1;
}

.fruit-answer-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.1);
}

.fruit-sign-btn {
  font-size: 2.8rem;
  background: #E8F5E9;
}

.fruit-answer-btn.correct {
  box-shadow: 0 0 0 4px #8BC34A, 0 4px 0 rgba(0,0,0,0.15);
}

.fruit-answer-btn.wrong {
  box-shadow: 0 0 0 4px #E8A87C, 0 4px 0 rgba(0,0,0,0.15);
  opacity: 0.6;
}

.fruit-feedback {
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fruit-feedback-text {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.4rem 1.2rem;
  border-radius: 16px;
}

.fruit-feedback-text.correct {
  background: rgba(139, 195, 74, 0.9);
  color: white;
}

.fruit-feedback-text.wrong {
  background: rgba(232, 168, 124, 0.9);
  color: white;
}

.fruit-retry {
  text-align: center;
  background: rgba(255,255,255,0.95);
  border-radius: 24px;
  padding: 2rem;
  max-width: 320px;
  margin: auto;
}

.fruit-retry h2 {
  font-size: 1.7rem;
  color: #5D4E37;
  margin-bottom: 0.8rem;
}

.fruit-retry p {
  font-size: 1.15rem;
  color: #8B7355;
  margin-bottom: 0.5rem;
}

.fruit-retry-btn {
  background: #F7C948;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 1rem 2.5rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 0 #C9A133, 0 6px 12px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  margin-top: 1.2rem;
}

.fruit-retry-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C9A133, 0 3px 6px rgba(0,0,0,0.15);
}

/* ─── Fruit Guide ─── */
.guide-fruit-rows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem;
  background: rgba(255,255,255,0.6);
  border-radius: 16px;
  margin-bottom: 0.8rem;
}

.guide-fruit-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.guide-fruit-tree {
  font-size: 2rem;
}

.guide-fruit-apple {
  font-size: 1.5rem;
  letter-spacing: 0.1em;
}

.guide-fruit-op {
  font-size: 1.3rem;
  font-weight: 700;
  color: #8B7355;
}

.guide-fruit-eq {
  font-size: 1.4rem;
  font-weight: 700;
  color: #5D4E37;
  background: rgba(255,255,255,0.7);
  padding: 0.3rem 1rem;
  border-radius: 12px;
  margin-top: 0.3rem;
}


