/**
 * style.css — Стили для Checkers Highway
 * Шахматная тематика, аркадный стиль
 */

/* === Сброс и базовые стили === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Arial Black', Arial, sans-serif;
    background: #0a0a2e;
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
}

canvas {
    display: block;
}

/* === Общие стили экранов === */
.game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.game-screen.hidden {
    display: none;
    opacity: 0;
}

/* === ГЛАВНОЕ МЕНЮ === */
#main-menu {
    background: radial-gradient(ellipse at center, rgba(20, 20, 60, 0.95) 0%, rgba(5, 5, 20, 0.98) 100%);
}

.menu-container {
    text-align: center;
    max-width: 500px;
    padding: 20px;
    animation: fadeInUp 0.8s ease;
}

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

/* Заголовок */
.title-section {
    margin-bottom: 40px;
}

.game-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(255, 204, 0, 0.5),
        0 0 30px rgba(255, 204, 0, 0.3),
        3px 3px 0 #1a1a1a;
    line-height: 1.1;
    margin: 0;
}

.title-decoration {
    width: 200px;
    height: 4px;
    margin: 15px auto;
    background: repeating-linear-gradient(
        90deg,
        #ffffff 0px,
        #ffffff 10px,
        #1a1a1a 10px,
        #1a1a1a 20px
    );
    border-radius: 2px;
}

.subtitle {
    font-size: 1rem;
    color: #8888aa;
    margin-top: 10px;
    font-style: italic;
}

/* Кнопки меню */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.menu-btn .btn-icon {
    font-size: 1.3rem;
}

.menu-btn.primary {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    color: #1a1a1a;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.4);
}

.menu-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 204, 0, 0.6);
}

.menu-btn.primary:active {
    transform: translateY(0);
}

.menu-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.menu-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Лучший результат в меню */
.best-score-display {
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 0.95rem;
}

.best-score-display span:last-child {
    color: #ffcc00;
    font-weight: 700;
    font-size: 1.2rem;
}

.version-info {
    margin-top: 20px;
    font-size: 0.7rem;
    color: #555577;
}

/* === HUD === */
#hud {
    pointer-events: none;
    background: transparent;
}

.hud-top {
    position: fixed;
    top: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 0 15px;
    z-index: 50;
}

.hud-score, .hud-multiplier, .hud-coins {
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label, .multiplier-label, .coins-label {
    font-size: 0.65rem;
    color: #8888aa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.multiplier-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}

.coins-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.hud-bottom {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.speed-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.speed-label {
    font-size: 0.65rem;
    color: #8888aa;
    text-transform: uppercase;
}

.speed-bar {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.speed-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #44cc44, #66ff44);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
}

.speed-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    min-width: 60px;
}

/* Индикатор паузы */
.pause-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 40px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* === GAME OVER === */
#game-over {
    background: radial-gradient(ellipse at center, rgba(80, 10, 10, 0.9) 0%, rgba(20, 5, 5, 0.95) 100%);
}

.gameover-container {
    text-align: center;
    max-width: 450px;
    padding: 30px;
    animation: fadeInUp 0.5s ease;
}

.gameover-title {
    font-size: 3rem;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    margin-bottom: 25px;
    letter-spacing: 3px;
}

.gameover-stats {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item.highlight {
    background: rgba(255, 204, 0, 0.1);
    border-radius: 8px;
    margin: 5px -15px;
    padding: 12px 15px;
}

.stat-label {
    color: #8888aa;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.stat-item.highlight .stat-value {
    color: #ffcc00;
    font-size: 1.4rem;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* === HOW TO PLAY === */
#how-to-panel {
    background: radial-gradient(ellipse at center, rgba(20, 20, 60, 0.95) 0%, rgba(5, 5, 20, 0.98) 100%);
}

.howto-container {
    text-align: center;
    max-width: 450px;
    padding: 30px;
    animation: fadeInUp 0.5s ease;
}

.howto-container h2 {
    font-size: 2rem;
    margin-bottom: 25px;
}

.controls-list {
    text-align: left;
    margin-bottom: 25px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.key-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 70px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-desc {
    font-size: 0.9rem;
    color: #ccccdd;
}

.tips-section {
    text-align: left;
    margin-bottom: 25px;
    background: rgba(255, 204, 0, 0.05);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 204, 0, 0.15);
}

.tips-section h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: #ffcc00;
}

.tips-section ul {
    list-style: none;
    padding: 0;
}

.tips-section li {
    padding: 4px 0;
    font-size: 0.85rem;
    color: #aaaacc;
}

.tips-section li::before {
    content: '▸ ';
    color: #ffcc00;
}

/* === HIGH SCORES === */
#scores-panel {
    background: radial-gradient(ellipse at center, rgba(20, 20, 60, 0.95) 0%, rgba(5, 5, 20, 0.98) 100%);
}

