/* === Базовые стили === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    color: #c9b37e;
    font-family: "Georgia", "Times New Roman", serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* === Контейнер игры === */
.game-container {
    width: 100%;
    max-width: 750px;
    min-height: 90vh;
    padding: 30px;
    background: linear-gradient(180deg, #0d0d0d 0%, #1a1a1a 100%);
    border: 1px solid #3a2a1a;
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8), inset 0 0 100px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

/* === Шапка === */
.game-header {
    display: flex;
    gap: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #3a2a1a;
    margin-bottom: 25px;
    align-items: center;
}

.stat {
    font-size: 16px;
    color: #8a7355;
}

.btn-grimoire {
    margin-left: auto;
    background: none;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-size: 20px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-grimoire:hover {
    background: #2a1a0a;
}

.btn-reset {
    background: none;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-size: 20px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-reset:hover {
    background: #2a1a0a;
}

/* === Текст === */
.game-text {
    flex: 1;
    font-size: 18px;
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 30px;
    color: #b8a88a;
}

/* === Кнопка пропуска анимации === */
.skip-btn {
    display: block;
    margin: 15px 0;
    background: transparent;
    border: 1px dashed #4a3a2a;
    color: #6a5a4a;
    padding: 8px 16px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.skip-btn:hover {
    border-color: #8a7355;
    color: #8a7355;
}

/* === Выборы === */
.game-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #3a2a1a;
}

.choice-btn {
    background: transparent;
    border: 1px solid #4a3a2a;
    color: #c9b37e;
    padding: 14px 20px;
    text-align: left;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.choice-btn:hover {
    background: #2a1a0a;
    border-color: #6a5a4a;
    color: #e0d0a0;
}

.choice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === Модальное окно === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #4a3a2a;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    color: #b8a88a;
}

.modal-close {
    float: right;
    font-size: 24px;
    cursor: pointer;
    color: #8a7355;
}

.modal-close:hover {
    color: #c9b37e;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #c9b37e;
}

/* === Гримуар === */
.spell-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #2a1a0a;
}

.spell-name {
    flex: 1;
    color: #c9b37e;
    text-transform: capitalize;
}

.spell-cost {
    color: #8a7355;
    font-size: 14px;
}

.cast-btn {
    background: #2a1a0a;
    border: 1px solid #4a3a2a;
    color: #c9b37e;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.cast-btn:hover:not(:disabled) {
    background: #4a2a1a;
    border-color: #6a5a4a;
}

.cast-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.spell-success {
    color: #7a9a5a;
    padding: 8px;
    background: #1a2a0a;
    border-radius: 4px;
    margin-bottom: 10px;
}

.spell-fail {
    color: #9a6a5a;
    padding: 8px;
    background: #2a1a0a;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* === Авторизация === */
.user-status {
    color: #6a5a4a;
    font-size: 14px;
}

.btn-auth {
    background: none;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-size: 20px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-auth:hover {
    background: #2a1a0a;
}

.auth-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #0d0d0d;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
}

.auth-input:focus {
    outline: none;
    border-color: #6a5a4a;
}

.auth-buttons {
    display: flex;
    gap: 10px;
}

.auth-btn {
    flex: 1;
    padding: 10px;
    background: #2a1a0a;
    border: 1px solid #4a3a2a;
    color: #c9b37e;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.auth-btn:hover {
    background: #4a2a1a;
    border-color: #6a5a4a;
}

#auth-message {
    margin-top: 10px;
    font-size: 14px;
    color: #9a6a5a;
}

/* === Стартовая страница === */
.start-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.start-card {
    background: linear-gradient(180deg, #0d0d0d 0%, #1a1a1a 100%);
    border: 1px solid #3a2a1a;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.start-title {
    font-size: 36px;
    color: #c9b37e;
    margin-bottom: 5px;
    font-weight: normal;
    letter-spacing: 3px;
}

.start-subtitle {
    font-size: 14px;
    color: #6a5a4a;
    margin-bottom: 30px;
}

.start-description {
    text-align: left;
    font-size: 15px;
    line-height: 1.7;
    color: #8a7355;
    margin-bottom: 30px;
}

.start-description p {
    margin-bottom: 12px;
}

.start-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.start-btn {
    padding: 14px 24px;
    background: #2a1a0a;
    border: 1px solid #4a3a2a;
    color: #c9b37e;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.start-btn:hover {
    background: #4a2a1a;
    border-color: #6a5a4a;
}

.start-btn-primary {
    background: #3a2a0a;
    border-color: #6a5a4a;
    font-size: 18px;
    padding: 16px 28px;
}

.start-btn-primary:hover {
    background: #5a3a1a;
}

.start-auth {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #3a2a1a;
}

.start-auth-buttons {
    display: flex;
    gap: 10px;
}

.start-auth-buttons .start-btn {
    flex: 1;
}

.start-footer {
    margin-top: 20px;
    font-size: 12px;
    color: #4a3a3a;
}

/* === Карта города === */
.btn-map {
    background: none;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-size: 20px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-map:hover {
    background: #2a1a0a;
}

.map-modal-content {
    max-width: 700px;
    width: 95%;
}

.city-map {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 600px;
    margin: 0 auto;
    background: radial-gradient(circle, #1a1a0a 0%, #0d0d0d 70%);
    border-radius: 50%;
    border: 2px solid #3a2a1a;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.map-ring {
    position: absolute;
    border: 1px dashed #3a2a1a;
    border-radius: 50%;
    pointer-events: none;
}

.map-ring-outer {
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
}

.map-ring-middle {
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
}

.map-ring-inner {
    top: 48%;
    left: 48%;
    width: 4%;
    height: 4%;
    background: #4a2a1a;
    border: 1px solid #6a4a2a;
}

.map-location {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #2a1a0a;
    border: 1px solid #3a2a1a;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.map-location.unlocked {
    background: #4a3a1a;
    border-color: #8a7355;
    box-shadow: 0 0 8px rgba(200, 160, 100, 0.3);
}

.map-location.unlocked:hover {
    background: #6a5a3a;
    box-shadow: 0 0 12px rgba(200, 160, 100, 0.6);
}

.map-location.locked {
    background: #1a1a1a;
    border-color: #2a2a2a;
    cursor: not-allowed;
    opacity: 0.5;
}

.map-location.current {
    background: #8a6a3a;
    border-color: #c9b37e;
    box-shadow: 0 0 12px rgba(200, 160, 100, 0.8);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(200, 160, 100, 0.4); }
    50% { box-shadow: 0 0 16px rgba(200, 160, 100, 0.8); }
}

.map-label {
    position: absolute;
    color: #6a5a4a;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    text-align: center;
    z-index: 1;
}

.map-location.unlocked + .map-label {
    color: #8a7355;
}

.map-location.current + .map-label {
    color: #c9b37e;
}

/* === Инвентарь === */
.btn-inventory {
    background: none;
    border: 1px solid #3a2a1a;
    color: #c9b37e;
    font-size: 20px;
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-inventory:hover {
    background: #2a1a0a;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #2a1a0a;
}

.inventory-name {
    display: block;
    color: #c9b37e;
}

.inventory-desc {
    display: block;
    color: #6a5a4a;
    font-size: 13px;
    margin-top: 3px;
}

.use-btn {
    background: #2a1a0a;
    border: 1px solid #4a3a2a;
    color: #c9b37e;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
}

.use-btn:hover {
    background: #4a2a1a;
}

/* === Адаптивная вёрстка (мобильные) === */
@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 0;
    }

    .game-container {
        max-width: 100%;
        min-height: 100vh;
        padding: 10px;
        border-radius: 0;
        border: none;
        box-shadow: none;
        overflow-x: hidden;
    }

    /* Шапка */
    .game-header {
        flex-wrap: wrap;
        gap: 4px;
        padding-bottom: 8px;
        margin-bottom: 10px;
        justify-content: flex-start;
    }

    .stat {
        font-size: 11px;
    }

    .user-status {
        display: none;
    }

    .btn-auth, .btn-grimoire, .btn-inventory, .btn-map, .btn-reset {
        font-size: 14px;
        padding: 3px 6px;
        border-radius: 3px;
    }

    .btn-grimoire {
        margin-left: 0;
    }

    /* Текст */
    .game-text {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    .skip-btn {
        font-size: 11px;
        padding: 5px 8px;
    }

    /* Выборы */
    .game-choices {
        gap: 6px;
        padding-top: 10px;
    }

    .choice-btn {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Модальные окна */
    .modal {
        align-items: flex-start;
        padding-top: 10px;
    }

    .modal-content {
        padding: 15px;
        max-width: 95vw;
        max-height: 85vh;
        overflow-y: auto;
        overflow-x: hidden;
        border-radius: 6px;
    }

    .map-modal-content {
        max-width: 95vw;
    }

    .modal-content h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .modal-close {
        font-size: 20px;
    }

    /* Карта */
    .city-map {
        max-width: 280px;
        margin: 0 auto;
    }

    .map-label {
        font-size: 7px;
    }

    .map-location {
        width: 8px;
        height: 8px;
    }

    /* Инвентарь и Гримуар */
    .spell-item, .inventory-item {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0;
    }

    .inventory-name, .spell-name {
        font-size: 13px;
    }

    .inventory-desc {
        font-size: 10px;
    }

    .use-btn, .cast-btn {
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Стартовая страница */
    .start-container {
        padding: 10px;
    }

    .start-card {
        padding: 20px 12px;
    }

    .start-title {
        font-size: 24px;
        letter-spacing: 1px;
    }

    .start-description {
        font-size: 12px;
        line-height: 1.5;
    }

    .start-btn {
        font-size: 13px;
        padding: 8px 14px;
    }

    .start-btn-primary {
        font-size: 14px;
        padding: 10px 16px;
    }

    .auth-input {
        font-size: 12px;
        padding: 6px;
    }

    .start-auth-buttons {
        flex-direction: column;
        gap: 6px;
    }
}

/* === Текст видения === */
.vision-text {
    margin-top: 15px;
    padding: 12px 15px;
    color: #d4b87a;
    background: linear-gradient(135deg, rgba(180, 140, 80, 0.08), rgba(180, 140, 80, 0.02));
    border-left: 2px solid #8a6a3a;
    font-style: italic;
    white-space: pre-wrap;
    animation: visionFade 2s ease-out;
    text-shadow: 0 0 15px rgba(200, 160, 100, 0.3);
}

@keyframes visionFade {
    from {
        opacity: 0;
        filter: blur(4px);
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}