/* ==========================================================================
   Word Moon Quiz · Cosmic Starry Design System
   Inspired by kid-friendly starry moon vocabulary adventures (landscape iPad + Desktop)
   ========================================================================== */

:root {
  --bg-deep: #1b1e49;
  --bg-mid: #24285e;
  --bg-glow: #30357a;
  --pill-bg: #131538;
  --mint: #73e8d2;
  --mint-strong: #4ad8ba;
  --mint-dark: #2ba98f;
  --moon-base: #9bbbd9;
  --moon-crater: #87a7c6;
  --moon-ring: rgba(255, 255, 255, 0.14);
  --ufo-orange: #ffb33a;
  --ufo-yellow: #ffe26b;
  --coral: #ff7f7f;
  --pink: #ff9ec7;
  --glass-bg: rgba(26, 30, 74, 0.72);
  --glass-border: rgba(162, 185, 240, 0.22);
  --card-bg: rgba(34, 39, 92, 0.78);
  --text-main: #f4f7ff;
  --text-sub: #b4bee3;
  --text-muted: #7f8ab8;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 18px 44px rgba(8, 10, 32, 0.42);
  --font-rounded: "SF Pro Rounded", "Nunito", "Quicksand", "PingFang SC", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-rounded);
  color: var(--text-main);
  background: radial-gradient(120% 100% at 75% 15%, #2b3175 0%, #202354 52%, #181a42 100%);
  overflow-x: hidden;
  user-select: none;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

/* ==========================================================================
   Cosmic Starry Canvas Background
   ========================================================================== */
.cosmic-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Giant soft moon planet on the left, matching screenshot */
.giant-planet {
  position: absolute;
  left: -240px;
  top: 52%;
  transform: translateY(-50%);
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle at 65% 45%, rgba(114, 126, 198, 0.22), rgba(55, 62, 125, 0.08) 70%, transparent 100%);
  box-shadow: inset -28px -18px 60px rgba(17, 19, 52, 0.35);
}

.giant-planet::before,
.giant-planet::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(15, 18, 52, 0.2);
}

.giant-planet::before {
  width: 72px;
  height: 72px;
  right: 112px;
  top: 138px;
}

.giant-planet::after {
  width: 44px;
  height: 44px;
  right: 78px;
  bottom: 148px;
}

.stars-layer {
  position: absolute;
  inset: 0;
}

.star-sparkle {
  position: absolute;
  animation: twinkle var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.75;
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.85); opacity: 0.38; }
  50% { transform: scale(1.18); opacity: 0.95; }
}

/* ==========================================================================
   App Container & Views
   ========================================================================== */
.app-root {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
}

.view.active {
  display: flex;
}

/* ==========================================================================
   VIEW 1: HUB / PARENT DECK MANAGER
   ========================================================================== */
.hub-shell {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

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

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(145deg, #3c4597, #222761);
  border: 2px solid rgba(115, 232, 210, 0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 26px rgba(10, 12, 36, 0.45);
}

.brand-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.brand-title span {
  color: var(--mint);
}

.brand-subtitle {
  margin: 3px 0 0;
  font-size: 0.88rem;
  color: var(--text-sub);
}

.hub-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #6de6cf 0%, #42c9ad 100%);
  color: #102432;
  box-shadow: 0 8px 22px rgba(74, 216, 186, 0.34);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(74, 216, 186, 0.46);
}

.btn-accent {
  background: linear-gradient(135deg, #ffd66b 0%, #ffaa40 100%);
  color: #2b1a06;
  box-shadow: 0 8px 22px rgba(255, 179, 58, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(186, 203, 255, 0.22);
  color: #eef2ff;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(115, 232, 210, 0.45);
}

.btn-danger-ghost {
  background: rgba(255, 118, 118, 0.12);
  border-color: rgba(255, 118, 118, 0.28);
  color: #ff9c9c;
}

.btn-danger-ghost:hover {
  background: rgba(255, 118, 118, 0.22);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

/* Quick Hero Strip */
.hero-banner {
  background: linear-gradient(125deg, rgba(44, 51, 120, 0.86), rgba(27, 31, 78, 0.9));
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(115, 232, 210, 0.16), transparent 68%);
  pointer-events: none;
}

.hero-text h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 800;
}

.hero-text p {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 650px;
}

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

/* Quick Quiz Preferences Pill Bar */
.prefs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(20, 23, 58, 0.65);
  border: 1px solid rgba(162, 185, 240, 0.16);
}

.prefs-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-sub);
  cursor: pointer;
}