.scores-container {
    text-align: center;
    max-width: 450px;
    padding: 30px;
    animation: fadeInUp 0.5s ease;
}

.scores-container h2 {
    font-size: 2rem;
    margin-bottom: 25px;
}

.score-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.score-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-entry.first {
    background: rgba(255, 204, 0, 0.1);
    border-color: rgba(255, 204, 0, 0.3);
}

.rank {
    font-size: 1.3rem;
    min-width: 35px;
    text-align: center;
}

.entry-score {
    flex: 1;
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffcc00;
}

.entry-date {
    font-size: 0.75rem;
    color: #666688;
}

.no-scores {
    color: #666688;
    font-style: italic;
    padding: 20px;
}

/* === Скроллбар === */
.score-list::-webkit-scrollbar {
    width: 4px;
}

.score-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.score-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* === Адаптивность === */
@media (max-width: 600px) {
    .game-title {
        font-size: 2.5rem;
    }

    .hud-top {
        flex-wrap: wrap;
        gap: 5px;
    }

    .hud-score, .hud-multiplier, .hud-coins {
        padding: 5px 12px;
        flex: 1;
        min-width: 80px;
    }

    .score-value {
        font-size: 1.1rem;
    }

    .speed-bar {
        width: 80px;
    }

    .menu-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .gameover-title {
        font-size: 2rem;
    }
}

/* === Шахматная анимация фона === */
@keyframes checkerPulse {
    0%, 100% { opacity: 0.03; }
    50% { opacity: 0.06; }
}

#main-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            rgba(255, 255, 255, 0.01) 40px,
            rgba(255, 255, 255, 0.01) 80px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            rgba(255, 255, 255, 0.01) 40px,
            rgba(255, 255, 255, 0.01) 80px
        );
    animation: checkerPulse 3s ease-in-out infinite;
    pointer-events: none;
}

/* === CHANGELOG === */
#changelog-modal {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
}

.changelog-container {
    max-width: 520px;
    width: 90%;
    max-height: 80vh;
    background: linear-gradient(160deg, rgba(20, 20, 60, 0.97) 0%, rgba(10, 10, 30, 0.99) 100%);
    border-radius: 20px;
    border: 2px solid rgba(255, 204, 0, 0.25);
    box-shadow:
        0 0 40px rgba(255, 204, 0, 0.15),
        0 20px 60px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    animation: changelogSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes changelogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Шапка changelog */
.changelog-header {
    padding: 25px 25px 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    flex-shrink: 0;
}

.changelog-header h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.changelog-version-badge {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    color: #1a1a1a;
    font-weight: 800;
    font-size: 0.85rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.changelog-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #8888aa;
    font-size: 1.2rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.changelog-close-btn:hover {
    background: rgba(255, 68, 68, 0.3);
    color: #ff4444;
    transform: rotate(90deg);
}

/* Список версий */
.changelog-body {
    padding: 15px 25px 25px;
    overflow-y: auto;
    flex: 1;
}

.changelog-body::-webkit-scrollbar {
    width: 4px;
}

.changelog-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.changelog-body::-webkit-scrollbar-thumb {
    background: rgba(255, 204, 0, 0.3);
    border-radius: 2px;
}

/* Блок одной версии */
.changelog-version {
    margin-bottom: 20px;
    animation: changelogFadeIn 0.4s ease both;
}

.changelog-version:last-child {
    margin-bottom: 0;
}

@keyframes changelogFadeIn {
    from { opacity: 0; transform: translateX(-15px); }
    to   { opacity: 1; transform: translateX(0); }
}

.changelog-version-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.changelog-version-tag {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.changelog-version-tag.latest {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    color: #1a1a1a;
}

.changelog-version-tag.old {
    background: rgba(255, 255, 255, 0.08);
    color: #8888aa;
}

.changelog-version-date {
    font-size: 0.7rem;
    color: #555577;
}

/* Категории изменений */
.changelog-category {
    margin-bottom: 8px;
}

.changelog-category-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.changelog-category-title .cat-icon {
    font-size: 0.85rem;
}

.changelog-category-title.new { color: #44dd88; }
.changelog-category-title.fix { color: #44aaff; }
.changelog-category-title.improve { color: #cc88ff; }
.changelog-category-title.visual { color: #ffaa44; }

.changelog-item {
    font-size: 0.85rem;
    color: #ccccdd;
    padding: 3px 0 3px 18px;
    position: relative;
    line-height: 1.4;
}

.changelog-item::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #555577;
}

/* Разделитель версий */
.changelog-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 204, 0, 0.15), transparent);
    margin: 20px 0;
}
