/* === БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold: #c8a415;
    --gold-light: #f0d850;
    --gold-dark: #8b7010;
    --red: #b22222;
    --red-light: #dc3545;
    --dark: #1a1a2e;
    --dark-light: #2d2d44;
    --cream: #faf8f0;
    --cream-dark: #f0ead6;
    --green: #2d6a4f;
    --green-light: #40916c;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--cream);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

.title, .game-header h2, .mode-header h3, .settings-card h3 {
    font-family: 'Playfair Display', serif;
}

/* === ГЛАВНАЯ СТРАНИЦА === */
.hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 50%, #3d2c5e 100%);
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(200, 164, 21, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(178, 34, 34, 0.08) 0%, transparent 50%);
}

.hero-content {
    position: relative;
    text-align: center;
    padding: 2rem;
    z-index: 1;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 8px rgba(200, 164, 21, 0.3));
}

.title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 10px rgba(200, 164, 21, 0.3);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: var(--cream);
    opacity: 0.9;
    margin-bottom: 1rem;
}

.description {
    max-width: 600px;
    margin: 0 auto;
    color: var(--cream-dark);
    opacity: 0.8;
    font-size: 1rem;
}

/* === ОСНОВНОЙ КОНТЕНТ === */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* === ФИЧИ === */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(200, 164, 21, 0.1);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.feature-card p {
    color: #666;
    font-size: 0.9rem;
}

/* === РЕЖИМЫ ИГРЫ === */
.game-modes {
    margin-bottom: 3rem;
}

.game-modes h2,
.leaderboard-preview h2,
.about h2 {
    text-align: center;
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 1.5rem;
    position: relative;
}

.game-modes h2::after,
.leaderboard-preview h2::after,
.about h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gold);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.mode-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: var(--transition);
}

.mode-card:hover {
    border-color: var(--gold);
}

.mode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mode-icon {
    font-size: 2rem;
}

.mode-header h3 {
    font-size: 1.4rem;
    color: var(--dark);
}

.mode-desc {
    color: #555;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.mode-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.mode-features li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: #444;
}

/* === КНОПКИ === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--white);
    box-shadow: 0 2px 10px rgba(200, 164, 21, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(200, 164, 21, 0.4);
}

.btn-secondary {
    background: var(--dark-light);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--dark);
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    width: 100%;
}

/* === ТАБЛИЦА ЛИДЕРОВ === */
.leaderboard-preview {
    margin-bottom: 3rem;
}

.leaderboard-table {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.leaderboard-table table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.leaderboard-table th {
    background: var(--cream-dark);
    font-weight: 600;
    color: var(--dark);
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.empty-leaderboard {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* === О ПРОЕКТЕ === */
.about {
    margin-bottom: 2rem;
}

.about-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.about-content p {
    margin-bottom: 1rem;
    color: #555;
}

.about-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold-dark);
}

.stat-label {
    font-size: 0.85rem;
    color: #777;
}

/* === ФУТЕР === */
.footer {
    background: var(--dark);
    color: var(--cream);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.footer p {
    margin-bottom: 0.3rem;
}

/* === СТРАНИЦА ИГРЫ === */
.game-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-header {
    background: var(--dark);
    color: var(--white);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    z-index: 1000;
}

.back-btn {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.back-btn:hover {
    color: var(--gold-light);
}

.game-header h2 {
    font-size: 1.2rem;
    color: var(--gold);
}

.game-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.game-stats span {
    background: rgba(255,255,255,0.1);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}

.round-progress {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 400px;
    z-index: 400;
    text-align: center;
}

.progress-container {
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.progress-bar {
    height: 100%;
    background: var(--gold);
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--dark);
    font-weight: 600;
}

/* === ПАНЕЛЬ НАСТРОЕК === */
.settings-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dark) 100%);
    padding: 1rem;
}

.settings-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
}

.settings-card h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--dark);
    font-size: 1.4rem;
}

.setting-group {
    margin-bottom: 1.25rem;
}

.setting-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.radio-label:hover {
    background: var(--cream);
}

.setting-group .checkbox-label {
    cursor: pointer;
    font-weight: 400;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: transparent;
}

.setting-group .checkbox-label:hover {
    background: var(--cream);
}

