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

html, body {
    height: 100%;
}

body {
    --bg-body: radial-gradient(circle at top, #141414 0, #050505 45%, #000000 100%);
    --text-color: #ffffff;
    --surface-main: rgba(14, 14, 14, 0.88);
    --surface-border: rgba(255, 255, 255, 0.06);
    --muted-text: #f1f1f1;
    --muted-secondary: #cfcfcf;
    --footer-text: #d0d0d0;
    --modal-bg: rgba(18, 18, 18, 0.97);
    --server-card-bg: rgba(255, 255, 255, 0.04);
    --server-card-border: rgba(255, 255, 255, 0.09);

    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-body);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-x: hidden;
    opacity: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

body[data-theme="light"] {
    --bg-body: radial-gradient(circle at top, #d0d0d0 0, #b5b5b5 40%, #868686 100%);
    --text-color: #050505;
    --surface-main: rgba(244, 244, 244, 0.96);
    --surface-border: transparent;
    --muted-text: #050505;
    --muted-secondary: #222222;
    --footer-text: #333333;
    --modal-bg: rgba(246, 246, 246, 0.98);
    --server-card-bg: rgba(0, 0, 0, 0.03);
    --server-card-border: rgba(0, 0, 0, 0.08);
}

body.loaded {
    opacity: 1;
    transition: opacity 0.7s ease, background 0.4s ease;
}

body.page-leave {
    opacity: 0;
    transition: opacity 0.35s ease, background 0.4s ease;
}

.page-wrapper {
    width: 100%;
    max-width: 860px;
    backdrop-filter: blur(22px);
    background: var(--surface-main);
    border-radius: 26px;
    padding: 38px 32px 22px;
    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.85),
        0 0 0 1px var(--surface-border);
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: relative;
    transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

/* На светлой теме убираем обводку у основного окна полностью */
body[data-theme="light"] .page-wrapper {
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
}

body.modal-open .page-wrapper {
    filter: blur(4px);
    transform: scale(0.98);
    transition: filter 0.3s ease, transform 0.3s ease;
}

.theme-toggle {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.2s ease;
}

body[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.7);
    background: rgba(255, 255, 255, 0.12);
}

body[data-theme="light"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 1);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.75);
}

.theme-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.theme-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-moon svg {
    fill: #ffffff;
    stroke: none;
}

.icon-moon,
.icon-sun {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

body[data-theme="dark"] .icon-moon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

body[data-theme="dark"] .icon-sun {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

body[data-theme="light"] .icon-moon {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

body[data-theme="light"] .icon-sun {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

body[data-theme="light"] .theme-icon svg {
    stroke: #111111;
}

.content {
    text-align: center;
}

.logo {
    width: 152px;
    height: 152px;
    object-fit: contain;
    margin: 0 auto 18px;
    display: block;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: translateY(-1px);
}

.title {
    font-size: clamp(34px, 4.4vw, 44px);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 26px;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-bottom: 30px;
}

.btn {
    min-width: 200px;
    padding: 13px 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease,
        opacity 0.16s ease;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.btn-primary {
    background: linear-gradient(135deg, #ffffff, #d7d7d7);
    color: #000000;
    border-color: rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #fdfdfd, #e3e3e3);
}

.btn-outline {
    background: rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.22);
}

body[data-theme="light"] .btn-outline {
    background: rgba(0, 0, 0, 0.78);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.55);
}

/* На светлой теме полностью убираем тень с кнопок */
body[data-theme="light"] .btn {
    box-shadow: none;
}

body[data-theme="light"] .btn:hover,
body[data-theme="light"] .btn:active {
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.9);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.8);
    opacity: 0.9;
}

.about {
    text-align: left;
    margin-top: 8px;
}

.about h2 {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 700;
}

.about p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted-text);
}

.footer {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--footer-text);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 10px;
}

body[data-theme="light"] .footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.footer .heart {
    display: inline-block;
    animation: heartBeat 1.8s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    20% { transform: scale(1.12); }
    40% { transform: scale(0.96); }
    60% { transform: scale(1.08); }
    80% { transform: scale(0.98); }
}

/* Модалка */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 40;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 100%;
    max-width: 880px;
    background: var(--modal-bg);
    border-radius: 22px;
    padding: 24px 22px 20px;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.95),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    transform: translateY(14px) scale(0.96);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.35s ease, box-shadow 0.35s ease;
    color: var(--text-color);
}

body[data-theme="light"] .modal {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.modal-overlay.active .modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background 0.18s ease, transform 0.18s ease;
}

body[data-theme="light"] .modal-close {
    background: rgba(0, 0, 0, 0.06);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

body[data-theme="light"] .modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
}

.modal-body {
    max-height: 68vh;
    overflow-y: auto;
    padding-right: 4px;
}

.servers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 14px;
    background: var(--server-card-bg);
    border: 1px solid var(--server-card-border);
}

.server-info {
    text-align: left;
    flex: 1;
    min-width: 0;
}

.server-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.server-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease;
}

body[data-theme="light"] .icon-btn {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--text-color);
}

body[data-theme="light"] .icon-btn svg {
    fill: #111111;
}

.icon-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.7);
}

body[data-theme="light"] .icon-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

/* Тост */
.toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translate(-50%, -20px);
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.35s ease, border-color 0.35s ease, color 0.35s ease;
    z-index: 60;
    border: 1px solid rgba(255, 255, 255, 0.22);
    white-space: nowrap;
    max-width: calc(100% - 32px);
}


.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

body[data-theme="light"] .toast-icon svg {
    stroke: #111111;
}

@media (max-width: 700px) {
    .page-wrapper {
        padding: 26px 18px 16px;
        border-radius: 20px;
        max-width: 100%;
    }

    .buttons {
        gap: 10px;
    }

    .btn {
        width: 100%;
    }

    .modal {
        max-width: 100%;
        padding: 20px 14px 16px;
    }

    .server-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .server-actions {
        align-self: flex-end;
    }
}


@media (max-width: 480px) {
    .page-wrapper {
        padding: 22px 14px 14px;
        border-radius: 18px;
    }

    .logo {
        width: 110px;
        height: 110px;
        margin-bottom: 12px;
    }

    .title {
        font-size: 22px;
        letter-spacing: 0.14em;
    }

    .buttons {
        gap: 8px;
    }

    .btn {
        padding: 9px 14px;
        font-size: 13px;
    }

    .about p {
        font-size: 13px;
        line-height: 1.7;
    }

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


body[data-theme="light"] .toast {
    background: rgba(250, 250, 250, 0.98);
    color: #050505;
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}
