:root {
    --background: #070807;
    --background-soft: #11110f;
    --card: rgba(18, 18, 16, 0.92);
    --card-light: rgba(28, 27, 23, 0.92);

    --gold: #d8a936;
    --gold-light: #f5cf68;
    --gold-dark: #8c681d;

    --red: #bd1f2d;
    --white: #f5f3eb;
    --muted: #aaa69b;

    --border: rgba(216, 169, 54, 0.24);
    --border-strong: rgba(216, 169, 54, 0.55);

    --shadow:
        0 20px 45px rgba(0, 0, 0, 0.45);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
    color-scheme: dark;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--white);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

button,
select,
a {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-background {
    position: fixed;
    inset: 0;
    z-index: -3;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(216, 169, 54, 0.2),
            transparent 35%
        ),
        radial-gradient(
            circle at 15% 70%,
            rgba(139, 16, 28, 0.17),
            transparent 35%
        ),
        linear-gradient(
            160deg,
            #15130f 0%,
            #080808 45%,
            #030303 100%
        );
}

.app-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;

    background:
        linear-gradient(
            rgba(0, 0, 0, 0.12),
            rgba(0, 0, 0, 0.68)
        );
}

.app-shell {
    width: min(100%, 620px);
    min-height: 100vh;
    margin: 0 auto;

    padding:
        calc(22px + var(--safe-top))
        18px
        calc(24px + var(--safe-bottom));
}

.app-header {
    display: flex;
    align-items: center;
    gap: 15px;

    margin-bottom: 26px;
}

.brand-logo {
    display: grid;
    place-items: center;
    flex: 0 0 auto;

    width: 64px;
    height: 64px;

    border: 1px solid var(--border-strong);
    border-radius: 18px;

    color: #090909;
    background:
        linear-gradient(
            145deg,
            var(--gold-light),
            var(--gold),
            var(--gold-dark)
        );

    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);

    font-size: 21px;
    font-weight: 900;
    letter-spacing: -1px;
}

.brand-logo-small {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 17px;
}

.brand-text {
    min-width: 0;
}

.brand-label {
    display: block;

    color: var(--gold-light);

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 5px;
}

.brand-text h1 {
    margin: 1px 0 3px;

    font-size: clamp(27px, 8vw, 40px);
    line-height: 1;
    letter-spacing: -1.5px;
}

.brand-text h1 span {
    color: var(--red);
}

.brand-text p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.view {
    display: none;
    animation: viewEnter 0.25s ease;
}

.view.active {
    display: block;
}

