:root {
    --lavender: #e8d4ff;
    --purple: #7b4fd4;
    --purple-dark: #3d2066;
    --pink: #ffd6f0;
    --blue: #d4ecff;
    --mint: #d4fff3;
    --glass: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.85);
    --shadow: 0 12px 40px rgba(100, 60, 160, 0.18);
    --radius-xl: 28px;
    --radius-pill: 999px;
    --font: 'Nunito', system-ui, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
}

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

html {
    scroll-behavior: smooth;
}

body.umka-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--purple-dark);
    background: linear-gradient(135deg, #dff4ff 0%, #f0e4ff 45%, #ffe8f5 100%);
    background-attachment: fixed;
}

.bg-stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.9), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(200, 180, 255, 0.6), transparent);
    background-size: 200px 200px;
    opacity: 0.6;
    z-index: 0;
}

.site-header {
    position: relative;
    z-index: 10;
    padding: 16px 20px 8px;
}

.site-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 16px;
}

.brand__logo {
    height: 72px;
    width: auto;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(120, 80, 200, 0.25));
}

.header-mascot {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
}

.header-mascot__owl {
    height: 64px;
    width: auto;
}

.header-mascot__ai {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    border-radius: 50%;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.header-mascot__ai:hover {
    transform: scale(1.06);
    box-shadow: 0 16px 48px rgba(100, 60, 160, 0.28);
}

.header-mascot__ai img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.header-mascot__ai span {
    font-size: 11px;
    font-weight: 900;
    color: var(--purple);
}

.search-glass {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 520px;
    width: 100%;
    justify-self: center;
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(232, 212, 255, 0.5));
    backdrop-filter: blur(14px);
    border: 3px solid rgba(180, 140, 255, 0.45);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.search-glass__icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.search-glass__input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--purple-dark);
    letter-spacing: 0.04em;
    outline: none;
    min-width: 0;
}

.search-glass__input::placeholder {
    color: rgba(61, 32, 102, 0.55);
}

.login-glass {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(180, 140, 255, 0.4);
    color: var(--purple);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.login-glass:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(100, 60, 160, 0.25);
}

.site-main {
    position: relative;
    z-index: 5;
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 20px 48px;
}

.site-footer {
    text-align: center;
    padding: 24px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(61, 32, 102, 0.6);
    position: relative;
    z-index: 5;
}

/* Feed */
.feed {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
}

.categories-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid rgba(123, 79, 212, 0.5);
    background: rgba(255, 255, 255, 0.92);
    color: var(--purple);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

.categories-btn:hover {
    transform: scale(1.04);
}

.categories-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-xl);
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 2px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.categories-panel__link {
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    color: var(--purple-dark);
    font-size: 14px;
}

.categories-panel__link:hover,
.categories-panel__link.is-active {
    background: rgba(123, 79, 212, 0.15);
    color: var(--purple);
}

.feed__hint {
    font-weight: 800;
    margin: 0 0 16px;
}

.feed__empty {
    text-align: center;
    padding: 48px 24px;
    background: var(--glass);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
}

.feed__empty-img {
    max-width: 180px;
    margin-bottom: 16px;
}

.feed__empty a {
    color: var(--purple);
    font-weight: 900;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.video-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(100, 60, 160, 0.22);
}

.video-card__thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--lavender);
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card__body {
    padding: 16px 18px 20px;
}

.video-card__title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.3;
    color: var(--purple-dark);
}

.video-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 800;
}

.pill--age {
    background: rgba(200, 170, 255, 0.45);
    color: var(--purple-dark);
}

.pill--cat {
    background: rgba(180, 230, 255, 0.6);
    color: var(--purple-dark);
}

.video-card__views,
.video-page__views {
    font-size: 13px;
    font-weight: 700;
    color: rgba(61, 32, 102, 0.55);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

.pagination__btn {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    background: var(--glass);
    border: 2px solid rgba(123, 79, 212, 0.35);
    color: var(--purple);
    font-weight: 800;
    text-decoration: none;
}

.pagination__info {
    font-weight: 800;
}

.glass-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    border-radius: var(--radius-xl);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow);
    padding: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-family: var(--font);
    font-weight: 900;
    font-size: 15px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, filter 0.15s;
}

.btn--primary {
    background: linear-gradient(135deg, #b88cff, #7b4fd4);
    color: #fff;
    box-shadow: 0 6px 20px rgba(123, 79, 212, 0.4);
}

.btn--primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.7);
    color: var(--purple);
    border: 2px solid rgba(123, 79, 212, 0.35);
}

