/* ─── Шапка: Полностью скрываем прямой переключатель крыльев #libSwitch (переход строго через Портал) ─── */
#libSwitch {
  display: none !important;
}

/* На Заглавном Портале скрываем центральный блок вкладок .screen-tabs */
body[data-active-screen="home"] .screen-tabs {
  display: none !important;
}

/* В крыле Никки скрываем все другие вкладки, кроме «Дневник» (grid) и «Идеи» (reader) */
body[data-wing="nikki"] .screen-tabs button:not([data-screen="grid"]):not([data-screen="reader"]) {
  display: none !important;
}

/* Стилизация кликабельного заголовка шапки для быстрого возврата Домой */
#brandBlock {
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

#brandBlock:hover {
  opacity: 0.92;
  transform: scale(1.04);
}

/* ─── Элегантная премиальная анимация появления при открытии ─── */
@keyframes homePortalFadeIn {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    filter: blur(6px);
  }
  60% {
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
  }
}

.home-portal {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px 20px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  color: #FFFFFF;
}

/* ─── Hero-баннер ─── */
.home-hero {
  background: linear-gradient(135deg, rgba(35, 43, 52, 0.95) 0%, rgba(24, 30, 36, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  padding: 36px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  animation: homePortalFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes homeGlowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 70%;
  height: 200%;
  background: radial-gradient(circle, rgba(143, 174, 124, 0.25) 0%, transparent 70%);
  pointer-events: none;
  animation: homeGlowPulse 7s ease-in-out infinite;
}

.home-hero-greeting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

.home-hero-date {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #A3D991;
  font-weight: 700;
}

.home-hero-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 32px;
  font-weight: 800;
  color: #FFFFFF !important;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.home-hero-subtitle {
  font-size: 16px;
  color: #D0D5DD !important;
  margin: 4px 0 0 0;
  font-weight: 400;
}

.home-hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.home-quick-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  color: #FFFFFF !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.home-quick-search-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #A3D991;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.home-quick-search-btn kbd {
  background: rgba(0,0,0,0.3);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #A3D991;
  font-family: monospace;
  font-weight: 700;
}

/* ─── Секция крыльев с каскадной анимацией ─── */
.home-section-wings {
  animation: homePortalFadeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

/* ─── Заголовок секции ─── */
.home-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.home-section-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF !important;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-section-title .jp-badge {
  font-size: 13px;
  font-family: sans-serif;
  opacity: 0.8;
  font-weight: 500;
  padding: 3px 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #E4E7EC;
}

/* ─── Сетка Порталов Крыльев (4 Библиотеки) ─── */
.home-wings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.wing-portal-card {
  background: #1A2128;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

.wing-portal-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  transition: background 0.25s ease;
}

.wing-portal-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  border-color: rgba(255,255,255,0.3);
}

/* Цветовые схемы крыльев с высокой контрастностью */
.wing-portal-card[data-wing="japan"]::after { background: #A3D991; }
.wing-portal-card[data-wing="japan"]:hover { border-color: rgba(163, 217, 145, 0.6); }

.wing-portal-card[data-wing="fiction"]::after { background: #FFA552; }
.wing-portal-card[data-wing="fiction"]:hover { border-color: rgba(255, 165, 82, 0.6); }

.wing-portal-card[data-wing="cinema"]::after { background: #FF66A1; }
.wing-portal-card[data-wing="cinema"]:hover { border-color: rgba(255, 102, 161, 0.6); }

.wing-portal-card[data-wing="nikki"]::after { background: #79B5ED; }
.wing-portal-card[data-wing="nikki"]:hover { border-color: rgba(121, 181, 237, 0.6); }

.wing-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.wing-kanji-badge {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  font-family: 'Source Serif 4', Georgia, serif;
}

.wing-portal-card[data-wing="japan"] .wing-kanji-badge { color: #A3D991; }
.wing-portal-card[data-wing="fiction"] .wing-kanji-badge { color: #FFA552; }
.wing-portal-card[data-wing="cinema"] .wing-kanji-badge { color: #FF66A1; }
.wing-portal-card[data-wing="nikki"] .wing-kanji-badge { color: #79B5ED; }

.wing-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wing-title {
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF !important;
  margin: 0;
}

.wing-subtitle {
  font-size: 13px;
  color: #D0D5DD !important;
  font-weight: 500;
}

.wing-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.wing-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.wing-stat-label {
  color: #98A2B3 !important;
  font-weight: 500;
}

.wing-stat-val {
  font-weight: 700;
  color: #FFFFFF !important;
}

.wing-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
}

.wing-portal-card[data-wing="japan"] .wing-card-footer { color: #A3D991 !important; }
.wing-portal-card[data-wing="fiction"] .wing-card-footer { color: #FFA552 !important; }
.wing-portal-card[data-wing="cinema"] .wing-card-footer { color: #FF66A1 !important; }
.wing-portal-card[data-wing="nikki"] .wing-card-footer { color: #79B5ED !important; }

.wing-arrow {
  transition: transform 0.2s ease;
  font-size: 16px;
}

.wing-portal-card:hover .wing-arrow {
  transform: translateX(4px);
}

/* ─── Секция инструментов с задержкой ─── */
.home-section-tools {
  animation: homePortalFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

/* ─── Сетка Быстрых Инструментов ─── */
.home-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-tool-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.home-tool-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: #A3D991;
  transform: translateY(-2px);
}

.home-tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #A3D991;
  flex-shrink: 0;
}

.home-tool-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-tool-title {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF !important;
}

.home-tool-desc {
  font-size: 13px;
  color: #D0D5DD !important;
}

/* ─── Задел под Ленту Активностей ─── */
.home-section-activity {
  animation: homePortalFadeIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

.home-activity-feed {
  background: #1A2128;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.home-activity-item {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.home-activity-item:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.04);
}

.home-activity-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #A3D991;
  flex-shrink: 0;
}

.home-activity-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-activity-title {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF !important;
}

.home-activity-sub {
  font-size: 13px;
  color: #D0D5DD !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .home-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }
  .home-hero-actions {
    width: 100%;
  }
  .home-quick-search-btn {
    width: 100%;
    justify-content: center;
  }
}
