:root {
    --primary-color: #6A1B9A;
    --secondary-color: #DA70D6;
    --background-gradient: linear-gradient(135deg, #2E0854, #6A1B9A);
    --text-color: #E6E6FA;
    --accent-color: #8A2BE2;
    --neon-glow: #00FFD1;
    --window-border: #9370DB;
    --window-title: #E0B0FF;
}

* {
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

*, *::after, *::before {
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-app-region: no-drag;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background: var(--background-gradient) fixed;
    display: flex;
    flex-direction: column;
    perspective: 1000px;
}

/* Window Design */
.window-container {
    width: 95%;
    max-width: 1400px;
    margin: 10px auto;
    height: 95vh; /* Фиксированная высота для всего окна */
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    background-color: #111;
    border: 2px solid var(--window-border);
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(1deg);
    transition: transform 0.3s ease;
}

.window-container:hover {
    transform: perspective(1000px) rotateX(0deg);
}

.window-titlebar {
    height: 45px;
    background: linear-gradient(90deg, #4A148C, #7B1FA2);
    display: flex;
    align-items: center;
    padding: 0 10px;
    position: relative;
    z-index: 10;
}

.window-title {
    color: var(--window-title);
    font-weight: 700;
    font-size: 22px;
    text-shadow: 0 0 5px rgba(218, 112, 214, 0.6);
    flex-grow: 1;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
}

.window-buttons {
    display: flex;
    gap: 8px;
}

.window-button {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.window-button.close {
    background-color: #ff5f57;
}

.window-button.minimize {
    background-color: #ffbd2e;
}

.window-button.maximize {
    background-color: #28ca41;
}

/* Улучшенный контейнер содержимого */
.window-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 45px);
    padding: 15px;
    background-color: #1a1a1a;
    position: relative;
    overflow: hidden;
}

/* Cosmic Background Animation */
.cosmic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    z-index: -1;
    overflow: hidden;
}

.cosmic-background::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: starfield 20s linear infinite;
}

@keyframes starfield {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Succinct Elements Background Animation */
.falling-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.falling-item {
    position: absolute;
    z-index: -1;
    filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.6));
    transition: all 0.5s ease;
}

/* Blinking pixel elements */
.blinking-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.succinct-pixel {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    box-shadow: 0 0 10px currentColor;
}

/* Новая структура заголовка в одну строку */
.header-area {
    display: flex;
    padding: 0 15px;
    margin-bottom: 15px;
    align-items: center;
    height: 45px;
}

/* Стили для логотипа */
.logo-section {
    display: flex;
    align-items: center;
    margin-right: 15px;
    height: 100%;
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.logo-icon {
    font-size: 34px;
    color: var(--secondary-color);
    text-shadow: 0 0 10px var(--neon-glow);
}

.logo-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(218, 112, 214, 0.5);
    letter-spacing: 2px;
}

/* Стили для таймера */
#timer {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 5px;
    position: relative;
    overflow: hidden;
    flex-grow: 1;
    height: 34px;
    display: flex;
    align-items: center;
    margin: 0 15px;
}

#progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #6e2dd3, #00FFD1);
    border-radius: 12px;
    transition: width 0.3s;
}

#timer span {
    position: relative;
    z-index: 1;
    color: white;
    font-weight: 600;
    margin-left: 10px;
    font-size: 14px;
}

/* Стили для счетчика */
#score {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    height: 34px;
}

#score span {
    color: #00FFD1;
    text-shadow: 0 0 10px rgba(0, 255, 209, 0.5);
}

/* Скрываем оригинальный game-header */
.game-header {
    display: none;
}

/* Улучшенный макет страницы для лучшего использования пространства */
.game-layout {
    display: flex;
    flex: 1;
    gap: 15px;
    height: calc(100% - 60px); /* Уменьшено для устранения лишнего пространства */
    margin-bottom: 0; /* Убран отступ перед панелью задач */
    overflow: hidden; /* Предотвращаем переполнение */
}