.toggle-chip input[type="checkbox"] {
  accent-color: var(--mint-strong);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.segmented {
  display: inline-flex;
  background: rgba(13, 15, 42, 0.7);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid rgba(162, 185, 240, 0.16);
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented button.active {
  background: var(--mint-strong);
  color: #102432;
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mint);
  background: rgba(115, 232, 210, 0.14);
  padding: 2px 10px;
  border-radius: 999px;
}

/* Deck Grid */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.deck-card {
  background: var(--card-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(10, 12, 36, 0.32);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.deck-card:hover {
  transform: translateY(-3px);
  border-color: rgba(115, 232, 210, 0.48);
  box-shadow: 0 16px 38px rgba(10, 12, 36, 0.48);
}

.deck-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.deck-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.deck-emoji {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: rgba(155, 187, 217, 0.2);
  border: 1.5px solid rgba(155, 187, 217, 0.35);
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.deck-name {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-desc {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.4;
}

/* Preview strip of circular moon stickers */
.deck-preview-moons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-moon {
  width: 62px;
  height: 46px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--moon-base);
  border: 2px solid rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(10, 12, 36, 0.28);
}

.mini-moon.circle-mode {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.mini-moon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mini-moon-more {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sub);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.deck-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-sub);
}

.mastery-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(115, 232, 210, 0.14);
  color: var(--mint);
  font-weight: 700;
}

.wrong-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 168, 92, 0.16);
  color: #ffc37d;
  font-weight: 700;
}

.deck-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.deck-card-actions .btn-primary {
  flex: 1;
}

/* Recent History List */
.history-strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background: rgba(26, 30, 74, 0.62);
  border: 1px solid rgba(162, 185, 240, 0.16);
}

.history-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-score-badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  background: rgba(115, 232, 210, 0.16);
  color: var(--mint);
}

.history-meta {
  font-size: 0.84rem;
  color: var(--text-sub);
}

/* ==========================================================================
   VIEW 2: STARRY MOON QUIZ ARENA (Faithful to reference screenshot!)
   ========================================================================== */
.quiz-view {
  min-height: 100dvh;
  padding: 22px 32px 26px;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 5;
}

.quiz-back-btn {
  justify-self: start;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}

.quiz-back-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.06);
}

/* Signature Frog + Mint Word Pill from Screenshot */
.word-pill {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 8px 30px 8px 9px;
  min-height: 68px;
  border-radius: 999px;
  background: linear-gradient(180deg, #171a42 0%, #121436 100%);
  border: 2px solid rgba(110, 128, 212, 0.28);
  box-shadow: 0 12px 30px rgba(8, 10, 32, 0.5), inset 0 2px 8px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.word-pill:hover {
  transform: scale(1.03);
  border-color: rgba(115, 232, 210, 0.55);
}

.word-pill:active {
  transform: scale(0.97);
}

.word-pill.speaking {
  border-color: var(--mint);
  box-shadow: 0 0 0 6px rgba(115, 232, 210, 0.18), 0 12px 30px rgba(8, 10, 32, 0.5);
}

.frog-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7489d8, #4d60ad);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.word-pill.speaking .frog-avatar {
  animation: frogBounce 0.5s ease-in-out infinite;
}

@keyframes frogBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1) translateY(-2px); }
}

.word-pill-text {
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  font-weight: 800;
  color: var(--mint);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.word-pill-audio-icon {
  display: inline-flex;
  align-items: center;
  color: rgba(115, 232, 210, 0.72);
  margin-left: 2px;
}

.quiz-top-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-chip-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(186, 203, 255, 0.22);
  background: rgba(20, 23, 58, 0.72);
  color: var(--text-sub);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
}

.quiz-chip-btn:hover,
.quiz-chip-btn.active {
  color: var(--mint);
  border-color: rgba(115, 232, 210, 0.5);
  background: rgba(115, 232, 210, 0.12);
}

/* Center Arena: Circular Moon Option Discs (3-choice or 4-choice) */
.quiz-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 0;
  position: relative;
  z-index: 4;
}

.moon-options-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.2vw, 40px);
  width: 100%;
  max-width: 1120px;
  flex-wrap: nowrap;
}

.moon-options-grid.four-choices {
  gap: clamp(14px, 2.2vw, 28px);
}

