/* ========================================================
   MEIWORD SPELL — Fun Spelling Adventure (Little & Junior)
   Mobile & Tablet First, Locked Navbars, Clean Tactile Design
   ======================================================== */

:root {
  --spell-primary: #FF5E7E;
  --spell-primary-dark: #E11D48;
  --spell-primary-soft: #FFF0F3;
  --spell-junior: #2563EB;
  --spell-junior-dark: #1D4ED8;
  --spell-junior-soft: #EFF6FF;
  --spell-accent-gold: #F59E0B;
  --spell-accent-mint: #10B981;
  --spell-bg: #F0F7FF;
  --spell-card-bg: #FFFFFF;
  --spell-text-dark: #0F172A;
  --spell-text-muted: #64748B;
  --spell-border-color: #E2E8F0;
  --spell-slot-bg: #F8FAFC;
  --spell-tile-shadow: #CBD5E1;

  --nav-height: 64px;
  --bottom-bar-height: 76px;
}

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

html, body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--spell-bg);
  color: var(--spell-text-dark);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Background Animated Sky Clouds */
.spell-sky-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.sky-cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.08);
}

.sky-cloud::before,
.sky-cloud::after {
  content: '';
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.sky-cloud::before {
  width: 52%;
  height: 110%;
  top: -50%;
  left: 14%;
}

.sky-cloud::after {
  width: 36%;
  height: 75%;
  top: -32%;
  right: 18%;
}

.cloud-1 {
  width: 180px;
  height: 54px;
  top: 8%;
  left: -200px;
  opacity: 0.7;
  animation: driftClouds 50s linear infinite;
}

.cloud-2 {
  width: 240px;
  height: 70px;
  top: 36%;
  left: -260px;
  opacity: 0.5;
  animation: driftClouds 70s linear infinite;
  animation-delay: -22s;
}

.cloud-3 {
  width: 160px;
  height: 48px;
  top: 68%;
  left: -180px;
  opacity: 0.6;
  animation: driftClouds 58s linear infinite;
  animation-delay: -35s;
}

@keyframes driftClouds {
  0% { transform: translate3d(-10vw, 0, 0); }
  100% { transform: translate3d(120vw, 0, 0); }
}

/* ========================================================
   LOCKED TOP NAVIGATION BAR (Fixed on Mobile & Tablet)
   ======================================================== */
.spell-locked-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
}

.spell-nav-inner {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spell-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spell-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #F1F5F9;
  color: var(--spell-text-dark);
  text-decoration: none;
  border: 1px solid #E2E8F0;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.spell-back-btn:hover {
  background: #E2E8F0;
  transform: scale(1.05);
}

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

/* Clean Brand Text (No Emoji, No ABC) */
.spell-brand-text {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: #0F172A;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.spell-brand-text span {
  color: var(--spell-primary);
}

/* Track Selector Dropdown in Navbar (Saves space, ultra clean) */
.spell-track-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.spell-track-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--spell-text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.spell-track-dropdown-btn:hover {
  background: #E2E8F0;
}

.spell-track-dropdown-btn:active {
  transform: scale(0.97);
}

.dropdown-arrow-icon {
  color: var(--spell-text-muted);
  transition: transform 0.2s ease;
}

.spell-track-dropdown-wrap.open .dropdown-arrow-icon {
  transform: rotate(180deg);
}

.spell-track-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #FFFFFF;
  border-radius: 20px;
  border: 2px solid #E2E8F0;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
  padding: 8px;
  min-width: 230px;
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 6px;
  animation: dropdownPop 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spell-track-dropdown-wrap.open .spell-track-dropdown-menu {
  display: flex;
}

