/* ===== 1. ПЕРЕМЕННЫЕ И СБРОС ===== */
:root {
  /* Основная палитра */
  --primary: #D4A574;
  --primary-dark: #B08C5A;
  --secondary: #A08C6D;
  --accent: #C19A6B;
  --background: #FFF8F0;
  --card-bg: #FFFFFF;
  --text: #4A3C31;
  --text-light: #8B7D6B;
  --border: #E8D9C9;
  --shadow: rgba(0, 0, 0, 0.1);

  /* Статусы */
  --status-reading: #1976D2;
  --status-read: #2E7D32;
  --status-want: #FF8F00;
  --status-stopped: #7B1FA2;
  --status-own: #2E7D32;

  /* Системные */
  --success: #4CAF50;
  --error: #C62828;
  --warning: #FF8F00;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Raleway', 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  padding: 20px;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body.loaded {
  opacity: 1;
}

body:not(.loaded) * {
  transition: none !important;
}

/* ===== 2. ОБЩИЕ ЭЛЕМЕНТЫ ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px var(--shadow);
  overflow: hidden;
  padding: 30px;
  position: relative;
}

.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

/* Кнопки */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: 50px;
  font-family: 'Raleway', sans-serif;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.btn-secondary {
  background: var(--background);
  color: var(--primary-dark);
  border: 2px solid var(--border);
}

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

/* Формы */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 1.05em;
}

.form-input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1em;
  background: white;
  transition: border-color 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.form-checkbox label {
  font-weight: 500;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 1.05em;
  margin-bottom: 0;
}

/* Переключатель (свитч) */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #1A1612;
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Прелоадер */
#app-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s;
}

#app-loader div:first-child {
  font-size: 64px;
  margin-bottom: 20px;
}

#app-loader h1 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--primary);
}

#app-loader p {
  color: #666;
  font-size: 16px;
}

#loader-dots {
  margin-top: 20px;
  font-size: 24px;
}

/* ===== 3. ЭКРАН АВТОРИЗАЦИИ ===== */
#auth-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-container {
  background: white;
  border-radius: 25px;
  padding: 50px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.auth-container h2 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 2.2em;
  color: var(--primary-dark);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.auth-container p {
  color: var(--text-light);
  margin-bottom: 25px;
  font-size: 1.15em;
}

.auth-form-group {
  margin-bottom: 20px;
  text-align: left;
  position: relative;
}

.auth-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-dark);
}

.auth-form-group input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 15px;
  font-size: 1.05em;
}

/* Глазик для пароля */
.password-toggle {
  position: absolute;
  right: 15px;
  top: 38px;
  cursor: pointer;
  color: var(--text-light);
}

.auth-buttons {
  display: flex;
  gap: 15px;
  flex-direction: column;
}

.auth-buttons .btn {
  width: 100%;
  padding: 16px;
  font-size: 1.1em;
}

.auth-error {
  display: none;
  color: #C62828;
  background: #FFEBEE;
  padding: 12px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: center;
  font-size: 0.95em;
}

.auth-info {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 0.95em;
}

/* Доп. поля регистрации */
#register-extra-fields {
  animation: slideDown 0.4s ease-out;
  position: relative;
}

#back-to-login-from-register-btn {
  position: absolute;
  top: -400px;
  left: -40px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #F5F5F5;
  border: 1px solid #E0E0E0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Сообщение о верификации */
#verification-message {
  display: none;
  margin-top: 20px;
  text-align: center;
  background: #E8F5E9;
  border: 2px solid #4CAF50;
  border-radius: 15px;
  padding: 25px;
  animation: slideUp 0.5s ease-out;
}

#verification-message i {
  font-size: 3em;
  color: #4CAF50;
  margin-bottom: 15px;
}

#verification-message h3 {
  color: #4CAF50;
  font-size: 1.3em;
  margin-bottom: 10px;
}

#verification-email {
  color: #1976D2;
  font-weight: 600;
  font-size: 1.1em;
  word-break: break-all;
}

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

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

/* ===== 4. ОСНОВНОЙ ИНТЕРФЕЙС ===== */
#app {
  display: none;
}

/* Шапка */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: linear-gradient(135deg, #FFF8F0 0%, #E8D9C9 100%);
  border-bottom: 2px solid var(--border);
  position: relative;
  border-radius: 15px;
  margin-bottom: 30px;
  border-bottom: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-right {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;         /* запрещаем перенос */
  flex-shrink: 0;
  margin-left: auto;
}

.header-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--primary-dark);
  font-size: 1.1em;
  position: relative;
  flex-shrink: 0;            /* запрещаем сжатие */
  padding: 0;                /* убираем внутренние отступы */
}

.header-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.header-btn:active {
  transform: scale(0.95);
}

/* Логотип */
.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo i {
  font-size: 3em;
  color: var(--primary);
}

.logo h1 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 2.5em;
  color: var(--primary-dark);
}

.subtitle {
  color: var(--text-light);
  font-style: italic;
  margin-left: 45px;
  margin-top: 5px;
}

/* Навигация */
.main-nav {
  background: white;
  border-bottom: 2px solid var(--border);
  padding: 10px 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border-radius: 15px;
  margin-bottom: 25px;
  border: 1px solid var(--border);
}

