/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #00f2fe;
    --accent-dark: #0099cc;
    --gold: #ffcc00;
    --danger: #ff4b2b;
    --success: #00ff87;
    --warning: #ffcc00;
    --luck: #9d00ff;
    --vip: #ff00ff;
    --premium: #ffcc00;
    --bg-dark: #05070a;
    --bg-darker: #030507;
    --bg-light: rgba(10,10,20,0.95);
    --border: rgba(255,255,255,0.15);
    --text: #ffffff;
    --text-dim: #cccccc;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Снег */
#snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    display: none;
}

/* Верхняя панель */
.top-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    z-index: 100;
    gap: 15px;
}

.top-left,
.top-center,
.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-box {
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
    min-width: 180px;
}

.timer {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}

.timer-label {
    font-size: 0.75em;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Панель управления музыкой */
.music-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 5px 10px;
}

.volume-slider {
    width: 80px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

/* Кнопки верхней панели */
.music-btn,
.level-btn,
.save-btn,
.calendar-btn,
.report-btn,
.donate-btn,
.snow-btn,
.close-shop,
.promo-btn,
.modal-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.music-btn:hover,
.level-btn:hover,
.save-btn:hover,
.calendar-btn:hover,
.report-btn:hover,
.donate-btn:hover,
.snow-btn:hover,
.close-shop:hover,
.promo-btn:hover,
.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
}

.close-shop {
    background: rgba(255,255,255,0.1);
    color: white;
    padding: 6px 10px;
}