.btn--danger {
    background: #ff8fab;
    color: #fff;
}

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

@media (max-width: 900px) {
    .site-header__inner {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .brand {
        grid-column: 1;
    }

    .header-mascot {
        display: none;
    }

    .search-glass {
        grid-column: 1 / -1;
        max-width: none;
    }

    .login-glass {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .feed {
        grid-template-columns: 1fr;
    }

    .categories-btn {
        width: 100%;
        height: auto;
        border-radius: var(--radius-pill);
        padding: 14px;
    }
}

body.ai-modal-open {
    overflow: hidden;
}

.ai-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ai-modal[hidden] {
    display: none !important;
}

.ai-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 26, 80, 0.45);
    backdrop-filter: blur(4px);
}

.ai-modal__dialog {
    position: relative;
    width: min(440px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #fff 0%, #f5ecff 100%);
    border-radius: var(--radius-xl);
    border: 3px solid rgba(180, 140, 255, 0.5);
    box-shadow: 0 24px 60px rgba(80, 40, 140, 0.35);
    padding: 24px 20px 20px;
}

.ai-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(123, 79, 212, 0.15);
    color: var(--purple-dark);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.ai-modal__logo {
    display: block;
    height: 56px;
    margin: 0 auto 8px;
}

.ai-modal__logo--owl {
    height: 72px;
}

.ai-modal__title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 900;
}

.ai-modal__subtitle {
    margin: 0 0 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(61, 32, 102, 0.7);
    line-height: 1.4;
}

.ai-modal__messages {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
    padding: 4px;
}

.ai-msg {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    max-width: 92%;
}

.ai-msg--bot {
    align-self: flex-start;
    background: rgba(232, 212, 255, 0.7);
    color: var(--purple-dark);
}

.ai-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #b88cff, #7b4fd4);
    color: #fff;
}

.ai-msg--typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    border-radius: 50%;
    background: var(--purple);
    animation: ai-dot 1s infinite ease-in-out;
}

.ai-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.ai-modal__form {
    display: flex;
    gap: 8px;
}

.ai-modal__input {
    flex: 1;
    padding: 12px 14px;
    border-radius: var(--radius-pill);
    border: 2px solid rgba(123, 79, 212, 0.35);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
}

.ai-modal__send {
    flex-shrink: 0;
    padding: 12px 18px;
}

.ai-prompt-label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.ai-prompt-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border-radius: 14px;
    border: 2px solid rgba(123, 79, 212, 0.35);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    resize: vertical;
}

.ai-prompt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.ai-prompt-status {
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 700;
}

.ai-prompt-status--ok { color: #2e7d32; }
.ai-prompt-status--err { color: #c62828; }

body.category-modal-open {
    overflow: hidden;
}

.feed__active-cat {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--purple);
    text-align: center;
}

.feed__active-cat-clear {
    margin-left: 6px;
    color: var(--purple-dark);
    text-decoration: none;
    font-weight: 900;
}

.category-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.category-modal[hidden] {
    display: none !important;
}

.category-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 26, 80, 0.4);
    backdrop-filter: blur(3px);
}

.category-modal__sheet {
    position: relative;
    width: min(360px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8f4ff 0%, #efe8ff 100%);
    border-radius: 24px;
    border: 3px solid rgba(180, 150, 230, 0.5);
    box-shadow: 0 20px 50px rgba(80, 50, 140, 0.3);
    padding: 20px 16px 16px;
}

.category-modal__close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(123, 79, 212, 0.15);
    font-size: 22px;
    cursor: pointer;
    color: var(--purple-dark);
}

.category-modal__title {
    margin: 0 0 16px;
    text-align: center;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: rgba(61, 32, 102, 0.65);
    text-transform: uppercase;
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-list__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--purple-dark);
    background: rgba(255, 255, 255, 0.65);
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.category-list__item:hover {
    background: #fff;
    border-color: rgba(123, 79, 212, 0.35);
    transform: translateX(4px);
}

.category-list__item.is-active {
    background: #fff;
    border-color: var(--purple);
    box-shadow: 0 4px 16px rgba(123, 79, 212, 0.2);
}

.category-list__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.category-list__icon--all,
.category-list__icon--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8d4ff, #d4ecff);
    font-size: 22px;
}

.category-list__name {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.02em;
}
