/* 1. БАЗОВІ НАЛАШТУВАННЯ СЕРЕДОВИЩА */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background-color: #f0f2f5;
  margin: 0;
  padding: 0;
  color: #222;
  overflow: hidden;
}
.app-container {
  max-width: 450px;
  margin: 0 auto;
  background: #ffffff;
  height: 100vh;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

/* 2. СТАТИЧНА ШАПКА ДОДАТКА (STICKY HEADER) */
.sticky-header-block {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
}
.header {
  background: #2481cc;
  color: white;
  padding: 20px;
  text-align: center;
}
.header h1 {
  margin: 0;
  font-size: 20px;
}
.header p {
  margin: 5px 0 0 0;
  font-size: 14px;
  opacity: 0.9;
}

/* 3. НАВІГАЦІЯ ТА КНОПКА НАЗАД */
.nav-bar {
  padding: 10px 15px;
  background: #ffffff;
  border-bottom: 1px solid #e4e6eb;
  display: none;
}
.back-btn {
  background: #f0f2f5;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  width: 100%;
  text-align: left;
  transition: background 0.2s;
}
.back-btn:hover {
  background: #e4e6eb;
}

/* 4. ОСНОВНИЙ РУХОМИЙ КОНТЕНТ */
.content {
  padding: 15px;
  padding-bottom: 50px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen {
  display: none;
}
.screen.active {
  display: block;
}

/* 5. СІТКА ТА КАРТКИ ПОЛИЧОК (ЖАНРІВ / СУБКАТЕГОРІЙ) */
.genre-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 5px;
}
.genre-card {
  background: #f8f9fa;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  padding: 18px 15px;
  text-align: left;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
}
.genre-card:hover {
  background: #e4e6eb;
  transform: translateY(-1px);
}

/* 6. АЛФАВІТНІ СПИСКИ ТА СТРІЧКИ КНИГ */
.letter-group {
  margin-bottom: 20px;
}
.letter-header {
  font-size: 18px;
  font-weight: bold;
  color: #2481cc;
  border-bottom: 2px solid #e4e6eb;
  padding-bottom: 3px;
  margin-bottom: 8px;
}
.book-item {
  display: block;
  padding: 12px 5px;
  border-bottom: 1px solid #f0f2f5;
  text-decoration: none;
  color: #222;
  font-size: 15px;
  transition: background 0.2s;
}
.book-item:hover {
  background: #f8f9fa;
  color: #2481cc;
}
.author-name {
  font-weight: 600;
}
.loading-text {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

/* 7. АДАПТИВНИЙ РЕКЛАМНИЙ БАНЕР (STICKY FOOTER) */
.ad-footer-block {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: #ffffff;
  border-top: 1px solid #e4e6eb;
  display: none;
  width: 100%;
  box-sizing: border-box;
  line-height: 0;
}
.ad-banner-link {
  display: block;
  width: 100%;
  text-decoration: none;
}
.ad-banner-img {
  width: 100%;
  height: auto;
  max-height: 90px;
  object-fit: cover;
  display: block;
}
.content.has-ad {
  padding-bottom: 110px; /* Захисний відступ від перекривання контенту */
}
