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

:root {
    --bg: #0a0d1c;
    --surface: rgba(22, 27, 51, 0.72);
    --surface-2: rgba(30, 36, 68, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.12);
    --text: #eef1fb;
    --muted: #8f97bf;
    --accent: #5b7cff;
    --accent-2: #9d5bff;
    --accent-hover: #4a6aff;
    --ok: #5ce8a8;
    --warn: #ffd166;
    --danger: #ff6b8a;
    --grad: linear-gradient(135deg, #5b7cff 0%, #9d5bff 100%);
    --radius: 16px;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

html { scroll-behavior: smooth; }

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Анимированные «аврора»-пятна на фоне */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.55;
    pointer-events: none;
}
body::before {
    width: 620px;
    height: 620px;
    top: -160px;
    right: -120px;
    background: radial-gradient(circle, rgba(91, 124, 255, 0.32) 0%, transparent 70%);
    animation: drift 18s ease-in-out infinite;
}
body::after {
    width: 520px;
    height: 520px;
    bottom: -160px;
    left: -120px;
    background: radial-gradient(circle, rgba(157, 91, 255, 0.28) 0%, transparent 70%);
    animation: drift 22s ease-in-out infinite reverse;
}
@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 30px) scale(1.1); }
}

.container { width: 100%; max-width: 1020px; margin: 0 auto; padding: 0 20px; }

::selection { background: rgba(91, 124, 255, 0.4); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3160; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4380; }