.nav-tabs {
display: flex;
  gap: 15px;
  padding: 15px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-tab {
   display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 15px 10px;
  font-size: 1em;
  white-space: nowrap;
  text-align: center;
  border-radius: 12px;
  transition: all 0.3s;
  color: var(--text);
  cursor: pointer;
  font-family: 'Playfair Display', serif;
  font-weight: 500; /* можно чуть жирнее */
  font-size: 1.3em; /* можно чуть увеличить */
}

.nav-tab:hover {
  background: var(--background);
  color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-tab.active {
   background: #D4A574;
  color: white;
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 3px;
  background: white;
  border-radius: 2px;
}

/* Панель управления (фильтры, поиск) */
.control-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--background);
  padding: 20px;
  border-radius: 15px;
  border: 1px solid var(--border);
}

.filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  flex-grow: 1;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.filter-group label {
  font-weight: 600;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-group select,
.filter-group input {
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1em;
  background: white;
  transition: border-color 0.3s;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

.search-group {
  flex-grow: 1;
  max-width: 350px;
  position: relative;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

/* Кнопка очистки поиска (крестик) */
.search-clear-btn {
    position: absolute;
    right: 55px; /* Размещаем слева от кнопки поиска */
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.search-clear-btn:hover {
    background: var(--background);
    color: var(--primary-dark);
    transform: scale(1.1);
}

.search-clear-btn:active {
    transform: scale(0.95);
}

/* Обновляем padding для input, чтобы текст не заезжал на кнопки */
.search-input {
    padding-right: 95px; /* Увеличиваем для двух кнопок */
}

.search-input {
  width: 100%;
  padding: 12px 45px 12px 15px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1em;
  background: white;
  transition: border-color 0.3s;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

.search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  font-size: 1em;
}

.search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.search-actions {
  display: flex;
  gap: 15px;
}

/* Сортировка книг */
.sort-group {
    min-width: 200px;
}

.sort-select {
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .sort-group {
        min-width: 100%;
    }
    
    .sort-select {
        width: 100%;
    }
}

/* Счётчики в строке поиска библиотеки */
.library-stats-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-left: auto;
  flex-shrink: 0;
}

.stat-card.stat-counter.small {
  background: linear-gradient(135deg, #FFF8F0 0%, #E8D9C9 100%);
  border: 2px solid #D4A574;
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  min-width: 70px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.stat-card.stat-counter.small .stat-number {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px 0;
  line-height: 1;
  font-family: 'Courier New', monospace;
}

.stat-card.stat-counter.small .stat-label {
  font-size: 0.8em;
  color: #757575;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Статистика (кликабельные баннеры) */
.stats-section {
  margin-bottom: 30px;
}

.stats-section h2 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.8em;
  color: var(--primary-dark);
  margin-bottom: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card.clickable {
  cursor: pointer;
  transition: all 0.3s;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 15px;
  text-align: center;
  min-width: 120px;
}

.stat-card.clickable:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  background: var(--background);
  border-color: var(--primary);
}

.stat-card.clickable .stat-number {
  font-size: 1.8em;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  color: var(--primary);
  margin-bottom: 5px;
  line-height: 1;
}

.stat-card.active .stat-number {
  color: white;
}

.stat-label {
  color: var(--text-light);
  font-size: 0.85em;
  font-weight: 500;
}

/* Кнопка установки PWA */
#install-btn {
   background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
  color: white;
  border: none;
  width: 38px;               /* такой же размер, как у header-btn */
  height: 38px;
  border-radius: 50%;        /* круглая форма, как у остальных */
  display: none;             /* скрыта по умолчанию */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-right: 0;           /* убираем лишний отступ */
  flex-shrink: 0;
  font-size: 1.1em;          /* размер иконки */
  padding: 0; 
}

#install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

#install-btn i {
  margin-right: 0px;
}

#install-btn .nav-text {
  font-size: 0.85em;
  font-weight: 600;
}

/* ===== 5. КАРТОЧКИ КНИГ И РЕЗУЛЬТАТЫ ПОИСКА ===== */
.books-container,
.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 40px;
}

.book-card,
.search-result-card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 550px; /* Фиксированная высота для выравнивания */
}

.book-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--primary);
}

.book-card:hover,
.search-result-card:hover {
  transform: translateY(-4px) scale(1.01);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}

/* ========== БЫСТРАЯ СМЕНА СТАТУСА (КОМПАКТНЫЙ OVERLAY) ========== */
.book-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 22, 18, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 50;
    border-radius: 18px 18px 0 0; /* Закругление только сверху */
    height: 60px; /* Фиксированная высота */
}

.book-card:hover .book-card-overlay {
    opacity: 1;
    visibility: visible;
}

.overlay-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.overlay-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(212, 165, 116, 0.4);
}

.overlay-btn:active {
    transform: scale(0.95);
}

/* Цвета для разных действий */
.overlay-btn[data-status="read"]:hover {
    background: #2E7D32;
    border-color: #2E7D32;
}

.overlay-btn[data-status="stopped"]:hover {
    background: #7B1FA2;
    border-color: #7B1FA2;
}

.overlay-btn[data-action="favorite"]:hover {
    background: #FF9800;
    border-color: #FF9800;
}