.setting-group select {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

.setting-group select:focus {
    outline: none;
    border-color: var(--gold);
}

.settings-info {
    color: #555;
    text-align: center;
    margin-bottom: 1rem;
}

/* === ИГРОВАЯ ОБЛАСТЬ === */
.game-area {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.game-map {
    flex: 1;
    z-index: 1;
}

/* === БОКОВАЯ ПАНЕЛЬ (Напиши место) === */
.side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.input-group input {
    flex: 1;
    padding: 0.7rem;
    border: 2px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--gold);
}

.input-group .btn {
    padding: 0.7rem 1rem;
}

.feedback {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    min-height: 2rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.feedback.success {
    background: #d4edda;
    color: #155724;
}

.feedback.error {
    background: #f8d7da;
    color: #721c24;
}

.found-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.found-list h4 {
    margin-bottom: 0.5rem;
    color: var(--dark);
    padding-right: 0.5rem;
}

.found-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
}

.found-list li {
    padding: 0.4rem 0.6rem;
    background: var(--cream);
    border-radius: 4px;
    font-size: 0.85rem;
    border-left: 3px solid var(--green);
    word-wrap: break-word;
    hyphens: auto;
}

/* === ПАНЕЛЬ УГАДЫВАНИЯ (ГеоГессер) === */
.guess-panel {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    max-width: 400px;
    width: calc(100% - 2rem);
}

.location-info h3 {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 0.3rem;
}

.hint {
    color: #777;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* === РЕЗУЛЬТАТ РАУНДА === */
.round-result {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 600;
    padding: 1rem;
}

.result-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.result-card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.result-card p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #555;
}

.result-line {
    height: 4px;
    background: var(--cream-dark);
    border-radius: 2px;
    margin: 1rem 0;
    overflow: hidden;
}

.result-line::after {
    content: '';
    display: block;
    height: 100%;
    background: var(--gold);
    width: var(--score-percent, 0%);
    transition: width 1s ease;
}

/* === GAME OVER === */
.game-over {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    padding: 1rem;
}

.game-over-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.game-over-card h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.final-stat {
    text-align: center;
}

.final-value {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--gold-dark);
}

.final-label {
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-over-actions input {
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    text-align: center;
}

.game-over-actions input:focus {
    outline: none;
    border-color: var(--gold);
}

/* === LEAFLET КАСТОМИЗАЦИЯ === */
.leaflet-container {
    font-family: inherit;
}

.custom-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.marker-target {
    background: var(--red);
}

.marker-guess {
    background: var(--green);
}

.marker-found {
    background: var(--gold);
}

/* === МОБИЛЬНАЯ АДАПТИВНОСТЬ === */
.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.settings-modal-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.settings-modal-header h3 {
    font-size: 1.4rem;
    color: var(--dark);
    margin: 0;
}

.close-settings {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.25rem 0.5rem;
}

.settings-modal-body {
    margin-bottom: 1.5rem;
}

.settings-modal-footer {
    text-align: right;
}

@media (max-width: 768px) {
    .hero {
        min-height: 50vh;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
    }

    .modes-grid {
        grid-template-columns: 1fr;
    }

    .game-header {
        padding: 0.5rem 0.75rem;
    }

    .game-stats {
        gap: 0.5rem;
        font-size: 0.75rem;
    }

    .side-panel {
        width: 100%;
        height: 55%;
        top: auto;
        bottom: 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }

    .guess-panel {
        bottom: 0.5rem;
        padding: 1rem;
    }

    .game-over-card {
        padding: 1.5rem;
    }

    .final-stats {
        gap: 1rem;
    }

    .about-stats {
        gap: 1.5rem;
    }

    .round-progress {
        top: 55px;
        width: 90%;
    }
}

@media (max-width: 480px) {
    .features {
        grid-template-columns: 1fr;
    }

    .title {
        letter-spacing: 0.05em;
    }

    .settings-card {
        padding: 1.5rem;
    }

    .game-over-actions {
        gap: 0.5rem;
    }

    .game-over-actions input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

/* === АНИМАЦИИ === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

/* === ТАБЛИЦА ЛИДЕРОВ - ДВЕ КОЛОНКИ === */
.leaderboards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.leaderboard-column h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--dark);
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .leaderboards-grid {
        grid-template-columns: 1fr;
    }
}

/* === ЗАТЕМНЕНИЕ ЗА ПРЕДЕЛАМИ ОБЛАСТИ === */
.leaflet-container {
    background: #2d2d44 !important;
}

.outside-overlay {
    fill: rgba(26, 26, 46, 0.6);
    stroke: none;
    pointer-events: all;
}

.oblast-border {
    fill: none;
    stroke: var(--gold);
    stroke-width: 2;
    stroke-dasharray: 5, 10;
    pointer-events: none;
}