/* ==================== Общие настройки ==================== */
* {
  box-sizing: border-box;
}

body {
  background-color: #000;
  color: #ccc;
  font-family: monospace;
  font-size: 20px;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  animation: fadeIn 2s ease-in-out forwards;
  position: relative;
}

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

/* ==================== Matrix Canvas Background ==================== */
#matrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
  opacity: 0.4;
}

/* ==================== Glitch Overlay ==================== */
.glitch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 50%,
    transparent 100%
  );
  transition: opacity 0.1s;
}

.glitch-overlay.active {
  opacity: 1;
  animation: glitchScan 0.1s linear;
}

@keyframes glitchScan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* ==================== Название и цитатка ==================== */
.nazvanie {
  animation: floatText 4s ease-in-out infinite !important;
  text-align: center;
  z-index: 10;
  position: relative;
  will-change: transform;
}

@keyframes floatText {
  0%   { transform: translateY(-2px); }
  50%  { transform: translateY(-6px); }
  100% { transform: translateY(-2px); }
}

.nazvanie h1 {
  font-size: 70px;
  margin-bottom: 0;
}

.nazvanie p {
  margin-top: 2px;
  margin-bottom: 0;
  font-style: italic;
  color: #aaa;
}


/* ==================== Glitch Text Effect ==================== */
.glitch-text {
  position: relative;
  cursor: pointer;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.glitch-text.glitch-active::before {
  animation: glitch-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  color: #0ff;
  z-index: -1;
}

.glitch-text.glitch-active::after {
  animation: glitch-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  color: #f0f;
  z-index: -2;
}

@keyframes glitch-1 {
  0%, 100% {
    transform: translate(0);
    opacity: 0;
  }
  20% {
    transform: translate(-3px, 3px);
    opacity: 0.8;
  }
  40% {
    transform: translate(-3px, -3px);
    opacity: 0.8;
  }
  60% {
    transform: translate(3px, 3px);
    opacity: 0.8;
  }
  80% {
    transform: translate(3px, -3px);
    opacity: 0.8;
  }
}

@keyframes glitch-2 {
  0%, 100% {
    transform: translate(0);
    opacity: 0;
  }
  20% {
    transform: translate(3px, -3px);
    opacity: 0.8;
  }
  40% {
    transform: translate(3px, 3px);
    opacity: 0.8;
  }
  60% {
    transform: translate(-3px, -3px);
    opacity: 0.8;
  }
  80% {
    transform: translate(-3px, 3px);
    opacity: 0.8;
  }
}

.nickname-glow {
  animation: nicknameGlowPulse 1s ease-in-out;
}

@keyframes nicknameGlowPulse {
  0%, 100% {
    text-shadow: 
      0 0 10px rgba(255, 255, 255, 0.5),
      0 0 20px rgba(255, 255, 255, 0.3),
      0 0 30px rgba(255, 255, 255, 0.2);
  }
  50% {
    text-shadow: 
      0 0 20px rgba(255, 255, 255, 0.8),
      0 0 40px rgba(255, 255, 255, 0.6),
      0 0 60px rgba(255, 255, 255, 0.4),
      0 0 80px rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }
}

/* ==================== Плеер ==================== */
.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 30px 0 20px;
  font-size: 24px;
  z-index: 10;
  position: relative;
}

.volume-buttons {
  cursor: pointer;
  font-weight: bold;
  transition: color 0.3s ease;
  font-size: 22px;
  color: #888;
}

.volume-buttons:hover {
  color: #fff;
}

.volume-buttons:active {
  transform: scale(0.95);
}

#centerDisplay {
  width: 60px;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.3s ease;
  font-size: 22px;
  color: #aaa;
}

/* ==================== Меню ==================== */
.link-bar {
  margin: 12px 0;
  transition: transform 0.6s ease, opacity 0.6s ease;
  text-align: center;
  z-index: 10;
  position: relative;
}

.link-bar a {
  position: relative;
  font-size: 20px;
  margin: 0 10px;
  color: #888;
  text-decoration: none;
  transition: all 0.3s ease;
  display: inline-block;
}

.link-bar a::before {
  content: "> ";
  opacity: 0;
  transition: opacity 0.3s ease;
  color: #fff;
}