.moon-card {
  position: relative;
  width: clamp(180px, 24vw, 276px);
  height: clamp(180px, 24vw, 276px);
  border-radius: 50%;
  border: 5px solid transparent;
  padding: 0;
  background: var(--moon-base);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease, opacity 0.25s ease;
  box-shadow:
    0 18px 42px rgba(9, 12, 36, 0.45),
    inset 0 -10px 20px rgba(72, 102, 138, 0.28),
    inset 0 6px 14px rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

/* Real-life Photography 4:3 Rounded Card Mode (Default!) */
.moon-options-grid.photo-cards .moon-card {
  width: clamp(220px, 28vw, 336px);
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: 26px;
  border: 4px solid rgba(255, 255, 255, 0.34);
  background: #1d234d;
  box-shadow:
    0 20px 44px rgba(8, 10, 32, 0.52),
    0 0 0 1px rgba(115, 232, 210, 0.14);
}

.moon-options-grid.photo-cards .moon-card::before {
  display: none;
}

.moon-options-grid.photo-cards .moon-card-inner {
  border-radius: 22px;
}

.moon-options-grid.photo-cards.four-choices .moon-card {
  width: clamp(170px, 21vw, 252px);
  height: auto;
  aspect-ratio: 4 / 3;
}

.four-choices .moon-card {
  width: clamp(150px, 19vw, 224px);
  height: clamp(150px, 19vw, 224px);
}

/* Cute subtle moon rim crater bump at top like reference screenshot */
.moon-card::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 11px;
  border-radius: 50%;
  background: var(--moon-base);
  opacity: 0.92;
  pointer-events: none;
}

.moon-card-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  display: block;
}

.moon-card-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.26s ease;
  pointer-events: none;
}

.moon-card:hover:not(:disabled) {
  transform: translateY(-8px) scale(1.045);
  box-shadow:
    0 24px 48px rgba(9, 12, 36, 0.55),
    0 0 0 6px rgba(115, 232, 210, 0.22);
}

.moon-card:hover:not(:disabled) .moon-card-inner img {
  transform: scale(1.04);
}

.moon-card:active:not(:disabled) {
  transform: scale(0.95);
}

/* Feedback States */
.moon-card.is-correct {
  border-color: #6df2cb;
  transform: scale(1.07);
  box-shadow:
    0 0 0 10px rgba(109, 242, 203, 0.25),
    0 0 42px rgba(109, 242, 203, 0.55);
  animation: correctPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.moon-card.is-wrong {
  border-color: rgba(255, 162, 130, 0.85);
  opacity: 0.62;
  animation: gentleShake 0.45s ease;
}

.moon-card.is-dimmed {
  opacity: 0.36;
  transform: scale(0.94);
}

.moon-badge-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.moon-card.is-correct .moon-badge-overlay {
  opacity: 1;
  background: #23c79b;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(16, 60, 48, 0.35);
}

.moon-card.is-wrong .moon-badge-overlay {
  opacity: 1;
  background: rgba(30, 34, 78, 0.88);
  color: #ffcf99;
}

@keyframes correctPop {
  0% { transform: scale(0.96); }
  45% { transform: scale(1.11); }
  100% { transform: scale(1.07); }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px) rotate(-2deg); }
  40% { transform: translateX(10px) rotate(2deg); }
  60% { transform: translateX(-7px) rotate(-1deg); }
  80% { transform: translateX(6px) rotate(1deg); }
}

/* Celebratory floating stars burst */
.star-burst {
  position: absolute;
  inset: -24px;
  pointer-events: none;
  z-index: 10;
}

.burst-particle {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 1.5rem;
  animation: burstOut 0.78s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes burstOut {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.15) rotate(var(--rot)); opacity: 0; }
}

/* Subtle kid feedback prompt under moons */
.quiz-hint-line {
  min-height: 28px;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-sub);
  text-align: center;
  letter-spacing: 0.2px;
}

.quiz-hint-line.good {
  color: var(--mint);
}

.quiz-hint-line.try-again {
  color: #ffd385;
}

/* Bottom Progress Bar with Diagonal Stripes & Gliding UFO + Space Koala Mascot */
.quiz-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 110px 14px;
  z-index: 5;
}

.ufo-progress-wrap {
  width: 100%;
  max-width: 640px;
  position: relative;
  padding-bottom: 22px;
}