/* На мобильных скрываем overlay */
@media (max-width: 768px) {
    .book-card-overlay {
        display: none;
    }
}

/* Обложка */
.book-cover {
  width: 100%;
  height: 200px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 16px;
  margin-bottom: 15px;
  box-shadow: 0 10px 30px rgba(74, 60, 49, 0.25);
  background-color: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2em;
  font-family: 'Playfair Display', serif;
  border: 1px solid var(--border);
  transition: all 0.4s;
  position: relative;
  overflow: hidden;
}

.book-cover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  opacity: 0.15;
  z-index: 0;
}

.book-cover span {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  display: none;
}

.book-cover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 40px rgba(74, 60, 49, 0.35);
}

/* Плашка статуса (в правом верхнем углу обложки) */
.book-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
  z-index: 15;
}

.book-status-badge.reading { background: var(--status-reading); }
.book-status-badge.read    { background: var(--status-read); }
.book-status-badge.want    { background: var(--status-want); }
.book-status-badge.stopped { background: var(--status-stopped); }

/* Плашка "Есть дома" */
.book-owned {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--status-own);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 20;
}

/* Закладка (избранное) */
.bookmark-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
  cursor: pointer;
  transition: all 0.2s;
  animation: bookmarkPulse 2s infinite;
}

.bookmark-ribbon.outline {
  background: white;
  color: var(--text-light);
  border: 2px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: none;
}

.bookmark-ribbon:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.bookmark-ribbon.filled:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 12px rgba(245, 124, 0, 0.5);
}

@keyframes bookmarkPulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 124, 0, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(245, 124, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 124, 0, 0); }
}

/* Заголовок, автор, формат */
.book-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  /* padding-bottom: 5px;*/ 
  border-bottom: 1px
  dashed var(--border);
  flex: 1;
  flex-direction: column;
  min-height: 30px;
}

.book-card-header h3 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.25em;
  font-weight: 400;
  color: var(--primary-dark);
  line-height: 1.3;
  flex: 1;
}

.book-author {
  font-size: 1em;
  color: var(--secondary);
  margin-bottom: 8px;
  font-style: italic;
  font-weight: 500;
  min-height: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-format {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 10px;
  min-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-print {
  background: #E3F2FD;
  color: #1976D2;
}

.format-digital {
  background: #E8F5E9;
  color: #2E7D32;
}

/* Подвал карточки (страницы, рейтинг, кнопка удаления) */
.book-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  min-height: 60px;
  width: 100%;
}

.book-info {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-light);
  font-size: 0.95em;
  white-space: nowrap;
  flex: 1;
}

.book-pages,
.book-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.delete-btn {
  background: var(--error);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Raleway', sans-serif;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* Карточка поиска */
.search-result-card {
  height: auto;
}

.search-result-card h3 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.4em;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.search-result-card p {
  color: var(--secondary);
  font-style: italic;
  margin-bottom: 15px;
}

.book-description {
  font-size: 0.9em;
  color: var(--text-light);
  margin: 10px 0;
  line-height: 1.6;
}

.search-result-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.search-result-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 0.9em;
}

.btn-add-book {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: 'Raleway', sans-serif;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 8px rgba(212, 165, 116, 0.3);
}

.btn-add-book:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 5px 15px rgba(212, 165, 116, 0.4);
  background: linear-gradient(135deg, var(--primary-dark) 0%, #9A7D5A 100%);
}

.btn-add-book:active {
  transform: translateY(0) scale(0.98);
}

/* Пустые состояния */
.no-books {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 1.3em;
}

.no-books i {
  font-size: 4em;
  margin-bottom: 25px;
  display: block;
  color: var(--border);
}

/* ===== 6. МОДАЛЬНЫЕ ОКНА ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}

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

.modal-content {
  background: white;
  border-radius: 25px;
  padding: 40px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
  border: 3px solid var(--primary);
}

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

.close-modal {
  position: absolute;
  top: 25px;
  right: 25px;
  font-size: 1.3em;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.3s;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border: 2px solid var(--border);
}

.close-modal:hover {
  color: var(--error);
  background: #ffebee;
  transform: rotate(90deg) scale(1.1);
}

.modal-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Специфичные модалки */
.status-select-content {
  max-width: 500px;
}

.status-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.status-option {
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--background);
  text-align: center;
}

.status-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.status-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.3);
}

.status-option i {
  font-size: 2em;
  display: block;
  margin-bottom: 10px;
}

.status-option span {
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  font-size: 1.1em;
}

/* Детали книги */
.book-detail-header {
  text-align: center;
  margin-bottom: 30px;
}

.book-detail-cover {
  width: 200px;
  height: 300px;
  margin: 0 auto 20px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(74, 60, 49, 0.25);
  background-color: var(--background);
  border: 1px solid var(--border);
}

