/* =========================================================
   V2 — ГЛАВНАЯ ТОЧКА ВХОДА СТИЛЕЙ
   ========================================================= */


/* =========================================================
   ГЛОБАЛЬНАЯ ДИЗАЙН-СИСТЕМА
   ========================================================= */

:root {

    /* ---------------------------------------------------------
       BACKGROUND
       --------------------------------------------------------- */

    --app-bg: #f8f9f7;


    /* ---------------------------------------------------------
       SURFACES
       --------------------------------------------------------- */

    --app-surface: #ffffff;

    --app-surface-solid: #ffffff;

    --app-surface-soft: #f3f5f1;

    --app-surface-raised: #ffffff;


    /* ---------------------------------------------------------
       TEXT
       --------------------------------------------------------- */

    --app-text-title: #171b18;

    --app-text-primary: #202420;

    --app-text-secondary: #7f8781;

    --app-text-muted: #a0a7a2;


    /* ---------------------------------------------------------
       GREEN SYSTEM
       --------------------------------------------------------- */

    --app-green-active: #4f9d45;

    --app-green-ui: #668d50;


    /* ---------------------------------------------------------
       GAME COLORS
       --------------------------------------------------------- */

    --app-xp: #f4b814;


    /* ---------------------------------------------------------
       BORDERS / DIVIDERS
       --------------------------------------------------------- */

    --app-border:
        rgba(
            31,
            35,
            32,
            0.08
        );

    --app-divider:
        rgba(
            31,
            35,
            32,
            0.07
        );


    /* ---------------------------------------------------------
       OVERLAY
       --------------------------------------------------------- */

    --app-overlay:
        rgba(
            255,
            255,
            255,
            0.84
        );


    /* ---------------------------------------------------------
       SHADOW
       --------------------------------------------------------- */

    --app-shadow:
        0 6px 18px
        rgba(
            35,
            36,
            40,
            0.04
        );


    /* ---------------------------------------------------------
       NAVIGATION
       --------------------------------------------------------- */

    --nav-bg:
        rgba(
            255,
            255,
            255,
            0.97
        );

    --nav-active-bg:
        #f1f5ec;

    --nav-active-border:
        rgba(
            102,
            141,
            80,
            0.10
        );

    --nav-icon:
        #929991;

    --nav-fade-start:
        rgba(
            248,
            249,
            247,
            0
        );

    --nav-fade-end:
        rgba(
            248,
            249,
            247,
            1
        );


    /* ---------------------------------------------------------
       RADIUS
       --------------------------------------------------------- */

    --app-radius-large: 22px;

    --app-radius-medium: 20px;
}


/* =========================================================
   СБРОС
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}


html,
body {
    width: 100%;
    min-height: 100%;

    margin: 0;
    padding: 0;
}


/* =========================================================
   BODY
   ========================================================= */

body {
    min-height: 100dvh;

    overflow: hidden;

    background:
        var(--app-bg);

    color:
        var(--app-text-primary);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        Inter,
        Arial,
        sans-serif;

    -webkit-font-smoothing:
        antialiased;

    text-rendering:
        geometricPrecision;
}


/* =========================================================
   FORM ELEMENTS
   ========================================================= */

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}


button {
    padding: 0;

    border: 0;

    cursor: pointer;
}


/* =========================================================
   APP BOOTSTRAP
   ========================================================= */

#app {
    opacity: 0;

    pointer-events: none;
}


body.app-ready #app {
    opacity: 1;

    pointer-events: auto;
}


/* =========================================================
   APP LOADER
   ========================================================= */

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;

    overflow: hidden;

    background: #0b0b0b;
    color: #ffffff;
}

body.app-ready .app-loader {
    display: none;
}

.app-loader__bg {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
    object-position: center center;

    user-select: none;
    pointer-events: none;
}

/*
 * Минималистичный блок прогресса поверх фонового изображения.
 * Safe-area учитывает нижнюю область iPhone / Telegram Mini App.
 */
.app-loader__bottom {
    position: absolute;
    left: clamp(18px, 6vw, 28px);
    right: clamp(18px, 6vw, 28px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);

    z-index: 2;
}

.app-loader__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 16px;
    margin-bottom: 7px;
}

.app-loader__text,
.app-loader__percent {
    color: rgba(255, 255, 255, 0.96);
    font-size: clamp(11px, 3.1vw, 13px);
    line-height: 1.2;

    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.app-loader__text {
    min-width: 0;
    overflow: hidden;

    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.app-loader__percent {
    flex: 0 0 auto;
    font-weight: 600;
    text-align: right;
}

.app-loader__progress {
    width: 100%;
    height: 4px;

    overflow: hidden;

    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.app-loader__progress-fill {
    width: 0%;
    height: 100%;

    border-radius: inherit;
    background: #7ac943;

    transition: width 220ms ease-out;
    will-change: width;
}

@media (max-height: 620px) {
    .app-loader__bottom {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    }
}
