/* нормальный бокс-моделинг */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  color: white;
  overflow-x: hidden;
  position: relative;
}

/* Розмитий фон */
body::before {
  content: '';
  position: fixed;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  background-image: url('https://i.postimg.cc/L8ZrFW6Z/b5085809d0aa1c6d263d9e3722aed869.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(12px) brightness(0.6);
  z-index: -1;
  pointer-events: none;
}

/* якщо юзер з РФ — інший фон */
body.ru-blocked::before {
  background-image: url('https://i.postimg.cc/x1znz2p1/images.jpg');
}

h1 {
  margin-top: clamp(1rem, 4vw, 2rem);
  margin-bottom: 0.8rem;
  font-size: clamp(1.8rem, 6vw, 3rem);
  text-align: center;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.7);
  padding: 0 1rem;
  width: 100%;
}

/* Пошук */
.search-container {
  margin: 0 auto 1.2rem auto;
  width: 90%;
  max-width: 700px;
  padding: 0 1rem;
  order: 2;
}

#search,
.search-input {
  width: 100%;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

#search:focus,
.search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
}

#search::placeholder,
.search-input::placeholder {
  color: rgba(255,255,255,0.6);
}

/* Вкладки */
.nav {
  margin-top: 0;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 1rem;
  order: 3;
}

.nav-btn {
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #eee;
  font-size: 0.9rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.25s ease;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.3);
}

.nav-btn.active {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.35);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(0,0,0,0.3);
}

.page {
  width: 100%;
  display: none;
  order: 4;
}
.page.active { display: block; }

/* ===== УРОКИ ===== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 3rem auto;
  padding: 0 1rem;
}

.card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  border-radius: 1.8rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.25);
  perspective: 1000px;
}
.card:hover {
  box-shadow: 0 15px 30px rgba(0,0,0,0.5);
}
.card-title {
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
}
.card-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  text-align: center;
  font-size: 1rem;
  backdrop-filter: blur(5px);
  transition: transform 0.2s ease, background 0.2s ease;
  text-decoration: none;
  display: inline-block;
}
.card-button:hover {
  background: rgba(255,255,255,0.35);
  transform: scale(1.05);
}

/* ===== ПАМ’ЯТКА / ШПОРИ / НОВИНИ ===== */
.info-container {
  width: 90%;
  max-width: 900px;
  margin: 2.5rem auto 3rem auto;
}

.memo-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  border-radius: 1.8rem;
  padding: 1.4rem 1.8rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 0.4rem;
  border: 1px solid rgba(255,255,255,0.35);
}

.info-badge {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin-bottom: 0.4rem;
}

.info-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.info-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

.info-text strong { font-weight: 600; }

/* шпори */
.shpora-container {
  max-width: 1000px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* пасхалка */
.easter-egg {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 2rem 0 2.5rem 0;
}
.easter-egg img {
  max-width: 140px;
  opacity: 0.9;
  filter: drop-shadow(0 0 12px rgba(0,0,0,0.7));
}

/* Overlay block */
.blocked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.blocked-box {
  max-width: 420px;
  width: 100%;
  background: rgba(20,20,20,0.9);
  border-radius: 1.5rem;
  padding: 1.4rem 1.6rem;
  border: 1px solid rgba(255,255,255,0.2);
  text-align: center;
}
.blocked-box h2 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1.2rem;
}
.blocked-box p {
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0.3rem 0;
}

/* ===== МОБИЛКА ===== */
@media (max-width: 768px) {
  body { align-items: stretch; }
  body::before { filter: blur(8px) brightness(0.6); }

  .nav {
    margin-top: 0.8rem;
    padding: 0 0.8rem;
    gap: 0.4rem;
  }
  .nav-btn {
    flex: 1 1 30%;
    text-align: center;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
  }

  .search-container {
    width: 100%;
    max-width: none;
    padding: 0 1rem;
    margin: 1rem auto 0.8rem auto;
  }

  #search, .search-input {
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    width: 100%;
    max-width: none;
    padding: 0 1rem 1.8rem 1rem;
    margin-bottom: 1.5rem;
  }

  .card {
    height: auto;
    padding: 0.8rem 0.9rem;
    border-radius: 1.2rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
  }

  .card-title {
    font-size: 1.05rem;
    text-align: left;
    flex: 1;
  }

  .card-button {
    font-size: 0.92rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
  }

  .info-container {
    width: 100%;
    max-width: none;
    padding: 0 1rem 2rem 1rem;
    margin: 1.8rem auto 2rem auto;
  }
  .memo-card {
    border-radius: 1.4rem;
    padding: 1.2rem 1.3rem;
  }
  .info-title { font-size: 1.1rem; }
  .info-text { font-size: 0.9rem; }

  .shpora-container {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.4rem;
    padding: 0 0.8rem;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display:none; }

  .nav-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
  }

  .card {
    flex-direction: column;
    align-items: stretch;
  }
  .card-title { text-align: center; }
  .card-button { width: 100%; }
}