.link-bar a::after {
  content: " <";
  opacity: 0;
  transition: opacity 0.3s ease;
  color: #fff;
}

.link-bar a:hover {
  font-size: 24px;
  color: #fff;
}

.link-bar a:hover::before,
.link-bar a:hover::after {
  opacity: 1;
}

/* ==================== Видео фон ==================== */
video#bgVideo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  filter: brightness(0.3) blur(1px) saturate(1.2);
  z-index: -1;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  pointer-events: none;
}

video#bgVideo.visible {
  opacity: 1;
}

/* ==================== Сдвиг при показе ==================== */
#top-block {
  text-align: center;
  transition: transform 0.5s ease, margin-bottom 0.5s ease;
  z-index: 10;
  position: relative;
}

.shift-up {
  transform: translateY(-60px);
  margin-bottom: -30px;
}

/* ==================== Секции ==================== */
.section {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  z-index: 10;
  position: relative;
}

.section.active {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  max-height: none;
  overflow: visible;
}

.section-content {
  display: flex;
  justify-content: center;
  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;
}

.section-content::-webkit-scrollbar {
  width: 8px;
}

.section-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.section-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
}

.section-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.7);
}

.section-inner {
  padding-top: 20px;
  width: 100%;
  box-sizing: border-box;
}

.section-inner h3:first-child,
.section-inner p:first-child {
  margin-top: 0;
}

/* ==================== Текст и заголовки ==================== */
h3 {
  font-size: 24px;
}

hr {
  border: none;
  border-top: 1px dotted #ccc;
  margin: 6px 0;
}

/* ==================== Кнопка назад ==================== */
.back-button {
  margin: 30px auto 40px;
  cursor: pointer;
  font-weight: bold;
  color: #ccc;
  display: block;
  font-size: 20px;
  text-align: center;
  z-index: 100;
  position: relative;
}

.back-button:hover {
  color: white;
}

/* ==================== Печатающий эффект ==================== */
.typewriter {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ==================== Плавность меню ==================== */
#menu-block {
  transition: opacity 0.4s ease;
}

/* ==================== Мобильная версия ==================== */
@media (max-width: 768px) {
  body {
    font-size: 22px;
    padding: 20px 10px;
    justify-content: center;
  }

  .nazvanie h1 {
    font-size: 70px;
  }

  .nazvanie p {
    font-size: 18px;
  }

  .player-controls {
    font-size: 26px;
    gap: 20px;
    margin: 30px 0 20px;
  }

  .volume-buttons {
    font-size: 24px;
  }

  #centerDisplay {
    font-size: 24px;
    width: 70px;
  }

  .link-bar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    margin: 20px 0;
  }

  .link-bar a {
    font-size: 24px;
    margin: 0;
    display: block;
    width: auto;
    text-align: center;
  }

  .link-bar a:hover {
    font-size: 26px;
  }

  .section {
    max-width: 100%;
    padding: 0 15px;
    margin-bottom: 20px;
  }

  .section.active {
    max-height: none;
    overflow: visible;
  }

  .section-content {
    max-height: none;
    overflow-y: visible;
    padding-right: 5px;
  }

  .section-inner {
    font-size: 22px;
    padding-top: 20px;
  }

  .back-button {
    font-size: 24px;
    padding: 14px 28px;
    margin: 25px auto 35px;
    position: relative;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.5);
  }

  .shift-up {
    transform: translateY(-40px);
    margin-bottom: -20px;
  }


  /* Touch improvements */
  .volume-buttons,
  #centerDisplay,
  .link-bar a,
  .back-button {
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    touch-action: manipulation;
  }
}

@media (max-width: 480px) {
  .nazvanie h1 {
    font-size: 40px;
  }

  .link-bar a {
    font-size: 16px;
    margin: 0 6px;
  }

  .section-content {
    max-height: 35vh;
  }
}

/* ==================== Landscape mobile fix ==================== */
@media (max-height: 500px) and (orientation: landscape) {
  body {
    padding-top: 5vh;
  }

  .nazvanie h1 {
    font-size: 35px;
  }

  .player-controls {
    margin: 10px 0;
  }

  .section-content {
    max-height: 30vh;
  }

  .back-button {
    margin: 15px auto 20px;
    padding: 8px 16px;
  }
}