@keyframes dropdownPop {
  0% { opacity: 0; transform: translateY(-8px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.track-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
  width: 100%;
}

.track-menu-item:hover {
  background: #F8FAFC;
}

.track-menu-item.active {
  background: #F1F5F9;
}

.track-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.track-bullet.little {
  background: var(--spell-primary);
  box-shadow: 0 0 0 3px rgba(255, 94, 126, 0.2);
}

.track-bullet.junior {
  background: var(--spell-junior);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.track-menu-info {
  display: flex;
  flex-direction: column;
}

.track-menu-info b {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.9rem;
  color: #0F172A;
  font-weight: 700;
}

.track-menu-info small {
  font-size: 0.76rem;
  color: var(--spell-text-muted);
}

/* Top Nav Right Controls */
.spell-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.star-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FEF3C7;
  color: #B45309;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #FDE68A;
}

.star-svg-icon {
  width: 16px;
  height: 16px;
  fill: #F59E0B;
  stroke: #D97706;
  stroke-width: 1.5;
}

.spell-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: var(--spell-text-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.spell-icon-btn:hover {
  background: #F8FAFC;
  transform: translateY(-1px);
}

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

.spell-icon-btn.muted {
  color: #94A3B8;
  background: #F1F5F9;
}

/* ========================================================
   LOBBY / LEVEL SELECTION PAGE STYLES (/spell)
   ======================================================== */
.spell-lobby-container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 24px) 18px 48px;
  display: flex;
  flex-direction: column;
}

/* Student Name Card (Lobby & Player) */
.student-bar-box {
  background: #FFFFFF;
  border-radius: 20px;
  border: 2px solid #E2E8F0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  padding: 10px 14px;
  max-width: 440px;
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.student-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #FFF0F3;
  color: var(--spell-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-bar-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.student-name-input {
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0F172A;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.student-name-input:focus {
  border-color: var(--spell-primary);
}

.btn-student-save {
  border: none;
  background: var(--spell-primary);
  color: #FFFFFF;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-student-save:hover {
  background: var(--spell-primary-dark);
}

.student-greeting-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.92rem;
  color: #0F172A;
  gap: 8px;
}

.student-greeting-text b {
  color: var(--spell-primary);
}

.btn-edit-student {
  border: none;
  background: transparent;
  color: var(--spell-junior);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
  white-space: nowrap;
}

/* Student Name Pill in Navbar */
.student-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0F172A;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.student-nav-pill:hover {
  background: #E2E8F0;
}

/* Section Dividers for All Topics */
.topics-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 16px;
  flex-wrap: wrap;
}

.topics-section-header:first-of-type {
  margin-top: 10px;
}

.topics-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: #FFFFFF;
}

.topics-tier-badge.tier-1 {
  background: var(--spell-primary);
}

.topics-tier-badge.tier-2 {
  background: var(--spell-junior);
}

.topics-section-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F172A;
}

.topics-section-count {
  font-size: 0.85rem;
  color: var(--spell-text-muted);
  font-weight: 600;
  margin-left: auto;
}

.spell-lobby-hero {
  text-align: center;
  margin-bottom: 28px;
}

.lobby-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EFF6FF;
  color: var(--spell-junior);
  border: 1px solid #BFDBFE;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.spell-lobby-hero h1 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.25;
}

.spell-lobby-hero p {
  color: var(--spell-text-muted);
  font-size: 1rem;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.55;
}

/* Track Switcher Banner in Lobby */
.lobby-track-switch-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.lobby-track-toggle {
  display: inline-flex;
  background: #FFFFFF;
  padding: 6px;
  border-radius: 999px;
  border: 2px solid #E2E8F0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.lobby-toggle-btn {
  border: none;
  background: transparent;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--spell-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lobby-toggle-btn.active {
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.lobby-toggle-btn[data-track="little"].active {
  background: var(--spell-primary);
  box-shadow: 0 4px 12px rgba(255, 94, 126, 0.35);
}

.lobby-toggle-btn[data-track="junior"].active {
  background: var(--spell-junior);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Topics Grid */
.spell-topics-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
}

.topic-stage-card {
  background: #FFFFFF;
  border-radius: 22px;
  border: 2px solid #FFFFFF;
  box-shadow: 0 8px 24px rgba(100, 116, 139, 0.08);
  padding: 16px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.topic-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topic-stage-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(100, 116, 139, 0.14);
}

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

.topic-card-icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 0;
  flex: 0 0 auto;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.topic-card-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 4px;
}

.topic-card-subtitle {
  font-size: 0.85rem;
  color: var(--spell-junior);
  font-weight: 700;
  margin-bottom: 8px;
}

.topic-card-desc {
  font-size: 0.88rem;
  color: var(--spell-text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.topic-card-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  border-top: none;
  padding-top: 0;
  flex: 0 0 auto;
}

.topic-card-count {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--spell-text-muted);
}

.topic-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--spell-primary);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
}