.level-btn {
    background: linear-gradient(135deg, #9d00ff, #6a00ff);
}

.save-btn {
    background: linear-gradient(135deg, #00ff87, #00cc66);
}

.calendar-btn {
    background: linear-gradient(135deg, #ff9900, #ff6600);
}

.report-btn {
    background: linear-gradient(135deg, #00ccff, #0066ff);
}

.donate-btn {
    background: linear-gradient(135deg, var(--premium), #ff9900);
}

.snow-btn {
    background: linear-gradient(135deg, #00ccff, #0066ff);
}

.snow-btn.active {
    background: linear-gradient(135deg, #00ff87, #00cc66);
}

/* Сайт уведомление */
.site-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #000;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 3000;
    display: none;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 350px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-left: 4px solid var(--accent);
}

.site-notification.warning {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
}

.site-notification.success {
    background: linear-gradient(135deg, #00ff87, #00cc66);
}

.site-notification.info {
    background: linear-gradient(135deg, #9d00ff, #6a00ff);
}

/* Магазин */
.shop-panel {
    position: fixed;
    left: -350px;
    top: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-light);
    backdrop-filter: blur(15px);
    border-right: 2px solid var(--accent);
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.shop-panel.open {
    left: 0;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.shop-title {
    color: var(--accent);
    font-size: 1.3em;
    font-weight: 700;
}

.promo-section {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

#promo-code {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 0.95em;
}

#promo-code:focus {
    outline: none;
    border-color: var(--accent);
}

.xp-section {
    margin-bottom: 20px;
}

.xp-bar {
    background: rgba(255,255,255,0.1);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

.xp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: 700;
    color: #000;
}

/* Товары в магазине */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.shop-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shop-item.disabled:hover {
    transform: none;
    background: rgba(255,255,255,0.05);
    border-color: var(--border);
}

.shop-item-icon {
    font-size: 1.5em;
    min-width: 40px;
    text-align: center;
}

.shop-item-info {
    flex: 1;
    min-width: 0;
}

.shop-item-name {
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 4px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-item-desc {
    font-size: 0.8em;
    color: var(--text-dim);
    line-height: 1.3;
}

.shop-item-price {
    background: var(--accent);
    color: #000;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85em;
    min-width: 60px;
    text-align: center;
}

/* Основная игровая область */
.game-area {
    padding: 90px 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 100px);
}

/* Статистика */
.stats-section {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    justify-content: center;
}

.stat-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100px;
    justify-content: center;
}

.stat-icon {
    font-size: 1.8em;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-dim);
    font-weight: 600;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--accent);
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Цвет удачи */
.stat-card:nth-child(3) .stat-value {
    color: var(--luck);
}

/* Информация об игре */
.info-section {
    margin-bottom: 20px;
}

.info-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.info-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.info-label {
    color: var(--text-dim);
    font-size: 0.9em;
}

.info-value {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.1em;
}

/* Игровое поле */
.game-section {
    margin-bottom: 20px;
}

.game-board-container {
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
    overflow: auto;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-grid {
    display: grid;
    gap: 4px;
    margin: 0 auto;
    width: fit-content;
}

/* Клетки */
.cell {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.cell:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.cell.open {
    background: rgba(0,0,0,0.4);
    border-color: var(--accent);
    color: var(--accent);
    animation: cellReveal 0.2s ease;
}

.cell.mine {
    background: linear-gradient(135deg, var(--danger), #ff0000);
}

.cell.flagged::before {
    content: '🚩';
    font-size: 1.2em;
}

.cell.question::before {
    content: '❓';
    font-size: 1.2em;
    color: var(--warning);
}

.cell-number-1 { color: #00f2fe; }
.cell-number-2 { color: #00ff87; }
.cell-number-3 { color: #ff4b2b; }
.cell-number-4 { color: #9d00ff; }
.cell-number-5 { color: #ff00ff; }
.cell-number-6 { color: #ffcc00; }
.cell-number-7 { color: #ffffff; }
.cell-number-8 { color: #aaaaaa; }

/* Управление */
.controls-section {
    margin-top: 20px;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.control-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    transform: none;
    background: rgba(255,255,255,0.1);
}

.shop-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #000;
}

.newgame-btn {
    background: linear-gradient(135deg, #00ff87, #00cc66);
    color: #000;
}

.hint-btn {
    background: linear-gradient(135deg, #ffcc00, #ff9900);
    color: #000;
}

.question-btn {
    background: linear-gradient(135deg, #9d00ff, #6a00ff);
    color: #000;
}

.auto-btn {
    background: linear-gradient(135deg, #ff4b2b, #ff0000);
    color: #000;
}

/* Достижения */
.achievement-corner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.achievement-badge {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.achievement-badge:hover {
    background: rgba(0, 242, 254, 0.2);
    border-color: var(--accent);
    transform: scale(1.1);
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-light);
    border: 2px solid var(--accent);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.modal-title {
    color: var(--accent);
    font-size: 2em;
    margin-bottom: 10px;
}

.modal-subtitle {
    color: var(--text-dim);
    margin-bottom: 20px;
}

.roulette-section {
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.roulette-section h3 {
    margin-bottom: 15px;
    color: var(--accent);
}

.roulette {
    width: 100%;
    height: 80px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.roulette-tape {
    display: flex;
    height: 100%;
    position: absolute;
    transition: transform 4s cubic-bezier(0.1, 0, 0.1, 1);
}

.roulette-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 100%;
    background: #ff0000;
    z-index: 10;
    box-shadow: 0 0 10px #ff0000;
    pointer-events: none;
}

.prize {
    min-width: 100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #333;
    padding: 10px;
}

.win-prize {
    color: var(--accent);
    margin: 20px 0;
    font-size: 1.3em;
}

.reward-note {
    background: rgba(0, 242, 254, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    color: var(--text-dim);
}

/* Модалка достижений */
.achievement-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.close-modal {
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
}

.achievements-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Отчет */
.report-modal .report-content {
    text-align: left;
    max-height: 60vh;
    overflow-y: auto;
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.report-stat {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.report-stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
}

.report-stat-label {
    font-size: 0.9em;
    color: var(--text-dim);
}

/* Календарь */
.calendar-modal .calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 20px;
}

.calendar-day {
    aspect-ratio: 1;
    background: rgba(255,255,255,0.1);
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-day:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.calendar-day.open {
    background: linear-gradient(135deg, var(--success), #00cc66);
    border-color: var(--success);
}

.calendar-day.future {
    opacity: 0.5;
    cursor: not-allowed;
}

.calendar-day.future:hover {
    transform: none;
    border-color: var(--border);
}

.calendar-day-number {
    font-size: 1.2em;
    font-weight: 700;
    color: white;
}

.calendar-day-reward {
    font-size: 0.7em;
    color: var(--gold);
    margin-top: 2px;
}

/* Премиум модалка */
.premium-modal .premium-content {
    max-height: 60vh;
    overflow-y: auto;
    text-align: left;
}

.premium-packages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.premium-tier {
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.premium-tier:hover {
    transform: translateY(-5px);
    border-color: var(--premium);
}

.premium-tier h3 {
    color: var(--premium);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.premium-tier p {
    color: var(--text-dim);
    margin: 5px 0;
    font-size: 0.95em;
}

.premium-price {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: var(--premium);
    color: #000;
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.1em;
}

.premium-reward {
    color: var(--gold) !important;
    font-weight: 700;
    font-size: 1.2em !important;
}

.premium-status {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success);
    color: #000;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 700;
}

.premium-note {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    font-size: 0.9em;
    color: var(--text-dim);
    text-align: center;
}

/* Оверлей */
#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 999;
}

#modal-overlay.active {
    display: block;
}

/* Стиль для щита */
.shield {
    background: linear-gradient(135deg, #00ff87, #00cc66) !important;
    color: #000 !important;
}

/* Стиль для режима вопроса */
.active {
    box-shadow: 0 0 10px var(--accent) !important;
    border-color: var(--accent) !important;
}

/* Анимации */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes cellReveal {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.pulse {
    animation: pulse 0.5s ease;
}

.rainbow-active {
    background: linear-gradient(90deg, #ff0000, #ff9900, #ffff00, #00ff00, #00ffff, #0000ff, #9900ff, #ff00ff);
    background-size: 800% 800%;
    animation: rainbow 3s linear infinite;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .controls-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .top-panel {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .top-left,
    .top-center,
    .top-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .timer-box {
        min-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .shop-panel {
        width: 280px;
    }
    
    .cell {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .site-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .calendar-modal .calendar-container {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .info-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .info-card {
        min-width: 200px;
    }
    
    .music-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .volume-slider {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .cell {
        width: 30px;
        height: 30px;
        font-size: 0.9em;
    }
    
    .shop-panel {
        width: 250px;
        padding: 15px;
    }
    
    .calendar-modal .calendar-container {
        grid-template-columns: repeat(4, 1fr);
    }
}