* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
*::-webkit-scrollbar {
    display: none;
}

html {
    overflow-x: clip;
}

:root {
    --bg: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-subtle: rgba(255, 255, 255, 0.7);
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.3);
    --video: #ef4444;
    --site: #a78bfa;
    --pev: #f59e0b;
    --lr: #10b981;
    --vzp: #ec4899;
    --periscope: #06b6d4;

    /* Отступы sticky header */
    --nav-gap: 1rem;
    --search-gap: 1.5rem;
    --sticky-padding: 20px;
    --center-offset: calc(25vh - 100px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: clip;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2.5rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.main-section {
    flex: 1;
}

/* Header */
.header {
    position: relative;
    text-align: center;
    margin-bottom: 1.5rem;
    overflow: visible;
}

.logo {
    font-size: 2.9rem;
    font-weight: 700;
    background: linear-gradient(
        120deg,
        #818cf8 0%,
        #6366f1 15%,
        #a5b4fc 30%,
        #818cf8 45%,
        #6366f1 60%,
        #a5b4fc 75%,
        #818cf8 90%,
        #6366f1 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 100%;
    margin-bottom: 0.5rem;
    animation: logo-shimmer 14s ease-in-out infinite;
}

@keyframes logo-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header-link {
    text-decoration: none;
    color: inherit;
}

/* Logo wrapper for sparkles */
.logo-wrapper {
    position: relative;
    display: inline-block;
}

.sparkles-container {
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    bottom: 10px;
    pointer-events: none;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.sparkle svg {
    display: block;
    filter: drop-shadow(0 0 2px currentColor);
}

@keyframes sparkle-grow {
    0% { 
        transform: scale(0) rotate(0deg); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1) rotate(90deg); 
        opacity: 1; 
    }
    100% { 
        transform: scale(0) rotate(180deg); 
        opacity: 0; 
    }
}

@keyframes sparkle-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(180deg); }
}


.tagline {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

/* Navigation */
.nav-menu {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.nav-item {
    position: relative;
    padding: 4px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}

.nav-item:hover {
    color: var(--text);
}

.nav-item:hover::after {
    transform: scaleX(1);
}

.nav-item.active {
    color: var(--text);
}

.nav-item.active::after {
    transform: scaleX(1);
}

/* === Sticky Header (общие стили для обеих вкладок) === */
.search-block,
.timecodes-sticky-header {
    margin-bottom: 0.75rem;
}

.search-block .nav-menu,
.timecodes-sticky-header .nav-menu {
    margin-bottom: var(--nav-gap);
}

.search-block .search-row,
.timecodes-sticky-header .search-row {
    margin-bottom: var(--search-gap);
}

/* Desktop (min-width: 601px) */
@media (min-width: 601px) {
    html {
        scroll-padding-top: 180px;
    }

    /* Центрирование — половина отступа на header, половина на search */
    .header {
        margin-top: calc(var(--center-offset) * 0.7);
    }

    .search-block,
    .timecodes-sticky-header {
        margin-top: calc(var(--center-offset) * 0.3);
        padding-top: var(--sticky-padding);
    }

    /* Sticky состояние для поиска (когда есть результаты) */
    .search-block.has-results {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
    }

    /* Sticky состояние для таймкодов — всегда */
    .timecodes-sticky-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
    }

    /* Градиент под sticky */
    .search-block.has-results::after,
    .timecodes-sticky-header::after {
        content: '';
        position: absolute;
        bottom: -50px;
        left: 0;
        right: 0;
        height: 50px;
        background: linear-gradient(to bottom, var(--bg) 0%, rgba(10, 10, 10, 0.8) 40%, transparent 100%);
        pointer-events: none;
    }
}

.timecodes-toggles {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.timecodes-toggles .toggle-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.timecodes-toggles .toggle-group::-webkit-scrollbar { display: none; }

/* Search */
.search-wrapper {
    margin-bottom: 0.75rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 13px;
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

.search-box:focus-within .search-icon {
    color: var(--accent);
}

#searchInput,
#streamsSearchInput {
    width: 100%;
    padding: 14px 45px 14px 48px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    outline: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

#searchInput::placeholder,
#streamsSearchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus,
#streamsSearchInput:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

/* Animated placeholder overlay */
.search-placeholder {
    position: absolute;
    left: 48px;
    right: 45px;
    top: 0;
    padding: 14px 0;
    pointer-events: none;
    display: block;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-muted);
    z-index: 1;
    word-break: break-word;
}

.search-placeholder.hidden { display: none; }

.search-placeholder-cursor {
    display: inline-block;
    width: 1px;
    height: 1.1em;
    background: var(--text-muted);
    margin-left: 1px;
    animation: placeholder-blink 1s step-end infinite;
}

@keyframes placeholder-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    z-index: 10;
}

.search-clear.visible {
    display: flex;
}

.search-clear:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.search-clear.hidden {
    display: none;
}

.search-loader {
    position: absolute;
    right: 20px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.8s linear infinite;
    transition: opacity 0.2s;
    pointer-events: none;
}

.search-loader.active {
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Suggestions */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: #1a1a1a;
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-subtle);
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.suggestion-item mark,
.result-text mark,
.result-title mark,
.result-question mark {
    background: rgba(167, 139, 250, 0.3);
    color: var(--text);
    border-radius: 2px;
    padding: 0 2px;
}

.search-wrapper {
    position: relative;
}

/* Search row (mobile: search + filter button) */
.search-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    overflow: visible;
}

.search-row .search-wrapper {
    flex: 1;
    margin-bottom: 0;
}

