/* css/ui.css — общие UI-компоненты: скелетоны загрузки, пустые состояния, анимации.
   Подключается ПОСЛЕ существующих CSS. Только аддитивные правила. */

/* ===== Скелетоны (загрузка) ===== */
.skeleton-block {
  border-radius: var(--radius-md, 10px);
  background: linear-gradient(90deg, rgba(128, 128, 128, .12) 25%, rgba(128, 128, 128, .24) 50%, rgba(128, 128, 128, .12) 75%);
  background-size: 200% 100%;
  animation: webed-skeleton 1.4s ease-in-out infinite;
  min-height: 16px;
  margin-bottom: var(--space-2, 8px);
}
.skeleton-card {
  border-radius: var(--radius-md, 10px);
  padding: var(--space-4, 16px);
  border: 1px solid rgba(128, 128, 128, .15);
  margin-bottom: var(--space-2, 8px);
}
@keyframes webed-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Пустые состояния ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2, 8px);
  padding: var(--space-6, 32px) var(--space-4, 16px);
  text-align: center;
  color: var(--gray-500, #6c7086);
  border: 1px dashed rgba(128, 128, 128, .25);
  border-radius: var(--radius-lg, 14px);
  background: rgba(128, 128, 128, .04);
}
.empty-state .empty-icon { font-size: 34px; line-height: 1; opacity: .8; }
.empty-state .empty-title { font-size: var(--font-base, 14px); font-weight: 600; }
.empty-state .empty-sub { font-size: var(--font-sm, 13px); opacity: .8; }
.empty-state .empty-cta { margin-top: var(--space-2, 8px); }

/* ===== Анимации появления ===== */
@keyframes webed-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes webed-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.fade-in { animation: webed-fade-in var(--ease-base, 240ms) ease both; }
.slide-up { animation: webed-slide-up var(--ease-base, 240ms) cubic-bezier(0.16, 1, 0.3, 1) both; }
.modal-content, .quiz-card, .stat-card, .lesson-item, .student-card {
  animation: webed-fade-in var(--ease-base, 240ms) ease both;
}

/* ===== Topbar Icon Buttons (🔔, ⚙️) ===== */
.topbar-icon-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: var(--radius-md, 10px) !important;
  border: 1px solid var(--border-light, #e4e4e7) !important;
  background: var(--surface2, #f4f4f5) !important;
  color: var(--gray-800, #27272a) !important;
  cursor: pointer !important;
  font-size: 16px !important;
  line-height: 1 !important;
  transition: transform var(--ease-fast, 150ms) ease, box-shadow var(--ease-fast, 150ms) ease, background-color var(--ease-fast, 150ms) ease !important;
  box-sizing: border-box !important;
}
.topbar-icon-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.12)) !important;
}
[data-theme="dark"] .topbar-icon-btn {
  background: #242f3d !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f4f4f5 !important;
}

