@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #141e30 0%, #243b55 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #ffffff;
  --text-muted: #b0bec5;
  --accent: #4facfe;
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-text: #000000;
  --correct: #00e676;
  --incorrect: #ff1744;
}

body.light-theme {
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.4);
  --text-main: #2c3e50;
  --text-muted: #546e7a;
  --accent: #ff4b2b;
  --input-bg: rgba(255, 255, 255, 0.95);
  --input-text: #2c3e50;
  --correct: #00c853;
  --incorrect: #d50000;
}

body {
  margin: 0; 
  height: 100vh; 
  display: flex; 
  justify-content: center;
  align-items: center; 
  background: var(--bg-gradient);
  font-family: 'Inter', sans-serif; 
  color: var(--text-main); 
  overflow: hidden;
  transition: background 0.5s ease;
}

.theme-toggle {
  position: fixed; top: 20px; right: 20px; background: var(--glass-bg);
  border: 1px solid var(--glass-border); color: var(--text-main);
  border-radius: 50%; width: 45px; height: 45px; font-size: 20px;
  cursor: pointer; backdrop-filter: blur(12px); transition: all 0.3s ease;
  display: flex; justify-content: center; align-items: center; z-index: 100;
}
.theme-toggle:hover { transform: scale(1.1); }

.glass-card {
  background: var(--glass-bg); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-border);
  border-radius: 20px; padding: 35px; box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  text-align: center; width: 90%; max-width: 550px; transition: all 0.5s ease;
  max-height: 88vh; overflow-y: auto;
}

.glass-card::-webkit-scrollbar { width: 6px; }
.glass-card::-webkit-scrollbar-track { background: transparent; }
.glass-card::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.hidden { display: none !important; }

h2 { margin-top: 0; font-size: 24px; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

input {
  width: 100%; padding: 15px; margin: 10px 0; border-radius: 10px;
  border: none; background: var(--input-bg); color: var(--input-text);
  font-size: 16px; box-sizing: border-box; outline: none;
}

button.action-btn {
  width: 100%; padding: 14px; border: none; border-radius: 10px;
  background: var(--accent); color: white; font-weight: 600;
  font-size: 15px; cursor: pointer; margin-top: 15px; transition: all 0.3s ease;
}
button.action-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }

button.secondary-btn {
  background: transparent; border: 1px solid var(--accent); color: var(--text-main);
}
button.secondary-btn:hover { background: rgba(255,255,255,0.1); }

/* === ВКЛАДКИ ДАШБОРДА === */
.dashboard-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

/* === АНАЛИТИКА ПРОГРЕССА УЧЕНИКА === */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.advice-banner {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.12) 0%, rgba(79, 172, 254, 0.12) 100%);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.analytics-section {
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 14px;
}

.analytics-section-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--accent);
}

.skills-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.skill-bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.skill-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.skill-track {
  width: 100%;
  height: 9px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s ease-out;
}

.mastered-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mastered-badge {
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.35);
  color: var(--correct);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.activity-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.history-meta {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.status-box { background: rgba(0, 0, 0, 0.12); padding: 15px; border-radius: 12px; margin: 15px 0; text-align: left; }
.highlight { font-weight: 800; color: var(--accent); }

.question-box { margin-bottom: 25px; text-align: left; }
.question-text { font-size: 18px; font-weight: 600; margin-bottom: 15px; line-height: 1.4; }

.option-btn {
  display: block; width: 100%; padding: 12px 15px; margin-bottom: 10px;
  border: 1px solid var(--glass-border); border-radius: 8px;
  background: rgba(0, 0, 0, 0.15); color: var(--text-main);
  font-size: 15px; text-align: left; cursor: pointer; transition: all 0.2s ease;
}
.option-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.option-btn.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1); border-left-color: var(--accent);
  border-radius: 50%; width: 40px; height: 40px;
  animation: spin 1s linear infinite; margin: 15px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.review-item { background: rgba(0, 0, 0, 0.15); border-radius: 10px; padding: 15px; margin-bottom: 15px; text-align: left; }