/* ========================================================
   PLAYER PAGE STYLES (Fixed Nav, Fixed Bottom Bar)
   ======================================================== */
.spell-play-viewport {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--nav-height);
  padding-bottom: var(--bottom-bar-height);
}

.spell-play-stage {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Main Chunky Card */
.play-card-wrap {
  background: #FFFFFF;
  border-radius: 28px;
  border: 3px solid #FFFFFF;
  box-shadow: 0 12px 36px rgba(100, 116, 139, 0.12);
  width: 100%;
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Stage Info Header */
.play-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.meta-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #F1F5F9;
  color: var(--spell-text-muted);
}

.meta-pill-badge.cat {
  background: #EFF6FF;
  color: var(--spell-junior);
}

.meta-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--spell-text-muted);
}

/* Big Object Area */
.play-object-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.play-emoji-btn {
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background: linear-gradient(135deg, #FFF0F3 0%, #EFF6FF 100%);
  border: 3px solid #FFFFFF;
  box-shadow: 0 8px 20px rgba(255, 94, 126, 0.14);
  font-size: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-user-select: none;
}

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

.play-word-meaning {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0F172A;
  margin-top: 6px;
}

.btn-pronounce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFF0F3;
  color: var(--spell-primary);
  border: 1.5px solid #FFE4E8;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.2s;
}

.btn-pronounce:hover {
  background: #FFE4E8;
  transform: scale(1.03);
}

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

/* Target Letter Slots */
.play-slots-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  width: 100%;
}

.play-slot {
  width: 52px;
  height: 58px;
  border-radius: 16px;
  background: var(--spell-slot-bg);
  border: 3px dashed #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: #1E3A8A;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.play-slot .slot-ghost {
  color: #CBD5E1;
  opacity: 0.55;
}

.play-slot.filled {
  background: #FFFFFF;
  border: 3px solid #3B82F6;
  box-shadow: 0 5px 0 #2563EB, 0 6px 14px rgba(59, 130, 246, 0.18);
  animation: slotPopIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slotPopIn {
  0% { transform: scale(0.75); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.play-slots-container.shake {
  animation: shakeSlots 0.4s ease;
}

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

/* Letter Blocks Pool */
.play-pool-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--spell-text-muted);
  margin-bottom: 10px;
}

.play-pool-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.play-letter-tile {
  width: 52px;
  height: 56px;
  border-radius: 16px;
  border: 3px solid #FFFFFF;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  box-shadow: 0 5px 0 var(--spell-tile-shadow), 0 6px 14px rgba(100, 116, 139, 0.12);
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.play-letter-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--spell-tile-shadow), 0 8px 16px rgba(100, 116, 139, 0.16);
}

.play-letter-tile:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--spell-tile-shadow);
}

.play-letter-tile.used {
  opacity: 0.25;
  box-shadow: 0 2px 0 var(--spell-tile-shadow);
  pointer-events: none;
}

/* ========================================================
   LOCKED BOTTOM BAR (Fixed on Mobile & Tablet)
   ======================================================== */
.spell-locked-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: center;
}

.spell-bottom-inner {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-bottom-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #F1F5F9;
  color: var(--spell-text-dark);
  border: 1px solid #E2E8F0;
  padding: 10px 16px;
  border-radius: 16px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-bottom-action:hover {
  background: #E2E8F0;
  transform: translateY(-1px);
}

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

.btn-bottom-action.hint {
  background: #FEF3C7;
  color: #B45309;
  border-color: #FDE68A;
}

.btn-bottom-action.hint:hover {
  background: #FDE68A;
}

.btn-bottom-action.icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
}

.ghost-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--spell-text-muted);
  cursor: pointer;
}

.ghost-switch-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--spell-primary);
  cursor: pointer;
}

/* ========================================================
   EUREKA POP-UP SUCCESS MODAL
   ======================================================== */
