* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8fafc; color: #1e293b; min-height: 100vh; overflow-x: hidden; }

/* ВХОД */
.auth-container { width: 100%; max-width: 440px; margin: 8vh auto 0; padding: 0 20px; }
.auth-card { background: #fff; border-radius: 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.08); padding: 40px 36px; border: 1px solid #f1f5f9; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .icon { font-size: 48px; margin-bottom: 12px; display: block; }
.auth-logo h1 { font-size: 28px; font-weight: 800; background: linear-gradient(135deg, #7c3aed, #2563eb); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo p { font-size: 14px; color: #64748b; margin-top: 6px; }
.tabs { display: flex; background: #f1f5f9; border-radius: 12px; padding: 5px; margin-bottom: 24px; }
.tab { flex: 1; text-align: center; padding: 10px; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; border-radius: 8px; border: none; background: transparent; transition: 0.2s; }
.tab.active { background: #fff; color: #7c3aed; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 8px; }
.form-group input { width: 100%; padding: 14px; border: 2px solid #e2e8f0; border-radius: 12px; font-size: 15px; outline: none; transition: 0.2s; }
.form-group input:focus { border-color: #7c3aed; box-shadow: 0 0 0 4px rgba(124,58,237,0.1); }
.btn-primary { width: 100%; padding: 14px; background: #7c3aed; color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.hidden { display: none !important; }

/* ГЛАВНЫЙ ЭКРАН */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 290px; background: #fff; border-right: 1px solid #e2e8f0; padding: 24px; flex-shrink: 0; overflow-y: auto; height: 100vh; display: flex; flex-direction: column; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #f1f5f9; }
.user-badge { display: flex; align-items: center; gap: 10px; cursor: pointer; transition: 0.2s; }
.user-badge:hover { opacity: 0.8; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: #7c3aed; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.user-badge span { font-size: 15px; font-weight: 600; color: #1e293b; }
.btn-logout-side { background: #f8fafc; border: 1px solid #e2e8f0; padding: 8px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; transition: 0.2s; }
.btn-logout-side:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
.sidebar-brand { font-size: 20px; font-weight: 800; color: #1e293b; margin-bottom: 25px; display: flex; align-items: center; gap: 10px; }
.sidebar-brand::before { content: "🚀"; font-size: 24px; }
.modules-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; margin: 30px 0 15px; }
.nav-tabs { display: flex; flex-direction: column; gap: 6px; }
.nav-tab { padding: 14px 16px; border-radius: 12px; font-size: 15px; font-weight: 600; color: #475569; background: transparent; border: none; cursor: pointer; text-align: left; transition: 0.2s; }
.nav-tab:hover { background: #f1f5f9; }
.nav-tab.active { background: #f3e8ff; color: #7c3aed; }
.phone-nav-tab { color: #16a34a; background: #dcfce7; margin-top: 10px; }
.phone-nav-tab:hover { background: #bbf7d0; color: #15803d; }
.module { padding: 10px 14px; border-radius: 10px; font-size: 14px; color: #64748b; margin-bottom: 2px; cursor: pointer; transition: 0.2s; }
.module:hover { background: #f8fafc; color: #1e293b; }
.main { flex: 1; padding: 40px 50px; position: relative; height: 100vh; overflow-y: auto; }
.welcome-banner { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; border-radius: 20px; padding: 32px; margin-bottom: 40px; box-shadow: 0 10px 30px rgba(124,58,237,0.2); }
.welcome-banner h1 { font-size: 28px; margin-bottom: 8px; font-weight: 800; }
.welcome-banner p { font-size: 15px; opacity: 0.9; }

/* Уроки */
.lesson-header { font-size: 22px; font-weight: 800; color: #1e293b; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.lesson-header span { color: #7c3aed; background: #f3e8ff; padding: 4px 12px; border-radius: 8px; font-size: 18px; }
.lesson-section { margin-bottom: 40px; background: #fff; padding: 24px 30px; border-radius: 16px; border: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.circles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 18px; }
.circle-item { cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; transition: 0.2s; }
.circle-item:hover { transform: translateY(-4px); }
.circle-wrap { position: relative; display: inline-block; }
.circle { width: 60px; height: 60px; border-radius: 16px; background: #f1f5f9; color: #64748b; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; margin-bottom: 8px; transition: 0.2s; border: 2px solid transparent; }
.circle.done { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.circle-check { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: #10b981; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; border: 2px solid #fff; z-index: 2; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.circle-caption { font-size: 11px; font-weight: 600; color: #94a3b8; text-align: center; transition: 0.2s; }
.circle-item:hover .circle-caption { color: #7c3aed; }

/* Зал славы */
.top-header h2 { font-size: 28px; font-weight: 800; color: #1e293b; margin-bottom: 6px; }
.top-header p { font-size: 15px; color: #64748b; margin-bottom: 30px; }
.leaderboard { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; max-width: 700px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.leaderboard-row { display: flex; align-items: center; padding: 18px 24px; border-bottom: 1px solid #f1f5f9; font-size: 16px; transition: 0.2s; }
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: #f8fafc; }
.leaderboard-row.me { background: #f3e8ff; font-weight: 700; border-left: 4px solid #7c3aed; }
.lb-rank { width: 40px; font-size: 18px; font-weight: 800; color: #94a3b8; }
.lb-rank.gold { color: #fbbf24; }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #d97706; }
.lb-name { flex: 1; padding-left: 16px; color: #1e293b; font-weight: 600; }
.lb-score { font-weight: 800; color: #7c3aed; background: #f3e8ff; padding: 4px 12px; border-radius: 20px; font-size: 14px; }

/* ЭКРАН УРОКА */
.lesson-app { display: flex; height: 100vh; background: #f8fafc; }
.task-panel { width: 460px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; flex-shrink: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.02); z-index: 2; }
.task-top { padding: 24px 30px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.back-link { color: #7c3aed; text-decoration: none; font-size: 14px; font-weight: 600; transition: 0.2s; }
.back-link:hover { color: #4c1d95; }
.task-counter { font-size: 13px; font-weight: 700; color: #7c3aed; background: #f3e8ff; padding: 6px 14px; border-radius: 100px; }
.task-content-scroll { padding: 30px; flex: 1; overflow-y: auto; }
.task-title { font-size: 26px; font-weight: 800; color: #1e293b; margin-bottom: 16px; line-height: 1.3; }
.task-description { font-size: 16px; line-height: 1.8; color: #475569; margin-bottom: 24px; }
.task-description p { margin-bottom: 12px; }
.task-description b { color: #1e293b; }
.task-description code { background: #f1f5f9; color: #7c3aed; padding: 2px 8px; border-radius: 6px; font-family: 'Consolas', monospace; font-size: 14px; font-weight: 600; }
.task-hint { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 20px; font-size: 15px; color: #1e40af; line-height: 1.7; }
.task-hint b { display: block; margin-bottom: 10px; font-size: 16px; color: #1e3a8a; }
.hint-pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: 8px; font-family: 'Consolas', monospace; font-size: 14px; white-space: pre; margin-top: 10px; overflow-x: auto; }
.task-footer { padding: 24px 30px; border-top: 1px solid #f1f5f9; background: #fff; }
.task-progress-bar { height: 6px; background: #f1f5f9; border-radius: 10px; margin-bottom: 20px; overflow: hidden; }
.task-progress-fill { height: 100%; background: #7c3aed; border-radius: 10px; transition: width 0.4s; }
.task-actions { display: flex; gap: 12px; }
.btn-check { flex: 1; padding: 14px; background: #7c3aed; color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-check:hover { background: #6d28d9; box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.btn-skip { padding: 14px 24px; background: #f1f5f9; color: #64748b; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-skip:hover { background: #e2e8f0; color: #1e293b; }
.editor-panel { flex: 1; padding: 30px; display: flex; flex-direction: column; }
.editor-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filename { font-family: 'Consolas', monospace; font-size: 15px; color: #64748b; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.filename::before { content: "📄"; }
.editor-actions { display: flex; gap: 10px; }
.btn-small { padding: 8px 16px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; transition: 0.2s; }
.btn-small:hover { border-color: #cbd5e1; background: #f8fafc; }
.editor-wrap { display: flex; background: #1e293b; border-radius: 16px; overflow: hidden; flex: 1; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 1px solid #0f172a; }
.line-numbers { background: #0f172a; color: #64748b; padding: 20px 16px; font-family: 'Consolas', monospace; font-size: 15px; text-align: right; min-width: 50px; user-select: none; line-height: 1.6; }
.code-editor { flex: 1; background: #1e293b; color: #e2e8f0; border: none; padding: 20px; font-family: 'Consolas', monospace; font-size: 15px; resize: none; outline: none; line-height: 1.6; tab-size: 4; }
.code-editor::placeholder { color: #475569; }
.result-panel { padding: 20px; border-radius: 12px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.result-panel.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.result-panel.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Модалки */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: 0.3s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.admin-modal { background: #fff; border-radius: 20px; max-width: 480px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); transform: translateY(20px); transition: 0.3s; }
.modal-overlay.active .admin-modal { transform: translateY(0); }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-size: 22px; font-weight: 800; color: #1e293b; }
.modal-close { background: #f1f5f9; border: none; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 18px; color: #64748b; transition: 0.2s; }
.modal-close:hover { background: #e2e8f0; color: #1e293b; }
.admin-section { margin-bottom: 24px; }
.admin-info { background: #f8fafc; border-radius: 12px; padding: 20px; border: 1px solid #f1f5f9; }
.admin-info-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; color: #475569; }
.admin-info-row b { color: #1e293b; font-weight: 800; font-size: 16px; }
.admin-btn { display: block; width: 100%; padding: 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; font-size: 15px; font-weight: 600; color: #475569; cursor: pointer; transition: 0.2s; text-align: center; }
.admin-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.admin-btn.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.admin-btn.danger:hover { background: #fee2e2; }

/* ЗВОНОК */
.call-modal { max-width: 1100px; height: 90vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; background: #fff; }
.call-prompt { padding: 40px; display: flex; flex-direction: column; justify-content: center; height: 100%; }
.call-active-screen { display: flex; flex-direction: column; height: 100%; background: #0f172a; }
.call-top-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: #1e293b; color: #fff; }
.call-info { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.call-close-btn { background: #ef4444; color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.call-close-btn:hover { background: #dc2626; }

/* СЕТКА ВИДЕО */
.video-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; flex: 1; overflow-y: auto; background: #0f172a; align-content: center; justify-content: center; }
.user-stream-container { display: flex; flex-direction: column; gap: 8px; background: #1e293b; border-radius: 12px; padding: 8px; position: relative; flex: 1; min-width: 280px; max-width: 500px; max-height: 400px; }
.video-box { background: #000; border-radius: 8px; position: relative; overflow: hidden; flex: 1; display: flex; align-items: center; justify-content: center; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-label { position: absolute; bottom: 12px; left: 12px; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; z-index: 10;}

.call-bottom-bar { display: flex; gap: 16px; justify-content: center; padding: 20px; background: #1e293b; }
.ctrl-round-btn { width: 56px; height: 56px; border-radius: 50%; border: none; background: #334155; color: #fff; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.ctrl-round-btn:hover { background: #475569; transform: scale(1.05); }
.ctrl-round-btn.danger { background: #ef4444; }
.ctrl-round-btn.danger:hover { background: #dc2626; }
.ctrl-round-btn.off { background: #ef4444; }

/* ПЛАВАЮЩЕЕ ОКНО ЗВОНКА (PIP) */
.floating-call {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  background: #1e293b;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #334155;
}
.floating-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}
.floating-header:active { cursor: grabbing; }
.floating-header button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.floating-header button:hover { background: rgba(255,255,255,0.2); }

.floating-content { padding: 0 12px 12px 12px; }

/* Специальные стили для видео в PIP */
.floating-content .video-grid { display: block; padding: 0; background: transparent; }
.floating-content .user-stream-container { 
  padding: 0; 
  background: transparent; 
  border: 2px solid #10b981; 
  border-radius: 12px; 
  box-shadow: 0 0 10px rgba(16,185,129,0.3);
  min-width: auto;
  max-width: none;
  max-height: none;
}
.floating-content .video-label {
  display: block;
  font-size: 14px;
  padding: 6px 12px;
  background: transparent;
  color: #94a3b8;
  position: static;
  text-align: left;
  margin-bottom: 8px;
}
.floating-content .video-label::before {
  content: "● ";
  color: #10b981;
  font-size: 10px;
  vertical-align: middle;
}
.floating-content .video-box { 
  border-radius: 0; 
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  min-height: 160px; 
}
.floating-content #screen_box_me { display: none; }

.floating-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: #1e293b;
}
.floating-footer .ctrl-round-btn {
  width: 44px;
  height: 44px;
  font-size: 18px;
}