/* ==========================================================================
   Design System & Theme Tokens - English 16 Lessons Game (Petrov Method)
   ========================================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Color Palette - Vibrant Dark / Indigo / Emerald */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-card-hover: rgba(51, 65, 85, 0.85);
  --bg-input: #334155;
  --border-color: rgba(148, 163, 184, 0.15);
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(248, 250, 252, 0.95);
  --bg-input: #e2e8f0;
  --border-color: rgba(148, 163, 184, 0.3);
  --border-focus: #4f46e5;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #0284c7;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --secondary: #0284c7;
  --accent: #d97706;
  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.1);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.2);
}

/* ==========================================================================
   Global Reset & Base
   ========================================================================== */

html {
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  transition: var(--transition);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-top-bar {
  display: contents;
}

.logo-group {
  order: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
}

.nav-links {
  order: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.header-stats {
  order: 3;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-pill.xp {
  color: var(--accent);
}

.stat-pill.streak {
  color: #f97316;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Main Container & Screens
   ========================================================================== */

.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.screen {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.screen.active {
  display: block;
}

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

/* ==========================================================================
   Hero Section & Progress Banner
   ========================================================================== */

.hero-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(14, 165, 233, 0.1));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: "16";
  position: absolute;
  right: -20px;
  bottom: -30px;
  font-size: 11rem;
  font-family: var(--font-heading);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.hero-content h2 {
  font-size: 1.9rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff, var(--text-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-content h2 {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-content p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 650px;
  margin-bottom: 1.25rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
}

.hero-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
}

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

/* ==========================================================================
   Lessons Grid
   ========================================================================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.4rem;
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.5rem;
}

.lesson-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.lesson-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.lesson-card.completed {
  border-color: rgba(16, 185, 129, 0.4);
}

.lesson-card.completed::before {
  content: "✓ ЗАВЕРШЕНО";
  position: absolute;
  top: 10px;
  right: -25px;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 30px;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.lesson-number-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.num-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.lesson-card.completed .num-circle {
  background: var(--success-light);
  color: var(--success);
}

.lesson-icon {
  font-size: 1.75rem;
}

.card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

.card-body p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.card-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.card-footer .btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   Theory View (Markdown Article)
   ========================================================================== */

.theory-container {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}

.theory-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.markdown-body {
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1.75;
}

.markdown-body h1 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.markdown-body h3 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.markdown-body p {
  margin-bottom: 1.2rem;
}

.markdown-body blockquote {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-primary);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--bg-secondary);
}

.markdown-body th, 
.markdown-body td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.markdown-body th {
  background: rgba(99, 102, 241, 0.2);
  font-weight: 700;
  color: var(--text-primary);
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

.markdown-body tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.markdown-body code {
  background: var(--bg-input);
  color: var(--text-accent);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.95em;
  font-family: monospace;
}

.markdown-body ul, .markdown-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.5rem;
}

.theory-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   Quiz / Interactive Game Screen
   ========================================================================== */

.quiz-wrapper {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-progress-bar-wrap {
  margin-bottom: 1.5rem;
}

.quiz-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.quiz-progress-track {
  height: 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

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

.quiz-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.quiz-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.badge-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.audio-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.audio-btn:hover {
  transform: scale(1.08);
}

.quiz-question-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 1.75rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  transition: var(--transition);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(4px);
}

.option-btn.correct {
  background: var(--success-light) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.option-btn.incorrect {
  background: var(--danger-light) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.option-btn:disabled {
  cursor: default;
}

.quiz-feedback {
  display: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 5px solid var(--primary);
  animation: slideDown 0.3s ease;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.correct-feedback {
  border-left-color: var(--success);
}

.quiz-feedback.wrong-feedback {
  border-left-color: var(--danger);
}

.feedback-title {
  font-weight: 800;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.quiz-feedback.wrong-feedback .feedback-title {
  color: var(--danger);
}

.feedback-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Results Summary Screen
   ========================================================================== */

.result-card {
  max-width: 550px;
  margin: 2rem auto;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.result-badge-anim {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-score-circle {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--font-heading);
  margin: 1rem 0;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.result-stat-col {
  display: flex;
  flex-direction: column;
}

.result-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.result-stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Verb Matrix Interactive Tool
   ========================================================================== */

.matrix-tool-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.matrix-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.verb-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.custom-select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
}

.pronoun-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pronoun-btn {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pronoun-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.matrix-grid {
  display: grid;
  grid-template-columns: 140px repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.matrix-header-cell {
  background: rgba(99, 102, 241, 0.2);
  padding: 1rem;
  text-align: center;
  font-weight: 800;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-row-title {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.matrix-cell {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}

.matrix-cell:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--bg-card-hover);
}

.matrix-cell-en {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.matrix-cell-ua {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.matrix-cell-speak {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0.3;
  font-size: 0.85rem;
}

.matrix-cell:hover .matrix-cell-speak {
  opacity: 1;
}

/* ==========================================================================
   Dictionary & Flashcards
   ========================================================================== */

.dict-filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.word-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.word-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

.word-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.word-en {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.word-transcription {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
}

.word-ua {
  font-size: 1rem;
  color: var(--text-accent);
  font-weight: 600;
  margin: 0.3rem 0;
}

.word-example {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.5rem;
  border-left: 2px solid var(--border-color);
  padding-left: 0.5rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .matrix-grid {
    grid-template-columns: 80px repeat(3, 1fr);
    font-size: 0.9rem;
  }
  .hero-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  /* Header adjustments */
  .app-header {
    padding: 0.5rem 0.75rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .header-container {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    max-width: 100%;
  }

  /* Top Row: Logo on Left + Stats (1 дн. ⭐ 0 XP ☀️) on Right on exact same line */
  .header-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.35rem;
  }

  .logo-group {
    order: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex-shrink: 0;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }

  .logo-text h1 {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  .logo-subtitle,
  .logo-text span {
    display: none !important;
  }

  .header-stats {
    order: 2;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    margin-left: auto;
  }

  .stat-pill {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.25rem 0.45rem;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .stat-pill span:first-child {
    font-size: 0.82rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
  }

  /* Bottom Row: Navigation Menu */
  .nav-links {
    order: 2;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.2rem;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    flex: 1;
    padding: 0.38rem 0.25rem;
    font-size: 0.76rem;
    justify-content: center;
    white-space: nowrap;
  }

  /* Main Container */
  .app-main {
    padding: 1.25rem 0.75rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Hero Banner */
  .hero-banner {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-md);
    gap: 1rem;
    max-width: 100%;
  }

  .hero-content h2 {
    font-size: 1.35rem;
  }

  .hero-content p {
    font-size: 0.88rem;
  }

  .hero-stats {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .stat-card {
    flex: 1;
    padding: 0.75rem 0.5rem;
    text-align: center;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  /* Lessons Grid */
  .lessons-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    width: 100%;
  }

  .lesson-card {
    padding: 1.25rem 1rem;
    width: 100%;
  }

  /* Matrix 3x3 Tool */
  .matrix-tool-wrap {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .matrix-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
  }

  .verb-select-wrap {
    width: 100%;
  }

  .custom-select {
    width: 100%;
  }

  .pronoun-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
  }

  .pronoun-btn {
    flex: 1 1 calc(16% - 0.35rem);
    min-width: 44px;
    padding: 0.4rem 0.2rem;
    font-size: 0.78rem;
    text-align: center;
  }

  #matrix-grid-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.75rem;
  }

  .matrix-grid {
    min-width: 520px;
    grid-template-columns: 95px repeat(3, 1fr);
    gap: 0.45rem;
    font-size: 0.85rem;
  }

  .matrix-header-cell {
    padding: 0.6rem 0.35rem;
    font-size: 0.78rem;
  }

  .matrix-row-title {
    font-size: 0.85rem;
    padding: 0.5rem;
  }

  .matrix-cell {
    padding: 0.75rem 0.4rem;
  }

  .matrix-cell-en {
    font-size: 0.95rem;
  }

  .matrix-cell-ua {
    font-size: 0.75rem;
  }

  /* Theory Screen */
  .theory-container {
    padding: 1.25rem 0.85rem;
    width: 100%;
    max-width: 100%;
  }

  .theory-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .theory-content pre, .theory-content code {
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
  }

  /* Quiz Screen */
  .quiz-card {
    padding: 1.25rem 1rem;
    width: 100%;
    max-width: 100%;
  }

  .quiz-question-text {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
  }

  .option-btn {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  .quiz-actions {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .quiz-actions button {
    width: 100%;
    justify-content: center;
  }

  /* Dictionary & Word Game Subtabs */
  .subtabs-nav {
    width: 100%;
    max-width: 100%;
    display: flex;
    gap: 0.35rem;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
  }

  .dict-subtab-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.35rem;
    font-size: 0.85rem;
  }

  .dict-direction-wrap {
    width: 100%;
    gap: 0.35rem;
  }

  .dict-dir-btn {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.78rem;
  }

  .alphabet-ribbon {
    gap: 0.25rem;
    padding: 0.5rem;
    width: 100%;
    max-width: 100%;
  }

  .letter-chip {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
  }

  .big-dict-grid, .words-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    width: 100%;
    max-width: 100%;
  }

  .dict-entry-card {
    width: 100%;
    max-width: 100%;
    padding: 1rem 0.85rem;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .game-card {
    padding: 1.25rem 1rem;
    width: 100%;
    max-width: 100%;
  }

  .game-options-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    width: 100%;
  }

  .game-opt-btn {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
  }
}

/* ==========================================================================
   Big Bilingual Dictionary & Word Guess Game Styles
   ========================================================================== */

.subtabs-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  background: var(--bg-card);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.dict-subtab-btn {
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.dict-subtab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.dict-subtab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.dict-direction-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.dict-dir-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition);
}

.dict-dir-btn:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

.dict-dir-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.alphabet-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.letter-chip {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: var(--transition);
}

.letter-chip:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.letter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dict-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.big-dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.dict-entry-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
}

.dict-entry-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  background: var(--bg-card-hover);
}

.dict-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.dict-headword {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
  font-family: var(--font-heading);
}

.dict-transcription {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
}

.dict-translation {
  font-size: 0.95rem;
  color: var(--text-accent);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.dict-card-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.btn-train-word {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
}

.btn-train-word:hover {
  color: var(--text-primary);
  transform: translateX(3px);
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

/* Word Game Arena */
.game-setup-box {
  max-width: 600px;
  margin: 2rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.game-setup-options {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 2rem 0;
  text-align: left;
}

.game-arena-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
}

.game-prompt-box {
  text-align: center;
  margin: 1.5rem 0 2rem;
}

.game-direction-title {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.game-prompt-word {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.game-prompt-hint {
  font-size: 1rem;
  color: var(--text-muted);
  font-family: monospace;
}

.game-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.game-opt-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: left;
  transition: var(--transition);
}

.game-opt-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.game-opt-btn.correct {
  background: var(--success-light) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.game-opt-btn.incorrect {
  background: var(--danger-light) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.game-feedback {
  display: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 5px solid var(--primary);
  animation: slideDown 0.3s ease;
}

.game-feedback.show {
  display: block;
}

.game-feedback.correct-feedback {
  border-left-color: var(--success);
}

.game-feedback.wrong-feedback {
  border-left-color: var(--danger);
}