/* Стиль для терминала (боковая панель) */
.terminal-sidebar {
    width: 25%;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.terminal-container {
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    padding: 15px;
    flex: 1;
}

.terminal-console {
    font-family: 'Courier New', monospace;
    color: #00FFD1;
    font-size: 14px;
    height: 100%;
}

.terminal-line {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #33ff33;
    margin: 5px 0;
    opacity: 0.7;
    animation: typewriter 2s steps(40) forwards;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
}

.terminal-line:nth-child(2) {
    animation-delay: 0.5s;
    opacity: 0.6;
}

.terminal-line:nth-child(3) {
    animation-delay: 1s;
    opacity: 0.5;
}

@keyframes typewriter {
    to {
        width: 100%;
    }
}

/* Статистика игры */
.game-stats {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 15px;
}

.stats-title {
    color: #00FFD1;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: white;
    font-size: 14px;
}

.stats-value {
    color: #00FFD1;
}

/* Оптимизированное игровое поле - сетка 2x4 */
#game-field {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    border: 2px solid #9370DB;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
    padding: 15px;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Адаптивные сетки для разных размеров экрана */
@media (min-width: 992px) {
    #game-field {
        grid-template-columns: repeat(4, minmax(150px, 1fr));
        grid-template-rows: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 991px) {
    #game-field {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }
}

#game-field::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(138, 43, 226, 0.05) 0px,
        rgba(138, 43, 226, 0.05) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    opacity: 0.5;
}

#game-field::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, 
        rgba(218, 112, 214, 0.1) 0%, 
        rgba(0, 0, 0, 0) 70%);
    z-index: 1;
    pointer-events: none;
}

/* Исправление для контейнеров изображений в игровом поле */
#game-field > div {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.3);
    transition: all 0.3s ease-in-out;
}

/* Улучшенный стиль для изображений участников */
.member-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Изменено с cover на contain */
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); /* Плавная кривая Безье */
    filter: hue-rotate(-40deg) brightness(0.9);
    opacity: 0.7;
    cursor: pointer;
    display: block;
}

.member-img:hover {
    filter: hue-rotate(0) brightness(1.2);
    transform: scale(1.05); /* Уменьшено с 1.1 до 1.05 */
    opacity: 1;
}

/* Добавление активного состояния для плавного перехода при клике */
.member-img:active {
    transform: scale(0.98);
    transition: all 0.1s ease;
}

/* Удаляем все grid-area назначения, чтобы grid-template работал корректно */
#game-field > .member-img,
#game-field > div {
    grid-area: auto !important;
}

/* Animation keyframes for background elements */
@keyframes diagonal-drift {
    0% {
        transform: translateX(-100px) translateY(-100px) rotate(0deg);
    }
    100% {
        transform: translateX(calc(100vw + 100px)) translateY(calc(100vh + 100px)) rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(100px) scale(0.9);
    }
}

@keyframes circular-path {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(200px, 0) rotate(90deg);
    }
    50% {
        transform: translate(200px, 200px) rotate(180deg);
    }
    75% {
        transform: translate(0, 200px) rotate(270deg);
    }
    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

@keyframes zigzag {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(100px, 50px) scale(1.1);
    }
    50% {
        transform: translate(0, 100px) scale(1);
    }
    75% {
        transform: translate(-100px, 50px) scale(0.9);
    }
}

@keyframes gentle-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(0.9); }
    50% { transform: scale(1.1); }
}

.hidden {
    display: none !important;
}

/* Glitch Effect */
.glitch-text {
    position: relative;
    color: var(--secondary-color);
    text-shadow: 0 0 10px var(--neon-glow);
}

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

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 red;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 blue;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(5px, 9999px, 54px, 0); }
    5% { clip: rect(80px, 9999px, 54px, 0); }
    10% { clip: rect(40px, 9999px, 54px, 0); }
    15% { clip: rect(10px, 9999px, 54px, 0); }
    20% { clip: rect(30px, 9999px, 54px, 0); }
    25% { clip: rect(20px, 9999px, 54px, 0); }
    30% { clip: rect(60px, 9999px, 54px, 0); }
    35% { clip: rect(70px, 9999px, 54px, 0); }
    40% { clip: rect(15px, 9999px, 54px, 0); }
    45% { clip: rect(25px, 9999px, 54px, 0); }
    50% { clip: rect(5px, 9999px, 54px, 0); }
    55% { clip: rect(35px, 9999px, 54px, 0); }
    60% { clip: rect(45px, 9999px, 54px, 0); }
    65% { clip: rect(55px, 9999px, 54px, 0); }
    70% { clip: rect(65px, 9999px, 54px, 0); }
    75% { clip: rect(75px, 9999px, 54px, 0); }
    80% { clip: rect(15px, 9999px, 54px, 0); }
    85% { clip: rect(25px, 9999px, 54px, 0); }
    90% { clip: rect(35px, 9999px, 54px, 0); }
    95% { clip: rect(45px, 9999px, 54px, 0); }
    100% { clip: rect(55px, 9999px, 54px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(15px, 9999px, 54px, 0); }
    5% { clip: rect(25px, 9999px, 54px, 0); }
    10% { clip: rect(35px, 9999px, 54px, 0); }
    15% { clip: rect(45px, 9999px, 54px, 0); }
    20% { clip: rect(55px, 9999px, 54px, 0); }
    25% { clip: rect(65px, 9999px, 54px, 0); }
    30% { clip: rect(75px, 9999px, 54px, 0); }
    35% { clip: rect(15px, 9999px, 54px, 0); }
    40% { clip: rect(25px, 9999px, 54px, 0); }
    45% { clip: rect(35px, 9999px, 54px, 0); }
    50% { clip: rect(45px, 9999px, 54px, 0); }
    55% { clip: rect(5px, 9999px, 54px, 0); }
    60% { clip: rect(15px, 9999px, 54px, 0); }
    65% { clip: rect(25px, 9999px, 54px, 0); }
    70% { clip: rect(35px, 9999px, 54px, 0); }
    75% { clip: rect(45px, 9999px, 54px, 0); }
    80% { clip: rect(55px, 9999px, 54px, 0); }
    85% { clip: rect(65px, 9999px, 54px, 0); }
    90% { clip: rect(75px, 9999px, 54px, 0); }
    95% { clip: rect(25px, 9999px, 54px, 0); }
    100% { clip: rect(15px, 9999px, 54px, 0); }
}

