/* ============================================
   oil-game/assets/css/game.css
   Искатель нефти v7.2 — Все стили
   ============================================ */

:root {
    --bg: #0a0a0f;
    --accent: #ff6b6b;
    --accent2: #4ecdc4;
    --gold: #ffaa00;
    --card-bg: rgba(26, 26, 46, 0.95);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --radius-md: 20px;
    --radius-lg: 32px;
    --radius-xl: 40px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0f;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== ИГРОВАЯ ОБЁРТКА ==================== */
.game-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 15px 15px;
    position: relative;
    z-index: 1;
}

/* ==================== HUD ==================== */
.game-hud {
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #e0e0e0;
    white-space: nowrap;
    padding: 2px 0;
}

.hud-icon {
    font-size: 1rem;
}

/* Сердца */
.hearts-row {
    display: flex;
    gap: 3px;
    align-items: center;
}

.hearts-row img {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    transition: opacity 0.3s, filter 0.3s;
}

.hearts-row img.lost {
    opacity: 0.2;
    filter: grayscale(1);
}

/* ==================== ПРОГРЕСС И БЛОК ==================== */
.level-progress {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 4px;
}

.progress-bar-outer {
    width: 100%;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #2ecc71);
    border-radius: 8px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 0.7rem;
    color: #888;
    margin-top: 3px;
}

.block-display {
    text-align: center;
    margin: 4px 0;
    position: relative;
    z-index: 10;
}

.block-display img {
    width: 44px;
    height: 44px;
    image-rendering: pixelated;
    transition: transform 0.15s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.block-display img.breaking {
    animation: blockShake 0.12s ease infinite;
}

@keyframes blockShake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-3px) rotate(-2deg); }
    50% { transform: translateX(3px) rotate(2deg); }
    75% { transform: translateX(-2px) rotate(-1deg); }
}

/* ==================== CANVAS ==================== */
#gameCanvas {
    display: block;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: var(--radius-md);
    background-size: cover;
    background-position: center;
    background-color: #1a1a2a;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 2;
}

/* ==================== КНОПКИ УПРАВЛЕНИЯ ==================== */
.game-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.game-controls .btn,
.game-controls button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* ==================== ТАЙМЕР ==================== */
.countdown-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
}

.countdown-content {
    text-align: center;
    position: relative;
}

.countdown-number {
    font-size: 10rem;
    font-weight: 900;
    color: #ff6b6b;
    text-shadow: 
        0 0 40px rgba(255, 107, 107, 0.8),
        0 0 80px rgba(255, 107, 107, 0.5),
        0 0 120px rgba(255, 107, 107, 0.3);
    line-height: 1;
}

.countdown-number.go {
    color: #4ecdc4;
    text-shadow: 
        0 0 40px rgba(78, 205, 196, 0.8),
        0 0 80px rgba(78, 205, 196, 0.5);
    font-size: 6rem;
}

.countdown-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.3rem;
    margin-top: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Блюр-фон */
.countdown-bg {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-size: cover;
    background-position: center;
    filter: blur(15px);
    opacity: 0.3;
    z-index: 9998 !important;
    display: none;
    pointer-events: none !important;
}

@keyframes countPulse {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==================== ОВЕРЛЕИ ==================== */
.overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000 !important;
    pointer-events: none !important;
}

.overlay-content {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px 35px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    border: 1px solid rgba(78, 205, 196, 0.3);
    box-shadow: var(--shadow-lg);
    position: relative;
    pointer-events: auto !important;
}

.overlay-content h2 {
    color: #ff6b6b;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
}

.overlay-content .message {
    color: #e0e0e0;
    margin: 15px 0;
    line-height: 1.6;
}

.overlay-content .buttons-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
    flex-wrap: wrap;
    pointer-events: auto !important;
}

.overlay-content .btn,
.overlay-content button {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 9999 !important;
}

/* ==================== НЕФТЯНОЙ ОВЕРЛЕЙ ==================== */
.oil-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.88) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000 !important;
    pointer-events: none !important;
}

.oil-content {
    text-align: center;
    pointer-events: auto !important;
}

.oil-content img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 20px rgba(255, 170, 0, 0.4));
}

@keyframes oilCrack {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 170, 0, 0.4)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 35px rgba(255, 170, 0, 0.7)); }
}

.oil-content .oil-result {
    font-size: 2rem;
    color: #ffaa00;
    margin-top: 15px;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

.oil-content .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 9999 !important;
}

/* ==================== РЕЙТИНГ ==================== */
.rank-display {
    font-size: 5rem;
    font-weight: 900;
    margin: 20px 0;
}

.rank-SS { color: #ffd700; text-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
.rank-S { color: #ffd700; }
.rank-A { color: #4ecdc4; text-shadow: 0 0 30px rgba(78, 205, 196, 0.5); }
.rank-B { color: #2ecc71; }
.rank-C { color: #f1c40f; }
.rank-D { color: #ff6b6b; }

/* ==================== ТОСТЫ ==================== */
.game-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 3000;
    background: var(--card-bg);
    padding: 16px 24px;
    border-radius: 12px;
    color: #fff;
    animation: slideInRight 0.4s ease;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #4ecdc4;
    backdrop-filter: blur(10px);
    max-width: 350px;
}

.game-toast.warning { border-left-color: #ffaa00; }
.game-toast.error { border-left-color: #ff6b6b; }

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== АДАПТИВ ==================== */
@media (max-width: 768px) {
    .game-hud {
        grid-template-columns: auto auto auto auto;
        gap: 6px;
        padding: 8px 10px;
        font-size: 0.7rem;
    }
    .hud-item { font-size: 0.7rem; gap: 4px; }
    .hearts-row img { width: 16px; height: 16px; }
    .block-display img { width: 36px; height: 36px; }
    .countdown-number { font-size: 6rem; }
    .countdown-number.go { font-size: 4rem; }
    .overlay-content { padding: 30px 20px; }
    .overlay-content h2 { font-size: 1.4rem; }
    .rank-display { font-size: 3.5rem; }
    .oil-content img { width: 120px; height: 120px; }
    .game-controls .btn { padding: 8px 16px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .game-hud {
        grid-template-columns: auto auto;
        gap: 4px;
        padding: 6px 8px;
    }
    .game-controls { gap: 8px; }
    .game-controls .btn {
        padding: 8px 14px;
        font-size: 0.75rem;
        min-width: auto;
        border-radius: 30px;
    }
    .countdown-number { font-size: 4rem; }
    .game-toast { left: 20px; right: 20px; bottom: 20px; max-width: none; }
}