.book-detail-title {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 2em;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.book-detail-author {
  font-size: 1.3em;
  color: var(--secondary);
  font-style: italic;
  margin-bottom: 20px;
}

.book-detail-meta {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.book-meta-item {
  text-align: center;
}

.book-meta-icon {
  font-size: 2em;
  color: var(--primary);
  margin-bottom: 8px;
}

.book-meta-value {
  font-weight: 600;
  font-size: 1.1em;
}

.book-meta-label {
  font-size: 0.85em;
  color: var(--text-light);
}

.book-detail-description {
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 30px;
  font-style: italic;
}

.book-detail-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

/* Даты чтения */
.book-dates-info {
  background: var(--background);
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
  border-left: 4px solid var(--primary);
  font-size: 0.95em;
}

.book-dates-info h4 {
  margin-bottom: 10px;
  color: var(--primary-dark);
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-dates-info p {
  margin: 5px 0;
  color: var(--text);
}

.book-dates-info strong {
  color: var(--primary-dark);
  font-weight: 600;
}

.book-dates-info .btn {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 0.9em;
}

/* Рейтинг (звёзды) */
.rating-stars {
  display: flex;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  margin: 15px 0;
  padding: 10px;
  background: var(--background);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.rating-stars i {
  font-size: 2.2em;
  color: #ddd;
  transition: all 0.25s ease;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.rating-stars i.active {
  color: var(--primary);
  transform: scale(1.25);
  text-shadow: 0 0 8px rgba(212, 165, 116, 0.7);
  filter: drop-shadow(0 3px 5px rgba(212, 165, 116, 0.4));
}

.rating-stars i:hover {
  transform: scale(1.4);
  color: var(--primary);
  text-shadow: 0 0 10px rgba(212, 165, 116, 0.9);
}

/* Произведения (сборники) */
.simple-work-item {
  display: flex;
  align-items: center;
  padding: 15px;
  background: var(--background);
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid var(--border);
}

.simple-work-item:hover {
  border-color: var(--primary);
  transform: translateX(5px);
}

.simple-work-item.read {
  background: #E8F5E9;
  border-color: #2E7D32;
}

.simple-work-item.read .simple-work-title::before {
  content: "✓ ";
  color: #2E7D32;
  font-weight: bold;
}

.simple-work-title {
  font-weight: 600;
  font-size: 1.1em;
  flex: 1;
}

.simple-work-status {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-light);
}

.simple-work-item.read .simple-work-status {
  background: #2E7D32;
}

.works-progress {
  margin-top: 20px;
  padding: 20px;
  background: var(--background);
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.works-progress-bar {
  width: 100%;
  height: 12px;
  background: #E0E0E0;
  border-radius: 6px;
  margin: 15px 0;
  overflow: hidden;
}

.works-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.5s ease;
}

.works-progress-text {
  font-weight: 600;
  font-size: 1.2em;
  color: var(--primary-dark);
  margin-bottom: 5px;
}

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

#works-paste-area {
  font-family: inherit;
}

#works-paste-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

/* Кнопки магазинов */
.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

.store-btn {
  background: var(--background);
  color: var(--primary-dark);
  border: 2px solid var(--border);
  padding: 8px 15px;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Raleway', sans-serif;
  font-size: 0.95em;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.store-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ===== 7. ПРОФИЛЬ И СТАТИСТИКА ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: var(--background);
  border-radius: 15px;
  border: 1px solid var(--border);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  font-weight: bold;
  font-family: 'Playfair Display', 'Times New Roman', serif;
  flex-shrink: 0;
}

.profile-info h2 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.8em;
  color: var(--primary-dark);
  margin-bottom: 5px;
}

.profile-info p {
  color: var(--text-light);
  font-size: 1em;
}

.profile-section {
  background: white;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.profile-section h3 {
  margin: 0 0 20px 0;
  color: var(--primary-dark);
  font-size: 1.2em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-section h3 i {
  color: var(--primary);
}

/* Подробная статистика (5 карточек) */
#stats-content .stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  margin: 0 auto;
  justify-items: center;
  align-items: center;
}

#stats-content .stat-card {
  background: linear-gradient(135deg, #FFF8F0 0%, #E8D9C9 100%);
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
  min-width: 120px;
}

#stats-content .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#stats-content .stat-card-icon {
  font-size: 1.6em;
  margin-bottom: 6px;
  display: block;
  line-height: 1;
  color: var(--primary);
}

#stats-content .stat-card-number {
  font-size: 1.7em;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 4px 0;
  line-height: 1.1;
  display: block;
}

#stats-content .stat-card-label {
  font-size: 0.82em;
  color: #757575;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
}

/* Счётчики на вкладке "Дома" */
.home-stats-counters {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 25px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 20px;
}

.home-stat-card {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  border: 2px solid #D4A574;
  border-radius: 12px;
  padding: 25px 15px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  cursor: default;
}

.home-stat-card .home-stat-number {
  font-size: 3.2em;
  font-family: 'Courier New', monospace;
  letter-spacing: 3px;
  background: #D4A574;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  width: 100%;
  text-align: center;
  font-weight: 600;
  margin-bottom: 10px;
}

.home-stat-card .home-stat-label {
  margin-top: 10px;
  font-size: 1.1em;
  color: #4A3C31;
  text-align: center;
  font-weight: 600;
}

/* События */
.event-list {
  background: var(--background);
  border-radius: 15px;
  padding: 20px;
  border: 1px solid var(--border);
}

.event-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

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

.event-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.event-content {
  flex: 1;
}

.event-content h4 {
  font-family: 'Playfair Display', 'Times New Roman', serif;
  font-size: 1.1em;
  color: var(--primary-dark);
  margin-bottom: 5px;
}

