:root {
  --bg-primary: #0b1320;
  --bg-surface: #14213d;
  --bg-card: #1f2f4e;
  --text-main: #f8f9fa;
  --text-muted: #a0aec0;
  --accent-gold: #f4a261;
  --accent-amber: #e76f51;
  --accent-teal: #2a9d8f;
  --accent-persian: #008080;
  --accent-bus-red: #e63946;
  --paper-cream: #fefae0;
  --paper-text: #264653;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

body.nightlight-theme {
  --bg-primary: #080c14;
  --bg-surface: #0f172a;
  --bg-card: #192339;
  --paper-cream: #fcf6bd;
  --text-main: #fceade;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Header */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.foundry-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: -0.5px;
}

.tag-london {
  margin-left: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border-subtle);
  padding-left: 10px;
}

.header-controls {
  display: flex;
  gap: 10px;
}

.btn-toggle {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-toggle:hover {
  background: var(--accent-gold);
  color: #0b1320;
}

/* Container */
.app-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}

.view-hidden {
  display: none !important;
}

/* Hero */
.shelf-hero {
  background: linear-gradient(135deg, #1b263b 0%, #0d1b2a 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.shelf-hero::before {
  content: "🇬🇧 🇵🇹 🇮🇷";
  position: absolute;
  right: 24px;
  top: 24px;
  font-size: 2.2rem;
  opacity: 0.2;
}

.hero-content h1 {
  font-size: 2rem;
  color: var(--accent-gold);
  margin-bottom: 12px;
  font-family: "Georgia", serif;
}

.hero-desc {
  max-width: 780px;
  color: #d1d5db;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--accent-gold);
  color: #0b1320;
  border: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s;
}

.btn-primary:hover {
  background: #f7b731;
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(244, 162, 97, 0.15);
}

.shelf-section-title h2 {
  font-size: 1.4rem;
  color: var(--text-main);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: 8px;
}

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

.book-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.card-badge {
  background: var(--accent-bus-red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title-en {
  font-size: 1.15rem;
  color: var(--accent-gold);
  margin-bottom: 6px;
  font-weight: 700;
}

.card-title-pt {
  font-size: 0.85rem;
  color: var(--accent-amber);
  font-style: italic;
  margin-bottom: 4px;
}

.card-title-fa {
  font-size: 0.95rem;
  font-family: "Tahoma", sans-serif;
  color: #64dfdf;
  margin-bottom: 12px;
}

.card-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-summary {
  font-size: 0.88rem;
  color: #cbd5e1;
  margin-bottom: 16px;
  flex: 1;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-card-read {
  flex: 1;
  background: var(--accent-gold);
  color: #0b1320;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 0.85rem;
}

.btn-card-pdf {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 0.85rem;
}

.btn-card-pdf:hover {
  background: #2a9d8f;
  color: #fff;
}

/* Reader View */
.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
}

.btn-back {
  background: transparent;
  color: var(--accent-gold);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.reader-meta {
  text-align: center;
}

.story-title-display {
  font-weight: 700;
  color: var(--text-main);
  display: block;
  font-size: 1rem;
}

.page-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reader-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-action:hover {
  background: var(--accent-gold);
  color: #0b1320;
}

/* Book Stage & 3D Flip */
.book-stage {
  perspective: 1200px;
  display: flex;
  justify-content: center;
  margin: 10px 0 24px 0;
}

.book-card {
  width: 100%;
  max-width: 720px;
  min-height: 600px;
  background: var(--paper-cream);
  color: var(--paper-text);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  position: relative;
}

.book-card.flipping-next {
  animation: flipNext 0.4s ease;
}

.book-card.flipping-prev {
  animation: flipPrev 0.4s ease;
}

@keyframes flipNext {
  0% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(-15deg) scale(0.98); }
  100% { transform: rotateY(0deg) scale(1); }
}

@keyframes flipPrev {
  0% { transform: rotateY(0deg) scale(1); }
  50% { transform: rotateY(15deg) scale(0.98); }
  100% { transform: rotateY(0deg) scale(1); }
}

.reader-illustration {
  width: 100%;
  height: 240px;
  background: #f1f2f6;
  border-radius: 8px;
  overflow: hidden;
  margin: 12px 0 16px 0;
  border: 1px solid #e2d9cc;
}

/* Vocab Callouts in Reader */
.reader-vocab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.interactive-vocab-pill {
  background: #fdf2e9;
  border: 1px solid #e67e22;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.interactive-vocab-pill:hover, .interactive-vocab-pill.active {
  background: #e67e22;
  color: #fff;
}

.interactive-vocab-pill:hover .audio-icon, .interactive-vocab-pill.active .audio-icon {
  filter: brightness(2);
}

.stress-mark {
  font-weight: 800;
  color: #c0392b;
  text-decoration: underline;
}

.reader-narrative-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.reader-text-en {
  font-size: 1.05rem;
  line-height: 1.45;
  color: #2c3e50;
  font-weight: 500;
}

.reader-text-pt {
  font-size: 0.98rem;
  line-height: 1.4;
  color: #a04000;
  font-style: italic;
}

.reader-persian-block {
  background: #f7f9fa;
  border-left: 4px solid #008080;
  padding: 10px 14px;
  border-radius: 6px;
}

.reader-text-fa {
  font-family: "Tahoma", "Vazirmatn", sans-serif;
  font-size: 1.1rem;
  color: #0b5345;
  text-align: right;
  direction: rtl;
  margin-bottom: 6px;
}

.reader-text-finglish {
  font-size: 0.95rem;
  color: #d35400;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* Audio button inside lines */
.tts-speaker-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 6px;
  vertical-align: middle;
}

.reader-dialogue-block {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-item {
  background: #ffffff;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 10px 14px;
}

.dialogue-speaker-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #b33927;
  text-transform: uppercase;
}

/* Nav Controls */
.reader-nav-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.nav-arrow {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.nav-arrow:hover {
  background: var(--accent-gold);
  color: #0b1320;
}

.nav-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  max-width: 600px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h3 {
  color: var(--accent-gold);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-tip {
  font-size: 0.9rem;
  color: #d1d5db;
  margin-bottom: 14px;
}

#bedtimePromptInput {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 16px;
  resize: vertical;
}

.teams-info-content ul {
  padding-left: 20px;
  margin: 12px 0;
}

.teams-test-row {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

#teamsSimInput {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
}

.code-box {
  background: #080c14;
  border: 1px solid var(--border-subtle);
  padding: 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #38bdf8;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}



/* =========================================================================
   Idea #43: Option B Integrated Arcade & Top-Level Navigation Styles
   ========================================================================= */

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.top-nav-tabs {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 3px;
  gap: 4px;
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--accent-gold);
  color: #0b1320;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Arcade Banner & Child Selector */
.arcade-banner {
  background: linear-gradient(135deg, #162447 0%, #1f4068 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.arcade-banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.arcade-banner h2 {
  font-size: 1.8rem;
  color: var(--accent-gold);
  font-family: "Georgia", serif;
}

.arcade-subtitle {
  color: #d1d5db;
  font-size: 0.95rem;
  margin-top: 4px;
}

.child-picker-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(11, 19, 32, 0.7);
  padding: 8px 14px;
  border-radius: 24px;
  border: 1px solid var(--border-subtle);
}

.picker-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.child-toggle-group {
  display: flex;
  gap: 6px;
}

.child-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.child-btn:hover {
  background: var(--accent-teal);
  color: #fff;
}

.child-btn.active {
  background: #f4a261;
  color: #0b1320;
  border-color: #f4a261;
  box-shadow: 0 0 10px rgba(244, 162, 97, 0.5);
}

/* Mode Tabs */
.arcade-mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
}

.mode-tab {
  background: rgba(11, 19, 32, 0.6);
  color: #d1d5db;
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.mode-tab:hover {
  background: var(--bg-card);
  color: #fff;
}

.mode-tab.active {
  background: #2a9d8f;
  color: #ffffff;
  border-color: #2a9d8f;
}

/* Deck Selector Chips */
.deck-selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.deck-row-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.deck-chips-scroll {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.deck-chip {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  font-weight: 600;
  transition: all 0.2s;
}

.deck-chip:hover {
  border-color: var(--accent-gold);
}

.deck-chip.active {
  background: var(--accent-gold);
  color: #0b1320;
  border-color: var(--accent-gold);
}

/* Arcade Content Area */
.arcade-content-area {
  min-height: 480px;
}

/* Mode 1: Listen & Tap (Quiz) */
.quiz-card-stage {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.quiz-prompt-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.quiz-audio-trigger-btn {
  background: var(--accent-bus-red);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(230, 57, 70, 0.4);
  margin-bottom: 12px;
  transition: transform 0.15s, background 0.2s;
}

.quiz-audio-trigger-btn:hover {
  transform: scale(1.04);
}

.quiz-prompt-hint {
  font-size: 0.95rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
}

.quiz-tile {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.quiz-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
  background: #273859;
}

.quiz-tile-emoji {
  font-size: 2.2rem;
}

.quiz-tile-texts {
  flex: 1;
}

.quiz-tile-en {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.quiz-tile-pt {
  font-size: 0.85rem;
  color: #f4a261;
  font-style: italic;
}

.quiz-tile-fa {
  font-size: 0.9rem;
  color: #64dfdf;
  font-family: "Tahoma", sans-serif;
  direction: rtl;
}

.quiz-tile.correct {
  border-color: #2ecc71 !important;
  background: rgba(46, 204, 113, 0.25) !important;
  animation: pulseCorrect 0.5s ease;
}

.quiz-tile.wrong {
  border-color: #e74c3c !important;
  background: rgba(231, 76, 60, 0.25) !important;
  animation: shakeWrong 0.4s ease;
}

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.quiz-feedback-bar {
  margin-top: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  min-height: 32px;
}

/* Mode 2: Flip & Speak Explorer */
.explorer-stage {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.explorer-card-3d-wrap {
  perspective: 1200px;
  margin: 20px 0;
}

.explorer-card-3d {
  width: 100%;
  min-height: 340px;
  background: var(--paper-cream);
  color: var(--paper-text);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 30px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.explorer-card-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  backface-visibility: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-back {
  transform: rotateY(180deg);
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  padding: 30px;
}

.explorer-emoji {
  font-size: 4rem;
  margin-bottom: 12px;
}

.explorer-term-en {
  font-size: 1.7rem;
  font-weight: 800;
  color: #112d4e;
  font-family: Georgia, serif;
}

.explorer-term-pt {
  font-size: 1.2rem;
  color: #b33927;
  font-style: italic;
  margin-top: 4px;
}

.explorer-term-fa {
  font-size: 2.2rem;
  font-family: "Tahoma", "Vazirmatn", sans-serif;
  color: #0b5345;
  font-weight: 700;
  direction: rtl;
  margin-bottom: 8px;
}

.explorer-term-finglish {
  font-size: 1.3rem;
  color: #d35400;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.explorer-phonetic-hint {
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-top: 8px;
}

.flip-hint-badge {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #8c7b75;
  background: rgba(0,0,0,0.06);
  padding: 4px 10px;
  border-radius: 12px;
}

.explorer-audio-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-speak-lang {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.btn-speak-lang:hover {
  background: var(--accent-gold);
  color: #0b1320;
}

.family-voice-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.family-voice-tag {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.family-voice-tag.recorded {
  border-color: #2ecc71;
  color: #2ecc71;
}

/* Mode 3: Family Voice Studio */
.voice-studio-container {
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.speaker-select-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 24px 0;
  flex-wrap: wrap;
}

.speaker-pill-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.speaker-pill-btn.active {
  background: #e63946;
  color: #fff;
  border-color: #e63946;
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.4);
}

.record-mic-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--accent-bus-red);
  color: #fff;
  border: none;
  font-size: 2.2rem;
  cursor: pointer;
  margin: 14px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.2s;
}

.record-mic-circle:hover {
  transform: scale(1.06);
}

.record-mic-circle.recording {
  background: #e74c3c;
  animation: recordPulse 1s infinite alternate;
}

@keyframes recordPulse {
  from { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  to { box-shadow: 0 0 0 16px rgba(231, 76, 60, 0); }
}

/* Mode 4: Mastery Dashboard */
.mastery-dashboard-view {
  max-width: 800px;
  margin: 0 auto;
}

.mastery-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.leitner-boxes-track {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}

.leitner-boxes-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.leitner-box-slot {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
}

.box-slot-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.box-slot-count {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin: 6px 0;
}

.box-slot-5 {
  border-color: #f1c40f;
  background: rgba(241, 196, 15, 0.15);
}

.box-slot-5 .box-slot-count {
  color: #f1c40f;
}

.lang-prof-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
}

.prof-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
}

.prof-lang-tag {
  width: 140px;
  font-size: 0.9rem;
  font-weight: 700;
}

.prof-bar-outer {
  flex: 1;
  height: 12px;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
}

.prof-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2a9d8f, #e76f51);
  border-radius: 6px;
  transition: width 0.4s ease;
}
