:root {
    --bg: #061225;
    --bg-soft: rgba(7, 23, 46, 0.72);
    --line: rgba(196, 229, 255, 0.12);
    --text: #ecf6ff;
    --muted: #a4b9d0;
    --accent: #8ed5ff;
    --accent-2: #ceddff;
    --success: #4dd9a6;
    --error: #ff8f9c;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
    --radius: 24px;
    --radius-sm: 16px;
    --maxw: 1280px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(122, 191, 255, 0.15), transparent 34%),
        radial-gradient(circle at 80% 15%, rgba(87, 161, 255, 0.14), transparent 28%),
        linear-gradient(180deg, #041020 0%, #07192e 40%, #051322 100%);
    min-height: 100vh;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(2, 8, 18, 0.28), rgba(2, 8, 18, 0.7)),
        url("/static/img/a22514c7-03d0-49de-b134-51a164f0b9bc.png") center/cover no-repeat;
    opacity: 0.9;
    pointer-events: none;
    z-index: -3;
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 15%, rgba(173, 229, 255, 0.08), transparent 20%),
        radial-gradient(circle at 85% 12%, rgba(173, 229, 255, 0.05), transparent 18%);
    z-index: -2;
    pointer-events: none;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.page-shell { width: min(var(--maxw), calc(100% - 28px)); margin: 0 auto; padding-bottom: 80px; position: relative; }