.event-time {
  font-size: 0.85em;
  color: var(--text-light);
}

/* Кнопка выхода */
.logout-btn {
  width: 100%;
  margin-top: 20px;
  background: #F5F5F5;
  color: #757575;
  border: 1px solid #E0E0E0;
}

.logout-btn:hover {
  background: #E0E0E0;
  color: #424242;
  transform: none;
  box-shadow: none;
}

/* ===== 8. ДОСТИЖЕНИЯ (С ВКЛАДКАМИ) ===== */
.achievement-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  padding: 10px 0;
  border-bottom: 2px solid var(--border);
}

.category-tab {
  padding: 8px 16px;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 30px;
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.category-tab:hover {
  background: var(--border);
  color: var(--secondary);
}

.category-tab.active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: white;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 10px;
}

@media (max-width: 1200px) {
  .achievements-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 900px) {
  .achievements-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.achievement-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 7px 5px;
  text-align: center;
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
  cursor: pointer;
}

.achievement-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Цвета уровней */
.achievement-card.unlocked[data-level="1"] { border-color: #CD7F32; }
.achievement-card.unlocked[data-level="2"] { border-color: #C0C0C0; }
.achievement-card.unlocked[data-level="3"] { border-color: #FFD700; }
.achievement-card.unlocked[data-level="4"] { border-color: #E5E4E2; }
.achievement-card.unlocked[data-level="5"] { border-color: #B9F2FF; }
.achievement-card.unlocked[data-level="6"] { border-color: #4A3C31; }

.achievement-card.locked {
  opacity: 0.7;
}

.achievement-icon {
  font-size: 1.6em;
  margin-bottom: 3px;
  display: block;
  line-height: 1;
  position: relative;
  color: var(--primary-dark);
}

.secret-emoji {
  font-size: 1.8em;
  display: block;
  line-height: 1;
  margin-bottom: 3px;
}

.secret-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #FF5722;
  color: white;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 0.65em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.achievement-title {
  display: none; /* Скрыто, используется data-name */
}

.achievement-desc {
  font-size: 0.7em;
  font-weight: 600;
  color: #5D4037;
  margin: 2px 0 4px;
  line-height: 1.1;
  max-height: 2.2em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.achievement-card.locked .achievement-desc {
  color: #A5D6A7;
}

.achievement-progress {
  margin-top: 8px;
  height: 14px;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: #E0E0E0;
  border-radius: 7px;
  overflow: hidden;
  border: none;
}

.progress-fill {
  height: 100%;
  border-radius: 7px;
  transition: width 0.3s ease;
  background: var(--achievement-color, var(--primary));
}

.progress-fill::after {
  content: attr(data-progress) '%';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7em;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}

.progress-fill:hover::after {
  opacity: 1;
}

.achievement-card.unlocked .achievement-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 15px;
}

.achievement-card.unlocked .achievement-progress::before {
  content: '✅';
  font-size: 0.9em;
  color: var(--primary);
}

/* Цвета прогресс-бара по уровням */
.achievement-card.unlocked[data-level="1"] .progress-fill { background: #CD7F32; }
.achievement-card.unlocked[data-level="2"] .progress-fill { background: #C0C0C0; }
.achievement-card.unlocked[data-level="3"] .progress-fill { background: #FFD700; }
.achievement-card.unlocked[data-level="4"] .progress-fill { background: #E5E4E2; }
.achievement-card.unlocked[data-level="5"] .progress-fill { background: #B9F2FF; }
.achievement-card.unlocked[data-level="6"] .progress-fill { background: #4A3C31; }

/* Модальное окно деталей достижения */
#achievement-detail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#achievement-detail-modal .modal-content {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.4s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 3px solid var(--primary);
}

.achievement-detail-icon {
  font-size: 4em;
  margin-bottom: 15px;
  color: var(--primary);
}

.achievement-detail-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8em;
  color: var(--primary-dark);
  margin-bottom: 10px;
  text-align: center;
}

.achievement-detail-desc {
  font-size: 1.1em;
  color: var(--text);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.6;
}

.achievement-detail-progress {
  background: var(--background);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary);
}

.achievement-detail-status {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin: 10px 0;
}

.progress-text {
  font-size: 0.9em;
  color: var(--text-light);
  margin-bottom: 8px;
}

/* ===== 9. ЧИТАТЕЛЬСКИЙ ДНЕВНИК ===== */
#diarySection {
  display: none;
}

#diary-stats {
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  display: none;
}

#diary-stats > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

#diary-stats .stat-card {
  text-align: center;
  padding: 15px;
  background: var(--card-bg);
  border-radius: 8px;
}

#diary-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 20px;
}

.diary-entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s, transform 0.2s;
  margin-bottom: 16px;
}

.diary-entry:hover {
   box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.diary-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.diary-entry-title {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.diary-entry-author {
  font-size: 0.95em;
  color: var(--secondary);
  font-style: italic;
  margin: 0;
}

.diary-entry-rating {
  margin: 8px 0 6px;
  font-size: 1.1em;
  letter-spacing: 2px;
  color: #FFB800; /* золотистый */
}

.diary-entry-date {
  font-size: 0.85em;
  color: var(--text-light);
  white-space: nowrap;
  margin-left: 15px;
}

.diary-entry-note {
  font-size: 0.95em;
  line-height: 1.6;
  color: var(--text);
  margin: 8px 0 16px;
  padding: 8px 0;
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  font-style: italic;
}

.diary-entry-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn-diary-edit,
.btn-diary-delete {
  padding: 6px 14px;
  font-size: 0.85em;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.btn-diary-edit {
background: var(--background);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn-diary-edit:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-diary-delete {
  background: #fee;
  color: var(--error);
  border: 1px solid #ffcdd2;
}

.btn-diary-delete:hover {
   background: var(--error);
  color: white;
  border-color: var(--error);
}

#diary-search {
  transition: border-color 0.3s;
}

#diary-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

#diary-search::placeholder {
  color: #757575;
}

/* Панель инструментов дневника */
#diary-toolbar {
  display: none;
  margin: 15px 0;
  padding: 12px;
  background: #FFF3E0;
  border-radius: 10px;
  border: 1px solid #FFD54F;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-dark);
}

/* Регулировка ширины */
input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #E0E0E0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

/* Кнопки эмодзи и цветов */
.diary-tool-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.diary-tool-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-dark);
}

.diary-color-btn {
  width: 24px;
  height: 24px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.diary-color-btn:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-dark);
}

.format-btn {
  width: 32px;
  height: 32px;
  border: 2px solid var(--primary);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0;
}

.format-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-dark);
  background: var(--background);
}

