/* ============================================================
   COMMON CSS — общие стили для всех страниц
   ============================================================ */

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

/* ===== ПЕРЕМЕННЫЕ ===== */
:root {
    --bg-1: #0a0a1a;
    --bg-2: #1a1a3a;
    --text: #e8e8f0;
    --muted: rgba(232, 232, 240, .55);
    --accent: #6c8cff;
    --glow: rgba(108, 140, 255, .3);
    --card-bg: rgba(255, 255, 255, .04);
    --card-border: rgba(255, 255, 255, .12);
    --modal-panel: rgba(20, 20, 45, .97);
    --modal-field: rgba(255, 255, 255, .06);
    --modal-field-focus: rgba(255, 255, 255, .1);
    --shadow: rgba(0, 0, 0, .5);
    --footer-bg: rgba(6, 6, 16, .6);
    --inset-dark: rgba(0, 0, 0, .5);
    --inset-light: rgba(255, 255, 255, .06);
    --btn-inset-bg: rgba(0, 0, 0, .3);
}

html[data-theme="light"] {
    --bg-1: #f0eee6;
    --bg-2: #dcd8cc;
    --text: #1a1a2e;
    --muted: rgba(26, 26, 46, .6);
    --accent: #4a6cf7;
    --glow: rgba(74, 108, 247, .22);
    --card-bg: rgba(255, 255, 255, .75);
    --card-border: rgba(26, 26, 46, .1);
    --modal-panel: rgba(255, 255, 255, .98);
    --modal-field: rgba(0, 0, 0, .04);
    --modal-field-focus: rgba(0, 0, 0, .06);
    --shadow: rgba(26, 26, 46, .15);
    --footer-bg: rgba(230, 226, 216, .7);
    --inset-dark: rgba(0, 0, 0, .15);
    --inset-light: rgba(255, 255, 255, .7);
    --btn-inset-bg: rgba(0, 0, 0, .06);
}

/* ===== БАЗА ===== */
html { scroll-behavior: smooth; }

body {
    font-family: 'PT Sans Caption', sans-serif;
    background: var(--bg-1);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    transition: background .5s, color .5s;
}

/* ===== ФОН: ЗВЁЗДЫ + ОРБ ===== */
#stars {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.bg-orb {
    position: fixed;
    inset: -20%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 25% 30%, var(--glow) 0%, transparent 45%),
        radial-gradient(circle at 75% 70%, var(--bg-2) 0%, transparent 55%);
    animation: bg-drift 25s ease-in-out infinite alternate;
    transition: background .5s;
}
@keyframes bg-drift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-5%, 5%) scale(1.1); }
}

/* ===== КНОПКИ: ВХОД / РЕГИСТРАЦИЯ ===== */
.btn-auth {
    padding: 9px 18px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--card-border);
    background: var(--btn-inset-bg);
    color: var(--text);
    box-shadow:
        inset 0 2px 4px var(--inset-dark),
        inset 0 -1px 2px var(--inset-light);
    transition: box-shadow .2s, color .2s, transform .2s;
}
.btn-auth:hover {
    color: var(--accent);
    box-shadow:
        inset 0 1px 2px var(--inset-dark),
        inset 0 -1px 1px var(--inset-light),
        0 0 20px var(--glow);
}
.btn-auth:active { transform: translateY(1px); }