.eureka-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.eureka-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.eureka-card {
  background: #FFFFFF;
  border-radius: 32px;
  border: 4px solid #FFFFFF;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 440px;
  padding: 28px 22px;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.eureka-overlay.open .eureka-card {
  transform: scale(1) translateY(0);
}

.eureka-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #059669;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.eureka-emoji {
  font-size: 3.8rem;
  line-height: 1;
  margin-bottom: 8px;
}

.eureka-word {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.eureka-sub {
  font-size: 1.05rem;
  color: var(--spell-text-muted);
  font-weight: 600;
  margin-bottom: 16px;
}

.eureka-secret-box {
  background: #FFFBEB;
  border: 2px dashed #FDE68A;
  border-radius: 18px;
  padding: 14px 16px;
  text-align: left;
  margin-bottom: 20px;
}

.eureka-secret-header {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  color: #92400E;
  margin-bottom: 4px;
}

.eureka-secret-content {
  font-size: 0.9rem;
  color: #78350F;
  line-height: 1.5;
}

.eureka-mistake-pill {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #FCD34D;
  font-size: 0.85rem;
  color: #B45309;
}

.btn-eureka-continue {
  width: 100%;
  padding: 15px;
  border-radius: 18px;
  border: none;
  background: var(--spell-primary);
  color: #FFFFFF;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--spell-primary-dark), 0 10px 22px rgba(255, 94, 126, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-eureka-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 var(--spell-primary-dark);
}

.btn-eureka-continue:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--spell-primary-dark);
}

/* Confetti Particles */
.spell-confetti-particle {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  z-index: 1001;
  pointer-events: none;
  animation: fallConfetti linear forwards;
}

@keyframes fallConfetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}

/* Parent Guide Accordion in Lobby */
.spell-lobby-guide {
  background: #FFFFFF;
  border-radius: 22px;
  border: 2px dashed #CBD5E1;
  padding: 20px 22px;
  margin-top: 20px;
  line-height: 1.6;
}

.spell-lobby-guide h3 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0F172A;
  margin-bottom: 6px;
}

.spell-lobby-guide p {
  font-size: 0.9rem;
  color: var(--spell-text-muted);
}

/* Mobile Responsive Adaptations */
@media (max-width: 480px) {
  :root {
    --nav-height: 58px;
    --bottom-bar-height: 72px;
  }

  .spell-brand-text {
    font-size: 1.15rem;
  }

  .play-card-wrap {
    padding: 14px 12px 18px;
    border-radius: 22px;
  }

  .play-emoji-btn {
    width: 76px;
    height: 76px;
    font-size: 3rem;
  }

  .play-word-meaning {
    font-size: 1.2rem;
  }

  .play-slot {
    width: 44px;
    height: 50px;
    font-size: 1.55rem;
    border-radius: 12px;
  }

  .play-letter-tile {
    width: 46px;
    height: 50px;
    font-size: 1.55rem;
    border-radius: 12px;
  }

  .btn-bottom-action {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .ghost-switch-label span {
    display: none;
  }
}

/* ============================================================
   Emoji: one Android/HyperOS set (Noto Color Emoji) on every
   device — same treatment as Meiword Little.
   ============================================================ */
.play-emoji-btn,
.eureka-emoji,
.topic-card-icon {
  font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* === Apple devices: native Apple Color Emoji ===
   Google Fonts serves an SVG-flavored Noto Color Emoji to Apple
   browsers; iOS Safari cannot paint it (emoji render blank) and the
   fallback never engages because the font still claims the glyphs.
   The .apple-emoji class is set by a small <head> script when an
   Apple device is detected (Fahrur, 2026-10-22: iPhone follows
   the native Apple style). */
html.apple-emoji .play-emoji-btn,
html.apple-emoji .eureka-emoji,
html.apple-emoji .topic-card-icon {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* Topic list rows on small screens (list layout, 2026-10-24) */
@media (max-width: 560px) {
  .topic-stage-card { gap: 12px; padding: 13px 14px; border-radius: 18px; }
  .topic-card-icon { width: 48px; height: 48px; border-radius: 15px; font-size: 1.6rem; }
  .topic-card-title { font-size: 1.08rem; }
  .topic-card-desc { font-size: 0.84rem; }
}