/* Вложения */
#diary-attachments-section {
  margin: 20px 0;
  padding: 15px;
  background: var(--background);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.attachment-preview {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background: #f5f5f5;
}

.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--error);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.attachment-remove:hover {
  background: #B71C1C;
  transform: scale(1.1);
}

.diary-entry-attachments {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(212, 165, 116, 0.1);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  margin-top: 5px;
  color: #5D4037;
}

.diary-entry-attachments i {
  color: var(--primary);
}

/* ===== 10. ЗАЙМЫ ===== */
#loansSection {
  display: none;
}

.loans-column {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.loans-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 300px;
}

.loan-card {
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.loan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.loan-card.given::before {
  background: #2E7D32;
}

.loan-card.taken::before {
  background: #1976D2;
}

.loan-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.loan-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  min-height: 120px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.loan-book-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1em;
  color: var(--primary-dark);
  margin: 0 0 5px 0;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.loan-book-author {
  font-style: italic;
  color: var(--secondary);
  font-size: 0.9em;
  margin: 0;
  line-height: 1.2;
}

.loan-person {
  color: var(--text);
  font-weight: 600;
  margin: 5px 0;
  font-size: 0.95em;
}

.loan-date {
  color: var(--text-light);
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}

.loan-date.overdue {
  color: var(--error);
  font-weight: 600;
}

.loan-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  width: 100%;
  justify-content: flex-end;
}

.loan-btn {
  padding: 8px 15px;
  font-size: 0.9em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-weight: 600;
}

.loan-btn.return {
  background: #2E7D32;
  color: white;
}

.loan-btn.return:hover {
  background: #1B5E20;
  transform: scale(1.05);
}

.loan-btn.extend {
  background: #1976D2;
  color: white;
}

.loan-btn.extend:hover {
  background: #0D47A1;
  transform: scale(1.05);
}

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

.loan-btn.delete:hover {
  background: #B71C1C;
  transform: scale(1.05);
}

/* Модальные окна займов */
.loan-form-group {
  margin-bottom: 20px;
}

.loan-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 1em;
}

.loan-form-group input,
.loan-form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1em;
  background: white;
  transition: border-color 0.3s;
}

.loan-form-group input:focus,
.loan-form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

/* ===== 11. СКАНЕР ШТРИХ-КОДОВ ===== */
#scanner-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#scanner-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 300px;
  background: black;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#scanner-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scanner-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 150px;
  border: 3px solid #4CAF50;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.scanner-instructions {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.close-scanner {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.close-scanner:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* ===== 12. УВЕДОМЛЕНИЯ ===== */
#notifications-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #E91E63;
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: none; /* Показывается через JS */
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* Модальное окно уведомлений */
#notifications-modal {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  height: 100vh;
  background: white;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 10001;
  transform: translateX(100%);
  transition: transform 0.3s ease-out;
}

#notifications-modal .modal-content {
  height: 100%;
  max-width: 100%;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

#notifications-modal.active {
  transform: translateX(0);
}