.ambient { position: fixed; border-radius: 999px; filter: blur(60px); opacity: 0.2; pointer-events: none; z-index: -1; }
.ambient-a { width: 240px; height: 240px; background: #58bfff; top: 10%; left: 5%; }
.ambient-b { width: 360px; height: 360px; background: #235cff; bottom: 5%; right: 4%; }
.glass { background: linear-gradient(180deg, rgba(13, 33, 61, 0.72), rgba(8, 24, 47, 0.64)); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.topbar {
    position: sticky;
    top: 10px;
    z-index: 40;
    margin-top: 10px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand strong { display: block; font-size: 1rem; }
.brand small { display: block; color: var(--muted); font-size: 0.72rem; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(146, 214, 255, 0.12); border: 1px solid rgba(146, 214, 255, 0.2); font-size: 1.05rem; color: var(--accent); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.nav a { color: var(--muted); font-size: 0.88rem; transition: 0.2s ease; }
.nav a:hover { color: var(--text); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.section { padding: 84px 0 24px; }
.hero {
    min-height: 78vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: center;
}
.eyebrow { margin: 0 0 14px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.76rem; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 5.2rem); line-height: 0.98; margin: 0 0 18px; max-width: 11ch; }
.hero h1 span { color: var(--accent); }
.lead { max-width: 640px; color: var(--muted); font-size: 1.08rem; line-height: 1.72; margin: 0 0 24px; }
.hero-actions, .form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.pill { display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(18, 42, 72, 0.42); color: var(--accent-2); font-size: 0.92rem; }
.hero-card {
    border-radius: 30px;
    padding: 32px;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-card-inner {
    width: 100%;
    max-width: 560px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.hero-card h3, .section-head h2, .info-card h3, .result-panel h3, .cabinet-column h3, .cabinet-readings h3 { margin-top: 0; }
.card-label { color: var(--accent); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.15em; }
.hero-card .card-label {
    display: block;
    margin: 0;
    color: var(--accent);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.hero-card h3 {
    margin: 0;
    font-size: clamp(1.8rem, 2.4vw, 2.6rem);
    line-height: 1.15;
    max-width: 14ch;
}

.hero-card p {
    margin: 0;
    max-width: 34ch;
    color: var(--text);
    font-size: 1.04rem;
    line-height: 1.75;
}
.section-head { max-width: 820px; margin-bottom: 28px; }
.section-head h2 { margin-bottom: 12px; font-size: clamp(2rem, 3vw, 3rem); }
.section-sub, .inline-note, .muted, .price-copy, .review-card small, .cabinet-status, .reading-question, .history-item span, .history-item small { color: var(--muted); }
.about-grid, .oracle-grid, .cabinet-grid, .reviews-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.info-card, .result-panel, .cabinet-column, .cabinet-readings, .review-editor, .review-card, .price-card, .ask-form { border-radius: var(--radius); padding: 24px; }
.feature-list { margin: 16px 0 24px; padding-left: 18px; line-height: 1.8; color: var(--muted); }
.telegram-btn { width: 100%; justify-content: center; }
.ask-form textarea, .chat-form textarea, .stack-form textarea, .stack-form input, .auth-form input, .auth-form textarea { width: 100%; border-radius: 18px; border: 1px solid rgba(196, 229, 255, 0.12); background: rgba(9, 22, 40, 0.7); color: var(--text); padding: 14px 16px; outline: none; transition: border-color 0.2s ease, transform 0.2s ease; }
.ask-form textarea:focus, .chat-form textarea:focus, .stack-form textarea:focus, .stack-form input:focus, .auth-form input:focus { border-color: rgba(142, 213, 255, 0.38); transform: translateY(-1px); }
.field-label, .stack-form label, .auth-form label { display: block; margin-bottom: 12px; font-size: 0.96rem; color: var(--accent-2); }
.result-panel { display: flex; flex-direction: column; gap: 18px; }
.empty-state { min-height: 280px; display: grid; place-items: center; text-align: center; border: 1px dashed rgba(196, 229, 255, 0.14); border-radius: 22px; padding: 24px; background: rgba(7, 18, 35, 0.36); }
.empty-state.small { min-height: 180px; }




.reading-history-card img {
    border-radius: 18px;
    object-fit: cover;
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(196, 229, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}
.reading-result {
    width: min(100%, 820px);
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.reading-visual {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.reading-visual img {
    display: block;
    width: min(100%, 430px);
    height: auto;
    max-height: 780px;
    object-fit: contain;
    border-radius: 18px;
    border: 1px solid rgba(196, 229, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
}

.reading-copy {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reading-answer {
    width: 100%;
    white-space: pre-wrap;
    line-height: 1.82;
    font-size: 1.03rem;
    text-align: left;
    overflow-wrap: break-word;
}
.chat-panel { border-top: 1px solid rgba(196, 229, 255, 0.08); padding-top: 18px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow: auto; margin-bottom: 14px; }
.chat-bubble { max-width: 86%; border-radius: 18px; padding: 12px 14px; line-height: 1.65; }
.chat-bubble.user { align-self: flex-end; background: rgba(78, 155, 255, 0.16); border: 1px solid rgba(78, 155, 255, 0.22); }
.chat-bubble.assistant { align-self: flex-start; background: rgba(143, 218, 255, 0.08); border: 1px solid rgba(143, 218, 255, 0.18); }
.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.price-card { min-height: 280px; display: flex; flex-direction: column; }
.price-title { color: var(--accent-2); margin-top: 0; }
.price-card h3 { margin: 8px 0 14px; font-size: 2.2rem; }
.price-card .glass-btn { margin-top: auto; }
.cabinet-grid { margin-bottom: 20px; }
.stack-form { display: grid; gap: 12px; }
.divider { height: 1px; background: rgba(196, 229, 255, 0.1); margin: 20px 0; }
.history-list { display: grid; gap: 14px; }
.history-list.compact .history-item { padding: 14px; }
.history-item, .reading-history-card { border-radius: 18px; border: 1px solid rgba(196, 229, 255, 0.08); background: rgba(7, 18, 34, 0.44); padding: 16px; }
.reading-history-card { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.review-card { display: grid; gap: 14px; }
.review-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.glass-btn, .ghost-btn { border-radius: 999px; padding: 13px 18px; border: 1px solid rgba(196, 229, 255, 0.14); transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease; display: inline-flex; align-items: center; justify-content: center; }
.glass-btn { background: linear-gradient(180deg, rgba(157, 216, 255, 0.16), rgba(103, 162, 255, 0.1)); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
.ghost-btn { background: rgba(12, 25, 42, 0.46); color: var(--accent-2); }
.glass-btn:hover, .ghost-btn:hover { transform: translateY(-1px); border-color: rgba(142, 213, 255, 0.26); }
.glass-btn.small, .ghost-btn.small { padding: 8px 12px; font-size: 0.88rem; }
.glass-btn.danger { color: #ffd3d9; }
.hidden { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 80; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(1, 6, 14, 0.68); }
.modal-dialog { position: relative; width: min(520px, calc(100% - 22px)); margin: 8vh auto 0; border-radius: 28px; padding: 24px; z-index: 2; }
.modal-close { position: absolute; top: 10px; right: 14px; font-size: 1.8rem; background: transparent; border: 0; color: var(--muted); }
.auth-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.auth-tab { border: 1px solid rgba(196, 229, 255, 0.12); background: rgba(12, 25, 42, 0.4); color: var(--muted); border-radius: 16px; padding: 12px 14px; }
.auth-tab.active { color: var(--text); border-color: rgba(142, 213, 255, 0.3); background: rgba(157, 216, 255, 0.1); }
.auth-form { display: grid; gap: 12px; }
.toast-container { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 90; }
.toast { min-width: 280px; max-width: 360px; padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(196, 229, 255, 0.12); background: rgba(8, 24, 45, 0.92); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: 0.24s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(77, 217, 166, 0.28); }
.toast.error { border-color: rgba(255, 143, 156, 0.3); }

.mobile-menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.10);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

@media (max-width: 768px) {
    .topbar {
        position: sticky;
        top: 8px;
        padding: 10px 12px;
        gap: 10px;
        align-items: center;
        width: fit-content;
        max-width: calc(100% - 16px);
        margin-left: auto;
        margin-right: auto;
        border-radius: 22px;
    }

    .brand small {
        display: none;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .nav,
    .topbar-actions {
        display: none;
    }

    .topbar.mobile-open {
        flex-wrap: wrap;
        align-items: flex-start;
        width: fit-content;
        max-width: calc(100% - 16px);
    }

    .topbar.mobile-open .nav,
    .topbar.mobile-open .topbar-actions {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: auto;
        margin-top: 10px;
    }

    .topbar.mobile-open .nav a,
    .topbar.mobile-open .topbar-actions a,
    .topbar.mobile-open .topbar-actions button {
        width: auto;
        justify-content: flex-start;
        padding-inline: 14px;
    }

    .hero,
    .about-grid,
    .oracle-grid,
    .cabinet-grid,
    .reviews-layout,
    .pricing-grid,
    .reading-result {
        grid-template-columns: 1fr;
    }

    .reading-result {
        gap: 14px;
    }
}

.chat-bubble__author {
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    opacity: 0.9;
}

.chat-bubble__content {
    white-space: pre-wrap;
}

.chat-bubble.assistant .chat-bubble__author {
    color: var(--accent);
}

.chat-bubble.user .chat-bubble__author {
    color: var(--accent-2);
}

.chat-bubble.system {
    align-self: center;
    text-align: center;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(196, 229, 255, 0.12);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.admin-stat {
    padding: 24px;
    border-radius: 24px;
    text-align: center;
}

.admin-stat strong {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
}

.admin-stat span {
    color: var(--muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.admin-block {
    padding: 22px;
    border-radius: 24px;
}

.admin-log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 460px;
    overflow: auto;
}

.admin-log-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(17, 35, 61, 0.46);
}

.admin-log-meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.admin-log-text {
    margin-top: 8px;
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.55;
}

@media (max-width: 900px) {
    .admin-stats,
    .admin-grid {
        grid-template-columns: 1fr;
    }
}