/* Filters Button (mobile only) */
.filters-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 48px;
    height: 48px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.filters-btn svg {
    stroke: currentColor;
}

.filters-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    color: var(--text);
}

/* Filters Panel (mobile only) - bottom sheet */
.filters-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 1000;
    flex-direction: column;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    max-height: 70vh;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
    padding-bottom: 40px;
}

.filters-panel.active {
    transform: translateY(0);
}

.filters-panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.filters-panel-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.filters-panel::before {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 10px auto 0;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.filters-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.filters-close {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.filters-close:hover {
    color: var(--text);
}

.filters-close:hover circle {
    fill: rgba(255, 255, 255, 0.12);
}

.filters-content {
    padding: 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: flex-start;
}

.filters-content .toggle-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.filters-content .toggle-group {
    flex-wrap: wrap;
}

/* Toggles */
.toggles {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.toggle-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    color: var(--text-muted);
    font-size: 14px;
}

.toggle-group {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.source-toggles {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.source-toggles::-webkit-scrollbar { display: none; }

.toggle {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    word-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle:hover {
    color: var(--text-subtle);
    background: rgba(255, 255, 255, 0.05);
}

.toggle.active {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent);
}

/* Results */
.results-footer {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.results-footer.visible {
    display: flex;
}

.results-footer .results-count {
    margin: 0;
    padding: 0;
}

.results-footer .limit-section {
    flex-direction: row;
    gap: 10px;
}

.results-count {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.3s ease;
    overflow-x: clip;
}

@keyframes fadeIn {
    from { transform: translateY(8px); }
    to { transform: translateY(0); }
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: all 0.2s ease;
    cursor: default;
    overflow: visible;
    animation: cardFadeIn 0.4s ease backwards;
    scroll-margin-top: 120px;
}

@keyframes cardFadeIn {
    from { transform: translateY(12px); }
    to { transform: translateY(0); }
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.result-card:has(.fragment-badge.clickable:hover) {
    z-index: 10;
    position: relative;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-video {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.badge-site {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-transform: none;
    text-decoration: none;
}

.badge-site.clickable {
    cursor: pointer;
    transition: all 0.15s;
}

.badge-site.clickable:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

.score {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: white;
    font-weight: 500;
    position: relative;
    cursor: default;
}


.fragment-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: white;
    font-weight: 500;
    position: relative;
    margin-left: auto;
}

.fragment-badge.clickable {
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}

.fragment-badge.clickable:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
    z-index: 2200;
}

.fragment-badge.clickable::after {
    content: "Фрагмент обсуждения";
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    transform: translateY(3px);
    background: #1a1a1f;
    color: rgba(255, 255, 255, 0.75);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 2201;
    pointer-events: none;
    max-width: 90vw;
}

.fragment-badge.clickable::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    width: 8px;
    height: 8px;
    background: #1a1a1f;
    rotate: 45deg;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease-out;
    z-index: 2200;
    pointer-events: none;
}

.fragment-badge.clickable:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fragment-badge.clickable:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.badge-stream {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: white;
    font-weight: 500;
}

.badge-stream.clickable {
    cursor: pointer;
    transition: all 0.15s;
}

.badge-stream.clickable:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

.badge-folder {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: none;
}

.badge-folder:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}


.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    text-decoration: none;
}

a.result-title:hover {
    color: var(--accent);
}

.result-question {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-bottom: 8px;
}

.result-title-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.result-title-row .timecode-badge {
    flex-shrink: 0;
    margin-top: 2px;
}

.result-title-row .result-title {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.result-text {
    color: var(--text-subtle);
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: break-word;
}

.result-text.has-more {
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.result-text.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.result-actions > * {
    margin-top: 0 !important;
}

.btn-icon {
    margin-right: 6px;
}

.result-link,
.show-thread-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 0;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.result-link:hover,
.show-thread-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

/* Main content with thread panel */
.main-content {
    display: flex;
    gap: 16px;
}

.results {
    flex: 1;
    min-width: 0;
}

.thread-panel {
    display: none;
    width: 420px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-height: calc(100vh - 220px);
    overflow: hidden;
    position: sticky;
    top: 200px;
}

.thread-panel.active {
    display: flex;
    flex-direction: column;
}

.thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.thread-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.thread-close {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.thread-close:hover {
    color: var(--text);
}

.thread-close:hover circle {
    fill: rgba(255, 255, 255, 0.12);
}

.thread-items {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.thread-items::-webkit-scrollbar {
    display: none;
}

.thread-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    scroll-margin-top: 16px;
}

.thread-item.current {
    border-color: var(--accent);
    background: rgba(167, 139, 250, 0.05);
}

.thread-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.thread-item-part {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.thread-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-decoration: none;
    display: block;
}

a.thread-item-title:hover {
    color: var(--accent);
}

.thread-item-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    cursor: pointer;
    transition: color 0.15s;
}

.thread-item-text:hover {
    color: var(--text-subtle);
}

.thread-item-text.has-more {
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.thread-item-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.thread-item-link:hover {
    text-decoration: underline;
}



/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 13px;
}

.footer a {
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

.footer .heart {
    color: var(--accent);
}

.footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 0.5px;
    background: var(--text-muted);
    transform-origin: right;
    transition: transform 0.3s ease, background 0.3s ease;
}

.footer a:hover {
    color: var(--text);
}

.footer a:hover::after {
    animation: underline-slide 0.5s ease forwards;
    background: var(--accent);
}

@keyframes underline-slide {
    0% { transform: scaleX(1); transform-origin: right; }
    50% { transform: scaleX(0); transform-origin: right; }
    51% { transform: scaleX(0); transform-origin: left; }
    100% { transform: scaleX(1); transform-origin: left; }
}

/* === Streams & Timecodes === */
.streams-count {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2rem;
    padding: 1rem 0;
}

.streams-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.stream-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: all 0.2s ease;
    scroll-margin-top: 120px;
    animation: cardFadeIn 0.4s ease backwards;
}

.stream-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.stream-card > .badge {
    display: inline-block;
    margin-bottom: 8px;
}

.stream-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.4;
    text-decoration: none;
}

a.stream-title:hover {
    color: var(--accent);
}

.stream-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
    cursor: pointer;
}

.stream-timecode-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    text-decoration: none !important;
    transition: opacity 0.15s;
}

.stream-timecode-row:hover {
    text-decoration: none !important;
}

.stream-timecode-time {
    background: rgba(167, 139, 250, 0.3);
    color: var(--text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    flex-shrink: 0;
    text-decoration: none;
}

.stream-timecode-time:hover {
    background: rgba(167, 139, 250, 0.5);
}

@media (min-width: 601px) {
    .stream-preview .stream-timecode-time:hover {
        background: rgba(167, 139, 250, 0.3);
    }
    
    .stream-preview .timecode-goto-btn:hover {
        color: #666;
    }
}

.stream-timecode-title {
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1.4;
}



.stream-preview.hidden {
    display: none;
}

.stream-all-timecodes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.stream-timecode-row-full {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.stream-timecode-content {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.stream-timecode-title-full {
    color: var(--text-muted);
    line-height: 1.4;
}

.stream-all-timecodes {
    cursor: pointer;
}

.timecode-goto-btn {
    background: none;
    border: none;
    color: #666;
    opacity: 1;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    margin-right: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}

.timecode-goto-btn svg {
    opacity: 1;
}

.timecode-goto-btn:hover {
    color: var(--accent);
}

.stream-timecodes-loading,
.stream-timecodes-error {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 0;
}

.stream-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stream-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.stream-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

/* Timecodes Panel */
.timecodes-panel {
    display: none;
    width: 480px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-height: calc(100vh - 220px);
    overflow: hidden;
    position: sticky;
    top: 200px;
}

/* Thread panel for timecodes section (desktop) - replaces timecodes panel */
#timecodesThreadPanel {
    width: 480px;
}

#timecodes-section .timecodes-panel.active:has(~ #timecodesThreadPanel.active) {
    display: none;
}

.timecodes-panel.active {
    display: flex;
    flex-direction: column;
}

.timecodes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.timecodes-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    flex: 1;
}

.timecodes-title a {
    color: inherit;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timecodes-title a:hover {
    color: var(--accent);
}

.timecodes-close {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}

.timecodes-close:hover {
    color: var(--text);
}

.timecodes-close:hover circle {
    fill: rgba(255, 255, 255, 0.12);
}

.timecodes-items {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.timecodes-items::-webkit-scrollbar {
    display: none;
}

.timecode-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.15s;
    scroll-margin-top: 16px;
    min-width: 0;
}

.timecode-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.timecode-item.current {
    border-color: var(--accent);
    background: rgba(167, 139, 250, 0.05);
}

.timecode-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.timecode-badge {
    background: rgba(167, 139, 250, 0.3);
    color: var(--text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.timecode-badge:hover {
    background: rgba(167, 139, 250, 0.5);
}

.timecode-topic {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    text-decoration: none;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.timecode-topic:hover {
    color: var(--accent);
}

.timecode-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 10px;
    cursor: pointer;
    transition: color 0.15s;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.timecode-text:hover {
    color: var(--text-subtle);
}

.timecode-text.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-mask-image: none;
    mask-image: none;
}

.timecode-text.has-more {
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.timecode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.timecode-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.timecode-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
    }
    
    .logo {
        font-size: 2.2rem;
    }
    
    /* Оба блока сразу sticky, без центрирования */
    .search-block,
    .timecodes-sticky-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
        margin-bottom: 1.5rem;
        margin-top: 0;
        width: calc(100% + 2rem);
        margin-left: -1rem;
        display: flow-root;
    }

    .search-block {
        max-width: 100vw;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .timecodes-sticky-header {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100vw;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .search-block .nav-menu,
    .timecodes-sticky-header .nav-menu {
        margin-top: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .search-block .search-row {
        margin: 0 1rem;
    }

    .timecodes-sticky-header .search-row {
        margin-bottom: 0;
    }

    .timecodes-toggles {
        display: none;
    }

    /* Градиент под sticky — одинаковый */
    .search-block::after,
    .timecodes-sticky-header::after {
        content: '';
        position: absolute;
        bottom: -40px;
        left: 0;
        right: 0;
        height: 40px;
        background: linear-gradient(to bottom, rgba(10, 10, 10, 0.9), transparent);
        pointer-events: none;
    }

    .search-block::after {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    
    .filters-btn {
        display: flex;
    }
    
    .search-wrapper {
        margin-bottom: 0.5rem;
    }
    
    .toggles {
        display: none;
    }
    
    .results-footer .limit-section {
        display: none;
    }
    
    .toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    
    
    .result-card {
        padding: 16px 18px;
    }
    
    .thread-panel.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        z-index: 1001;
        background: var(--bg);
    }
    
    .thread-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--bg);
    }
    

    
    .thread-items {
        flex: 1;
        padding-bottom: 2rem;
    }
    
    .timecodes-panel.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        z-index: 1000;
        background: var(--bg);
    }
    
    .timecodes-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--bg);
    }
    
    .timecodes-items {
        flex: 1;
        padding-bottom: 2rem;
    }
    
    #timecodesThreadPanel.active {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        z-index: 1001;
        background: var(--bg);
    }
    
    .timecode-goto-btn {
        margin-left: auto;
        margin-right: 0;
    }
}