.notifications-header {
  background: linear-gradient(135deg, #FFF8F0 0%, #E8D9C9 100%);
  padding: 20px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.notifications-header h2 {
  font-family: 'Playfair Display', serif;
  color: var(--primary-dark);
  margin: 0;
}

.notifications-close {
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.3s;
}

.notifications-close:hover {
  color: var(--primary);
}

.notifications-list {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  padding: 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 15px;
  transition: background 0.3s;
  cursor: pointer;
}

.notification-item:hover {
  background: var(--background);
}

.notification-item.unread {
  background: #FFF3E0;
  border-left: 3px solid #FF9800;
}

.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon.unread {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0 0 5px 0;
  font-size: 0.95em;
}

.notification-text {
  color: var(--text-light);
  font-size: 0.9em;
  margin: 0;
  line-height: 1.4;
}

.notification-time {
  font-size: 0.8em;
  color: #9E9E9E;
  margin-top: 5px;
}

.notifications-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.notifications-empty i {
  font-size: 3em;
  margin-bottom: 15px;
  color: #E0E0E0;
}

/* ===== 13. НАСТРОЙКИ И ТЁМНАЯ ТЕМА ===== */
/* Тёмная тема */
[data-theme="dark"] {
  --background: #1A1612;
  --card-bg: #2A2520;
  --text: #E8D9C9;
  --text-light: #A89A89;
  --border: #4A3C31;
  --shadow: rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
  background-color: var(--background);
  color: var(--text);
}

[data-theme="dark"] .container,
[data-theme="dark"] .book-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .profile-section,
[data-theme="dark"] .search-result-card,
[data-theme="dark"] .auth-container,
[data-theme="dark"] .main-nav,
[data-theme="dark"] .loans-column {
  background-color: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .book-author,
[data-theme="dark"] .book-format,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .book-description,
[data-theme="dark"] .event-time,
[data-theme="dark"] .book-meta-label,
[data-theme="dark"] .subtitle,
[data-theme="dark"] .nav-tab,
[data-theme="dark"] .filter-group label {
  color: var(--text-light);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: #332D28;
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .close-modal:hover {
  background: #332D28;
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #D4A574 0%, #FFD54F 100%);
}

[data-theme="dark"] .support-project {
  background: linear-gradient(135deg, #1A1612 0%, #2A2520 100%);
  border-color: var(--border);
}

[data-theme="dark"] .achievement-card {
  background: var(--card-bg);
  border-color: var(--border);
}

[data-theme="dark"] .achievement-desc {
  color: var(--text-light);
}

[data-theme="dark"] .diary-entry {
  background: var(--card-bg);
}

/* ===== 14. АДАПТИВНОСТЬ (МЕДИАЗАПРОСЫ) ===== */
@media (max-width: 900px) {
  .library-stats-inline {
    display: none !important;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 20px;
  }

  .app-header {
    flex-direction: column;
    gap: 15px;
    padding: 15px 20px;
  }

  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
  }

  .logo h1 {
    font-size: 2em;
  }

  .subtitle {
    margin-left: 0;
  }

  .nav-tabs {
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-tab {
    padding: 8px 15px;
    font-size: 0.95em;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #stats-content .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .control-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .search-group {
    max-width: 100%;
  }

  .books-container,
  .search-results {
    grid-template-columns: 1fr;
  }

  .profile-stats {
    flex-direction: column;
  }

  .status-options {
    grid-template-columns: 1fr;
  }

  .book-detail-meta {
    flex-direction: column;
    gap: 15px;
  }

  .store-buttons {
    flex-direction: column;
  }

  #diary-entries {
    grid-template-columns: 1fr;
  }

  .loans-column {
    padding: 15px;
  }

  .loan-card {
    padding: 15px;
  }

  .loan-book-title {
    font-size: 1.1em;
  }

  #scanner-container {
    max-width: 100%;
    height: 250px;
  }

  .scanner-frame {
    width: 200px;
    height: 120px;
  }

  #install-btn .nav-text {
    display: none;
  }

  #notifications-modal {
    width: 100%;
  }
}

@media (max-width: 480px) {
  #stats-content .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .achievements-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .achievement-card {
    height: 60px;
    padding: 4px 2px;
  }

  .achievement-icon {
    font-size: 1.3em;
  }

  .achievement-desc {
    font-size: 0.65em;
  }
}

/* ===== ДОПОЛНИТЕЛЬНЫЕ ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ===== */
.touch-active {
  transform: scale(0.95);
  opacity: 0.8;
  transition: all 0.1s;
}

.load-more-container {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  background: var(--background);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fa-spinner.fa-spin {
  animation: spin 1s linear infinite;
}
/* ===== КНОПКА СОХРАНИТЬ ПРОФИЛЬ ===== */
.save-btn,
#saveProfileBtn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 50px; /* Круглые углы, как у .btn-primary */
  padding: 14px 28px;
  font-family: 'Raleway', sans-serif;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  width: 100%;
  margin-top: 10px;
}

.save-btn:hover,
#saveProfileBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
  background: linear-gradient(135deg, var(--primary-dark) 0%, #9A7D5A 100%);
}

.save-btn:active,
#saveProfileBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* ========== МОБИЛЬНЫЕ УСТРОЙСТВА ==========
   Экраны до 768px (смартфоны) */