/* Floating desktop icons */
.desktop-icons {
    position: absolute;
    right: 20px;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 5;
}

.desktop-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.desktop-icon:hover {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(218, 112, 214, 0.3);
}

.desktop-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.desktop-icon-text {
    font-size: 10px;
    color: var(--text-color);
    text-align: center;
    margin-top: 5px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Стиль для панели задач */
.taskbar {
    margin-top: 10px; /* Небольшой отступ сверху вместо auto */
    padding: 10px;
    background-color: rgba(30, 30, 40, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    height: 60px;
}

.taskbar-icons {
    display: flex;
    gap: 15px;
}

.taskbar-icon {
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.taskbar-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.taskbar-icon img {
    width: 20px;
    height: 20px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(46, 8, 84, 0.9);
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    perspective: 1000px;
}

.overlay-content {
    max-width: 600px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 2px solid var(--secondary-color);
    box-shadow: 0 0 30px rgba(218, 112, 214, 0.3);
    transform: rotateX(15deg);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.overlay-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        rgba(138, 43, 226, 0.1),
        rgba(138, 43, 226, 0.1) 10px,
        rgba(138, 43, 226, 0.2) 10px,
        rgba(138, 43, 226, 0.2) 20px
    );
    z-index: -1;
}

.overlay:hover .overlay-content {
    transform: rotateX(0);
}

.overlay h1 {
    color: var(--secondary-color);
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
}

.overlay h2, .overlay h3 {
    color: var(--text-color);
    margin-bottom: 20px;
}

.glitch-button {
    position: relative;
    margin-top: 20px;
    padding: 12px 32px;
    background-color: transparent;
    color: var(--secondary-color);
    font-size: 18px;
    font-weight: 600;
    border: 2px solid var(--secondary-color);
    border-radius: 32px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    overflow: hidden;
}

.glitch-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(218, 112, 214, 0.3), transparent);
    transition: all 0.5s;
}

.glitch-button:hover::before {
    left: 100%;
}

.glitch-button:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(218, 112, 214, 0.5);
}

.typing-text {
    position: relative;
    display: inline-block;
}

.typing-text::after {
    content: '|';
    animation: blink 0.7s infinite;
}

/* Small screen adjustments */
@media (max-width: 768px) {
    .game-layout {
        flex-direction: column;
    }
    
    .terminal-sidebar {
        width: 100%;
        min-width: unset;
        order: 2;
    }
    
    .terminal-container,
    .game-stats {
        max-height: 150px;
    }
    
    #game-field {
        width: 100%;
        aspect-ratio: 1/1;
    }
    
    .overlay-content {
        max-width: 90%;
        padding: 20px;
    }
    
    .overlay h1 {
        font-size: 1.8rem;
    }
    
    .desktop-icons {
        display: none;
    }
    
    .header-area {
        flex-wrap: wrap;
        height: auto;
        margin-bottom: 10px;
    }
    
    .logo-section {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }
    
    #timer, #score {
        flex: 1;
    }
}