/* ---------- Шапка ---------- */
.topbar {
    background: rgba(10, 13, 28, 0.75);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    position: relative;
}
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.2px;
    min-width: 0;
    justify-self: start;
}
.brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-2);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    justify-self: end;
}
.burger:hover { background: rgba(255, 255, 255, 0.08); }
.burger:active { transform: scale(0.95); }
.burger span { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; transition: transform 0.25s, opacity 0.2s; }
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.topnav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 4px;
    background: rgba(13, 17, 36, 0.97);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--border-2);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    padding: 14px 16px 18px;
    animation: fadeDown 0.25s ease;
    z-index: 30;
}
.topnav.open { display: flex; }
.topnav a {
    color: var(--muted);
    text-decoration: none;
    padding: 11px 14px;
    font-size: 0.98rem;
    border-radius: 12px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.topnav a:hover {
    color: #fff;
    background: rgba(91, 124, 255, 0.14);
    border-left-color: var(--accent);
    transform: translateX(4px);
}
.topnav a.danger { color: var(--danger); }
.topnav a.danger:hover { background: rgba(255, 107, 138, 0.12); border-left-color: var(--danger); }

.topnav-user {
    justify-self: center;
    font-size: 0.85rem;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    padding: 5px 14px;
    border-radius: 24px;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

main { flex: 1; padding: 32px 20px; animation: fadeUp 0.4s ease; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Подвал ---------- */
.footer { padding: 24px 0; color: #6b7391; font-size: 0.85rem; border-top: 1px solid var(--border); background: rgba(10, 13, 28, 0.5); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { color: #7d85ad; text-decoration: none; transition: color 0.15s; }
.footer-nav a:hover { color: #fff; }

/* ---------- Флеш ---------- */
.flash {
    padding: 13px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeDown 0.3s ease;
}
.flash-error { background: rgba(255, 107, 138, 0.12); border: 1px solid rgba(255, 107, 138, 0.35); color: #ffb3c4; }
.flash-success { background: rgba(92, 232, 168, 0.12); border: 1px solid rgba(92, 232, 168, 0.35); color: #a7f2cd; }

/* ---------- Карточки ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: rgba(91, 124, 255, 0.35); transform: translateY(-2px); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45); }

.card-inner {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}
.card-inner:hover { border-color: rgba(157, 91, 255, 0.4); }
.card-inner h3 { font-size: 0.98rem; margin-bottom: 12px; color: #fff; }

.sub-card { position: relative; overflow: hidden; }
.sub-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--grad);
    opacity: 0.8;
}
.sub-card.sub-wdtt::before { background: linear-gradient(135deg, #7c5cff, #ff5c9d); }
.sub-card.sub-wdtt { border-left: 3px solid rgba(124, 92, 255, 0.6); }
.sub-card.sub-vpn { border-left: 3px solid rgba(91, 124, 255, 0.6); }
.sub-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- Заголовки ---------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { margin-bottom: 6px; }
h1 { font-size: 1.7rem; margin-bottom: 18px; font-weight: 700; letter-spacing: -0.3px; }
h2 { font-size: 1.15rem; margin-bottom: 12px; color: #fff; }
h3 { font-size: 1rem; margin-bottom: 10px; color: #fff; }
p { margin-bottom: 10px; line-height: 1.6; }
.muted { color: var(--muted); font-size: 0.9rem; }
a { color: var(--accent); }
a:hover { color: #9db3ff; }

/* ---------- Статистика ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}
.stat:hover { transform: translateY(-3px); border-color: rgba(91, 124, 255, 0.45); }
.stat .value {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat .label { font-size: 0.82rem; color: var(--muted); margin-top: 5px; letter-spacing: 0.3px; text-transform: uppercase; }

/* ---------- Кнопки ---------- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--grad);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(91, 124, 255, 0.35);
    transition: filter 0.15s, transform 0.1s, box-shadow 0.15s, background 0.15s;
    position: relative;
    overflow: hidden;
}
button:hover, .btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(91, 124, 255, 0.5); }
button:active, .btn:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(91, 124, 255, 0.3); }
button::after, .btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}
button:hover::after, .btn:hover::after { left: 120%; }

.btn-secondary { background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.14); box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, #ff6b8a, #ff4d6d); box-shadow: 0 6px 20px rgba(255, 107, 138, 0.35); }
.btn-danger:hover { box-shadow: 0 10px 26px rgba(255, 107, 138, 0.5); }
.btn-success { background: linear-gradient(135deg, #27c07a, #18a05f); box-shadow: 0 6px 20px rgba(39, 192, 122, 0.35); }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { display: flex; width: 100%; margin-bottom: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

/* ---------- Формы ---------- */
label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 0.9rem; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-2);
    background: rgba(10, 13, 28, 0.6);
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.25);
}
input.input-sm {
    width: 92px;
    padding: 6px 8px;
    font-size: 0.85rem;
    margin-bottom: 0;
    display: inline-block;
}

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ---------- Теги ---------- */
.tag { display: inline-block; padding: 4px 12px; border-radius: 24px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.2px; }
.tag-ok { background: rgba(92, 232, 168, 0.14); color: var(--ok); border: 1px solid rgba(92, 232, 168, 0.3); }
.tag-bad { background: rgba(255, 107, 138, 0.14); color: #ff8fa6; border: 1px solid rgba(255, 107, 138, 0.3); }
.tag-warn { background: rgba(255, 209, 102, 0.14); color: var(--warn); border: 1px solid rgba(255, 209, 102, 0.3); }

/* ---------- Код ---------- */
.code-block {
    background: rgba(8, 10, 22, 0.8);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    padding: 14px;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin-bottom: 14px;
    color: #c3cbf2;
}
.code-block.small { font-size: 0.75rem; max-height: 220px; overflow-y: auto; }
.code-block.click-copy { cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.1s; }
.code-block.click-copy:hover { border-color: var(--accent); background: rgba(91, 124, 255, 0.08); }
.code-block.click-copy:active { transform: scale(0.995); }

/* ---------- QR ---------- */
.qr-wrap { text-align: center; margin: 14px 0; }
.qr-wrap img {
    border-radius: 14px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
}
.qr-wrap img:hover { transform: scale(1.04); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.price { font-size: 1.5rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.link-list a { margin-bottom: 12px; }

/* Лёгкая адаптация для мобильных */
@media (max-width: 640px) {
    .brand > span:last-child { display: none; }
    .topnav-user { max-width: 180px; }
}
@media (max-width: 480px) {
    main { padding: 20px 14px; }
    h1 { font-size: 1.4rem; }
    .card { padding: 18px; }
    .topbar-inner { padding: 10px 14px; gap: 8px; }
    .topnav-user { font-size: 0.75rem; padding: 4px 10px; max-width: 140px; }
}

/* ---------- Фортуна ---------- */
.fortuna-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .fortuna-layout { grid-template-columns: 1fr; } }

.fortuna-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.fortuna-wheel-card { display: flex; flex-direction: column; align-items: center; }

.wheel-wrap { position: relative; width: 320px; max-width: 100%; margin: 6px auto 18px; }
#wheel { display: block; width: 100%; height: auto; filter: drop-shadow(0 14px 34px rgba(91, 124, 255, 0.35)); }

.wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 26px solid #fff;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
    z-index: 2;
}

.fortuna-controls { width: 100%; max-width: 300px; }

.stat-inline {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}
.stat-inline-value {
    font-size: 1.9rem;
    font-weight: 800;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-inline-label { color: var(--muted); font-size: 0.9rem; }

.center { text-align: center; }

.result-banner {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 32px);
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 1rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    animation: toastIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.result-win { background: rgba(92, 232, 168, 0.16); border: 1px solid rgba(92, 232, 168, 0.45); color: #a7f2cd; }
.result-lose { background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.4); color: #ffe4a1; }
.result-banner.toast-hide { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -24px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -24px); }
}

button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; transform: none; }
button:disabled::after, .btn:disabled::after { display: none; }