/* Основной контейнер */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  /* Навигация */
  .nav-tabs {
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 10px;
  }
  
  .nav-tab {
    font-size: 0.85em;
    padding: 8px 12px;
    min-width: 80px;
    text-align: center;
  }
  
  /* Карточки книг */
  .book-card {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto 1fr auto !important;
    gap: 10px !important;
  }
  
  .book-cover {
    width: 80px !important;
    height: 120px !important;
    min-width: 80px;
  }
  
  .book-info {
    font-size: 0.9em;
  }
  
  /* Модальные окна */
  .modal-content {
    width: 95% !important;
    margin: 10px auto !important;
    padding: 15px !important;
  }
  
  /* Статистика */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  .stat-card {
    padding: 12px !important;
  }
  
  .stat-number {
    font-size: 1.5em !important;
  }
  
  /* Займы */
  .loans-column {
    padding: 15px !important;
  }
  
  .loan-card {
    padding: 15px !important;
  }
  
  .loan-book-title {
    font-size: 1em !important;
  }
  
  /* Дневник */
  #diary-entries {
    gap: 15px !important;
  }
  
  /* Формы */
  .form-group label {
    font-size: 0.95em;
  }
  
  .form-input {
    font-size: 1em;
    padding: 10px !important;
  }
  
  /* Кнопки */
  .btn {
    padding: 10px 15px !important;
    font-size: 0.95em !important;
  }
  
  .btn-small {
    padding: 6px 10px !important;
    font-size: 0.85em !important;
  }
  
  /* Достижения */
  .achievement-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  .achievement-card {
    padding: 12px !important;
  }
  
  /* Скрыть второстепенные элементы */
  .book-format {
    display: none !important;
  }
  
  .book-pages {
    font-size: 0.85em;
  }
  /* Уведомления на мобильных */
.notification,
.notifications,
#notification-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: 100%;
  max-width: 400px;
  padding: 0 15px;
}

/* Иконка уведомления */
.notification i,
.notifications i {
  font-size: 1.2em !important;
}

/* Кнопка закрытия */
.notification .close,
.notifications .close-btn {
  font-size: 1.2em !important;
  min-width: 30px !important;
  min-height: 30px !important;
}

/* Множественные уведомления */
.notification + .notification {
  margin-top: 8px !important;
}
}

/* ========== ПЛАНШЕТЫ ==========
   Экраны от 769px до 1024px */

@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 20px;
  }
  
  /* Карточки книг */
  .book-card {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  /* Статистика */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  /* Займы */
  .loans-column {
    padding: 20px !important;
  }
  
  /* Достижения */
  .achievement-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
}

/* ========== ДОПОЛНИТЕЛЬНЫЕ УЛУЧШЕНИЯ ДЛЯ МОБИЛЬНЫХ ========== */

@media (max-width: 768px) {
  /* Убрать длинные тексты */
  .book-author {
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Упростить карточку книги */
  .book-card-footer {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  
  /* Скрыть иконки в навигации */
  .nav-tab i {
     font-size: 1.8em;
    }
  
  /* Увеличить зону клика для кнопок */
  .btn, .nav-tab {
    min-width: 80px;
    padding: 12px 5px;
  }
  
  /* Убрать прокрутку в модальных окнах */
  .modal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Скрыть второстепенные кнопки в деталях книги */
  #book-detail-actions .btn-secondary:nth-child(n+3) {
    display: none;
  }
  
  /* Показать только основные кнопки */
  #book-detail-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Упростить хедер */
  .app-header .subtitle {
    font-size: 0.9em;
    display: none; /* Скрыть подзаголовок на мобильных */
  }
  
  /* Уменьшить логотип */
  .logo h1 {
    font-size: 1.8em !important;
  }
  
  .logo i {
    font-size: 1.8em !important;
  }
  
  /* Скрыть некоторые элементы в профиле */
  #profile-stats .stat-card:nth-child(n+5) {
    display: none;
  }
  
  /* Упростить фильтры */
  #library-filters {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Убрать текст с кнопок, оставить только иконки */
  .btn i + span {
    display: none;
  }
}
/* ========== СЕНСОРНЫЕ УСТРОЙСТВА ========== */
@media (hover: none) and (pointer: coarse) {
  /* Увеличить зону клика */
  .btn, .nav-tab, .book-card, .delete-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Убрать :hover эффекты */
  .btn:hover, .book-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  
  /* Добавить обратную связь при нажатии */
  .btn:active, .nav-tab:active, .book-card:active {
    transform: scale(0.98);
    opacity: 0.8;
    transition: all 0.1s;
  }
  
  /* Убрать анимации для производительности */
  * {
    transition: none !important;
  }
}
/* ===== ЯВНОЕ ЗАДАНИЕ ЦВЕТОВ ДЛЯ КНОПОК ПАЛИТРЫ ===== */
.diary-color-btn[data-color="#000000"] { background-color: #000000 !important; }
.diary-color-btn[data-color="#1976D2"] { background-color: #1976D2 !important; }
.diary-color-btn[data-color="#2E7D32"] { background-color: #2E7D32 !important; }
.diary-color-btn[data-color="#C62828"] { background-color: #C62828 !important; }
.diary-color-btn[data-color="#FF8F00"] { background-color: #FF8F00 !important; }
.diary-color-btn[data-color="#7B1FA2"] { background-color: #7B1FA2 !important; }
.diary-color-btn[data-color="#5D4037"] { background-color: #5D4037 !important; }
.diary-color-btn[data-color="#D4A574"] { background-color: #D4A574 !important; }
.diary-color-btn[data-color="#FFD700"] { background-color: #FFD700 !important; }
.diary-color-btn[data-color="#FF1493"] { background-color: #FF1493 !important; }
.diary-color-btn[data-color="#00CED1"] { background-color: #00CED1 !important; }
.diary-paperclip {
  font-size: 1.2em;
  opacity: 0.8;
  transition: transform 0.2s;
}
.diary-paperclip:hover {
  transform: scale(1.2);
  opacity: 1;
}