:root {
  --bg-page: #f4f7ff;
  --ink: #1b2845;
  --ink-soft: #4b5d7a;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --shadow: 0 10px 28px rgba(24, 42, 82, 0.14);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #e7f0ff 0%, #fff6e9 100%);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  color: inherit;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Top Bar */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-strong);
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 32px;
  line-height: 1;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.15;
}

.brand-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lantern-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff3c4;
  border: 2px solid #ffd166;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 1rem;
}

.script-toggle {
  display: inline-flex;
  background: #eef3fb;
  padding: 4px;
  border-radius: 999px;
  gap: 2px;
}

.pill-btn {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.pill-btn.active {
  background: #3a86ff;
  color: #ffffff;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: #eef3fb;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}

.icon-btn.muted {
  opacity: 0.48;
  background: #e2e6ef;
}

.icon-btn:active, .action-pill:active {
  transform: scale(0.95);
}

.action-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #eef3fb;
  font-weight: 800;
  font-size: 0.9rem;
  transition: background 0.15s ease, transform 0.12s ease;
}

@media (hover: hover) {
  .action-pill:hover {
    background: #dfeafc;
  }
}

/* Main Stage */
.stage-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sky-stage {
  position: relative;
  width: 100%;
  min-height: 360px;
  height: clamp(360px, 54vh, 520px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #8ecae6;
  transition: height 0.2s ease, min-height 0.2s ease;
}

.sky-stage.compact-hero {
  min-height: 205px;
  height: clamp(210px, 31vh, 270px);
}

#sky-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.below-deck {
  width: 100%;
}

/* Home Overlay */
.overlay-view {
  position: absolute;
  inset: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.home-banner {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  max-width: 440px;
  box-shadow: 0 8px 22px rgba(24, 42, 82, 0.12);
}

.home-banner h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 900;
}

.home-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.home-banner .dojo-cta {
  margin-top: 10px;
}

.dojo-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb703, #fb8500);
  color: #361d00;
  font-weight: 900;
  font-size: 0.96rem;
  box-shadow: 0 4px 0 #c96a00;
  transition: transform 0.12s ease;
}