.btn-auth--primary { color: var(--accent); }
.btn-auth--primary:hover {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--glow);
}
html[data-theme="dark"] .btn-auth--primary:hover { color: #0a0a1a; }

/* ===== ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ===== */
.theme-toggle {
    background: var(--btn-inset-bg);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    color: var(--text);
    box-shadow:
        inset 0 2px 4px var(--inset-dark),
        inset 0 -1px 2px var(--inset-light);
    transition: box-shadow .2s, color .2s, transform .2s;
}
.theme-toggle:hover {
    color: var(--accent);
    box-shadow:
        inset 0 1px 2px var(--inset-dark),
        inset 0 -1px 1px var(--inset-light),
        0 0 20px var(--glow);
}

/* ===== СОЦ-ССЫЛКИ ===== */
.social-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.social-link {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-inset-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    text-decoration: none;
    box-shadow:
        inset 0 2px 4px var(--inset-dark),
        inset 0 -1px 2px var(--inset-light);
    transition: box-shadow .2s, color .2s, transform .2s;
}
.social-link:hover {
    color: var(--accent);
    box-shadow:
        inset 0 1px 2px var(--inset-dark),
        inset 0 -1px 1px var(--inset-light),
        0 0 20px var(--glow);
}
.social-link svg { width: 16px; height: 16px; display: block; }

/* ===== МОДАЛКИ ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
    padding: 20px;
}
.modal.open { opacity: 1; pointer-events: auto; }

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity .35s ease;
}
.modal.open .modal__backdrop { opacity: 1; }

.modal__panel {
    position: relative;
    width: 440px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--modal-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 48px 40px 36px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 80px var(--glow);
    clip-path: inset(50% 0 50% 0 round 22px);
    transition: clip-path .55s cubic-bezier(.34, 1.4, .64, 1);
}
.modal.open .modal__panel { clip-path: inset(0 0 0 0 round 22px); }

.modal__title {
    font-family: 'Rubik Wet Paint', cursive;
    font-size: 42px;
    font-weight: 400;
    text-align: center;
    margin-bottom: 32px;
    display: flex;
    justify-content: center;
    gap: 2px;
    perspective: 500px;
    letter-spacing: .02em;
    text-shadow: 0 0 30px var(--glow);
    flex-wrap: wrap;
}
.modal__title span {
    display: inline-block;
    opacity: 0;
    transform: rotateX(-90deg) translateY(-40px);
    transform-origin: bottom center;
    transition: opacity .45s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1);
    transition-delay: calc(0.35s + var(--i, 0) * 0.06s);
}
.modal.open .modal__title span {
    opacity: 1;
    transform: rotateX(0) translateY(0);
}

.modal__field, .modal__row {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .45s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1);
    transition-delay: calc(0.6s + var(--i, 0) * 0.1s);
    margin-bottom: 14px;
}
.modal.open .modal__field,
.modal.open .modal__row { opacity: 1; transform: translateY(0); }

.modal__field input {
    width: 100%;
    padding: 15px 18px;
    background: var(--modal-field);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    box-shadow: inset 0 2px 4px var(--inset-dark);
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.modal__field input::placeholder { color: var(--muted); }
.modal__field input:focus {
    border-color: var(--accent);
    background: var(--modal-field-focus);
    box-shadow: inset 0 2px 4px var(--inset-dark), 0 0 15px var(--glow);
}

.modal__check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    user-select: none;
}
.modal__check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.modal__check-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 1px;
    background: var(--btn-inset-bg);
    border: 1px solid var(--card-border);
    box-shadow: inset 0 2px 4px var(--inset-dark);
    transition: background .2s, border-color .2s, box-shadow .2s;
    position: relative;
}
.modal__check-box::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border-right: 2px solid #0a0a1a;
    border-bottom: 2px solid #0a0a1a;
    transform: rotate(45deg) scale(0);
    transition: transform .2s;
}
.modal__check input:checked + .modal__check-box {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--glow);
}
.modal__check input:checked + .modal__check-box::after {
    transform: rotate(45deg) scale(1);
}
.modal__check input:focus-visible + .modal__check-box {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.modal__check-label a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.modal__check-label a:hover {
    color: var(--accent);
    filter: brightness(1.2);
}

.modal__submit {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    background: var(--accent);
    color: #0a0a1a;
    border: 0;
    border-radius: 999px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transform: translateY(24px) scale(.9);
    transition: opacity .45s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
    transition-delay: .95s;
    box-shadow: 0 0 25px var(--glow);
}
.modal.open .modal__submit { opacity: 1; transform: translateY(0) scale(1); }
.modal__submit:hover { box-shadow: 0 0 50px var(--glow); }
.modal__submit:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.modal__links {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    font-size: 13px;
    gap: 12px;
    flex-wrap: wrap;
}
.modal__link {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    padding: 4px 0;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .35s ease, transform .35s, color .2s;
    transition-delay: calc(1.15s + var(--i, 0) * 0.1s);
}
.modal.open .modal__link { opacity: 1; transform: translateY(0); }
.modal__link:hover { color: var(--accent); }

.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--btn-inset-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: rotate(-180deg) scale(.3);
    transition: opacity .35s ease, transform .5s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
    transition-delay: 1.3s;
    box-shadow:
        inset 0 2px 4px var(--inset-dark),
        inset 0 -1px 2px var(--inset-light);
}
.modal.open .modal__close { opacity: 1; transform: rotate(0) scale(1); }
.modal__close:hover {
    color: var(--accent);
    box-shadow:
        inset 0 1px 2px var(--inset-dark),
        inset 0 -1px 1px var(--inset-light),
        0 0 20px var(--glow);
}

.modal:not(.open) .modal__title span,
.modal:not(.open) .modal__field,
.modal:not(.open) .modal__row,
.modal:not(.open) .modal__submit,
.modal:not(.open) .modal__link,
.modal:not(.open) .modal__close {
    transition-delay: 0s !important;
    transition-duration: .2s;
}

/* ===== ФУТЕР ===== */
.site-footer {
    position: relative;
    z-index: 2;
    background: var(--footer-bg);
    border-top: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.site-footer__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 64px 32px 32px;
}
.site-footer__top {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--card-border);
}
.site-footer__col h4 {
    font-family: 'Amatic SC', cursive;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 18px;
    letter-spacing: .03em;
    color: var(--text);
}
.site-footer__col a {
    display: block;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 0;
    transition: color .2s, padding-left .2s;
}
.site-footer__col a:hover {
    color: var(--accent);
    padding-left: 4px;
}
.site-footer__col--brand .logo {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 20px;
}
.site-footer__col--brand p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 20px;
    max-width: 340px;
}
.site-footer__col--brand .social-links { margin-top: 8px; }
.site-footer__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 28px;
    font-size: 13px;
    color: var(--muted);
}
.site-footer__legal {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.site-footer__legal a {
    color: var(--muted);
    text-decoration: none;
    transition: color .2s;
}
.site-footer__legal a:hover { color: var(--accent); }

/* ===== АДАПТИВ ===== */
@media (max-width: 1024px) {
    .site-footer__top { grid-template-columns: 1fr 1fr; gap: 40px; }
    .site-footer__col--brand { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
    .site-footer__inner { padding: 48px 20px 24px; }
    .site-footer__top { grid-template-columns: 1fr; gap: 32px; padding-bottom: 32px; }
    .site-footer__bottom { flex-direction: column; text-align: center; gap: 16px; }
    .site-footer__legal { justify-content: center; }
    .modal__panel { padding: 44px 24px 28px; }
    .modal__title { font-size: 32px; margin-bottom: 24px; }
    .modal__title span { font-size: 32px; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .bg-orb { animation: none; }
    #stars { display: none; }
}