@keyframes viewEnter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-card,
.app-card {
    border: 1px solid var(--border);
    border-radius: 22px;

    background:
        linear-gradient(
            145deg,
            rgba(29, 28, 24, 0.96),
            rgba(11, 11, 10, 0.94)
        );

    box-shadow: var(--shadow);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.welcome-card {
    margin-bottom: 18px;
    padding: 23px;
}

.welcome-card h2 {
    margin: 14px 0 7px;
    font-size: 23px;
}

.welcome-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.status-badge {
    display: inline-flex;
    align-items: center;

    padding: 7px 11px;

    border: 1px solid var(--border-strong);
    border-radius: 999px;

    color: var(--gold-light);
    background: rgba(216, 169, 54, 0.1);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.main-menu {
    display: grid;
    gap: 12px;
}

.menu-button {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;

    width: 100%;
    min-height: 74px;
    padding: 12px 17px;

    border: 1px solid var(--border);
    border-radius: 20px;

    color: var(--white);
    background:
        linear-gradient(
            145deg,
            rgba(32, 31, 27, 0.98),
            rgba(13, 13, 12, 0.98)
        );

    box-shadow:
        0 12px 25px rgba(0, 0, 0, 0.34);

    text-align: left;
    cursor: pointer;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.menu-button:active {
    transform: scale(0.985);
}

.menu-button:hover {
    border-color: var(--border-strong);
}

.menu-button-primary {
    color: #080808;
    border-color: rgba(255, 222, 125, 0.72);

    background:
        linear-gradient(
            145deg,
            var(--gold-light),
            var(--gold),
            #a67920
        );

    box-shadow:
        0 15px 30px rgba(164, 119, 24, 0.28);
}

.menu-icon {
    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    border-radius: 14px;

    background: rgba(255, 255, 255, 0.08);
    font-size: 22px;
}

.menu-button-primary .menu-icon {
    background: rgba(0, 0, 0, 0.13);
}

.menu-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.menu-content b {
    font-size: 16px;
}

.menu-content small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-button-primary .menu-content small {
    color: rgba(0, 0, 0, 0.68);
}

.menu-arrow,
.link-arrow {
    font-size: 27px;
    line-height: 1;
    opacity: 0.65;
}

.install-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;

    margin-top: 18px;
    padding: 19px;
}

.install-card h2 {
    margin: 1px 0 5px;
    font-size: 17px;
}

.install-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.card-icon {
    font-size: 27px;
}

.page-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 12px;

    margin-bottom: 15px;
}

.page-toolbar h2 {
    margin: 0;
    font-size: 24px;
}

.toolbar-label {
    display: block;
    margin-bottom: 1px;

    color: var(--gold-light);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.toolbar-button {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;
    padding: 0;

    border: 1px solid var(--border);
    border-radius: 14px;

    color: var(--white);
    background: var(--card);

    font-size: 28px;
    cursor: pointer;
}

.toolbar-placeholder {
    width: 44px;
}

.section-description {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.news-list {
    display: grid;
    gap: 13px;
}

.news-item,
.news-card {
    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            rgba(29, 28, 24, 0.96),
            rgba(10, 10, 9, 0.96)
        );

    box-shadow:
        0 12px 25px rgba(0, 0, 0, 0.3);
}

.news-item h3,
.news-card h3 {
    margin: 8px 0;
    font-size: 18px;
}

.news-item p,
.news-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.news-date,
.news-category {
    color: var(--gold-light);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.loading-card {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 32px;
}

.loader {
    width: 31px;
    height: 31px;

    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--gold);

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.muted {
    margin: 0;
    color: var(--muted);
}

.settings-group {
    margin-bottom: 20px;
}

.settings-title {
    margin: 0 0 9px 4px;

    color: var(--gold-light);
    font-size: 13px;
    letter-spacing: 0.3px;
}

.settings-card,
.app-card {
    padding: 18px;
}

.settings-card label {
    display: block;
    margin-bottom: 10px;

    font-size: 13px;
    font-weight: 800;
}

select {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;

    border: 1px solid var(--border-strong);
    border-radius: 14px;
    outline: none;

    color: var(--white);
    background: #10100f;

    font-size: 15px;
}

select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(216, 169, 54, 0.13);
}

.link-list {
    padding: 0;
    overflow: hidden;
}

.link-list a {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;

    min-height: 70px;
    padding: 13px 16px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.link-list a:last-child {
    border-bottom: 0;
}

.link-list a:active {
    background: rgba(255, 255, 255, 0.04);
}

.link-list span:not(.link-icon):not(.link-arrow) {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.link-list b {
    font-size: 15px;
}

.link-list small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-icon {
    display: grid;
    place-items: center;

    width: 40px;
    height: 40px;

    border-radius: 13px;
    background: rgba(255, 255, 255, 0.06);

    font-size: 19px;
}

.danger-button {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;

    border: 1px solid rgba(208, 55, 69, 0.46);
    border-radius: 15px;

    color: #ffb3ba;
    background: rgba(168, 30, 43, 0.12);

    font-weight: 800;
    cursor: pointer;
}

.card-note {
    margin: 11px 0 0;

    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.about-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.about-card strong {
    font-size: 16px;
}

.about-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.app-footer {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 3px;

    padding:
        31px
        10px
        calc(4px + var(--safe-bottom));

    color: var(--muted);
    text-align: center;
}

.app-footer strong {
    color: var(--gold-light);
    font-size: 13px;
}

.app-footer span {
    font-size: 11px;
}

.app-footer small {
    font-size: 10px;
    opacity: 0.72;
}

@media (min-width: 700px) {
    .app-shell {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .app-shell {
        width: min(100%, 900px);
        padding-top: calc(13px + var(--safe-top));
    }

    .app-header {
        margin-bottom: 15px;
    }

    .brand-logo {
        width: 52px;
        height: 52px;
        border-radius: 15px;
    }

    .brand-text h1 {
        font-size: 28px;
    }

    .welcome-card {
        padding: 16px;
    }

    .welcome-card h2 {
        margin-top: 9px;
        font-size: 19px;
    }

    .main-menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .menu-button {
        grid-template-columns: 38px minmax(0, 1fr);
        min-height: 65px;
        padding: 10px 12px;
    }

    .menu-arrow {
        display: none;
    }

    .menu-icon {
        width: 37px;
        height: 37px;
        border-radius: 11px;
        font-size: 18px;
    }

    .menu-content small {
        display: none;
    }

    .install-card {
        padding: 14px 16px;
    }
}

@media (max-width: 370px) {
    .app-shell {
        padding-left: 13px;
        padding-right: 13px;
    }

    .brand-logo {
        width: 56px;
        height: 56px;
    }

    .brand-text h1 {
        font-size: 26px;
    }

    .menu-button {
        padding-left: 13px;
        padding-right: 13px;
    }
}