/* ===== Микровзаимодействия ===== */
.nav-item, .btn, .stat-card, .quiz-card, .lesson-item, .student-card {
  transition: transform var(--ease-fast, 150ms) ease, box-shadow var(--ease-fast, 150ms) ease, background-color var(--ease-fast, 150ms) ease;
}
.nav-item:hover, .btn:hover, .stat-card:hover, .quiz-card:hover, .lesson-item:hover, .student-card:hover {
  transform: translateY(-1px);
}
.stat-card:hover, .quiz-card:hover, .student-card:hover {
  box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, .16));
}
.nav-item {
  transition: background-color var(--ease-fast, 150ms) ease, color var(--ease-fast, 150ms) ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

/* ===== Тост (единая анимация) ===== */
.toast {
  animation: webed-toast-in var(--ease-spring, 320ms) cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes webed-toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Печать доски (экспорт в PDF) ===== */
@media print {
  body.print-board * { visibility: hidden; }
  body.print-board #boardCanvas, body.print-board #boardCanvas * { visibility: visible; }
  body.print-board #boardCanvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
  }
}

/* ===== Таймер онлайн-доски (Floating HUD в стиле звонка Telegram) ===== */
/* ===== Таймер онлайн-доски (Draggable Floating Capsule в стиле Telegram) ===== */
.board-timer-widget {
  position: fixed;
  top: 70px;
  right: 20px;
  background: rgba(23, 33, 43, 0.94);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.12));
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  padding: 10px 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--tg-text, #ffffff);
  cursor: grab;
  user-select: none;
  touch-action: none;
  animation: webed-fade-in 180ms ease;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.board-timer-widget:active {
  cursor: grabbing;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.7);
  border-color: rgba(51, 144, 236, 0.4);
}
.timer-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-text-muted, #708499);
  cursor: grab;
  padding: 2px 4px;
}
.timer-drag-handle:active {
  cursor: grabbing;
}
.timer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.timer-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-primary, #3390ec);
  padding: 4px;
  border-radius: 8px;
  transition: background 0.12s ease;
}
.timer-icon-wrap:hover {
  background: rgba(51, 144, 236, 0.15);
}
.timer-digits {
  font-size: 24px;
  font-weight: 700;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
  letter-spacing: 1.5px;
  color: var(--tg-green, #4fae4e);
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.12s ease;
}
.timer-digits:hover {
  background: rgba(255, 255, 255, 0.08);
}
.timer-digits.urgent {
  color: var(--tg-red, #e53935);
  animation: pulse-urgent 0.9s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes pulse-urgent {
  from { transform: scale(1); }
  to { transform: scale(1.08); text-shadow: 0 0 14px rgba(229, 57, 53, 0.8); }
}
.timer-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--tg-surface-elevated, #242f3d);
  color: var(--tg-text-secondary, #708499);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.timer-btn-icon {
  background: none;
  border: none;
  color: var(--tg-text-muted, #708499);
  cursor: pointer;
  margin-left: auto;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
}
.timer-btn-icon:hover { color: #fff; background: rgba(255,255,255,0.12); }
.timer-controls { margin-top: 14px; border-top: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08)); padding-top: 12px; }
.timer-presets { display: flex; gap: 6px; margin-bottom: 12px; }
.timer-preset-btn {
  flex: 1;
  font-size: 11px;
  padding: 6px 0;
  border-radius: var(--tg-radius-sm, 8px);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  background: var(--tg-surface-elevated, #242f3d);
  color: var(--tg-text-secondary, #708499);
  cursor: pointer;
  transition: transform 120ms var(--ease-out, ease-out), background 120ms ease, color 120ms ease, border-color 120ms ease;
  font-weight: 500;
}
.timer-preset-btn:hover, .timer-preset-btn.active {
  background: var(--tg-primary, #3390ec);
  color: #ffffff;
  border-color: var(--tg-primary, #3390ec);
  font-weight: 600;
}
.timer-actions { display: flex; gap: 10px; }

/* ===== Плоттер Графиков (Telegram Modal Sheet) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: webed-fade-in 180ms ease;
}
.modal-overlay.active,
.modal-overlay.open,
.modal-overlay.show {
  display: flex !important;
}
.modal-overlay.hidden {
  display: none !important;
}
.modal-card {
  background: var(--tg-surface-elevated, #242f3d);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius, 16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 92%;
  max-width: 480px;
  padding: 22px;
  color: var(--tg-text, #ffffff);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 600; color: #fff; }
.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--tg-surface, #17212b);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.1));
  border-radius: var(--tg-radius-sm, 8px);
  color: var(--tg-text, #ffffff);
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.modal-input:focus {
  border-color: var(--tg-primary, #3390ec);
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.25);
}
.plotter-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.preset-pill {
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--tg-surface, #17212b);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  color: var(--tg-text-secondary, #708499);
  cursor: pointer;
  transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
  font-weight: 500;
}
.preset-pill:hover {
  border-color: var(--tg-primary, #3390ec);
  color: #ffffff;
  background: rgba(51, 144, 236, 0.2);
}
.plotter-preview-wrap {
  margin-top: 14px;
  background: #0f1822;
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius-sm, 8px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Флеш-карточки (Telegram 3D Flip Card) ===== */
.flashcard-stage {
  perspective: 1000px;
  width: 100%;
  max-width: 480px;
  min-height: 250px;
  margin: 16px auto;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 250px;
  text-align: center;
  transition: transform 0.24s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  border-radius: var(--tg-radius, 16px);
}
.flashcard-stage.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--tg-radius, 16px);
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.flashcard-front {
  background: linear-gradient(135deg, #17212b, #242f3d);
  color: #ffffff;
}
.flashcard-back {
  background: linear-gradient(135deg, #182a20, #223e30);
  color: var(--tg-green, #4fae4e);
  transform: rotateY(180deg);
  border-color: rgba(79, 174, 78, 0.3);
}
.flashcard-topic-pill {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(51, 144, 236, 0.15);
  margin-bottom: 14px;
  color: var(--tg-primary, #3390ec);
  font-weight: 600;
}
.flashcard-text { font-size: 19px; font-weight: 600; line-height: 1.4; color: #fff; }
.flashcard-hint { font-size: 12px; color: var(--tg-text-secondary, #708499); margin-top: 12px; font-style: italic; }

/* ===== Древо Навыков (Skill Tree в стиле Telegram) ===== */
.skill-tree-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 6px 0;
}
.skill-category-block {
  background: var(--tg-surface-elevated, #242f3d);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius, 14px);
  padding: 16px;
}
.skill-category-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-primary, #3390ec);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.skill-node-card {
  background: var(--tg-surface, #17212b);
  border: 1.5px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius-sm, 10px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), box-shadow 160ms ease, border-color 160ms ease;
}
.skill-node-card.completed {
  border-color: var(--tg-green, #4fae4e);
  box-shadow: 0 0 16px rgba(79, 174, 78, 0.2);
  background: linear-gradient(135deg, #182a20, #17212b);
}
.skill-node-card.unlocked {
  border-color: var(--tg-primary, #3390ec);
  box-shadow: 0 0 14px rgba(51, 144, 236, 0.2);
}
.skill-node-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}
.skill-node-icon { font-size: 24px; }
.skill-node-name { font-size: 13px; font-weight: 600; color: #fff; }
.skill-node-desc { font-size: 11px; color: var(--tg-text-secondary, #708499); line-height: 1.35; }

/* ===== Трекер Готовности к ОГЭ/ЕГЭ ===== */
.readiness-card {
  background: var(--tg-surface-elevated, #242f3d);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius, 14px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.readiness-overview {
  display: flex;
  align-items: center;
  gap: 20px;
}
.readiness-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--tg-primary, #3390ec) calc(var(--percent, 0) * 1%), var(--tg-surface, #17212b) 0);
  position: relative;
  flex-shrink: 0;
}
.readiness-circle::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--tg-surface-elevated, #242f3d);
}
.readiness-circle-val {
  position: relative;
  font-size: 20px;
  font-weight: 700;
  color: var(--tg-primary, #3390ec);
}
.readiness-circle-lbl {
  position: relative;
  font-size: 9px;
  color: var(--tg-text-secondary, #708499);
  text-transform: uppercase;
}
.readiness-bar-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.readiness-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--tg-text-secondary, #708499);
}
.readiness-bar-track {
  height: 8px;
  background: var(--tg-surface, #17212b);
  border-radius: 4px;
  overflow: hidden;
}
.readiness-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3390ec, #4fae4e);
  border-radius: 4px;
  transition: width 0.24s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ===== Красная Ручка (Аннотирование Фото ДЗ) ===== */
.hw-pen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 22, 33, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: webed-fade-in 180ms ease;
}
.hw-pen-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  background: var(--tg-surface-elevated, #242f3d);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius-pill, 24px);
  box-shadow: var(--tg-shadow);
  margin-bottom: 12px;
}
.hw-pen-canvas-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--tg-radius, 14px);
  background: #0f1822;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* ===== Telegram-Styled Student Cards ===== */
.student-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.student-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: rgba(51, 144, 236, 0.4);
}

.student-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.student-card-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.student-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3390ec 0%, #2b5278 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(51, 144, 236, 0.25);
}

.student-card-details {
  min-width: 0;
  flex: 1;
}

.student-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.student-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-grade-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.12);
  color: #3390ec;
}

.student-card-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.student-card-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.student-icon-btn {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 140ms var(--ease-out, ease-out), background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.student-icon-btn:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  border-color: var(--gray-300);
}

.student-icon-btn.danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.25);
}

.student-links-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.student-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--gray-100);
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  font-size: 12px;
}

.student-link-pill:hover {
  background: rgba(51, 144, 236, 0.12);
  color: #3390ec;
}

.student-card-toolbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

.student-card-btn {
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--surface);
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.student-card-btn:hover {
  background: rgba(51, 144, 236, 0.08);
  border-color: #3390ec;
  color: #3390ec;
}

.student-card-btn.active {
  background: #3390ec;
  border-color: #3390ec;
  color: #ffffff;
}

[data-theme="dark"] .student-card {
  background: var(--tg-surface, #17212b);
  border-color: var(--tg-border, rgba(255, 255, 255, 0.08));
}

[data-theme="dark"] .student-card-name {
  color: #ffffff;
}

[data-theme="dark"] .student-icon-btn,
[data-theme="dark"] .student-card-btn {
  background: var(--tg-surface-elevated, #242f3d);
  border-color: var(--tg-border, rgba(255, 255, 255, 0.08));
  color: var(--tg-text, #ffffff);
}

[data-theme="dark"] .student-link-pill {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

[data-theme="dark"] .student-card-toolbar {
  border-top-color: var(--tg-border, rgba(255, 255, 255, 0.08));
}

/* ===== Telegram Switch Toggle ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  vertical-align: middle;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--gray-300, #cbd5e1);
  transition: background-color 180ms ease, transform 180ms var(--ease-out, ease-out), opacity 180ms ease;
  border-radius: 24px;
}
.switch .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch input:checked + .slider {
  background-color: #3390ec;
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* ===== XP Settings Telegram Accordion & Controls ===== */
.xp-group-item {
  margin-bottom: 12px;
}

.xp-group-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  color: var(--gray-900, #0f172a);
  transition: transform 140ms var(--ease-out, ease-out), background-color 160ms ease, border-color 160ms ease;
  user-select: none;
}

.xp-group-header:hover {
  background: var(--gray-50, #f8fafc);
  border-color: rgba(51, 144, 236, 0.35);
}

.xp-group-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(51, 144, 236, 0.12);
  color: #3390ec;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.xp-group-arrow {
  font-size: 11px;
  color: var(--gray-400, #94a3b8);
  transition: transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.xp-group-header:not(.collapsed) .xp-group-arrow {
  transform: rotate(180deg);
}

.xp-group-body {
  padding: 8px 0 0 0;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.xp-group-body.collapsed {
  display: none;
}

.xp-setting-row {
  margin: 6px 0;
  padding: 12px 16px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 10px;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.xp-setting-row:hover {
  border-color: rgba(51, 144, 236, 0.3);
}

.xp-input-num {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  width: 80px;
  padding: 7px 10px;
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #3390ec;
  background: var(--surface, #ffffff);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.xp-input-num:focus {
  border-color: #3390ec;
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.2);
}

.xp-reset-btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  padding: 6px 12px;
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  color: var(--gray-600, #475569);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.xp-reset-btn:hover {
  background: var(--gray-100, #f1f5f9);
  color: var(--gray-900, #0f172a);
  border-color: var(--gray-300, #cbd5e1);
}

[data-theme="dark"] .xp-group-header,
[data-theme="dark"] .xp-setting-row {
  background: var(--tg-surface, #17212b);
  border-color: var(--tg-border, rgba(255, 255, 255, 0.08));
  color: #ffffff;
}

[data-theme="dark"] .xp-group-header:hover,
[data-theme="dark"] .xp-setting-row:hover {
  background: var(--tg-surface-elevated, #242f3d);
}

[data-theme="dark"] .xp-input-num,
[data-theme="dark"] .xp-reset-btn {
  background: var(--tg-surface-elevated, #242f3d);
  border-color: var(--tg-border, rgba(255, 255, 255, 0.08));
  color: #ffffff;
}

/* ===== STEM ИНТЕРАКТИВНЫЕ ИНСТРУМЕНТЫ (RULER & PROTRACTOR) ===== */
.stem-tool-hud {
  position: fixed;
  background: rgba(23, 33, 43, 0.92);
  border: 1.5px solid rgba(51, 144, 236, 0.4);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  z-index: 990;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff;
  user-select: none;
  touch-action: none;
  cursor: grab;
  padding: 10px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.stem-tool-hud:active {
  cursor: grabbing;
}
.stem-tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.stem-ruler-body {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.stem-rotate-handle {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(51, 144, 236, 0.25);
  border: 1px solid #3390ec;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: crosshair;
  transition: transform 0.15s ease, background 0.15s ease;
}
.stem-rotate-handle:hover {
  background: #3390ec;
  transform: scale(1.15);
}

/* ===== БЫСТРАЯ ПАЛИТРА ДЛЯ СТИКЕРОВ-ЗАМЕТОК ===== */
.sticky-color-picker {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(23, 33, 43, 0.96);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.12));
  border-radius: 24px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(16px);
}
.sticky-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.sticky-color-dot:hover {
  transform: scale(1.25);
  border-color: #ffffff;
}

/* ===== СЕТКА ДОСКИ (GRID CARDS) ===== */
.grid-mode-card {
  transition: transform 160ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), border-color 160ms ease, box-shadow 160ms ease;
}
.grid-mode-card:hover {
  border-color: rgba(51, 144, 236, 0.5) !important;
  background: rgba(51, 144, 236, 0.1) !important;
}
.grid-mode-card.active {
  border-color: #3390ec !important;
  background: rgba(51, 144, 236, 0.2) !important;
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.3);
}

/* ===== SPOTLIGHT (ПРОЖЕКТОР ВНИМАНИЯ) ===== */
.spotlight-ring {
  position: fixed;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid #3390ec;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45), 0 0 40px rgba(51, 144, 236, 0.8);
  pointer-events: none;
  z-index: 950;
  transform: translate(-50%, -50%);
  animation: spotlight-pulse 1.2s infinite alternate ease-in-out;
}
@keyframes spotlight-pulse {
  from { transform: translate(-50%, -50%) scale(0.95); opacity: 0.85; }
  to { transform: translate(-50%, -50%) scale(1.1); opacity: 1; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), 0 0 60px rgba(51, 144, 236, 1); }
}

/* ===== STREAK & SHOP BADGES ===== */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 107, 0, 0.18), rgba(255, 179, 0, 0.25));
  border: 1px solid rgba(255, 152, 0, 0.4);
  color: #ff9800;
  font-weight: 700;
  font-size: 13px;
  animation: flame-glow 1.5s infinite alternate ease;
}
@keyframes flame-glow {
  from { box-shadow: 0 0 4px rgba(255, 152, 0, 0.3); }
  to { box-shadow: 0 0 14px rgba(255, 107, 0, 0.6); }
}

/* ===== SHOP REWARD CARDS ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.shop-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--tg-border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.shop-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.shop-card.owned {
  border-color: rgba(79, 174, 78, 0.4);
  background: rgba(79, 174, 78, 0.04);
}
.shop-card.equipped {
  border-color: #3390ec;
  box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.3);
}

/* Custom Cursors on Board Canvas */
.cursor-neon { filter: drop-shadow(0 0 8px #00e5ff); }
.cursor-fire { filter: drop-shadow(0 0 10px #ff5722); }
.cursor-rainbow { filter: drop-shadow(0 0 10px #e040fb); }
.cursor-gold { filter: drop-shadow(0 0 10px #ffd700); }
.cursor-cyber { filter: drop-shadow(0 0 8px #00e676); }

/* ===== Password Wrapper & Left-aligned Toggle ===== */
.password-wrapper {
  position: relative !important;
  display: block !important;
  width: 100% !important;
}

.password-wrapper input,
.form-group .password-wrapper input {
  width: 100% !important;
  padding-left: 44px !important;
  padding-right: 16px !important;
  box-sizing: border-box !important;
}

button.password-toggle-btn,
.password-toggle-btn {
  position: absolute !important;
  left: 10px !important;
  right: auto !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease !important;
  z-index: 5 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  line-height: 1 !important;
}

button.password-toggle-btn:hover,
.password-toggle-btn:hover {
  color: var(--primary, #4f46e5) !important;
  background-color: rgba(79, 70, 229, 0.08) !important;
}

button.password-toggle-btn:active,
.password-toggle-btn:active {
  transform: translateY(-50%) scale(0.92) !important;
}

.password-toggle-btn .eye-icon {
  width: 18px !important;
  height: 18px !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  pointer-events: none !important;
}

.password-toggle-btn .eye-closed {
  display: none;
}

.password-toggle-btn.is-visible .eye-open {
  display: none !important;
}

.password-toggle-btn.is-visible .eye-closed {
  display: block !important;
}

[data-theme="dark"] button.password-toggle-btn,
[data-theme="dark"] .password-toggle-btn {
  color: #94a3b8 !important;
}

[data-theme="dark"] button.password-toggle-btn:hover,
[data-theme="dark"] .password-toggle-btn:hover {
  color: #818cf8 !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ===== ЦЕНТР УВЕДОМЛЕНИЙ (NOTIFICATION CENTER) ===== */
.notif-bell-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--apple-red, #ff3b30);
  color: #ffffff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(255, 59, 48, 0.4);
  pointer-events: none;
  transform-origin: center center;
  transition: transform 160ms var(--ease-out, ease-out), opacity 160ms ease;
  z-index: 2;
}

.notif-badge.hidden {
  display: none !important;
}

.notif-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: 520px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
  border-radius: var(--radius-lg, 18px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: webed-slide-up 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="dark"] .notif-popover {
  background: rgba(30, 30, 46, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.notif-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light, rgba(0, 0, 0, 0.06));
}

[data-theme="dark"] .notif-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.notif-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #1d1d1f);
}

[data-theme="dark"] .notif-header h4 {
  color: #f8fafc;
}

.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-icon-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 8px;
  color: var(--gray-600, #64748b);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease, color 150ms ease;
}

.notif-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary, #0071e3);
}

[data-theme="dark"] .notif-icon-btn {
  color: #94a3b8;
}

[data-theme="dark"] .notif-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #60a5fa;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-item {
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  background: transparent;
  transition: background-color 150ms ease;
  position: relative;
}

.notif-item:hover {
  background: rgba(0, 113, 227, 0.05);
}

[data-theme="dark"] .notif-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.notif-item.unread {
  background: rgba(0, 113, 227, 0.06);
}

[data-theme="dark"] .notif-item.unread {
  background: rgba(10, 132, 255, 0.12);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--primary, #0071e3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main, #1d1d1f);
  margin-bottom: 2px;
  line-height: 1.3;
}

[data-theme="dark"] .notif-item-title {
  color: #f1f5f9;
}

.notif-item-msg {
  font-size: 12px;
  color: var(--gray-600, #64748b);
  line-height: 1.35;
  word-break: break-word;
}

[data-theme="dark"] .notif-item-msg {
  color: #94a3b8;
}

.notif-item-time {
  font-size: 11px;
  color: var(--gray-400, #94a3b8);
  margin-top: 4px;
}

.notif-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apple-blue, #0071e3);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--gray-400, #94a3b8);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}