/* Small screens - toggle layout fix */
@media (max-width: 395px) {
    .toggle-section {
        flex-direction: column;
        gap: 6px;
    }
    
    .result-header {
        flex-wrap: wrap;
        gap: 6px;
    }
}

/* Extra small screens (320px) */
@media (max-width: 360px) {
    body {
        overflow-x: clip;
    }

    .container {
        padding: 1.5rem 0.75rem;
        max-width: 100%;
    }

    .search-block {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg);
        width: calc(100% + 1.5rem);
        margin-left: -0.75rem;
    }

    .search-block .search-row {
        margin: 1.5rem 0.75rem 0;
    }

    .timecodes-sticky-header {
        width: calc(100% + 1.5rem);
        margin-left: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .logo {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    .filters-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .filters-btn svg {
        width: 20px;
        height: 20px;
    }

    .filters-close svg {
        width: 32px;
        height: 32px;
    }

    .filters-header {
        padding: 1rem 1rem;
    }

    .filters-content {
        padding: 1rem 1rem 1rem;
    }

    .filters-title {
        font-size: 16px;
    }

    .nav-item {
        font-size: 13px;
    }

    .search-placeholder {
        left: 44px;
        right: 40px;
        padding: 12px 0;
        font-size: 0.8rem;
    }

    #searchInput,
    #streamsSearchInput {
        height: 44px;
        padding: 0 40px 0 44px;
        font-size: 0.8rem;
        border-radius: 12px;
    }

    .suggestion-item {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .search-icon {
        left: 16px;
        top: 13px;
        width: 18px;
        height: 18px;
    }

    .search-loader {
        right: 14px;
    }

    .toggles {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .toggle-section {
        flex-direction: column;
        gap: 6px;
    }

    .toggle-label {
        font-size: 12px;
    }

    .toggle-group {
        padding: 3px;
        border-radius: 8px;
    }

    .toggle {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 6px;
    }

    .result-card {
        padding: 12px 14px;
        border-radius: 10px;
    }

    .result-header {
        gap: 6px;
        margin-bottom: 10px;
        flex-wrap: wrap;
    }

    .badge {
        padding: 4px 8px;
        font-size: 10px;
    }

    .score, .fragment-badge {
        padding: 4px 8px;
        font-size: 10px;
    }

    .result-title {
        font-size: 0.9rem;
    }

    .result-text {
        font-size: 0.85rem;
    }

    .result-question {
        font-size: 0.8rem;
    }

    .result-link,
    .show-thread-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .results-count {
        font-size: 12px;
    }
}

/* === YouTube Player === */
.player-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 400px;
    background: #141414;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: none;
    overflow: visible;
    border: 1px solid var(--border);
    border-bottom: none;
    touch-action: none;
    box-sizing: border-box;
}

/* Resize handles */
.player-resize-handle {
    position: absolute;
    z-index: 20;
}
.player-resize-handle[data-dir="n"] { top: 0; left: 8px; right: 8px; height: 4px; cursor: n-resize; }
.player-resize-handle[data-dir="s"] { bottom: 0; left: 8px; right: 8px; height: 4px; cursor: s-resize; }
.player-resize-handle[data-dir="e"] { right: 0; top: 8px; bottom: 8px; width: 4px; cursor: e-resize; }
.player-resize-handle[data-dir="w"] { left: 0; top: 8px; bottom: 8px; width: 4px; cursor: w-resize; }
.player-resize-handle[data-dir="nw"] { top: 0; left: 0; width: 10px; height: 10px; cursor: nw-resize; }
.player-resize-handle[data-dir="ne"] { top: 0; right: 0; width: 10px; height: 10px; cursor: ne-resize; }
.player-resize-handle[data-dir="sw"] { bottom: 0; left: 0; width: 10px; height: 10px; cursor: sw-resize; }
.player-resize-handle[data-dir="se"] { bottom: 0; right: 0; width: 10px; height: 10px; cursor: se-resize; }

.player-container.active {
    display: block;
    animation: playerSlideIn 0.3s ease;
}

@keyframes playerSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.player-container.minimized .player-wrapper {
    display: none;
}

.player-container.minimized {
    width: auto;
    min-width: 250px;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
    gap: 10px;
    cursor: grab;
    user-select: none;
}

.player-header:active {
    cursor: grabbing;
}

.player-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.player-controls {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.player-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.player-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.player-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
}

.player-vpn-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    text-align: center;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: vpnHintFadeIn 0.5s ease 3s forwards;
}

