/* ==========================================================================
   1. Base Styles & Reset
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {

    margin: 0;
    padding: 0;
}

body {
    background-color: #000;
    color: #ccc;
    font-family: 'Share Tech Mono', monospace;
    background-image: url('https://Chponkler.github.io/site/img/concrete.png');
    background-attachment: fixed;
    height: 100vh;
    position: relative;
}

.content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 2rem; /* <<< ИЗМЕНЕНА ЭТА СТРОКА (было 2rem) */
    overflow-y: auto;
    transition: filter 10s linear;
}

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://Chponkler.github.io/site/img/noise.gif');
    opacity: 0.2;
    z-index: -1;
    pointer-events: none;
    transition: opacity 1s;
}


/* ==========================================================================
   2. Typography (Headings & Text)
   ========================================================================== */

/* === НАЧАЛО ИСПРАВЛЕНИЯ === */
header {
    text-align: center; /* Центрирует все внутри хедера (h1 и таймер) */
}
/* === КОНЕЦ ИСПРАВЛЕНИЯ === */

h1, h2 {
    font-family: 'VT323', monospace;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 4px;
    border-bottom: 1px solid #555;
    padding: 10px;
    padding-bottom: 10px;
    margin-bottom: 30px;
    position: relative;
    transition: color 0.3s ease;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.5rem;
    letter-spacing: 3px;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
    text-shadow: 0 0 2px rgba(204, 204, 204, 0.3);
}

a {
    color: #715c77;
    text-decoration: none;
    background: none;
    transition: color 0.3s ease, background-color 0.3s ease;
}

a:hover {
    color: #000;
    background-color: #fbfcfc;
}


/* ==========================================================================
   3. Main Content (Player Block)
   ========================================================================== */

main {
    width: 100%;
    max-width: 700px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    border-image: linear-gradient(to right, #333, #666) 1;
    padding: 40px;
    margin: 20px auto;
    position: relative;
}

.track {
    margin-bottom: 20px;
    padding-bottom: 20px;
    position: relative;
}

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0; left: 5%;
    width: 90%; height: 1px;
    background-image: linear-gradient(to right, #fcf5f5 50%, transparent 50%);
    background-size: 8px 1px;
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #ff0000;
    border-style: solid;
}

.corner-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; }
.corner-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; }
.corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; }
.corner-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; }


/* ==========================================================================
   4. Audio Player Styling
   ========================================================================== */

audio {
    width: 100%;
    height: 40px;
    margin-top: 10px;
    filter: grayscale(100%) contrast(150%) brightness(85%);
    border-radius: 0;
    transition: filter 0.3s ease;
}

audio:hover {
    filter: grayscale(80%) contrast(160%) brightness(100%);
}

audio:focus {
    outline: none;
}

audio::-webkit-media-controls-enclosure {
    border-radius: 0 !important;
    background-color: #e60707 !important;
}

audio::-webkit-media-controls-panel {
    border-radius: 0 !important;
    background-color: #ece9e9 !important;
}


/* ==========================================================================
   5. Animations & Effects
   ========================================================================== */

/* Glitch on H1 */
h1 {
    animation: constant-glitch 3.5s infinite;
}

h1::before,
h1::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}

h1::before {
    left: 2px;
    text-shadow: -2px 0 #ff00de;
    animation: constant-glitch-clip 3.5s infinite;
}

h1::after {
    left: -2px;
    text-shadow: -2px 0 #00aaff;
    animation: constant-glitch-clip-2 3.5s infinite;
}

@keyframes constant-glitch {
    0%, 97%  { transform: translate(0, 0); }
    98%      { transform: translate(-8px, 2px) skewX(-20deg); }
    99%      { transform: translate(6px, -3px); }
    100%     { transform: translate(0, 0); }
}

@keyframes constant-glitch-clip {
    0%, 97%  { clip-path: inset(50% 0 50% 0); }
    98%      { clip-path: inset(15% 0 60% 0); }
    99%      { clip-path: inset(75% 0 5% 0); }
    100%     { clip-path: inset(50% 0 50% 0); }
}

@keyframes constant-glitch-clip-2 {
    0%, 98%  { clip-path: inset(50% 0 50% 0); }
    99%      { clip-path: inset(5% 0 88% 0); }
    100%     { clip-path: inset(50% 0 50% 0); }
}

/* Hover glitch on H2 */
h2:hover {
    color: #b60101;
}

h2:hover::before,
h2:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

h2:hover::before {
    left: 2px;
    text-shadow: -1px 0 #00aaff;
    animation: glitch-anim 2s infinite linear alternate-reverse;
}

h2:hover::after {
    left: -2px;
    text-shadow: -1px 0 #ff00de;
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0%   { clip-path: inset(45% 0 50% 0); }
    20%  { clip-path: inset(10% 0 85% 0); }
    40%  { clip-path: inset(70% 0 10% 0); }
    60%  { clip-path: inset(90% 0 5% 0); }
    80%  { clip-path: inset(40% 0 45% 0); }
    100% { clip-path: inset(60% 0 30% 0); }
}

