/* ===== Variables ===== */
:root {
  --color-alltag: #4CAF50;
  --color-tiere: #FF9800;
  --color-umwelt: #2196F3;
  --color-success: #4CAF50;
  --color-error: #f44336;
  --color-warning: #FF9800;
  --color-primary: #6C63FF;
  --color-secondary: #9C27B0;
  --bg-light: #FAFAFA;
  --bg-white: #FFFFFF;
  --text-dark: #333333;
  --text-light: #666666;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
  --radius: 16px;
  --radius-small: 8px;
  --radius-lg: 20px;
  --bg-card: #FFFFFF;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
  --text: #333333;
  /* Level colors */
  --level-1: #4CAF50;
  --level-2: #2196F3;
  --level-3: #FF9800;
  --level-4: #9C27B0;
  --level-5: #f44336;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-dark);
  line-height: 1.6;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
#app-header {
  background: var(--bg-white);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -1px;
}

#main-nav {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  font-weight: 600;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  background: var(--color-primary);
  color: white;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-tokens {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-light);
  border-radius: var(--radius-small);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.nav-tokens:hover {
  background: var(--color-primary);
  color: white;
}

.nav-tokens-icon {
  font-size: 1rem;
}

.nav-tokens-count {
  min-width: 1.2rem;
  text-align: center;
}

#user-info {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ===== Main Content ===== */
#app-content {
  flex: 1;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Footer ===== */
#app-footer {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
  min-height: 60px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: #5a52d5;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-correct {
  background: var(--color-success);
  color: white;
}

.btn-correct:hover {
  background: #43a047;
}

.btn-wrong {
  background: var(--color-error);
  color: white;
}

.btn-wrong:hover {
  background: #e53935;
}

.btn-flip {
  background: var(--color-warning);
  color: white;
}

.btn-flip:hover {
  background: #f57c00;
}

.btn-large {
  padding: 1.2rem 3rem;
  font-size: 1.3rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  min-height: auto;
}

.btn-check {
  background: var(--color-primary);
  color: white;
}

.btn-next {
  background: var(--color-primary);
  color: white;
}

/* ===== Home Page ===== */
.home-page {
  text-align: center;
}

.home-page h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.mode-card {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-dark);
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.mode-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.mode-card h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.mode-card p {
  color: var(--text-light);
  font-size: 0.95rem;
}

.mode-flashcard { border-top: 4px solid var(--color-alltag); }
.mode-choice { border-top: 4px solid var(--color-tiere); }
.mode-typing { border-top: 4px solid var(--color-umwelt); }

.stats-preview {
  background: rgba(255, 255, 255, 0.15);
  padding: 1.5rem;
  border-radius: var(--radius);
  color: white;
  margin-bottom: 1rem;
}