@keyframes vpnHintFadeIn {
    to { opacity: 1; }
}

.player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* Mobile player */
@media (max-width: 600px) {
    .player-container {
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 12px 12px 0 0;
    }

    .player-container.minimized {
        min-width: unset;
    }
}

/* Small screens player */
@media (max-width: 460px) {
    .player-container:not(.minimized) {
        right: 0;
        left: 0;
        width: 100%;
    }
}

/* === Lunar widget === */
html.lunar-font-pending .lunar-widget {
    opacity: 0;
    pointer-events: none;
}

html.lunar-widget-hidden .lunar-widget {
    display: none !important;
}

.lunar-widget {
    --lunar-widget-scale: 0.68;
    position: relative;
    align-self: center;
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 20px);
    margin: -10px auto -56px;
    z-index: 320;
    transform: scale(var(--lunar-widget-scale));
    transform-origin: top center;
}

@media (min-width: 1025px) {
    .header .lunar-widget {
        position: absolute;
        right: 0;
        top: 50%;
        margin: 0;
        transform: translateY(-50%) scale(var(--lunar-widget-scale));
        transform-origin: center;
        align-self: auto;
        max-width: 280px;
    }
}

.lunar-widget::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 25% 50%, rgba(166, 184, 255, 0.17) 0%, rgba(166, 184, 255, 0) 55%),
        radial-gradient(circle at 75% 50%, rgba(118, 148, 251, 0.13) 0%, rgba(118, 148, 251, 0) 57%);
    filter: blur(10px);
    opacity: 0.38;
    pointer-events: none;
    z-index: -1;
    animation: lunar-halo-drift 12s ease-in-out infinite;
}