.review-q { font-weight: 600; margin-bottom: 10px; font-size: 15px; }
.review-wrong { color: var(--incorrect); font-size: 14px; margin: 5px 0; }
.review-correct { color: var(--correct); font-size: 14px; margin: 5px 0; font-weight: 600; }
.review-explanation { font-size: 13px; color: var(--text-muted); margin-top: 10px; border-top: 1px solid var(--glass-border); padding-top: 8px; font-style: italic; }

.watermark { position: fixed; bottom: 15px; right: 20px; font-size: 12px; letter-spacing: 1px; opacity: 0.5; }

/* === RPG, ШТРАФЫ И БАЗА ЗНАНИЙ === */
.streak-pill {
  background: rgba(255, 152, 0, 0.15);
  border: 1px solid rgba(255, 152, 0, 0.4);
  color: #ffb74d;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.streak-pill.penalty {
  background: rgba(255, 23, 68, 0.18);
  border-color: var(--incorrect);
  color: #ff5252;
}

.penalty-banner {
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid var(--incorrect);
  color: #ff8a80;
  border-radius: 12px;
  padding: 12px 15px;
  margin-bottom: 15px;
  text-align: left;
  box-shadow: 0 4px 20px rgba(255, 23, 68, 0.2);
  animation: penaltyPulse 1.8s infinite alternate;
}

@keyframes penaltyPulse {
  from { border-color: rgba(255, 23, 68, 0.5); }
  to { border-color: rgba(255, 23, 68, 1); }
}

.combo-pill {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--correct);
  color: var(--correct);
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 700;
  animation: pulseCombo 1s infinite alternate;
}

@keyframes pulseCombo {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.quests-panel {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  text-align: left;
}

.quests-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  border-left: 3px solid var(--accent);
}

.quest-item.done {
  opacity: 0.65;
  border-left-color: var(--correct);
  text-decoration: line-through;
}

.theory-banner-card {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.15) 0%, rgba(0, 230, 118, 0.08) 100%);
  border: 1px solid rgba(79, 172, 254, 0.45);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
}

.theory-banner-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.2);
}

.topic-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.topic-pill {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-pill:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.theory-lang-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.lang-switch-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switch-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.lang-switch-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.theory-content {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 18px;
  font-size: 14px;
  line-height: 1.6;
  max-height: 310px;
  overflow-y: auto;
}

.theory-content h3 {
  color: var(--accent);
  margin: 14px 0 6px 0;
  font-size: 16px;
}

.theory-content h3:first-child {
  margin-top: 0;
}

.theory-content ul {
  padding-left: 20px;
  margin: 6px 0;
}

.theory-content li {
  margin-bottom: 5px;
}

.theory-content code {
  background: rgba(79, 172, 254, 0.15);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: monospace;
  font-size: 13px;
}

/* === ЭКСПРЕСС-ПРОВЕРКА ЗНАНИЙ В AI ACADEMY === */
.theory-quiz-box {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  max-height: 360px;
  overflow-y: auto;
}

.mini-quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.mini-quiz-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.mini-quiz-q {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  line-height: 1.45;
}

.mini-opt-btn {
  display: block;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 7px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-opt-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.mini-opt-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.mini-opt-btn.correct {
  background: var(--correct) !important;
  border-color: var(--correct) !important;
  color: #000000 !important;
  font-weight: 600;
}

.mini-opt-btn.wrong {
  background: var(--incorrect) !important;
  border-color: var(--incorrect) !important;
  color: #ffffff !important;
}

.mini-quiz-exp {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--glass-border);
  line-height: 1.45;
}

.quiz-result-banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.quiz-result-banner.passed {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--correct);
  color: var(--correct);
}

.quiz-result-banner.failed {
  background: rgba(255, 23, 68, 0.15);
  border: 1px solid var(--incorrect);
  color: #ff8a80;
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  text-align: left;
}

.module-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--glass-border);
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.module-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.card-top h4 {
  margin: 0;
  font-size: 15px;
  color: var(--text-main);
}

.exp-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--correct);
  background: rgba(0, 230, 118, 0.12);
  padding: 3px 7px;
  border-radius: 6px;
}

.module-card p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.rankup-toast {
  position: fixed;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  border: 1px solid var(--correct);
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 230, 118, 0.35);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from { top: -60px; opacity: 0; }
  to { top: 25px; opacity: 1; }
}