.ufo-track {
  height: 15px;
  border-radius: 999px;
  background: repeating-linear-gradient(
    90deg,
    rgba(66, 74, 146, 0.65) 0px,
    rgba(66, 74, 146, 0.65) 18px,
    rgba(35, 40, 88, 0.55) 18px,
    rgba(35, 40, 88, 0.55) 24px
  );
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 5px rgba(10, 12, 34, 0.5);
}

.ufo-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: repeating-linear-gradient(
    -55deg,
    #7ae9c9 0px,
    #7ae9c9 10px,
    #52cca9 10px,
    #52cca9 20px
  );
  transition: width 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 0 12px rgba(115, 232, 210, 0.45);
}

.ufo-marker {
  position: absolute;
  top: -11px;
  left: 0%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

.ufo-label {
  margin-top: 3px;
  font-size: 0.84rem;
  font-weight: 800;
  color: #7ee9c7;
  text-shadow: 0 2px 8px rgba(8, 10, 32, 0.8);
}

/* Space Koala Mascot Bottom-Right */
.koala-mascot {
  position: fixed;
  right: 22px;
  bottom: 14px;
  width: 112px;
  height: 124px;
  z-index: 6;
  pointer-events: none;
  animation: koalaFloat 3.4s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.koala-mascot.cheer {
  animation: koalaCheer 0.6s ease-in-out;
}

.koala-mascot.encourage {
  animation: koalaTilt 0.55s ease-in-out;
}

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

@keyframes koalaCheer {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-18px) scale(1.1) rotate(-4deg); }
  70% { transform: translateY(-6px) scale(1.06) rotate(4deg); }
}

@keyframes koalaTilt {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-9deg); }
  70% { transform: rotate(7deg); }
}

.koala-speech {
  position: absolute;
  right: 98px;
  bottom: 84px;
  background: rgba(255, 255, 255, 0.96);
  color: #212655;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 7px 13px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 8px 22px rgba(10, 12, 36, 0.35);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(0.92);
  transition: all 0.22s ease;
}

.koala-speech.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   VIEW 3: MASTERY REPORT
   ========================================================================== */
.report-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.report-hero {
  background: linear-gradient(135deg, rgba(44, 52, 122, 0.9), rgba(24, 28, 72, 0.92));
  border: 1.5px solid var(--glass-border);
  border-radius: 28px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  box-shadow: var(--shadow-soft);
}

.report-stars {
  font-size: 2rem;
  letter-spacing: 6px;
  margin-bottom: 6px;
}

.report-title {
  margin: 0 0 6px;
  font-size: 1.65rem;
  font-weight: 800;
}

.report-sub {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.95rem;
}

.report-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.metric-box {
  min-width: 108px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(15, 18, 48, 0.65);
  border: 1px solid rgba(162, 185, 240, 0.18);
  text-align: center;
}

.metric-val {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--mint);
}

.metric-val.warn {
  color: #ffc16b;
}

.metric-lbl {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.report-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.report-panel {
  background: var(--card-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-panel h3 {
  margin: 0;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-word-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.report-word-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(16, 19, 50, 0.62);
  border: 1px solid rgba(162, 185, 240, 0.14);
}

.report-word-thumb {
  width: 60px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--moon-base);
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.report-word-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.report-word-info {
  flex: 1;
  min-width: 0;
}

.report-word-en {
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.report-word-note {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 2px;
}

.report-word-note.confused {
  color: #ffc17a;
}

/* ==========================================================================
   MODALS (Import, Deck Editor, AI Settings)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 34, 0.72);
  backdrop-filter: blur(8px);
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 780px;
  max-height: 88dvh;
  background: linear-gradient(180deg, #23285e 0%, #1a1d4a 100%);
  border: 1.5px solid rgba(162, 185, 240, 0.28);
  border-radius: 26px;
  box-shadow: 0 24px 64px rgba(4, 6, 22, 0.68);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(162, 185, 240, 0.16);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 1.15rem;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(162, 185, 240, 0.16);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Forms */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-sub);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(162, 185, 240, 0.24);
  background: rgba(14, 16, 44, 0.72);
  color: #ffffff;
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.18s ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--mint);
}

.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.55;
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed rgba(115, 232, 210, 0.44);
  border-radius: 20px;
  background: rgba(115, 232, 210, 0.06);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover,
.dropzone.dragover {
  background: rgba(115, 232, 210, 0.14);
  border-color: var(--mint);
  transform: scale(1.01);
}

.dropzone-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.dropzone-title {
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.dropzone-sub {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--text-sub);
}

/* Parsed Preview Chips */
.parsed-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 14px;
  background: rgba(14, 16, 44, 0.56);
  border: 1px solid rgba(162, 185, 240, 0.14);
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(115, 232, 210, 0.14);
  border: 1px solid rgba(115, 232, 210, 0.3);
  color: #e9fffb;
  font-size: 0.84rem;
  font-weight: 700;
}