.lunar-widget-button {
    position: relative;
    isolation: isolate;
    width: auto;
    text-align: center;
    font-family: 'Barlow Condensed', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 1px solid rgba(170, 174, 251, 0.28);
    border-radius: 14px;
    padding: 10px 14px;
    background: linear-gradient(
        124deg,
        rgba(9, 12, 25, 0.78) 0%,
        rgba(24, 39, 80, 0.62) 46%,
        rgba(10, 14, 27, 0.82) 100%
    );
    background-size: 170% 170%;
    box-shadow:
        0 6px 14px rgba(2, 5, 14, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 -5px 10px rgba(4, 7, 16, 0.23);
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    animation: lunar-capsule-flow 11s ease-in-out infinite;
    backdrop-filter: blur(11px) saturate(130%);
    -webkit-backdrop-filter: blur(11px) saturate(130%);
    will-change: transform, background-position;
}

.lunar-widget-button::before {
    content: '';
    position: absolute;
    top: -78%;
    left: -36%;
    width: 34%;
    height: 260%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.015) 22%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.015) 78%,
        rgba(255, 255, 255, 0) 100%
    );
    filter: blur(18px);
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        rgba(0, 0, 0, 0.95) 28%,
        rgba(0, 0, 0, 0.95) 72%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        rgba(0, 0, 0, 0.95) 28%,
        rgba(0, 0, 0, 0.95) 72%,
        transparent 100%
    );
    transform: rotate(28deg);
    animation: lunar-capsule-shine 8.8s ease-in-out infinite;
    z-index: 2;
    pointer-events: none;
}