.new-vocab-notice {
  background: var(--color-warning);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.new-vocab-notice p {
  font-weight: 600;
}

/* ===== Learn Pages ===== */
.learn-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.learn-header {
  text-align: center;
  margin-bottom: 2rem;
}

.learn-header h1 {
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.progress-bar {
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 6px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ===== Flashcard ===== */
.flashcard-container {
  perspective: 1000px;
  margin-bottom: 2rem;
  min-height: 420px;
  transition: min-height 0.3s ease;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 420px;
  transform-style: preserve-3d;
  transition: transform 0.6s, min-height 0.3s;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  min-height: 420px;
  backface-visibility: hidden;
  display: flex;
  transition: min-height 0.3s ease;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* When sentence is expanded, give more space */
.flashcard-container.sentence-expanded {
  min-height: 540px;
}

.flashcard-container.sentence-expanded .flashcard {
  min-height: 540px;
}

.flashcard-container.sentence-expanded .flashcard-front,
.flashcard-container.sentence-expanded .flashcard-back {
  min-height: 540px;
}

.category-badge {
  background: var(--color-primary);
  color: white;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.vocab-word {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.vocab-word-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.vocab-word-container .vocab-word {
  margin-bottom: 0;
}

.answer-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Audio Buttons ===== */
.btn-audio {
  background: rgba(108, 99, 255, 0.1);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-audio:hover {
  background: var(--color-primary);
}

.btn-audio:hover .audio-icon {
  fill: white;
}

.btn-audio.loading {
  opacity: 0.6;
  cursor: wait;
  animation: pulse-loading 1.5s infinite;
}

.btn-audio.playing {
  background: var(--color-primary);
  animation: pulse-playing 1s infinite;
}

.btn-audio.playing .audio-icon {
  fill: white;
}

@keyframes pulse-loading {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes pulse-playing {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.audio-icon {
  fill: var(--color-primary);
  transition: fill 0.2s;
}

.btn-audio-small {
  width: 36px;
  height: 36px;
}

/* ===== Example Sentence Section ===== */
.example-sentence-section {
  width: 100%;
  margin: 1rem 0;
}

.btn-toggle-sentence {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 auto;
  transition: background 0.2s;
}

.btn-toggle-sentence:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toggle-icon {
  font-weight: bold;
  transition: transform 0.2s;
  display: inline-block;
}

.btn-toggle-sentence.expanded .toggle-icon {
  transform: rotate(45deg);
}

.sentence-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: var(--radius-small);
  margin-top: 0.75rem;
  text-align: left;
}

.sentence-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.sentence-en {
  font-size: 1.1rem;
  color: white;
  margin-bottom: 0.5rem;
  flex: 1;
  line-height: 1.4;
}

.sentence-de {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
  padding-left: calc(36px + 0.75rem);
}

.sentence-loading {
  text-align: center;
  padding: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
}

.sentence-loading::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.sentence-error {
  text-align: center;
  padding: 0.5rem;
  color: rgba(255, 200, 200, 0.9);
}

/* Front side example sentence - different styling for light background */
.example-sentence-front .btn-toggle-sentence {
  background: rgba(108, 99, 255, 0.15);
  color: var(--color-primary);
}

.example-sentence-front .btn-toggle-sentence:hover {
  background: rgba(108, 99, 255, 0.25);
}

.example-sentence-front .sentence-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Audio button in sentence - white style for dark background */
.sentence-content .btn-audio {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.sentence-content .btn-audio .audio-icon {
  fill: white;
}

.sentence-content .btn-audio:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ===== Audio Loading Bubble ===== */
.audio-loading-bubble {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  animation: bubble-appear 0.3s ease-out;
  max-width: 90%;
}

@keyframes bubble-appear {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.audio-loading-bubble.hiding {
  animation: bubble-disappear 0.3s ease-out forwards;
}

@keyframes bubble-disappear {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

.audio-loading-bubble .bubble-icon {
  font-size: 2rem;
  animation: bounce 1s infinite;
}

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

.audio-loading-bubble .bubble-text {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.4;
}

.audio-loading-bubble .bubble-text strong {
  color: var(--color-primary);
}

.learn-actions {
  text-align: center;
}

/* ===== Multiple Choice ===== */
.choice-container {
  text-align: center;
  margin-bottom: 2rem;
}

/* Question card - same style as flashcard-front */
.question-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.question-card .question-label {
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.question-card .vocab-word-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.question-card .vocab-word {
  margin: 0;
}

.question-card .example-sentence-section {
  width: 100%;
  margin-top: 1rem;
}

.question-card .btn-toggle-sentence {
  background: rgba(108, 99, 255, 0.15);
  color: var(--color-primary);
}

.question-card .btn-toggle-sentence:hover {
  background: rgba(108, 99, 255, 0.25);
}

.question-card .sentence-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
}

.question-card .sentence-en {
  color: white;
}

.question-card .sentence-de {
  color: rgba(255, 255, 255, 0.85);
}

.question-card .btn-audio-small {
  background: rgba(255, 255, 255, 0.2);
}

.question-card .btn-audio-small:hover {
  background: rgba(255, 255, 255, 0.3);
}

.question-card .btn-audio-small .audio-icon {
  fill: white;
}

.question-label {
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.choice-btn {
  padding: 1.2rem;
  font-size: 1.2rem;
  font-weight: 600;
  border: 3px solid #e0e0e0;
  border-radius: var(--radius);
  background: var(--bg-white);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  transform: scale(1.02);
}

.choice-btn.correct {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.choice-btn.incorrect {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
}

.choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.feedback {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem;
  border-radius: var(--radius-small);
  margin: 1rem 0;
}

.feedback.correct {
  background: #e8f5e9;
  color: var(--color-success);
}

.feedback.incorrect {
  background: #ffebee;
  color: var(--color-error);
}

.feedback.retry {
  background: #fff8e1;
  color: #f57c00;
  border-left: 4px solid #f57c00;
}

.feedback.almost {
  background: #e3f2fd;
  color: #1976d2;
  border-left: 4px solid #1976d2;
}

/* Feedback inner components */
.feedback-success,
.feedback-retry,
.feedback-hint,
.feedback-streaming {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

/* Streaming feedback animation */
.feedback.streaming {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  border-left: 4px solid #7c4dff;
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% {
    border-left-color: #7c4dff;
  }
  50% {
    border-left-color: #b388ff;
  }
}

.streaming-text {
  white-space: pre-wrap;
  min-height: 1.5em;
}

.streaming-text:empty::after {
  content: '';
}

.streaming-text:not(:empty)::after {
  content: '|';
  animation: blink 0.7s infinite;
  font-weight: bold;
  color: #7c4dff;
}

/* Loading dots animation */
.loading-dots {
  font-size: 2rem;
  line-height: 1;
  color: #7c4dff;
}

.loading-dots span {
  animation: dotPulse 1.4s infinite ease-in-out;
  display: inline-block;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

.feedback-emoji {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.feedback-text {
  flex: 1;
}

.feedback-text p {
  margin: 0 0 0.5rem 0;
}

.feedback-text p:last-child {
  margin-bottom: 0;
}

.feedback-text .correct-answer {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-small);
}

.feedback-text .encouragement {
  font-style: italic;
  opacity: 0.9;
  margin-top: 0.5rem;
}

.feedback.correct .feedback-emoji {
  color: var(--color-success);
}

/* ===== Typing ===== */
.typing-container {
  text-align: center;
  margin-bottom: 2rem;
}

.typing-input {
  width: 100%;
  max-width: 400px;
  padding: 1rem 1.5rem;
  font-size: 1.3rem;
  border: 3px solid #e0e0e0;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  font-family: inherit;
  text-align: center;
}

.typing-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ===== Bucket Page ===== */
.bucket-page h1 {
  color: white;
  text-align: center;
  margin-bottom: 1.5rem;
}

.bucket-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.tab-btn {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-small);
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
  background: var(--bg-white);
  color: var(--color-primary);
}

a.tab-btn-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  background: var(--color-error);
  color: white;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-left: 0.3rem;
}

.search-box {
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
}

.search-box input:focus {
  outline: 3px solid var(--color-primary);
}

.tab-content {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.vocab-list {
  list-style: none;
}

.vocab-item-words {
  flex: 1;
}

.vocab-item-en {
  font-weight: 700;
  color: var(--text-dark);
}

.vocab-item-de {
  color: var(--text-light);
}

.vocab-item-level {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  color: white;
  font-weight: 500;
}

.vocab-item-action {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.vocab-item-action.add {
  background: var(--color-success);
  color: white;
}

.vocab-item-action.remove {
  background: var(--color-error);
  color: white;
}

.vocab-item-box {
  background: #e0e0e0;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ===== Add Page ===== */
.add-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
}

.add-page h1 {
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.add-page .subtitle {
  color: var(--text-light);
  text-align: center;
  margin-bottom: 2rem;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input {
  padding: 1rem;
  font-size: 1.1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.add-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-small);
  text-align: center;
  font-weight: 600;
}

.add-feedback.success {
  background: #e8f5e9;
  color: var(--color-success);
}

.add-feedback.error {
  background: #ffebee;
  color: var(--color-error);
}

/* ===== Result Page ===== */
.result-page {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.result-page h1 {
  color: var(--color-primary);
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 3rem;
  font-weight: 800;
}

.stat-item.correct .stat-value {
  color: var(--color-success);
}

.stat-item.incorrect .stat-value {
  color: var(--color-error);
}

.stat-label {
  color: var(--text-light);
  font-weight: 600;
}

.result-message {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 2rem;
}

/* ===== Auth Page - Child-friendly login ===== */
.auth-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 500px;
  margin: 1rem auto;
}

.auth-page h1 {
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

.auth-page h2 {
  color: var(--text-dark);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.auth-page p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form input {
  padding: 1rem 1.5rem;
  font-size: 1.3rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius);
  text-align: center;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Saved user card */
.saved-user-card {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.welcome-back {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.saved-user-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.saved-user-emoji {
  font-size: 2.5rem;
}

.saved-user-name {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-dark);
}

.saved-user-card .btn {
  margin-bottom: 0.5rem;
}

/* Picker Grid for animals and colors */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.picker-item:hover {
  background: #e9ecef;
  transform: scale(1.05);
}

.picker-item.selected {
  border-color: var(--color-primary);
  background: #e3f2fd;
}

.picker-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

.picker-name {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Auth summary */
.auth-summary {
  background: #f8f9fa;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-light);
}

.summary-value {
  font-weight: bold;
  color: var(--text-dark);
}

.auth-hint {
  font-size: 0.9rem;
  color: var(--color-primary);
  background: #fff3cd;
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.auth-error {
  background: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Responsive adjustments for auth */
@media (max-width: 480px) {
  .picker-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }

  .picker-emoji {
    font-size: 2rem;
  }

  .picker-name {
    font-size: 0.65rem;
  }

  .auth-page {
    padding: 1.5rem;
    margin: 0.5rem;
  }
}

/* Legacy styles kept for compatibility */
.no-user-page {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
}

.no-user-page h1 {
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.no-user-page p {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.user-form input {
  padding: 1rem 1.5rem;
  font-size: 1.2rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius);
  text-align: center;
  font-family: inherit;
}

.user-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.hint {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  max-width: 500px;
  margin: 0 auto;
}

.empty-state-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.empty-state-icon,
.empty-state-card .empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h2,
.empty-state-card h2 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.empty-state-main {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
}

.empty-state-explanation {
  background: #f8f9fa;
  border-radius: var(--radius-small);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.6;
}

.empty-state-explanation p {
  margin-bottom: 0.5rem;
}

.empty-state-explanation p:last-child {
  margin-bottom: 0;
}

.empty-state-explanation strong {
  color: var(--text-dark);
}

.empty-state-explanation em {
  color: var(--color-primary);
  font-style: normal;
  font-weight: 600;
}

.empty-state-next,
.empty-state-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-small);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.empty-state-next {
  background: #e3f2fd;
  color: #1565c0;
}

.empty-state-progress {
  background: #fff8e1;
  color: #f57c00;
}

.next-icon,
.progress-icon {
  font-size: 1.25rem;
}

.empty-state .btn,
.empty-state-card .btn {
  margin-top: 0.5rem;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* ===== Tutorial Page ===== */
.tutorial-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 700px;
  margin: 0 auto;
}

.tutorial-page h1 {
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.tutorial-page .subtitle {
  color: var(--text-light);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.tutorial-boxes {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tutorial-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  background: #f5f5f5;
  transition: transform 0.2s;
}

.tutorial-box:hover {
  transform: translateX(8px);
}

.box-number {
  font-size: 1.2rem;
  font-weight: 800;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  color: white;
  min-width: 70px;
  text-align: center;
}

.box-1 .box-number { background: #f44336; }
.box-2 .box-number { background: #FF9800; }
.box-3 .box-number { background: #FFC107; }
.box-4 .box-number { background: #8BC34A; }
.box-5 .box-number { background: #4CAF50; }

.box-title {
  font-weight: 700;
  color: var(--text-dark);
  min-width: 120px;
}

.box-desc {
  color: var(--text-light);
  flex: 1;
}

.tutorial-rules {
  background: #f0f4ff;
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.tutorial-rules h2 {
  color: var(--color-primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0;
}

.rule-icon {
  font-size: 1.5rem;
}

.rule-text {
  flex: 1;
}

.tutorial-tip {
  background: #fff8e1;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  border-left: 4px solid #FFC107;
  margin-bottom: 2rem;
}

.tutorial-actions {
  text-align: center;
}

.tutorial-link {
  text-align: center;
  margin-top: 1.5rem;
}

.tutorial-link a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  transition: all 0.2s;
}

.tutorial-link a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ===== Tutorial Page Mobile ===== */
@media (max-width: 480px) {
  .tutorial-page {
    padding: 1rem;
    margin: 0;
  }

  .tutorial-page h1 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
  }

  .tutorial-page .subtitle {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .tutorial-boxes {
    gap: 0.4rem;
    margin-bottom: 1rem;
  }

  .tutorial-box {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .tutorial-box:hover {
    transform: none;
  }

  .box-number {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    min-width: 45px;
  }

  .box-title {
    font-size: 0.85rem;
    min-width: auto;
  }

  .box-desc {
    display: none;
  }

  .tutorial-rules {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .tutorial-rules h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .rule {
    padding: 0.4rem 0;
    gap: 0.5rem;
  }

  .rule-icon {
    font-size: 1.1rem;
  }

  .rule-text {
    font-size: 0.85rem;
  }

  .tutorial-tip {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
  }

  .tutorial-actions .btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }
}

/* ===== Form Select ===== */
.form-group select {
  padding: 1rem;
  font-size: 1.1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
  background: white;
  cursor: pointer;
}

.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ===== Vocab Item Author ===== */
.vocab-item-author {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

/* ===== Box Badge with Tutorial Link ===== */
.vocab-item-box {
  background: #e0e0e0;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: help;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.vocab-item-box:hover {
  background: #d0d0d0;
}

/* ===== Vocab Item Audio Buttons ===== */
.vocab-item-audio {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.btn-toggle-sentence-list {
  background: rgba(108, 99, 255, 0.1);
  border: 2px solid var(--color-primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-toggle-sentence-list svg {
  fill: var(--color-primary);
  transition: fill 0.2s;
}

.btn-toggle-sentence-list:hover {
  background: var(--color-primary);
}

.btn-toggle-sentence-list:hover svg {
  fill: white;
}

.btn-toggle-sentence-list.expanded {
  background: var(--color-primary);
}

.btn-toggle-sentence-list.expanded svg {
  fill: white;
}

/* ===== Vocab Item Sentence Section ===== */
.vocab-item-sentence {
  width: 100%;
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e0e0e0;
}

.sentence-content-list {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
  border-radius: var(--radius-small);
}

.sentence-row-list {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.sentence-row-list .btn-audio {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.sentence-row-list .btn-audio .audio-icon {
  fill: white;
}

.sentence-row-list .btn-audio:hover {
  background: rgba(255, 255, 255, 0.4);
}

.sentence-text {
  flex: 1;
}

.sentence-en-list {
  font-size: 1rem;
  color: white;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.sentence-de-list {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

.sentence-content-list .sentence-loading {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
}

.sentence-content-list .sentence-error {
  text-align: center;
  color: rgba(255, 200, 200, 0.9);
}

/* Update vocab-item to use CSS grid for sentence expansion */
.vocab-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  gap: 1rem;
}

.vocab-item:last-child {
  border-bottom: none;
}

/* ===== Responsive ===== */
/* ===== Burger Menu (hidden on desktop) ===== */
.burger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 201;
}

.burger-line {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.burger-menu.active .burger-line:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.burger-menu.active .burger-line:nth-child(2) {
  opacity: 0;
}

.burger-menu.active .burger-line:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
}

.nav-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .burger-menu {
    display: flex;
  }

  #app-header {
    padding: 1rem;
    gap: 1rem;
  }

  #main-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-white);
    flex-direction: column;
    padding: 80px 1.5rem 2rem;
    box-shadow: var(--shadow-large);
    z-index: 200;
    transition: left 0.3s ease;
    gap: 0.5rem;
  }

  #main-nav.open {
    left: 0;
  }

  #main-nav .nav-link {
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: var(--radius);
    text-align: left;
  }

  #main-nav .nav-link:hover,
  #main-nav .nav-link.active {
    background: var(--bg-light);
    color: var(--color-primary);
  }

  #app-content {
    padding: 1rem;
  }

  .mode-cards {
    grid-template-columns: 1fr;
  }

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

  .vocab-word {
    font-size: 2rem;
  }

  .flashcard-front, .flashcard-back {
    min-height: 320px;
  }

  .flashcard {
    min-height: 320px;
  }

  .flashcard-container {
    min-height: 320px;
  }

  .flashcard-container.sentence-expanded {
    min-height: 480px;
  }

  .flashcard-container.sentence-expanded .flashcard,
  .flashcard-container.sentence-expanded .flashcard-front,
  .flashcard-container.sentence-expanded .flashcard-back {
    min-height: 480px;
  }

  .bucket-tabs {
    flex-direction: column;
  }

  .vocab-item {
    grid-template-columns: auto 1fr auto;
  }

  .vocab-item-audio {
    grid-row: 1;
    grid-column: 1;
  }

  .vocab-item-level {
    grid-row: 1;
    grid-column: 1;
    display: none;
  }

  .vocab-item-words {
    grid-row: 1;
    grid-column: 2;
  }

  .vocab-item-box {
    grid-row: 1;
    grid-column: 3;
  }

  .vocab-item-action {
    grid-row: 1;
    grid-column: 3;
  }

  .result-stats {
    flex-direction: column;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .nav-link {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .answer-buttons {
    flex-direction: column;
    width: 100%;
  }

  .answer-buttons .btn {
    width: 100%;
  }
}

/* ===== Games Hub Page ===== */
.games-hub-page {
  text-align: center;
}

.games-hub-page h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.token-balance {
  background: var(--bg-white);
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.token-icon {
  font-size: 2.5rem;
}

.token-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.token-count {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}

.token-label {
  font-size: 0.9rem;
  color: var(--text-light);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.game-card {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border-top: 4px solid var(--color-primary);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.game-card-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.game-card-title {
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.game-card-desc {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.btn-play {
  width: 100%;
}

.btn-play:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.games-earn-notice {
  background: rgba(255, 255, 255, 0.15);
  padding: 1.5rem;
  border-radius: var(--radius);
  color: white;
  margin-bottom: 2rem;
}

.games-earn-notice p {
  margin-bottom: 1rem;
}

.leaderboard-preview {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.leaderboard-preview h2 {
  color: var(--color-primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-small);
  margin-bottom: 0.5rem;
  background: #f5f5f5;
}

.leaderboard-entry.is-current-user {
  background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
  border: 2px solid var(--color-primary);
}

.leaderboard-rank {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-primary);
  min-width: 2rem;
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
}

.leaderboard-score {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-success);
}

.no-scores {
  text-align: center;
  color: var(--text-light);
  padding: 1rem;
}

/* ===== Snake Game Page ===== */
.snake-game-page {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.game-score {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.score-label {
  font-size: 1rem;
  color: var(--text-light);
}

.score-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-primary);
}

.btn-pause {
  background: var(--color-warning);
  color: white;
}

.game-word-display {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  text-align: center;
}

.game-word-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.game-word-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.game-word {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.game-word-container .btn-audio-small {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.game-word-container .btn-audio-small .audio-icon {
  fill: white;
}

.game-word-container .btn-audio-small:hover {
  background: rgba(255, 255, 255, 0.4);
}

.game-canvas-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto 1rem;
  aspect-ratio: 6 / 5;
}

#game-canvas {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  border: 3px solid var(--color-primary);
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 46, 0.95);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  overflow-y: auto;
}

.overlay-content {
  text-align: center;
  color: white;
  padding: 1.5rem;
  width: 100%;
  max-width: 350px;
}

.overlay-content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: #fff;
}

.overlay-content p {
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.final-score {
  font-size: 1.5rem;
  font-weight: 700;
}

/* How-To Page */
.howto-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
  min-height: calc(100vh - 80px);
  overflow-y: auto;
}

.howto-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  margin-bottom: 1rem;
}

.howto-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--color-primary);
}

.howto-subtitle {
  color: var(--text-light);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.howto-section {
  margin-bottom: 1rem;
  text-align: left;
}

.howto-section h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.2rem;
  display: inline-block;
}

.howto-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.howto-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-small);
}

.howto-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.howto-ball {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.howto-item span:last-child {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
}

.howto-warning {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--radius-small);
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font-size: 0.85rem;
}

.howto-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.howto-card .btn {
  margin: 0;
  width: 100%;
}

.howto-card .btn-large {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
}

/* Mobile optimizations for how-to page */
@media (max-width: 480px) {
  .howto-page {
    padding: 0.75rem;
  }

  .howto-card {
    padding: 1rem;
    border-radius: var(--radius);
  }

  .howto-card h1 {
    font-size: 1.3rem;
  }

  .howto-subtitle {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .howto-section {
    margin-bottom: 0.75rem;
  }

  .howto-section h3 {
    font-size: 0.85rem;
  }

  .howto-item {
    padding: 0.4rem 0.6rem;
    gap: 0.5rem;
  }

  .howto-icon {
    font-size: 1rem;
    width: 1.2rem;
  }

  .howto-ball {
    width: 14px;
    height: 14px;
  }

  .howto-item span:last-child {
    font-size: 0.8rem;
  }

  .howto-warning {
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }
}

.btn-start-game {
  font-size: 1.1rem;
  padding: 0.7rem 2rem;
  margin-top: 0.5rem;
}

.game-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.legend-correct .legend-color {
  background: #4CAF50;
}

.legend-apple .legend-color {
  background: #ffd700;
  border-radius: 50%;
}

.legend-wrong .legend-color {
  background: #f44336;
}

.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.control-row {
  display: flex;
  gap: 0.25rem;
}

.control-btn {
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
  border: 2px solid var(--color-primary);
  background: rgba(108, 99, 255, 0.1);
  color: var(--color-primary);
  border-radius: var(--radius-small);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.control-btn:hover, .control-btn:active {
  background: var(--color-primary);
  color: white;
}

/* ===== Game Result Page ===== */
.game-result-page {
  background: var(--bg-white);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}

.game-result-page h1 {
  color: var(--color-primary);
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.game-result-score {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.result-score-value {
  font-size: 4rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.result-score-label {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0.5rem;
}

.game-result-stats {
  margin-bottom: 1.5rem;
}

.result-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: var(--radius-small);
  margin-bottom: 0.5rem;
}

.result-stat .stat-icon {
  font-size: 1.5rem;
}

.result-stat .stat-text {
  font-size: 1rem;
}

#personal-best-stat {
  background: linear-gradient(135deg, #ffd70020 0%, #ffaa0020 100%);
  border: 2px solid #ffd700;
}

.game-result-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-leaderboard {
  border-top: 1px solid #e0e0e0;
  padding-top: 1.5rem;
}

.result-leaderboard h2 {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

/* ===== No Token Page ===== */
.no-token-page {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
}

.no-token-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.no-token-page h1 {
  color: var(--color-error);
  margin-bottom: 1rem;
}

.no-token-page p {
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.no-token-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

/* ===== Token Earned Notification ===== */
.token-earned-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  animation: slide-up 0.3s ease-out, shake 0.5s 0.3s ease-in-out;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-5deg); }
  75% { transform: translateX(-50%) rotate(5deg); }
}

.token-earned-notification .notification-icon {
  font-size: 2rem;
}

.token-earned-notification .notification-text {
  font-weight: 600;
}

.token-earned-notification .notification-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Games Responsive ===== */
@media (max-width: 768px) {
  .snake-game-page {
    padding: 1rem;
  }

  .game-word {
    font-size: 1.4rem;
  }

  .game-controls {
    margin-top: 1rem;
  }

  .control-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .game-legend {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .token-balance {
    padding: 1rem;
  }

  .token-icon {
    font-size: 2rem;
  }

  .token-count {
    font-size: 1.5rem;
  }

  .game-result-score {
    padding: 1.5rem;
  }

  .result-score-value {
    font-size: 3rem;
  }
}

/* ===== Box Distribution ===== */
.box-distribution-container {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.box-distribution-container h3 {
  margin-bottom: 1rem;
  color: var(--text-dark);
  font-size: 1.1rem;
  text-align: center;
}

.box-items {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.box-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-small);
  background: linear-gradient(180deg, var(--box-color) 0%, color-mix(in srgb, var(--box-color) 70%, #000) 100%);
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.box-item.active {
  box-shadow: 0 4px 12px color-mix(in srgb, var(--box-color) 40%, transparent);
}

.box-item.empty {
  opacity: 0.4;
}

.box-item:hover {
  transform: translateY(-2px);
}

.box-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

.box-label {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.box-hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: var(--radius-small);
}

.box-hint strong {
  color: var(--color-primary);
}

.box-hint-success {
  background: #e8f5e9;
  color: #2e7d32;
}

@media (max-width: 480px) {
  .box-items {
    flex-wrap: wrap;
    justify-content: center;
  }

  .box-item {
    flex: 0 0 calc(33.33% - 0.5rem);
    margin-bottom: 0.5rem;
  }

  .box-count {
    font-size: 1.25rem;
  }

  .box-label {
    font-size: 0.6rem;
  }
}

/* ===== Level System ===== */
.level-progress-container {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}

.level-progress-container h3 {
  margin-bottom: 1rem;
  color: var(--text-dark);
  font-size: 1.1rem;
}

.level-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.level-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.level-bar-row.locked {
  opacity: 0.5;
}

.level-bar-row.current {
  opacity: 1;
}

.level-bar-row.can-unlock {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

.level-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.level-bar-container {
  flex: 1;
  height: 24px;
  background: #e0e0e0;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.level-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.5s ease;
}

.level-bar-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--text-dark);
  text-shadow: 0 0 2px white;
}

.level-name {
  font-size: 0.8rem;
  color: var(--text-light);
  width: 100px;
  text-align: right;
}

.unlock-level-card {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #fff9e6, #fffbf0);
  border: 2px solid #ffc107;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: celebrate 0.5s ease-out;
}

@keyframes celebrate {
  0% { transform: scale(0.9); opacity: 0; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

.unlock-level-icon {
  font-size: 2.5rem;
  animation: bounce 1s infinite;
}

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

.unlock-level-text {
  text-align: center;
  font-size: 1rem;
  color: var(--text-color);
  line-height: 1.4;
}

.unlock-level-text strong {
  font-size: 1.1rem;
  color: #e67e00;
}

.unlock-level-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--color-success), #45a049);
  border: none;
  border-radius: var(--radius-small);
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: glow 2s infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--color-success); }
  50% { box-shadow: 0 0 20px var(--color-success); }
}

.unlock-level-btn:hover {
  transform: scale(1.02);
}

.level-hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Level Up Notification */
.level-up-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, var(--color-success), #45a049);
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(76, 175, 80, 0.4);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.level-up-notification.show {
  transform: translateX(-50%) translateY(0);
}

.level-up-icon {
  font-size: 2rem;
}

.level-up-text {
  display: flex;
  flex-direction: column;
}

.level-up-text strong {
  font-size: 1.1rem;
}

.level-up-text span {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Level Badge on Vocab Items */
.vocab-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  margin-left: 0.5rem;
}

@media (max-width: 480px) {
  .level-bar-row {
    gap: 0.5rem;
  }

  .level-badge {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .level-name {
    width: 70px;
    font-size: 0.7rem;
  }

  .level-bar-text {
    font-size: 0.65rem;
  }
}

/* ===== Onboarding Page ===== */
.onboarding-page {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.onboarding-page h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.onboarding-page .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.onboarding-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.onboarding-choice {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.3s;
  border: 3px solid transparent;
}

.onboarding-choice:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: var(--color-primary);
}

.onboarding-choice-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.onboarding-choice h2 {
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.onboarding-choice p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.onboarding-choice-features {
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-light);
}

.onboarding-choice-features li {
  margin-bottom: 0.3rem;
}

/* ===== Add Choice Page ===== */
.add-choice-page {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.add-choice-page h1 {
  font-size: 2rem;
  color: white;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.add-choice-page .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.add-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.add-choice-card {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-dark);
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border-top: 4px solid var(--color-primary);
}

.add-choice-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.add-choice-card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.add-choice-card h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.add-choice-card p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ===== Import Page ===== */
.import-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.import-page h1 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.import-page .subtitle {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.qr-code-section {
  margin-bottom: 2rem;
}

.qr-code-container {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  display: inline-block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-code-container img {
  display: block;
  max-width: 200px;
}

.qr-code-section p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-top: 1rem;
}

.import-divider {
  display: flex;
  align-items: center;
  margin: 2rem 0;
  color: var(--text-light);
}

.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.import-divider span {
  padding: 0 1rem;
  font-weight: 600;
}

.upload-area {
  border: 3px dashed #e0e0e0;
  border-radius: var(--radius);
  padding: 2rem;
  transition: all 0.2s;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--color-primary);
  background: rgba(108, 99, 255, 0.05);
}

.upload-area-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-area p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.upload-area input[type="file"] {
  display: none;
}

.btn-upload {
  background: var(--color-primary);
  color: white;
}

/* Import Waiting State */
.import-waiting {
  text-align: center;
  padding: 2rem;
}

.import-waiting-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

.import-waiting h2 {
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.import-waiting p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.import-waiting .btn-secondary {
  margin-top: 1rem;
}

/* Import Processing State */
.import-processing {
  text-align: center;
  padding: 2rem;
}

.import-processing-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid #e0e0e0;
  border-top: 5px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.import-processing h2 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.import-processing p {
  color: var(--text-light);
}

/* Import Complete State */
.import-complete {
  text-align: center;
  padding: 2rem;
}

.import-complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--color-success);
}

.import-complete h2 {
  color: var(--color-success);
  margin-bottom: 1rem;
}

.import-complete p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ===== Import Mobile Page ===== */
.import-mobile-page {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.import-mobile-page h1 {
  color: var(--color-primary);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.import-mobile-page .subtitle {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.camera-area {
  background: #f5f5f5;
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  margin-bottom: 1.5rem;
}

.camera-area-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.camera-area p {
  color: var(--text-light);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.camera-area input[type="file"] {
  display: none;
}

.btn-camera {
  background: var(--color-primary);
  color: white;
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-camera:hover {
  background: #5a52d5;
}

.image-preview {
  margin-top: 1rem;
}

.image-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-small);
  box-shadow: var(--shadow);
}

.preview-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

/* ===== Mobile Buttons (for import) ===== */
.mobile-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.mobile-buttons .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
  font-size: 1.1rem;
}

.mobile-buttons .btn-icon {
  font-size: 1.5rem;
}

.mobile-capture-btn,
.mobile-upload-btn {
  width: 100%;
}

/* Import Mobile Done Page */
.import-mobile-done {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 400px;
  margin: 2rem auto;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.import-mobile-done .done-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.import-mobile-done h1 {
  color: var(--color-correct);
  margin-bottom: 0.5rem;
}

.import-mobile-done p {
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.import-mobile-done .hint {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 1.5rem;
}

/* Mobile upload status */
.mobile-upload-status {
  background: var(--color-primary-light);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.upload-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.upload-count-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.upload-count-label {
  color: var(--text-main);
}

.upload-hint {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.mobile-done-actions {
  margin-top: 1.5rem;
}

/* ===== Import Live View (Desktop) ===== */
.import-live-section {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.live-header h2 {
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.live-hint {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.live-images {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.live-image-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-radius: var(--radius-small);
  border-left: 4px solid #ccc;
}

.live-image-item.uploading {
  border-left-color: var(--color-primary);
}

.live-image-item.processing {
  border-left-color: #ffc107;
}

.live-image-item.done {
  border-left-color: var(--color-correct);
}

.live-image-item.failed {
  border-left-color: var(--color-wrong);
}

.live-image-icon {
  font-size: 1.25rem;
}

.live-image-status {
  flex: 1;
  color: var(--text-main);
}

.mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.live-vocabs-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.live-vocabs-section h3 {
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.live-vocabs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.live-vocab-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f9f9f9;
  border-radius: var(--radius-small);
  font-size: 0.9rem;
}

.live-vocab-item .vocab-en {
  color: var(--color-primary);
  font-weight: 600;
}

.live-vocab-item .vocab-sep {
  color: var(--text-light);
}

.live-vocab-item .vocab-de {
  color: var(--text-main);
}

.live-actions {
  margin-top: 1.5rem;
  text-align: center;
}

/* ===== Import Review Page ===== */
.import-review-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

.import-review-page h1 {
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 0.5rem;
}

.import-review-page .subtitle {
  color: var(--text-light);
  text-align: center;
  margin-bottom: 2rem;
}

.vocab-review-list {
  list-style: none;
  margin-bottom: 2rem;
}

.vocab-review-item {
  display: grid;
  grid-template-columns: 1fr 1fr 90px 40px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: var(--radius-small);
  margin-bottom: 0.5rem;
}

.vocab-review-item input {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.vocab-review-item input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.vocab-review-item select {
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  background: white;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.vocab-review-item .btn-remove,
.vocab-review-item .vocab-delete {
  width: 36px;
  height: 36px;
  padding: 0;
  min-height: auto;
  font-size: 1.2rem;
  background: var(--color-error);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  flex-shrink: 0;
}

.collection-name-section {
  margin-bottom: 2rem;
}

.collection-name-section label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.collection-name-section input,
.collection-name-section select {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
}

.collection-name-section input:focus,
.collection-name-section select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.review-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.review-actions .btn {
  flex: 1;
  min-width: 150px;
}

/* ===== Collections Page ===== */
.collections-page {
  max-width: 700px;
  margin: 0 auto;
}

.collections-page h1 {
  font-size: 2rem;
  color: white;
  text-align: center;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.collections-page .subtitle {
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 2rem;
}

.collections-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.collections-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.collection-card {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.collection-card:hover {
  transform: translateX(8px);
  box-shadow: var(--shadow-hover);
}

.collection-card-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.collection-card-info {
  flex: 1;
}

.collection-card-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.collection-card-meta {
  font-size: 0.9rem;
  color: var(--text-light);
}

.collection-card-arrow {
  font-size: 1.5rem;
  color: var(--color-primary);
}

.collections-empty {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: var(--radius);
  text-align: center;
}

.collections-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.collections-empty h2 {
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.collections-empty p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ===== Collection Detail Page ===== */
.collection-detail-page {
  max-width: 800px;
  margin: 0 auto;
}

.collection-detail-page .collection-header {
  background: var(--bg-white);
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.collection-detail-page .collection-header h1 {
  color: var(--color-primary);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.collection-detail-page .collection-meta {
  color: var(--text-light);
  font-size: 0.95rem;
}

.collection-detail-page .back-link {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
}

.collection-detail-page .back-link:hover {
  color: var(--color-primary);
}

.collection-detail-page .collection-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  background: var(--bg-white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Manual vocab add form */
.collection-add-vocab {
  background: var(--bg-white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.collection-add-vocab h3 {
  font-size: 1rem;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.collection-add-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.collection-add-form input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
}

.collection-add-form input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.collection-add-form select {
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  background: white;
  cursor: pointer;
}

.collection-add-form button {
  padding: 0.5rem 1rem;
  font-size: 1.2rem;
  min-height: auto;
}

/* Collection vocab list with full styling */
.collection-detail-page .collection-vocab-list {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  max-height: none;
  overflow: visible;
}

.collection-detail-header {
  background: var(--bg-white);
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.collection-detail-header h1 {
  color: var(--color-primary);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.collection-detail-meta {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.collection-detail-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.collection-vocab-section {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.collection-vocab-header {
  padding: 1rem 1.5rem;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
  color: var(--text-dark);
}

.collection-vocab-list {
  list-style: none;
  max-height: 400px;
  overflow-y: auto;
}

.collection-vocab-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  gap: 1rem;
}

.collection-vocab-item:last-child {
  border-bottom: none;
}

.collection-vocab-words {
  flex: 1;
}

.collection-vocab-en {
  font-weight: 600;
  color: var(--text-dark);
}

.collection-vocab-de {
  color: var(--text-light);
  font-size: 0.9rem;
}

.collection-vocab-level {
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  color: white;
  font-size: 0.8rem;
  font-weight: 500;
}

.collection-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
}

.collection-danger-zone {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #fff5f5;
  border-radius: var(--radius);
  border: 1px solid #ffcccc;
}

.collection-danger-zone h3 {
  color: var(--color-error);
  margin-bottom: 0.5rem;
}

.collection-danger-zone p {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
}

/* ===== Import/Collections Responsive ===== */
@media (max-width: 768px) {
  .onboarding-choices {
    grid-template-columns: 1fr;
  }

  .add-choices {
    grid-template-columns: 1fr;
  }

  .vocab-review-item {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .vocab-review-item input.vocab-en,
  .vocab-review-item input.vocab-de {
    grid-column: span 1;
  }

  .vocab-review-item select.vocab-level {
    grid-column: 1;
  }

  .vocab-review-item .btn-remove,
  .vocab-review-item .vocab-delete {
    grid-column: 2;
    justify-self: end;
  }

  .collection-detail-actions {
    flex-direction: column;
  }

  .collection-detail-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .import-page,
  .import-mobile-page,
  .import-review-page {
    padding: 1.5rem;
  }

  .qr-code-container img {
    max-width: 160px;
  }

  .review-actions {
    flex-direction: column;
  }

  .review-actions .btn {
    width: 100%;
  }
}

/* ===== Learning Source Selector ===== */
.learning-source-selector {
  background: var(--bg-white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.learning-source-selector label {
  font-weight: 600;
  color: var(--text-dark);
}

.learning-source-selector select {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  font-family: inherit;
  background: white;
  cursor: pointer;
}

.learning-source-selector select:focus {
  outline: none;
  border-color: var(--color-primary);
}

@media (max-width: 480px) {
  .learning-source-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .learning-source-selector select {
    width: 100%;
  }
}

/* ===== Direction Selector (EN→DE / DE→EN) ===== */
.direction-selector {
  background: var(--bg-white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.direction-label {
  font-weight: 600;
  color: var(--text-dark);
}

.direction-buttons {
  display: flex;
  gap: 0.5rem;
}

.direction-btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-small);
  background: white;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.direction-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.direction-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

@media (max-width: 480px) {
  .direction-selector {
    flex-direction: column;
    align-items: stretch;
  }

  .direction-buttons {
    width: 100%;
    justify-content: center;
  }

  .direction-btn {
    flex: 1;
    text-align: center;
  }
}

/* ===== Mobile Import Mode ===== */
/* Minimal header for mobile import page (via QR code) */
body.mobile-import-mode #app-header {
  padding: 0.5rem 1rem;
  justify-content: center;
}

body.mobile-import-mode #app-header .logo {
  font-size: 1.4rem;
}

body.mobile-import-mode #app-header #main-nav,
body.mobile-import-mode #app-header .header-right,
body.mobile-import-mode #app-header .burger-menu,
body.mobile-import-mode #app-header .nav-overlay,
body.mobile-import-mode #app-footer {
  display: none;
}

body.mobile-import-mode #app-content {
  padding-top: 1rem;
}

/* ===== Interactive Tutorial System ===== */

/* Tutorial Overlay - dims background */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 950;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tutorial-overlay.active {
  opacity: 1;
}

/* Tutorial target element gets elevated z-index */
.tutorial-target {
  position: relative !important;
  z-index: 951 !important;
  pointer-events: auto !important;
  background-color: var(--card-bg, #fff) !important;
  border-radius: 12px;
}

/* Page-level tutorial targets get the app gradient background */
.bucket-page.tutorial-target,
.collections-page.tutorial-target,
.games-page.tutorial-target,
.tutorial-boxes.tutorial-target {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  padding: 1rem;
}

/* Import page keeps white background */
.import-page.tutorial-target {
  background: var(--bg-white) !important;
}

/* Ensure all children also appear above overlay */
.tutorial-target * {
  position: relative;
  z-index: 951;
}

/* Highlight box around target element */
.tutorial-highlight {
  position: absolute;
  border: 3px solid #FFD700;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.1);
  pointer-events: none;
  z-index: 952;
  animation: tutorialPulse 2s infinite;
}

@keyframes tutorialPulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.1);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.7), inset 0 0 30px rgba(255, 215, 0, 0.2);
    transform: scale(1.02);
  }
}

/* Tutorial Controls at bottom of screen */
.tutorial-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.tutorial-controls.active {
  transform: translateY(0);
}

/* Progress dots */
.tutorial-dots {
  display: flex;
  gap: 8px;
  padding: 0 1rem;
}

.tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  transition: all 0.3s ease;
}

.tutorial-dot.active {
  background: var(--color-primary);
  transform: scale(1.3);
}

.tutorial-dot.completed {
  background: var(--color-success, #4CAF50);
}

/* Tutorial buttons */
.tutorial-buttons {
  display: flex;
  gap: 0.75rem;
}

.tutorial-skip,
.tutorial-pause {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-small);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.tutorial-skip {
  background: transparent;
  color: var(--text-light);
}

.tutorial-skip:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-dark);
}

.tutorial-pause {
  background: var(--color-primary);
  color: white;
  min-width: 100px;
}

.tutorial-pause:hover {
  background: var(--color-primary-dark, #5a52d5);
  transform: translateY(-2px);
}

/* Progress bar under controls */
.tutorial-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--color-primary);
  transition: width 0.3s linear;
}

/* Fox positioning during tutorial */
.tutorial-active .fox-avatar-container {
  transition: all 0.5s ease;
}

/* Step counter */
.tutorial-step-counter {
  font-size: 0.85rem;
  color: var(--text-light);
  padding: 0 1rem;
  white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .tutorial-controls {
    padding: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tutorial-dots {
    order: 1;
    width: 100%;
    justify-content: center;
    padding: 0;
  }

  .tutorial-dot {
    width: 8px;
    height: 8px;
  }

  .tutorial-step-counter {
    order: 2;
    flex: 1;
    text-align: left;
    padding: 0;
  }

  .tutorial-buttons {
    order: 3;
  }

  .tutorial-skip,
  .tutorial-pause {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  .tutorial-pause {
    min-width: 80px;
  }
}

/* Tutorial start button in help modal */
#btn-start-tutorial {
  margin-top: 1.5rem;
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--color-primary), #8B5CF6);
  border: none;
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#btn-start-tutorial:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(108, 99, 255, 0.4);
}

#btn-start-tutorial::before {
  content: "🦊";
  font-size: 1.3rem;
}

/* ===== Session Exit Confirmation Modal ===== */
.session-exit-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.session-exit-modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.session-exit-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.session-exit-modal h3 {
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.session-exit-modal p {
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.session-exit-progress {
  background: var(--bg-light);
  border-radius: var(--radius-small);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.session-exit-progress span:last-child {
  font-weight: 600;
}

.session-exit-buttons {
  display: flex;
  gap: 0.75rem;
}

.session-exit-buttons .btn {
  flex: 1;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.session-exit-buttons .btn-secondary {
  background: var(--color-primary);
  color: white;
}

.session-exit-buttons .btn-secondary:hover {
  background: #5a52e0;
  transform: translateY(-2px);
}

.session-exit-buttons .btn-danger {
  background: transparent;
  color: var(--color-error);
  border: 2px solid var(--color-error);
}

.session-exit-buttons .btn-danger:hover {
  background: var(--color-error);
  color: white;
}

/* ===== Speed Match Game ===== */

.speedmatch-modes-page {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.modes-subtitle {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mode-card {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-dark);
  transition: all 0.2s;
  display: block;
}

.mode-card:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.mode-card:hover p {
  color: rgba(255, 255, 255, 0.9);
}

.mode-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.mode-card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.mode-card p {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0;
}

/* Speed Match Game Page */
.speedmatch-game-page {
  background: var(--bg-white);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 500px;
  margin: 0 auto;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
}

.speedmatch-game-page .game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Timer Bar */
.game-timer-bar {
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  margin: 0.5rem 0 1rem;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--color-primary);
  border-radius: 4px;
  transition: width 0.1s linear;
}

.timer-fill.critical {
  background: var(--color-error);
  animation: timer-pulse 0.3s infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Lives Display */
.game-lives {
  display: flex;
  gap: 0.25rem;
}

.game-lives .heart {
  font-size: 1.5rem;
  transition: all 0.3s;
}

.game-lives .heart.lost {
  opacity: 0.2;
  transform: scale(0.8);
}

/* Streak Display */
.game-streak {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-light);
  border-radius: 8px;
  font-weight: 600;
}

.game-streak.on-fire {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  animation: fireGlow 0.5s infinite alternate;
}

@keyframes fireGlow {
  from { box-shadow: 0 0 5px rgba(255, 107, 53, 0.5); }
  to { box-shadow: 0 0 15px rgba(255, 107, 53, 0.8); }
}

/* Arena */
.speedmatch-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 1rem;
}

.speedmatch-arena.shake {
  animation: arena-shake 0.3s ease-in-out;
}

@keyframes arena-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* Word Card */
.word-card-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  min-height: 120px;
  align-items: center;
}

.word-card {
  background: var(--color-primary);
  color: white;
  padding: 2rem 3rem;
  border-radius: var(--radius);
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s;
  position: relative;
}

.word-card.boss-card {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  animation: bossGlow 1s infinite alternate;
}

@keyframes bossGlow {
  from { box-shadow: 0 0 10px rgba(139, 92, 246, 0.5); }
  to { box-shadow: 0 0 30px rgba(139, 92, 246, 0.8); }
}

.boss-icon {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
}

.word-card .btn-audio-small {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.word-card .btn-audio-small:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Swipe Animations */
.word-card.swipe-left {
  animation: swipeLeft 0.3s ease-out forwards;
}

.word-card.swipe-right {
  animation: swipeRight 0.3s ease-out forwards;
}

.word-card.swipe-top {
  animation: swipeTop 0.3s ease-out forwards;
}

.word-card.swipe-bottom {
  animation: swipeBottom 0.3s ease-out forwards;
}

@keyframes swipeLeft {
  to { transform: translateX(-150%) rotate(-15deg); opacity: 0; }
}

@keyframes swipeRight {
  to { transform: translateX(150%) rotate(15deg); opacity: 0; }
}

@keyframes swipeTop {
  to { transform: translateY(-150%) rotate(-10deg); opacity: 0; }
}

@keyframes swipeBottom {
  to { transform: translateY(150%) rotate(10deg); opacity: 0; }
}

.word-card.correct-swipe {
  background: var(--color-success);
}

.word-card.wrong-swipe {
  background: var(--color-error);
}

/* Answer Options - Two Options */
.answer-options.two-options {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.answer-options.two-options .answer-option {
  flex: 1;
  padding: 1.5rem 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.answer-options.two-options .answer-option:hover {
  background: var(--color-primary);
  color: white;
  transform: scale(1.02);
}

.answer-options.two-options .answer-option.left .option-text::before {
  content: "\2190 ";
}

.answer-options.two-options .answer-option.right .option-text::after {
  content: " \2192";
}

/* Answer Options - Four Options */
.answer-options.four-options {
  display: grid;
  grid-template-areas:
    ". top ."
    "left . right"
    ". bottom .";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.5rem;
  max-width: 400px;
  margin: 0 auto;
}

.answer-options.four-options .answer-option {
  padding: 1rem 0.5rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-options.four-options .answer-option:hover {
  background: var(--color-primary);
  color: white;
  transform: scale(1.02);
}

.answer-options.four-options .answer-option.top { grid-area: top; }
.answer-options.four-options .answer-option.left { grid-area: left; }
.answer-options.four-options .answer-option.right { grid-area: right; }
.answer-options.four-options .answer-option.bottom { grid-area: bottom; }

.answer-options.four-options .answer-option.top .option-text::before { content: "\2191 "; }
.answer-options.four-options .answer-option.left .option-text::before { content: "\2190 "; }
.answer-options.four-options .answer-option.right .option-text::after { content: " \2192"; }
.answer-options.four-options .answer-option.bottom .option-text::after { content: " \2193"; }

.answer-option.flash-correct {
  background: var(--color-success) !important;
  color: white !important;
  animation: flashCorrect 0.3s ease-out;
}

@keyframes flashCorrect {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* How-To Page Styles */
.howto-ball {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.howto-ball.correct {
  background: var(--color-success);
}

.howto-ball.wrong {
  background: var(--color-error);
}

/* Speed Match Overlay */
.speedmatch-game-page .game-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.speedmatch-game-page .overlay-content {
  background: var(--bg-white);
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 400px;
  width: 90%;
  color: var(--text-primary);
}

.speedmatch-game-page .overlay-content h2 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.speedmatch-game-page .overlay-content p {
  color: var(--text-secondary);
}

.speedmatch-game-page .final-score {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 1rem 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .speedmatch-game-page {
    padding: 0.75rem;
    min-height: 85vh;
  }

  .word-card {
    padding: 1.5rem 2rem;
    font-size: 1.4rem;
  }

  .word-card .btn-audio-small {
    right: -35px;
  }

  .answer-options.two-options .answer-option {
    padding: 1rem;
    font-size: 1rem;
  }

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

  .speedmatch-game-page .game-header {
    font-size: 0.9rem;
  }

  .game-lives .heart {
    font-size: 1.2rem;
  }
}