.word-chip span {
  color: var(--text-sub);
  font-weight: 500;
}

/* Deck Editor Word Grid */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 16, 44, 0.62);
  border: 1px solid rgba(162, 185, 240, 0.16);
}

.editor-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.editor-word-card {
  background: rgba(16, 19, 50, 0.72);
  border: 1.5px solid rgba(162, 185, 240, 0.18);
  border-radius: 18px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  position: relative;
}

.editor-word-moon {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--moon-base);
  border: 2px solid rgba(255, 255, 255, 0.24);
  position: relative;
}

.editor-word-moon.circle-mode {
  width: 96px;
  height: 96px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.editor-word-moon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-word-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--mint);
}

.editor-word-trans {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-top: -6px;
}

.editor-source-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-sub);
}

.editor-source-tag.ready {
  background: rgba(115, 232, 210, 0.16);
  color: var(--mint);
}

.editor-card-btns {
  display: flex;
  gap: 6px;
  width: 100%;
}

.editor-card-btns button,
.editor-card-btns label {
  flex: 1;
  padding: 6px 6px;
  border-radius: 10px;
  border: 1px solid rgba(162, 185, 240, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #eef2ff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.editor-card-btns button:hover,
.editor-card-btns label:hover {
  background: rgba(115, 232, 210, 0.2);
  border-color: var(--mint);
}

.editor-del-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 110, 110, 0.16);
  color: #ff9c9c;
  font-size: 0.78rem;
  cursor: pointer;
}

.editor-del-btn:hover {
  background: rgba(255, 110, 110, 0.34);
}

.ai-notice-box {
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(115, 232, 210, 0.1);
  border: 1px solid rgba(115, 232, 210, 0.28);
  font-size: 0.85rem;
  color: #d8fff7;
  line-height: 1.55;
}

.progress-inline {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mint);
}

/* Photo Picker Modal Grid */
.photo-search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.photo-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 162px;
  gap: 14px;
  min-height: 220px;
  flex-shrink: 0;
}

.photo-pick-item {
  position: relative;
  display: block;
  width: 100%;
  height: 162px;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid rgba(162, 185, 240, 0.24);
  background: rgba(14, 16, 44, 0.72);
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.photo-pick-item:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--mint);
  box-shadow: 0 12px 26px rgba(10, 12, 36, 0.5);
}

.photo-pick-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-pick-source {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(14, 16, 44, 0.78);
  color: #e6f2ff;
  font-size: 0.7rem;
  font-weight: 700;
}

.photo-picker-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px;
  color: var(--text-sub);
  text-align: center;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(16, 20, 52, 0.94);
  border: 1.5px solid rgba(115, 232, 210, 0.5);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(6, 8, 28, 0.55);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}

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

/* ==========================================================================
   Responsive Breakpoints (iPad Landscape, Tablet Portrait, Mobile)
   ========================================================================== */
@media (max-width: 820px) {
  .hub-shell {
    padding: 18px 16px 36px;
  }

  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-columns,
  .field-row {
    grid-template-columns: 1fr;
  }

  .quiz-view {
    padding: 16px 16px 20px;
  }

  .moon-options-grid {
    gap: 14px;
  }

  .moon-card {
    width: clamp(104px, 28vw, 190px);
    height: clamp(104px, 28vw, 190px);
  }

  .moon-options-grid.photo-cards .moon-card {
    width: clamp(120px, 29vw, 240px);
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 20px;
  }

  .moon-options-grid.photo-cards .moon-card-inner {
    border-radius: 16px;
  }

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

  .quiz-footer {
    padding: 6px 94px 14px 16px;
  }

  .koala-mascot {
    width: 78px;
    height: 86px;
    right: 10px;
    bottom: 8px;
  }
}

@media (max-width: 560px) {
  .moon-options-grid {
    gap: 10px;
  }

  .moon-card {
    width: clamp(92px, 28vw, 144px);
    height: clamp(92px, 28vw, 144px);
  }

  .quiz-top-right .quiz-chip-btn span.hide-xs {
    display: none;
  }
}