.lunar-widget-button::after {
    content: '';
    position: absolute;
    inset: -28%;
    border-radius: 18px;
    background:
        radial-gradient(circle at 22% 34%, rgba(200, 207, 255, 0.16) 0%, rgba(200, 207, 255, 0) 45%),
        radial-gradient(circle at 80% 66%, rgba(124, 148, 250, 0.14) 0%, rgba(124, 148, 250, 0) 47%);
    filter: blur(11px);
    opacity: 0.48;
    transform: translate3d(0, 0, 0);
    animation: lunar-liquid-drift 14s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

.lunar-widget-button > * {
    position: relative;
    z-index: 3;
}

.lunar-widget-button:hover {
    border-color: rgba(194, 195, 251, 0.5);
    box-shadow:
        0 8px 16px rgba(2, 5, 14, 0.33),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -6px 12px rgba(4, 7, 16, 0.26);
    transform: translateY(-1px);
}

.lunar-widget-hide-trigger {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(244, 247, 255, 0.5);
    background: linear-gradient(
        150deg,
        rgba(20, 32, 67, 0.94) 0%,
        rgba(34, 50, 98, 0.9) 100%
    );
    color: rgba(248, 252, 255, 0.92);
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        0 7px 15px rgba(2, 5, 14, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    z-index: 5;
}

.lunar-widget-hide-trigger:hover {
    transform: scale(1.06);
    border-color: rgba(255, 255, 255, 0.72);
    background: linear-gradient(
        150deg,
        rgba(28, 42, 84, 0.97) 0%,
        rgba(42, 60, 114, 0.94) 100%
    );
}

.lunar-widget-hide-trigger:focus-visible {
    outline: 2px solid rgba(212, 220, 255, 0.9);
    outline-offset: 1px;
}

.lunar-widget.is-loading .lunar-widget-button {
    cursor: wait;
    animation-duration: 2.6s;
}

.lunar-widget-main {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(13px, 1.24vw, 15px);
    line-height: 1.1;
    font-weight: 400;
    letter-spacing: 0.03em;
    color: rgba(235, 241, 255, 0.88);
    background: linear-gradient(
        118deg,
        rgba(232, 240, 255, 0.9) 0%,
        rgba(191, 194, 255, 0.92) 26%,
        rgba(170, 173, 252, 0.94) 50%,
        rgba(201, 203, 255, 0.92) 74%,
        rgba(232, 240, 255, 0.9) 100%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation:
        lunar-text-shimmer 9.4s ease-in-out infinite,
        lunar-text-breathe 6.2s ease-in-out infinite;
}

.lunar-widget-kicker {
    display: block;
    margin-bottom: 4px;
    font-size: clamp(9px, 0.82vw, 10px);
    line-height: 1;
    font-weight: 300;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(218, 224, 239, 0.62);
    text-align: center;
}

.lunar-widget-day-number {
    display: block;
    margin-bottom: 3px;
    font-size: clamp(66px, 5.9vw, 86px);
    line-height: 0.9;
    font-weight: 400;
    letter-spacing: 0.015em;
    color: rgba(249, 251, 255, 0.95);
    background: linear-gradient(
        114deg,
        rgba(245, 250, 255, 0.96) 0%,
        rgba(215, 214, 255, 0.97) 24%,
        rgba(184, 186, 252, 0.98) 50%,
        rgba(222, 220, 255, 0.97) 76%,
        rgba(245, 250, 255, 0.96) 100%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation:
        lunar-text-shimmer 8.2s ease-in-out infinite,
        lunar-text-breathe 5.6s ease-in-out infinite;
    text-shadow: 0 2px 6px rgba(20, 30, 68, 0.22);
}

.lunar-inline-icon {
    display: inline-flex;
    width: 15px;
    height: 15px;
    margin-right: 6px;
    vertical-align: -2px;
    color: var(--accent);
}

@keyframes lunar-capsule-flow {
    0%, 100% {
        background-position: 0% 48%;
    }
    50% {
        background-position: 100% 52%;
    }
}

@keyframes lunar-capsule-shine {
    0%, 100% {
        opacity: 0;
        transform: translateX(-32%) rotate(28deg);
    }
    20% {
        opacity: 0.31;
    }
    55% {
        opacity: 0;
        transform: translateX(290%) rotate(28deg);
    }
}

@keyframes lunar-text-shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes lunar-text-breathe {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(200, 214, 255, 0.22));
    }
    50% {
        filter: drop-shadow(0 0 4px rgba(212, 226, 255, 0.34));
    }
}

@keyframes lunar-liquid-drift {
    0% {
        transform: translate3d(-5%, -3%, 0) scale(1);
        opacity: 0.35;
    }
    50% {
        transform: translate3d(6%, 4%, 0) scale(1.03);
        opacity: 0.52;
    }
    100% {
        transform: translate3d(3%, -4%, 0) scale(1.01);
        opacity: 0.38;
    }
}

@keyframes lunar-halo-drift {
    0%, 100% {
        opacity: 0.25;
        transform: translate3d(0, 0, 0);
    }
    50% {
        opacity: 0.4;
        transform: translate3d(0, -1px, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .lunar-widget::before,
    .lunar-widget-button,
    .lunar-widget-button::before,
    .lunar-widget-button::after,
    .lunar-widget-main,
    .lunar-widget-day-number {
        animation: none;
    }
}

.lunar-sheet-backdrop,
.lunar-onboarding-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.64);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.lunar-sheet-backdrop {
    z-index: 1160;
}

.lunar-onboarding-backdrop {
    z-index: 1180;
}

.lunar-sheet-backdrop.active,
.lunar-onboarding-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.lunar-hide-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.66);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1200;
}

.lunar-hide-confirm-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.lunar-hide-confirm {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(430px, calc(100vw - 24px));
    transform: translate(-50%, -46%);
    border: 1px solid rgba(167, 183, 252, 0.4);
    border-radius: 14px;
    background: linear-gradient(
        170deg,
        rgba(118, 146, 253, 0.18) 0%,
        rgba(118, 146, 253, 0.07) 24%,
        rgba(10, 14, 24, 0.62) 100%
    );
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.58);
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1210;
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.lunar-hide-confirm.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.lunar-hide-confirm-title {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.35;
    color: var(--text);
}

.lunar-hide-confirm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lunar-hide-confirm-btn {
    flex: 1 1 180px;
    border: 1px solid rgba(118, 146, 253, 0.24);
    background: rgba(118, 146, 253, 0.12);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lunar-hide-confirm-btn:hover {
    border-color: rgba(167, 183, 252, 0.4);
    background: rgba(118, 146, 253, 0.2);
}

.lunar-hide-confirm-btn.danger {
    border-color: rgba(239, 68, 68, 0.38);
    background: rgba(239, 68, 68, 0.16);
}

.lunar-hide-confirm-btn.danger:hover {
    border-color: rgba(248, 113, 113, 0.52);
    background: rgba(239, 68, 68, 0.25);
}

.lunar-sheet {
    position: fixed;
    top: 76px;
    right: 24px;
    width: min(560px, calc(100vw - 48px));
    max-height: calc(100vh - 96px);
    padding: 0 16px 0;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(
        170deg,
        rgba(118, 146, 253, 0.2) 0%,
        rgba(118, 146, 253, 0.08) 20%,
        rgba(13, 17, 26, 0.66) 44%,
        rgba(9, 12, 19, 0.74) 100%
    );
    box-shadow: 0 24px 52px rgba(0, 0, 0, 0.56);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1170;
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.lunar-sheet.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (min-width: 1260px) {
    .lunar-sheet {
        right: max(24px, calc((100vw - 1000px) / 2 - 576px));
    }
}

.lunar-sheet-header {
    flex-shrink: 0;
    margin: 0 -16px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(118, 146, 253, 0.16);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.lunar-sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 18px;
}

.lunar-sheet-headcopy {
    min-width: 0;
}

.lunar-sheet-kicker {
    display: inline-block;
    margin-bottom: 7px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.lunar-sheet-title {
    font-size: clamp(24px, 2vw, 30px);
    line-height: 1.1;
    margin-bottom: 7px;
}

.lunar-sheet-meta {
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.lunar-meta-item {
    display: inline-flex;
    align-items: center;
}

.lunar-meta-sep {
    color: var(--text-muted);
}

.lunar-meta-phase-gap {
    width: 12px;
}

.lunar-sheet-close {
    border: 1px solid rgba(118, 146, 253, 0.2);
    background: rgba(118, 146, 253, 0.1);
    color: var(--text);
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.lunar-sheet-close:hover {
    border-color: rgba(167, 183, 252, 0.34);
    background: rgba(118, 146, 253, 0.16);
}

.lunar-block {
    border: 1px solid rgba(118, 146, 253, 0.18);
    border-radius: 12px;
    background: rgba(118, 146, 253, 0.08);
    padding: 13px;
    margin-bottom: 10px;
}

.lunar-block h3 {
    font-size: 12px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.lunar-block h4 {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 10px 0 6px;
}

.lunar-block p {
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.5;
}

.lunar-raw-text {
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    margin: 0;
}

.lunar-sheet ul,
.lunar-accordion-body ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
}

.lunar-sheet li,
.lunar-accordion-body li {
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    padding-left: 15px;
}

.lunar-sheet li::before,
.lunar-accordion-body li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--accent);
}

.lunar-accordion {
    border: 1px solid rgba(118, 146, 253, 0.18);
    border-radius: 12px;
    background: rgba(118, 146, 253, 0.08);
    margin-bottom: 10px;
    overflow: hidden;
}

.lunar-accordion summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 13px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lunar-accordion summary::-webkit-details-marker {
    display: none;
}

.lunar-accordion summary::after {
    content: '+';
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
}

.lunar-accordion[open] summary {
    border-bottom: 1px solid rgba(118, 146, 253, 0.18);
}

.lunar-accordion[open] summary::after {
    content: '\2212';
}

.lunar-accordion-body {
    padding: 11px 13px 12px;
}

.lunar-accordion-body .lunar-raw-text {
    margin: 0;
}

.lunar-week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.lunar-week-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(118, 146, 253, 0.18);
    background: rgba(118, 146, 253, 0.1);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lunar-week-nav-btn:hover:not(:disabled) {
    border-color: rgba(167, 183, 252, 0.34);
    background: rgba(118, 146, 253, 0.16);
}

.lunar-week-nav-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.lunar-week-range {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-subtle);
}

.lunar-week-state {
    margin: 0 0 9px;
    font-size: 13px;
    color: var(--text-muted);
}

.lunar-week-state[hidden] {
    display: none;
}

.lunar-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.lunar-week-day {
    border: 1px solid rgba(118, 146, 253, 0.16);
    border-radius: 10px;
    background: rgba(118, 146, 253, 0.08);
    color: var(--text);
    padding: 8px 6px;
    min-height: 92px;
    text-align: left;
    display: grid;
    align-content: start;
    gap: 3px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.lunar-week-day:hover {
    border-color: rgba(167, 183, 252, 0.3);
    background: rgba(118, 146, 253, 0.14);
    transform: translateY(-1px);
}

.lunar-week-day.is-today {
    border-color: rgba(118, 146, 253, 0.55);
}

.lunar-week-day.is-selected {
    border-color: rgba(118, 146, 253, 0.75);
    background: rgba(118, 146, 253, 0.18);
}

.lunar-week-day-weekday {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lunar-week-day-date {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.1;
}

.lunar-week-day-lunar {
    font-size: 11px;
    color: var(--text-subtle);
    line-height: 1.2;
}

.lunar-week-day-change {
    font-size: 10px;
    color: #acb2ff;
    line-height: 1.2;
}

.lunar-day-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 6;
}

.lunar-day-popup-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.lunar-day-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(520px, calc(100% - 26px));
    max-height: calc(100% - 26px);
    transform: translate(-50%, -46%);
    opacity: 0;
    pointer-events: none;
    border: 1px solid rgba(118, 146, 253, 0.4);
    border-radius: 12px;
    background:
        linear-gradient(
            165deg,
            rgba(118, 146, 253, 0.12) 0%,
            rgba(118, 146, 253, 0.035) 52%,
            rgba(118, 146, 253, 0.02) 100%
        ),
        rgb(8, 12, 22);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.52);
    overflow: auto;
    z-index: 7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.lunar-day-popup.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.lunar-day-popup-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgb(11, 15, 28);
    border-bottom: 1px solid rgba(118, 146, 253, 0.16);
}

.lunar-day-popup-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 700;
}

.lunar-day-popup-close {
    border: 1px solid rgba(118, 146, 253, 0.2);
    background: rgba(118, 146, 253, 0.1);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.lunar-day-popup-body {
    padding: 12px 14px 32px;
    display: grid;
    gap: 10px;
}

.lunar-day-segment {
    border: 1px solid rgba(118, 146, 253, 0.18);
    border-radius: 10px;
    background: rgba(14, 20, 38, 0.97);
    padding: 10px;
}

.lunar-day-segment h4 {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.lunar-day-segment p {
    margin: 0;
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.45;
}

.lunar-accordion-title {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 7px;
    font-size: 14px;
}

.lunar-accordion-body ul + .lunar-accordion-title {
    margin-top: 11px;
}

.lunar-disclaimer {
    margin-top: 9px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.lunar-onboarding {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(560px, calc(100vw - 32px));
    box-sizing: border-box;
    transform: translate(-50%, -47%);
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(
        170deg,
        rgba(118, 146, 253, 0.22) 0%,
        rgba(118, 146, 253, 0.1) 22%,
        rgba(12, 16, 25, 0.66) 42%,
        rgba(9, 12, 19, 0.74) 100%
    );
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.58);
    padding: 16px;
    z-index: 1190;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
}

.lunar-onboarding.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.lunar-onboarding-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
}

.lunar-onboarding-kicker {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.lunar-onboarding-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 1px solid rgba(118, 146, 253, 0.2);
    background: rgba(118, 146, 253, 0.1);
    color: var(--text);
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.lunar-onboarding-close:hover {
    border-color: rgba(167, 183, 252, 0.34);
    background: rgba(118, 146, 253, 0.16);
}

.lunar-onboarding-stepcount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(118, 146, 253, 0.2);
    background: rgba(118, 146, 253, 0.1);
    color: var(--text-subtle);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    white-space: nowrap;
}

.lunar-onboarding-step {
    display: none;
    min-width: 0;
    overflow: hidden;
}

.lunar-onboarding-step.is-active {
    display: block;
    animation: onboardingStepIn 0.2s ease;
}

@keyframes onboardingStepIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lunar-onboarding h2 {
    font-size: clamp(24px, 3vw, 30px);
    margin-bottom: 8px;
    line-height: 1.1;
}

.lunar-onboarding p {
    color: var(--text-subtle);
    font-size: 15px;
    line-height: 1.45;
    margin-bottom: 14px;
}

.lunar-onboarding-points {
    list-style: none;
    margin: 0 0 15px;
    padding: 0;
    display: grid;
    gap: 8px;
}

.lunar-onboarding-points li {
    position: relative;
    padding-left: 14px;
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.4;
}

.lunar-onboarding-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--accent);
}