/* ===== КОМЕНТАРІ ===== */
.comments-container .comment-form-card {
  margin-bottom: 1.2rem;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.comment-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 1rem;
  outline: none;
}
.comment-input:focus {
  border-color: rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.5);
}

.comments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.6rem 0 1rem 0;
  padding: 0 0.2rem;
}

.comments-count {
  opacity: 0.8;
  font-size: 0.95rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.comment-delete {
  margin-top: 0.6rem;
  cursor: pointer;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  align-self: flex-end;
  transition: transform 0.15s ease, color 0.15s ease;
}
.comment-delete:hover {
  color: #fff;
  transform: scale(1.08);
}

.comment-hint {
  font-size: 0.85rem;
  opacity: 0.7;
  min-height: 1em;
}

.policy-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(0,0,0,0.95), rgba(0,0,0,0.98));
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.policy-screen.policy-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.policy-screen.policy-hide {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

body.policy-lock {
  overflow: hidden;
}

.policy-panel {
  max-width: 800px;
  width: 100%;
  background: rgba(12, 12, 22, 0.96);
  border-radius: 1.6rem;
  padding: 1.6rem 1.8rem 1.2rem 1.8rem;
  border: 1px solid rgba(255,255,255,0.24);
  box-shadow: 0 18px 45px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: relative;
  overflow: hidden;
}

.policy-top-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff2f7a, #bf4dff);
  opacity: 0.9;
}

.policy-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 0.3rem;
}

.policy-logo {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.policy-logo-main {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.policy-logo-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  opacity: 0.75;
  color: #ff8aff;
}

.policy-intro {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.5;
  border-left: 3px solid rgba(255,47,122,0.8);
  padding-left: 0.8rem;
}

.policy-scroll {
  margin-top: 0.2rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.1);
  max-height: min(60vh, 480px);
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* внутренние элементы текста */
.policy-scroll h2 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem 0;
}

.policy-scroll h3 {
  font-size: 0.96rem;
  margin: 0.8rem 0 0.3rem 0;
}

.policy-scroll p {
  margin: 0.2rem 0 0.4rem 0;
}

.policy-scroll ul {
  margin: 0.2rem 0 0.4rem 1.1rem;
  padding: 0;
}

.policy-scroll li {
  margin: 0.15rem 0;
}

.policy-scroll code {
  font-family: Consolas, Menlo, monospace;
  font-size: 0.84rem;
  background: rgba(255,255,255,0.06);
  padding: 0.05rem 0.25rem;
  border-radius: 0.35rem;
}

/* тонкий скроллбар */
.policy-scroll::-webkit-scrollbar {
  width: 6px;
}
.policy-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.policy-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 999px;
}

.policy-actions {
  margin-top: 0.7rem;
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
}

.policy-btn {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 0.5rem 1.3rem;
  font-size: 0.9rem;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.policy-btn.primary {
  background: linear-gradient(135deg, #ff2f7a, #ff8aff);
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 8px 20px rgba(0,0,0,0.7);
}

.policy-btn.ghost {
  background: rgba(255,255,255,0.04);
  border-style: dashed;
}

.policy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.8);
}

.policy-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 14px rgba(0,0,0,0.75);
}

.policy-note {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  opacity: 0.8;
  text-align: right;
}

/* плавное появление карточек после загрузки */
.page.active .card,
.page.active .memo-card {
  opacity: 0;
  transform: translateY(8px);
}

body.site-loaded .page.active .card,
body.site-loaded .page.active .memo-card {
  animation: cardIn 0.45s ease forwards;
}

body.site-loaded .page.active .card:nth-child(2),
body.site-loaded .page.active .memo-card:nth-child(2) {
  animation-delay: 0.05s;
}
body.site-loaded .page.active .card:nth-child(3),
body.site-loaded .page.active .memo-card:nth-child(3) {
  animation-delay: 0.09s;
}
body.site-loaded .page.active .card:nth-child(4),
body.site-loaded .page.active .memo-card:nth-child(4) {
  animation-delay: 0.13s;
}

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

@media (max-width: 640px) {
  .policy-panel {
    padding: 1.3rem 1.1rem 1rem 1.1rem;
    border-radius: 1.3rem;
  }

  .policy-scroll {
    max-height: 55vh;
    padding: 0.7rem 0.8rem;
  }

  .policy-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .policy-note {
    text-align: left;
  }
}