@keyframes glitch-anim-2 {
    0%   { clip-path: inset(80% 0 10% 0); }
    20%  { clip-path: inset(25% 0 70% 0); }
    40%  { clip-path: inset(5% 0 90% 0); }
    60%  { clip-path: inset(65% 0 20% 0); }
    80%  { clip-path: inset(15% 0 75% 0); }
    100% { clip-path: inset(55% 0 35% 0); }
}


/* ==========================================================================
   6. Footer
   ========================================================================== */

footer {
    margin-top: 40px;
    font-size: 0.8em;
    color: #666;
    text-align: center; /* <<< ДОБАВЛЕНА ЭТА СТРОКА */
}


/* ==========================================================================
   7. Marquee (Бегущая строка)
   ========================================================================== */

.marquee {
    position: fixed;
    left: 0; width: 100%;
    background-color: #111;
    border: 1px solid #444;
    padding: 5px 0;
    overflow: hidden;
    white-space: nowrap;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #888;
    z-index: 100;
}

.marquee-top    { top: 0; }
.marquee-bottom { bottom: 0; }

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-scroll 40s linear infinite;
}

.marquee-bottom .marquee-content {
    animation-duration: 45s;
    animation-direction: reverse;
}

@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}


/* ==========================================================================
   8. UI Enhancements (Cursor & Scrollbar)
   ========================================================================== */

html { cursor: crosshair; }

a, button, audio { cursor: cell; }

::-webkit-scrollbar {
    width: 10px;
    background-color: #111;
}

::-webkit-scrollbar-thumb {
    background-color: #ff000000;
    border: 2px solid #111;
    border-radius: 0;
}

::-webkit-scrollbar-button {
    display: none;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0,
        rgba(0, 0, 0, 0.3) 1px,
        transparent 1px,
        transparent 3px
    );
    background-size: 100% 3px;
    z-index: 101;
    pointer-events: none;
}


/* ==========================================================================
   9. Fullscreen Glitch Events
   ========================================================================== */

#event-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 9998;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s ease-in-out, visibility 0.2s;
}

#event-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

#event-overlay.light-theme {
    background-color: #fff;
}

#event-text {
    font-family: 'VT323', monospace;
    color: #ff0000;
    font-size: 5vw;
    text-shadow: 0 0 10px #ff0000;
    text-transform: uppercase;
    text-align: center;
    padding: 20px;
}

#event-overlay.light-theme #event-text {
    color: #000;
    text-shadow: none;
}

.global-glitch {
    animation: screen-glitch 0.4s steps(2, jump-both) infinite;
}

@keyframes screen-glitch {
    0%, 100% { transform: translate(0, 0); clip-path: inset(20% 0 75% 0); }
    25%      { transform: translate(8px, -12px); clip-path: inset(5% 0 90% 0); }
    50%      { transform: translate(-10px, 10px); clip-path: inset(80% 0 10% 0); }
    75%      { transform: translate(12px, -8px); clip-path: inset(40% 0 30% 0); }
}


/* ==========================================================================
   10. Web Buttons (88x31)
   ========================================================================== */

.button-container {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(3, 88px);
    gap: 8px;
    justify-content: center;
}

.web-button {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    border: none;
}

.web-button.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* ==========================================================================
   11. Degradation Effects
   ========================================================================== */

/* Уровень 1: Едва заметные искажения */
body.degrade-level-1::after {
    opacity: 0.4; /* Шум становится заметнее */
}

body.degrade-level-1 h1 {
    animation-duration: 2s !important; /* Глитч на заголовке становится чаще */
}

/* Уровень 2: Цвета начинают выцветать */
body.degrade-level-2 .content-wrapper {
    filter: saturate(50%); /* Фильтр на обёртке */
}

body.degrade-level-2 .marquee {
    animation-duration: 80s !important; /* Бегущая строка замедляется */
}

/* Уровень 3: Серьезные сбои */
body.degrade-level-3::after {
    opacity: 0.7; /* Шум сильнее */
}

body.degrade-level-3 main {
    animation: screen-shake 0.3s infinite; /* Тряска основного блока */
}

/* Уровень 4: Предсмертное состояние */
body.degrade-level-4 .content-wrapper {
    filter: saturate(0%) brightness(70%);
}

body.degrade-level-4 .marquee-content {
    animation-play-state: paused; /* Бегущие строки “замерзают” */
}

@keyframes screen-shake {
    0%, 100% { transform: translate(0, 0); }
    25%      { transform: translate(2px, -1px); }
    50%      { transform: translate(-1px, 2px); }
    75%      { transform: translate(1px, 1px); }
}

/* ==========================================================================
   12. Countdown Timer
   ========================================================================== */

#countdown-timer {
    font-family: 'VT323', monospace;
    color: #fff;
    font-size: 1.8rem;
    letter-spacing: 3px;
    /* Отрицательный отступ, чтобы придвинуть таймер ближе к заголовку */
    margin-top: -20px;
    margin-bottom: 20px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
}

/* Класс для мигающей цифры */
.blinking {
    animation: blink-anim 1.5s infinite;
}

/* Анимация мигания */
@keyframes blink-anim {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3; /* Мигаем не до нуля, а до 0.3 для более мягкого эффекта */
    }
}