:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --accent-color: #4CAF50;
    --nav-bg: #1e1e1e;
    --card-bg: #1f1f1f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body { background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; }

/* Навигация и базовые элементы */
.navbar { display: flex; justify-content: space-between; align-items: center; background-color: var(--nav-bg); padding: 1rem 5%; box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.logo { font-size: 1.5rem; font-weight: bold; color: var(--accent-color); }
.nav-links { list-style: none; display: flex; gap: 20px; }
.nav-links a { color: var(--text-color); text-decoration: none; font-weight: 500; transition: color 0.3s ease; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-color); }
.container { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }
h1, h2, h3 { margin-bottom: 15px; }
h1 { color: var(--accent-color); border-bottom: 2px solid var(--accent-color); padding-bottom: 10px; margin-bottom: 30px; }
.divider { border: none; height: 1px; background-color: #333; margin: 40px 0; }
.benefits-list { margin: 20px 0 20px 20px; }

.contact-btn, .game-btn { background-color: var(--accent-color); color: white; border: none; padding: 10px 20px; font-size: 1rem; cursor: pointer; border-radius: 5px; transition: background-color 0.3s; }
.contact-btn:hover, .game-btn:hover { background-color: #45a049; }

/* Блок "Обо мне" */
.about-content { display: flex; align-items: center; justify-content: space-between; gap: 40px; margin-bottom: 30px; }
.about-text { flex: 1; }
.about-text p { margin-bottom: 15px; font-size: 1.1rem; }
.about-photo { flex-shrink: 0; }
.about-photo img { width: 250px; height: 250px; object-fit: cover; border-radius: 50%; border: 4px solid var(--accent-color); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.about-photo img:hover { transform: scale(1.05) rotate(2deg); box-shadow: 0 15px 30px rgba(76, 175, 80, 0.4); }

.skills-title { margin-top: 30px; margin-bottom: 20px; font-size: 1.4rem; color: var(--accent-color); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 10px; }
.skill-card { background-color: var(--card-bg); padding: 20px; border-radius: 8px; border-left: 4px solid var(--accent-color); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); transition: transform 0.3s ease; }
.skill-card:hover { transform: translateY(-5px); }
.skill-card h4 { margin-bottom: 15px; color: #fff; font-size: 1.1rem; }
.skill-card ul { list-style: none; }
.skill-card ul li { margin-bottom: 8px; position: relative; padding-left: 20px; color: #ccc; }
.skill-card ul li::before { content: "▹"; position: absolute; left: 0; color: var(--accent-color); }

/* Скриншоты и Лайтбокс */
.screenshots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }
.screenshot-placeholder { background-color: var(--card-bg); border: 1px solid #333; border-radius: 8px; padding: 15px; display: flex; justify-content: center; align-items: center; height: 300px; }
.screenshot-placeholder img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; cursor: zoom-in; transition: transform 0.3s ease; }
.screenshot-placeholder:hover img { transform: scale(1.05); }
.lightbox { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.9); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.lightbox.active { opacity: 1; pointer-events: all; }
.lightbox img { max-width: 90%; max-height: 90vh; border-radius: 8px; box-shadow: 0 0 30px rgba(0, 0, 0, 0.8); object-fit: contain; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; font-weight: bold; cursor: pointer; user-select: none; transition: color 0.3s; }
.lightbox-close:hover { color: var(--accent-color); }

/* Подвал */
.footer { background-color: var(--nav-bg); color: #888; padding: 30px 20px; margin-top: 60px; border-top: 1px solid #333; }
.footer-content { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.social-links { display: flex; gap: 20px; }
.social-links a { color: #bbb; text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.3s ease, transform 0.3s ease; }
.social-links a:hover { color: var(--accent-color); transform: translateY(-3px); }

/* Авторизация */
.auth-container { max-width: 400px; margin: 60px auto; background-color: var(--card-bg); padding: 30px; border-radius: 8px; border: 1px solid #333; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8); text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.auth-form input { width: 100%; padding: 12px; background-color: #121212; border: 1px solid #444; border-radius: 5px; color: #fff; font-size: 1rem; transition: border-color 0.3s; }
.auth-form input:focus { outline: none; border-color: var(--accent-color); }
.auth-error { color: #ff5252; font-size: 0.9rem; margin-bottom: 10px; }
.auth-error.hidden { display: none; }
.auth-toggle { margin-top: 20px; font-size: 0.9rem; color: #aaa; }
.auth-toggle a { color: var(--accent-color); text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }

/* Таблица лидеров */
.leaderboard-container { max-width: 800px; margin: 30px auto; background-color: var(--card-bg); padding: 20px; border-radius: 8px; border: 1px solid #333; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8); }
.leaderboard-container h3 { text-align: center; color: #ffd700; margin-top: 0; margin-bottom: 15px; border-bottom: 1px solid #333; padding-bottom: 10px; text-transform: uppercase; letter-spacing: 2px; }
.leaderboard-list { list-style: none; padding: 0; margin: 0; }
.leaderboard-list li { display: flex; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid #222; font-size: 1.1rem; align-items: center; }
.leaderboard-list li:last-child { border-bottom: none; }
.leaderboard-list li span.rank { width: 40px; font-size: 1.3rem; text-align: center; }
.leaderboard-list li span.name { flex-grow: 1; color: #fff; font-weight: bold; padding-left: 15px; }
.leaderboard-list li span.score { color: #00E676; font-weight: bold; font-size: 1.2rem; }
.leaderboard-list li:first-child span.name { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }

/* =========================================
   ИГРОВАЯ АРХИТЕКТУРА (КОМПАКТНЫЕ КНОПКИ)
   ========================================= */
.game-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-image: url('img/BG.png'); 
    background-size: cover;
    background-position: center;
    border: 4px solid var(--accent-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ui-panel {
    width: 100%;
    padding: 8px 10px; /* Уменьшили отступы панели */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* Кнопки плотнее друг к другу */
    background: rgba(0, 0, 0, 0.75);
    flex-wrap: wrap;
    z-index: 10;
}

.stat-badge {
    background: #1a1a1a;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    border: 1px solid #555;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* КОМПАКТНЫЕ КНОПКИ МАГАЗИНА */
.shop-btn {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #000;
    border: 2px solid #fff;
    border-radius: 6px;
    padding: 6px 12px; /* Сильно уменьшили отступы */
    font-size: 0.95rem; /* Меньше шрифт */
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8);
    transition: 0.2s;
    line-height: 1.1;
    flex-grow: 1; /* Кнопки равномерно заполняют ширину */
    max-width: 200px; /* Чтобы не растягивались на весь экран */
}

.shop-btn span {
    font-size: 0.75rem; /* Мелкий шрифт для описания */
    font-weight: normal;
}

.shop-btn:hover { transform: scale(1.05); }

/* КОМПАКТНАЯ КНОПКА ПОЛНОГО ЭКРАНА */
.fullscreen-btn {
    background: #333;
    color: #fff;
    border: 1px solid #777;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: 0.2s;
    height: 100%;
}
.fullscreen-btn:hover { background: #555; }

.canvas-container {
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    flex-grow: 1; 
}

#gameCanvas {
    width: 100%;
    max-width: 800px;
    height: auto;
    aspect-ratio: 4 / 3;
    display: block;
    touch-action: none;
    image-rendering: pixelated;
}

.game-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(18, 18, 18, 0.9);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 20;
}

#overlayTitle { color: #fff; font-size: 2rem; margin-bottom: 20px; text-shadow: 2px 2px 4px #000; text-align: center; }

/* ПОЛНОЭКРАННЫЙ РЕЖИМ */
#gameWrapper:fullscreen {
    width: 100vw; height: 100vh; max-width: none; border: none; border-radius: 0;
}
#gameWrapper:fullscreen #gameCanvas {
    width: auto !important; height: 100% !important; object-fit: contain;
}

/* Достижения (Ачивки) */
.achievement-popup {
    position: fixed; top: -100px; left: 50%; transform: translateX(-50%);
    background: linear-gradient(135deg, #1f1f1f, #333); color: #fff; padding: 15px 30px; border-radius: 8px; border-bottom: 4px solid #ffd700; box-shadow: 0 10px 30px rgba(0,0,0,0.8); z-index: 9999; text-align: center; font-size: 1.1rem; transition: top 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); pointer-events: none;
}
.achievement-popup.show { top: 20px; }
.profile-achievements { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; margin-top: 20px; }
.achievement-card { background: var(--card-bg); border: 1px solid #444; border-radius: 8px; padding: 15px; display: flex; align-items: center; gap: 15px; transition: 0.3s; filter: grayscale(100%); opacity: 0.6; }
.achievement-card.unlocked { filter: grayscale(0%); opacity: 1; border-color: #ffd700; background: linear-gradient(135deg, #1f1f1f, #2a2510); }
.achievement-icon { font-size: 2.5rem; }
.achievement-info h4 { margin-bottom: 5px; color: #fff; }
.achievement-info p { font-size: 0.9rem; color: #aaa; margin: 0; }

@media (max-width: 768px) {
    .navbar { flex-direction: column; padding: 15px; gap: 15px; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .about-content { flex-direction: column-reverse; text-align: center; }
    .about-photo img { width: 200px; height: 200px; }
}

@media (max-width: 600px) {
    .ui-panel { flex-direction: column; align-items: stretch; }
    .shop-btn { max-width: 100%; }
}

/* =========================================
   КУРСОРЫ-МЕЧИ ДЛЯ ЗАЩИТЫ ЦИТАДЕЛИ
   ========================================= */
/* Привязываем курсор к главной коробке gameWrapper */

/* Базовый меч (Урон 1) */
#gameWrapper,
#gameWrapper #gameCanvas,
#gameWrapper .game-overlay {
    cursor: url('img/cursor.cur'), crosshair !important; 
}

/* Улучшенный меч (Урон 2) */
#gameWrapper.sword-lvl-2,
#gameWrapper.sword-lvl-2 #gameCanvas,
#gameWrapper.sword-lvl-2 .game-overlay {
    cursor: url('img/cursor2.cur'), crosshair !important;
}

/* Эпический меч (Урон 3 и выше) */
#gameWrapper.sword-lvl-3,
#gameWrapper.sword-lvl-3 #gameCanvas,
#gameWrapper.sword-lvl-3 .game-overlay {
    cursor: url('img/cursor3.cur'), crosshair !important;
}