.lunar-onboarding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.lunar-onboarding-btn {
    border: 1px solid rgba(118, 146, 253, 0.2);
    background: rgba(118, 146, 253, 0.12);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lunar-onboarding-btn:hover {
    border-color: rgba(167, 183, 252, 0.34);
    background: rgba(118, 146, 253, 0.18);
}

.lunar-onboarding-btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.lunar-onboarding-btn.ghost {
    background: rgba(118, 146, 253, 0.08);
}

.lunar-timezone-row {
    margin-top: 14px;
    border-radius: 10px;
    border: 1px solid rgba(118, 146, 253, 0.18);
    background: rgba(118, 146, 253, 0.08);
    padding: 11px;
    display: grid;
    gap: 8px;
}

.lunar-timezone-row[hidden] {
    display: none;
}

.lunar-timezone-row label {
    font-size: 13px;
    color: var(--text-subtle);
}

.lunar-timezone-row select {
    width: 100%;
    box-sizing: border-box;
    background: rgba(13, 18, 34, 0.9);
    color: var(--text);
    border: 1px solid rgba(118, 146, 253, 0.2);
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
    outline: none;
}

.lunar-timezone-row .lunar-onboarding-btn {
    width: 100%;
    box-sizing: border-box;
}

.lunar-timezone-row select:focus {
    border-color: rgba(118, 146, 253, 0.55);
}

.lunar-timezone-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.lunar-timezone-check-row {
    margin-top: 14px;
    border-radius: 10px;
    border: 1px solid rgba(118, 146, 253, 0.22);
    background: rgba(118, 146, 253, 0.1);
    padding: 11px;
    display: grid;
    gap: 10px;
}

.lunar-timezone-check-row[hidden] {
    display: none;
}

.lunar-timezone-check-text {
    margin: 0;
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1.35;
}

.lunar-timezone-check-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lunar-timezone-check-actions .lunar-onboarding-btn {
    flex: 1 1 180px;
}

.lunar-onboarding-error {
    margin-top: 10px;
    color: #fca5a5;
    font-size: 13px;
    line-height: 1.35;
}

@media (max-width: 1024px) {
    .lunar-widget {
        align-self: center;
        margin: -8px auto -48px;
        transform-origin: top center;
        width: fit-content;
        min-width: 0;
        max-width: calc(100vw - 16px);
    }

    .lunar-sheet {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: 14px 14px 0 0;
    }

    .lunar-onboarding {
        padding: 16px;
    }
}

@media (max-width: 620px) {
    .lunar-widget {
        margin: -6px auto -46px;
        width: fit-content;
        min-width: 0;
        max-width: calc(100vw - 12px);
    }

    .lunar-widget-button {
        padding: 8px 12px;
    }

    .lunar-widget-hide-trigger {
        top: -7px;
        right: -7px;
        width: 19px;
        height: 19px;
        font-size: 10px;
    }

    .lunar-widget-kicker {
        font-size: 8px;
        letter-spacing: 0.12em;
        margin-bottom: 3px;
    }

    .lunar-widget-day-number {
        font-size: clamp(56px, 16.4vw, 72px);
    }

    .lunar-widget-main {
        font-size: clamp(12px, 3.45vw, 14px);
    }

    .lunar-sheet {
        padding: 0 12px 0;
    }

    .lunar-sheet-header {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .lunar-sheet-body {
        padding-bottom: 16px;
    }

    .lunar-sheet-title {
        font-size: 24px;
    }

    .lunar-onboarding-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .lunar-onboarding-stepcount {
        align-self: flex-start;
    }

    .lunar-onboarding h2 {
        font-size: 24px;
    }

    .lunar-hide-confirm {
        padding: 14px;
    }

    .lunar-hide-confirm-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .lunar-hide-confirm-actions {
        flex-direction: column;
    }

    .lunar-hide-confirm-btn {
        width: 100%;
        flex: 0 0 auto;
        padding: 12px 14px;
    }

    .lunar-week-grid {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: clamp(84px, 26vw, 108px);
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scroll-snap-type: x proximity;
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
        mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    }
    .lunar-week-grid.scrolled-end {
        -webkit-mask-image: none;
        mask-image: none;
    }

    .lunar-week-day {
        scroll-snap-align: start;
        min-height: 86px;
        padding: 7px 8px;
    }

    .lunar-week-day-date {
        font-size: 14px;
    }

    .lunar-week-day-lunar {
        font-size: 10px;
    }

    .lunar-day-popup {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 95%;
        border-radius: 14px 14px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        transform: translateY(100%);
    }

    .lunar-day-popup.active {
        transform: translateY(0);
    }
}