.dojo-cta:active {
  transform: translateY(2px);
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.world-card {
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(24, 42, 82, 0.14);
  border: 3px solid transparent;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

@media (hover: hover) {
  .world-card:hover {
    transform: translateY(-3px);
    border-color: #3a86ff;
  }
}

.world-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.5rem;
}

.world-stars {
  font-size: 1rem;
  letter-spacing: 2px;
}

.world-title {
  font-weight: 900;
  font-size: 1.05rem;
}

.world-desc {
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.world-tones-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.mini-tone-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Gameplay HUD */
.hud-view {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.world-pill, .streak-pill {
  pointer-events: auto;
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.92rem;
  box-shadow: 0 4px 14px rgba(20, 35, 70, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.streak-pill {
  background: #fff0d6;
  color: #b54708;
}

.progress-lanterns {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(20, 35, 70, 0.14);
}

.prog-pip {
  font-size: 1rem;
  opacity: 0.3;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.prog-pip.current {
  opacity: 0.85;
  transform: scale(1.22);
}

.prog-pip.done {
  opacity: 1;
}

.hud-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.word-lantern-card {
  pointer-events: auto;
  width: 196px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 12px 12px 10px;
  box-shadow: 0 12px 26px rgba(20, 35, 70, 0.18);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 3px solid #ffe08a;
}

.card-emoji {
  font-size: 2.3rem;
  line-height: 1.1;
}

.card-hanzi {
  font-size: 3.1rem;
  font-weight: 900;
  line-height: 1.05;
}

.card-pinyin {
  font-size: 1.35rem;
  font-weight: 800;
  color: #3a86ff;
}

.card-meaning {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.audio-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
}

.audio-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  background: #eef3fb;
  font-weight: 800;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.1s ease, background 0.12s ease;
}

.audio-btn.primary {
  background: #3a86ff;
  color: #ffffff;
}

.audio-btn:active {
  transform: scale(0.95);
}

.feedback-pill {
  min-height: 24px;
  margin-top: 4px;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

.feedback-pill.good {
  background: #d8f8ee;
  color: #066a4f;
}

.feedback-pill.retry {
  background: #fff1d6;
  color: #9c4a00;
}

/* Tone Dock */
.tone-dock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.tone-btn {
  min-height: 76px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16), var(--shadow);
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.15s ease;
  text-align: left;
}

@media (hover: hover) {
  .tone-btn:hover:not(:disabled) {
    transform: translateY(-2px);
  }
}

.tone-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.tone-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.tone-btn-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tone-btn-title {
  font-size: 1.05rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tone-btn-sub {
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0.88;
}

.tone-svg {
  width: 64px;
  height: 44px;
  flex-shrink: 0;
}

/* Dojo View */
.dojo-view {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  pointer-events: none;
}

.dojo-header {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(24, 42, 82, 0.12);
}

.dojo-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
}

.dojo-header p {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.dojo-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.family-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.family-tab {
  min-height: 44px;
  padding: 8px 15px;
  border-radius: 999px;
  background: #eef3fb;
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.family-tab.active {
  background: #3a86ff;
  color: #ffffff;
}

.dojo-play-all-btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb703, #fb8500);
  color: #361d00;
  font-weight: 900;
  font-size: 0.92rem;
  box-shadow: 0 3px 0 #c96a00;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.dojo-play-all-btn:active {
  transform: translateY(2px);
}

.dojo-cards {
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.dojo-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 3px solid transparent;
  box-shadow: 0 8px 20px rgba(24, 42, 82, 0.14);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .dojo-card:hover {
    transform: translateY(-3px);
  }
}

.dojo-card.playing {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 12px 28px rgba(58, 134, 255, 0.34);
}

.dojo-card-hanzi {
  font-size: 2.3rem;
  font-weight: 900;
  line-height: 1.05;
}

.dojo-card-pinyin {
  font-size: 1.15rem;
  font-weight: 900;
}

.dojo-card-en {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Complete Overlay */
.complete-view {
  position: absolute;
  inset: 0;
  background: rgba(15, 26, 52, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.complete-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 560px;
  width: 100%;
  max-height: 92%;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 18px 40px rgba(10, 20, 45, 0.3);
}

.complete-stars {
  font-size: 2.2rem;
  letter-spacing: 6px;
}

.complete-card h2 {
  margin: 4px 0 6px;
  font-size: 1.5rem;
  font-weight: 900;
}

.complete-stats {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

.complete-unlocks {
  background: #fff5d6;
  border: 2px solid #ffd166;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

.complete-recap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.recap-chip {
  background: #f3f6fc;
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 800;
}

@media (hover: hover) {
  .recap-chip:hover {
    background: #e4edfc;
  }
}

.complete-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-cta, .secondary-cta {
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-cta {
  background: #3a86ff;
  color: #ffffff;
}

.secondary-cta {
  background: #eef3fb;
  color: var(--ink);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 52, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 580px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 44px rgba(10, 20, 45, 0.28);
}

.modal-card.modal-wide {
  max-width: 780px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 900;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #eef3fb;
  font-weight: 900;
  font-size: 1rem;
}

.modal-sub {
  margin: 6px 0 12px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
}

.modal-section-title {
  margin: 14px 0 8px;
  font-size: 1rem;
  font-weight: 900;
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

.gear-btn {
  border-radius: var(--radius-md);
  padding: 10px;
  background: #f5f7fc;
  border: 3px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 0.88rem;
}

.gear-btn.selected {
  border-color: #3a86ff;
  background: #eaf1ff;
}

.gear-btn.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.12);
}

.wordbook-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wordbook-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  margin-bottom: 8px;
}

.wordbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.wb-card {
  background: #f5f7fc;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 2px solid transparent;
}

.wb-card.mastered {
  border-color: #06d6a0;
  background: #ebfbf6;
}

.wb-hanzi {
  font-size: 1.5rem;
  font-weight: 900;
}

.wb-pinyin {
  font-size: 0.92rem;
  font-weight: 800;
  color: #3a86ff;
}

.wb-en {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 700;
}

/* Front Page: Interactive Ocean Archipelago Map */
.archipelago-stage {
  position: relative;
  width: 100%;
  min-height: 530px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 16px 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(180deg, #48cae4 0%, #00b4d8 48%, #0096c7 100%);
  border: 3px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.ocean-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ocean-svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes boatBob {
  0%, 100% { transform: translate(472px, 272px) rotate(-2deg); }
  50% { transform: translate(472px, 265px) rotate(2.5deg); }
}

@keyframes waveShift {
  0%, 100% { transform: translateX(0px); }
  50% { transform: translateX(10px); }
}

@keyframes islandFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.map-sailboat {
  animation: boatBob 4.2s ease-in-out infinite;
}

.ocean-waves {
  animation: waveShift 6s ease-in-out infinite;
}

.map-header-row {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.map-title-pill {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: 0 8px 20px rgba(0, 48, 88, 0.16);
}

.map-title-pill h2 {
  margin: 0 0 2px;
  font-size: 1.25rem;
  font-weight: 900;
}

.map-title-pill p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.map-treasure-btn {
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe066, #ffb703);
  color: #422500;
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid #fff3b0;
  box-shadow: 0 4px 0 #c97a00, 0 8px 18px rgba(0, 48, 88, 0.18);
  transition: transform 0.12s ease;
}

.map-treasure-btn:active {
  transform: translateY(2px);
}

.island-grid {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: center;
  justify-items: center;
  gap: 18px 34px;
  padding: 4px 6px;
}

.island-node {
  background: transparent;
  padding: 4px 8px;
  width: 100%;
  max-width: 310px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: transform 0.16s ease;
  animation: islandFloat 4.8s ease-in-out infinite;
}

.island-node:nth-child(2) { animation-delay: 0.8s; }
.island-node:nth-child(3) { animation-delay: 1.6s; }
.island-node:nth-child(4) { animation-delay: 2.4s; }

.island-node:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .island-node:hover {
    transform: translateY(-6px) scale(1.03);
  }
}

.island-art {
  width: 100%;
  max-width: 225px;
  filter: drop-shadow(0 12px 16px rgba(0, 48, 88, 0.28));
}

.island-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.island-ribbon {
  width: 100%;
  background: rgba(255, 253, 245, 0.96);
  border: 2.5px solid #ffd166;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: 0 8px 18px rgba(0, 48, 88, 0.22);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.island-ribbon-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.island-title {
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--ink);
  text-align: left;
}

.island-badge {
  background: #eaf1ff;
  color: #1e4ed8;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.island-desc {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 700;
  text-align: left;
}

/* Balloon Pop Island */
.balloon-view {
  position: absolute;
  inset: 0;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  overflow-y: auto;
}

.balloon-prompt-bar {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
}

.balloon-audio-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.balloon-audio-group .audio-btn {
  flex: initial;
  padding: 0 14px;
}

.balloon-arena {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 8px 4px;
}

@keyframes balloonBob {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-9px); }
}

.balloon-btn {
  width: 100%;
  max-width: 190px;
  min-height: 175px;
  border-radius: 50% 50% 46% 46%;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  box-shadow: inset -8px -12px 0 rgba(0, 0, 0, 0.12), 0 12px 24px rgba(24, 42, 82, 0.2);
  animation: balloonBob 3.2s ease-in-out infinite;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.balloon-btn:nth-child(2) { animation-delay: 0.5s; }
.balloon-btn:nth-child(3) { animation-delay: 1.1s; }
.balloon-btn:nth-child(4) { animation-delay: 1.7s; }

.balloon-btn::after {
  content: "";
  position: absolute;
  bottom: -24px;
  left: 50%;
  width: 2px;
  height: 24px;
  background: rgba(60, 75, 110, 0.5);
}

@media (hover: hover) {
  .balloon-btn:hover:not(:disabled) {
    transform: scale(1.06);
  }
}

.balloon-btn.popped-wrong {
  opacity: 0.25;
  transform: scale(0.76);
  animation: none;
  cursor: default;
}

.balloon-btn.popped-right {
  transform: scale(1.14);
}

.balloon-emoji {
  font-size: 2.5rem;
  line-height: 1.05;
}

.balloon-hanzi {
  font-size: 1.95rem;
  font-weight: 900;
  line-height: 1.05;
}

.balloon-sub {
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0.92;
}

/* Magic Brush Island (Standalone Calligraphy Studio) */
.brush-view.studio-stage {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, #fffdf6 0%, #f7efe0 100%);
  border: 3px solid #ead8b8;
  box-shadow: var(--shadow);
}

.brush-char-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.brush-char-pill {
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-weight: 900;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(24, 42, 82, 0.12);
  border: 2px solid transparent;
}

.brush-char-pill.active {
  background: #3a86ff;
  color: #ffffff;
}

.brush-char-pill.traced {
  border-color: #06d6a0;
}

.brush-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 14px;
  align-items: center;
}

.brush-story-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 3px solid #ffe08a;
}

.morph-stage {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 6px;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  background: #fff9ec;
  border: 2px solid #ffe08a;
  box-shadow: 0 4px 12px rgba(24, 42, 82, 0.1);
}

.morph-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.morph-picto svg {
  width: 100%;
  height: 100%;
}

.morph-char {
  font-size: 3.4rem;
  font-weight: 900;
  color: var(--ink);
  background: rgba(255, 253, 245, 0.92);
  opacity: 0;
  transform: scale(0.76);
}

.morph-stage.show-char .morph-picto {
  opacity: 0.16;
  transform: scale(1.08);
}

.morph-stage.show-char .morph-char {
  opacity: 1;
  transform: scale(1);
}

.review-pill {
  pointer-events: auto;
  background: #eaf1ff;
  color: #1e4ed8;
  border: 2px solid #93c5fd;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.84rem;
}

.brush-story-text {
  margin: 6px 0 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.brush-edb-note {
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: #eaf4ff;
  border: 1.5px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.brush-grid-choices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.grid-choice-btn {
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  min-height: 40px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
}

.grid-choice-btn.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25);
}

.brush-pad-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: center;
}

.brush-pad-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.brush-canvas-wrap {
  width: min(310px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(24, 42, 82, 0.18);
  background: #fffdf5;
}

#brush-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Sticker Book Modal */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.sticker-card {
  background: #f5f7fc;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  border: 2px solid #ffd166;
}

.sticker-card.locked {
  opacity: 0.55;
  border-color: transparent;
  cursor: default;
}

.sticker-emoji {
  font-size: 2.1rem;
  line-height: 1.1;
}

.sticker-title {
  font-size: 0.9rem;
  font-weight: 900;
}

.sticker-sub {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 700;
}

/* Panda's Kitchen Island (Standalone Café Stage) */
.kitchen-view.cafe-stage {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  border: 3px solid #f7d9b0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 102, 102, 0.92) 0 28px,
      rgba(255, 255, 255, 0.98) 28px 56px
    ) top left / 100% 12px no-repeat,
    linear-gradient(180deg, #fff7eb 0%, #ffeed6 100%);
}

.kitchen-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(24, 42, 82, 0.1);
}

.kitchen-audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kitchen-audio-controls .audio-btn {
  flex: initial;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.kitchen-counter-area {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 10px;
}

.kitchen-customer-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid #ffe08a;
  box-shadow: 0 6px 16px rgba(24, 42, 82, 0.1);
}

.kitchen-avatars {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kitchen-panda-wrap {
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes pandaBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

@keyframes pawWave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-16deg); }
}

.chef-panda-svg.mood-idle .panda-paw {
  transform-origin: 84px 86px;
  animation: pawWave 2.4s ease-in-out infinite;
}

.chef-panda-svg.mood-happy {
  animation: pandaBounce 0.48s ease-in-out infinite;
}

.chef-panda-svg.mood-thinking {
  transform: rotate(-4deg);
  transition: transform 0.2s ease;
}

.kitchen-customer-emoji {
  font-size: 2.3rem;
  line-height: 1.05;
  background: #fff4d6;
  border-radius: 50%;
  padding: 6px;
  border: 2px solid #ffd166;
}

.kitchen-bubble {
  flex: 1;
  min-width: 0;
}

.kitchen-customer-name {
  font-size: 0.8rem;
  font-weight: 900;
  color: #b54708;
}

.kitchen-order-hanzi {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.2;
}

.kitchen-order-pinyin {
  font-size: 0.95rem;
  font-weight: 800;
  color: #3a86ff;
}

.kitchen-order-en {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.kitchen-tray-bar {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid #b9e4c9;
  box-shadow: 0 6px 16px rgba(24, 42, 82, 0.1);
}

.kitchen-tray-items {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: #f5f9f6;
  border-radius: 12px;
  padding: 6px 10px;
}

.tray-empty-hint {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.tray-chip {
  min-height: 44px;
  background: #ffffff;
  border: 2px solid #06d6a0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 1.15rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kitchen-tray-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.kitchen-tray-actions .audio-btn {
  flex: initial;
  min-height: 44px;
  padding: 0 14px;
}

.kitchen-serve-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: #06d6a0;
  color: #023b2b;
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 0 #049c74;
}

.kitchen-serve-btn:active {
  transform: translateY(2px);
}

.kitchen-food-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(95px, 1fr));
  gap: 8px;
}

.kitchen-food-btn {
  min-height: 92px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(24, 42, 82, 0.1);
  border: 2px solid transparent;
  transition: transform 0.1s ease, border-color 0.12s ease;
}

@media (hover: hover) {
  .kitchen-food-btn:hover {
    transform: translateY(-2px);
    border-color: #ffb703;
  }
}

.kitchen-food-btn:active {
  transform: scale(0.95);
}

.kitchen-food-emoji {
  font-size: 1.75rem;
  line-height: 1.05;
}

.kitchen-food-hanzi {
  font-size: 1rem;
  font-weight: 900;
}

.kitchen-food-pinyin {
  font-size: 0.74rem;
  font-weight: 800;
  color: #3a86ff;
}

/* Tablet Landscape Short-Height (e.g., iPad 1024x768) */
@media (min-width: 768px) and (max-height: 820px) {
  .app-shell {
    padding: 8px 14px 12px;
    gap: 8px;
  }

  .top-bar {
    padding: 8px 14px;
  }

  .sky-stage {
    height: clamp(320px, 49vh, 420px);
    min-height: 310px;
  }

  .sky-stage.compact-hero {
    height: clamp(185px, 28vh, 230px);
    min-height: 180px;
  }

  .tone-btn {
    min-height: 68px;
  }

  .archipelago-stage {
    min-height: 460px;
    padding: 12px 16px 16px;
    gap: 8px;
  }

  .island-art {
    max-width: 175px;
  }
}

/* Tablet Portrait & Medium Screens */
@media (max-width: 900px) {
  .island-grid {
    gap: 14px 16px;
  }
  .kitchen-counter-area {
    grid-template-columns: 1fr;
  }

  .kitchen-food-grid {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }

  .tone-dock {
    grid-template-columns: repeat(2, 1fr);
  }

  .brush-canvas-wrap {
    width: min(360px, 100%);
  }
}

@media (max-width: 780px) {
  .brush-workspace {
    grid-template-columns: 1fr;
  }

  .sky-stage {
    height: 390px;
    min-height: 340px;
  }

  .sky-stage.compact-hero {
    height: 205px;
    min-height: 190px;
  }
}

@media (max-width: 680px) {
  .sky-stage {
    height: 380px;
    min-height: 330px;
  }

  .sky-stage.compact-hero {
    height: 195px;
    min-height: 185px;
  }

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

  .word-lantern-card {
    width: 178px;
    padding: 10px;
  }

  .card-hanzi {
    font-size: 2.4rem;
  }
}

@media (max-width: 560px) {
  .island-grid {
    grid-template-columns: 1fr;
  }

  .kitchen-food-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Dev Audio Inspector Modal */
.dev-pill {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

.dev-audio-card {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.dev-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dev-search-input {
  flex: 1 1 200px;
  min-width: 160px;
  min-height: 40px;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  background: #ffffff;
}

.dev-search-input:focus {
  outline: none;
  border-color: #0284c7;
}

.dev-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dev-audio-status {
  margin: 0;
  font-size: 0.82rem;
}

.dev-audio-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.dev-audio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.dev-audio-row.playing {
  background: #e0f2fe;
  border-color: #0284c7;
}

.dev-play-btn {
  border: none;
  background: #0284c7;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dev-row-main {
  flex: 1 1 190px;
  min-width: 150px;
}

.dev-row-text {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--ink);
}

.dev-row-meta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.dev-path-chip {
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  padding: 5px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.dev-path-chip:hover {
  border-color: #0284c7;
  color: #0369a1;
}

.dev-row-badge {
  min-width: 52px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}

.dev-row-badge.ok {
  background: #dcfce7;
  color: #166534;
}

.dev-row-badge.err {
  background: #fee2e2;
  color: #b91c1c;
}
