/* ═══ 学习引擎 UI ═══ */

.learn-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    align-items: center;
}
.learn-search-input-wrap {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.learn-search-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.learn-search-input-wrap span { font-size: 18px; opacity: 0.6; }
.learn-search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}
.learn-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}
.learn-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.learn-filter-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    margin-right: 4px;
}
.learn-filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.22s ease;
    color: var(--text);
}
.learn-filter-btn:hover {
    border-color: var(--primary-light);
    background: rgba(13, 148, 136, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.1);
}
.learn-filter-btn.active {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.28);
}
.learn-filter-btn.active:hover {
    background: linear-gradient(135deg, #2dd4bf, var(--primary-dark));
}

.learn-post-card {
    padding: 16px 18px;
    margin-bottom: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s;
    list-style: none;
}
.learn-post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(13, 148, 136, 0.3);
}
.learn-post-card h4 {
    margin: 10px 0 6px;
    font-size: 16px;
}
.learn-post-card h4 a {
    color: var(--text);
    text-decoration: none;
}
.learn-post-card h4 a:hover { color: var(--primary-dark); }
.learn-post-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.learn-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.learn-type-badge--article { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.learn-type-badge--video { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.learn-type-badge--audio { background: rgba(168, 85, 247, 0.12); color: #7e22ce; }
.learn-type-badge--image { background: rgba(16, 185, 129, 0.12); color: #047857; }

.learn-post-card--audio {
    border-color: rgba(13, 148, 136, 0.22);
}
.learn-post-card--video {
    border-color: rgba(239, 68, 68, 0.18);
}
.learn-post-title {
    margin: 10px 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}
.learn-post-title a {
    color: inherit;
    text-decoration: none;
}
.learn-post-title a:hover {
    color: var(--primary-dark, #0f766e);
    text-decoration: underline;
}
.learn-post-snippet {
    margin: 6px 0 0;
    font-size: 13px;
}
.learn-post-snippet a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
}
.learn-feed-audio {
    margin: 10px 0 4px;
}
.learn-feed-audio-card {
    width: 100%;
    max-width: 520px;
    min-height: 190px;
}
.learn-feed-audio-bars {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.85;
}
.learn-feed-audio-play {
    margin-bottom: 8px;
}
.learn-feed-audio-hint {
    margin: 8px 0 0;
    font-size: 12px;
}

.learn-feed-video {
    margin: 10px 0 4px;
}
.learn-feed-video-stage {
    position: relative;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
}
.learn-feed-video-cover {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: opacity 0.2s ease;
}
.learn-feed-video-cover--fallback {
    background:
        linear-gradient(160deg, rgba(15, 118, 110, 0.35) 0%, rgba(15, 23, 42, 0.55) 55%, rgba(2, 6, 23, 0.75) 100%),
        radial-gradient(ellipse at 30% 20%, rgba(45, 212, 191, 0.45), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(251, 191, 36, 0.22), transparent 45%),
        linear-gradient(135deg, #134e4a 0%, #1e3a5f 45%, #0f172a 100%);
}
.learn-feed-video-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
    z-index: 2;
    opacity: 1;
    pointer-events: none;
}
.learn-feed-video-player.is-preview {
    object-fit: cover;
    filter: brightness(0.95) saturate(1.05);
}
/* 首帧未就绪：隐藏黑屏 video，露出下方渐变/封面 */
.learn-feed-video-player.is-preview:not(.is-frame-ready) {
    opacity: 0;
}
.learn-feed-video-player.is-preview.is-frame-ready {
    opacity: 1;
    z-index: 4;
}
.learn-feed-video-player.is-playing {
    object-fit: contain;
    opacity: 1;
    pointer-events: auto;
    filter: none;
    background: #000;
    z-index: 4;
}
.learn-feed-video-stage.is-playing .learn-feed-video-cover {
    opacity: 0;
}
.learn-feed-video-stage:not(.is-playing) .learn-feed-video-cover {
    z-index: 3;
}
.learn-feed-video-stage:not(.is-playing) .learn-feed-video-cover--fallback {
    z-index: 3;
    opacity: 1;
}
.learn-feed-video-play-mask {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.22);
    color: #fff;
}
.learn-feed-video-play-mask:active {
    background: rgba(15, 23, 42, 0.4);
}
.learn-feed-video-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(13, 148, 136, 0.95);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 22px;
    line-height: 1;
    padding-left: 3px;
}
.learn-feed-video-play-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.learn-feed-video-hint {
    margin: 8px 0 0;
    font-size: 12px;
}

.spirit-audio-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 32px;
    margin-bottom: 10px;
    opacity: 0.75;
}
.spirit-audio-bars span {
    display: block;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(to top, #34d399, #a7f3d0);
    animation: spiritBarDance 1.2s ease-in-out infinite;
}
.spirit-audio-bars span:nth-child(1) { height: 12px; animation-delay: 0s; }
.spirit-audio-bars span:nth-child(2) { height: 20px; animation-delay: 0.15s; }
.spirit-audio-bars span:nth-child(3) { height: 28px; animation-delay: 0.3s; }
.spirit-audio-bars span:nth-child(4) { height: 18px; animation-delay: 0.45s; }
.spirit-audio-bars span:nth-child(5) { height: 24px; animation-delay: 0.6s; }
@keyframes spiritBarDance {
    0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.learn-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.learn-pager-info {
    font-size: 13px;
    color: var(--muted);
    margin-right: 8px;
}
.btn-pager--ellipsis {
    border: none;
    background: transparent;
    cursor: default;
    min-width: auto;
    padding: 0 4px;
}

.theme-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-right: 4px;
}
.theme-row-icon svg { width: 28px; height: 28px; }
.theme-row {
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.theme-row:hover {
    background: rgba(13, 148, 136, 0.06);
    transform: translateX(3px);
}
.theme-row.active {
    background: rgba(13, 148, 136, 0.1);
    border-color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.feed-head h2 {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.guild-side-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 1px;
    margin: 0 0 10px;
}

/* 学习引擎：首页已有资产/身份，此处隐藏 */
.learn-profile-strip {
    display: none !important;
}

.learn-themes-toggle {
    display: none;
}

@media (max-width: 768px) {
    .world-layout--learn {
        display: flex;
        flex-direction: column;
    }

    .world-layout--learn .world-main {
        order: 1;
        padding: 16px 12px 12px;
    }

    .world-layout--learn .world-left {
        order: 2;
        max-height: none;
        border-right: none;
        border-top: 1px solid var(--card-border);
        border-bottom: none;
        padding: 12px;
    }

    .learn-sidebar-panel-head,
    .learn-org-hint,
    .learn-sidebar-publish {
        display: none !important;
    }

    .learn-themes-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
        margin: 0 0 10px;
        padding: 10px 14px;
        font-size: 14px;
        font-family: inherit;
        font-weight: 600;
        color: var(--primary-dark, #0f766e);
        background: rgba(204, 251, 241, 0.45);
        border: 1px solid rgba(13, 148, 136, 0.3);
        border-radius: 10px;
        cursor: pointer;
        touch-action: manipulation;
    }

    .learn-themes-toggle:active {
        opacity: 0.88;
    }

    .learn-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .learn-filter-group {
        flex-wrap: wrap;
    }

    .feed-head {
        flex-wrap: wrap;
        gap: 8px;
    }

    .feed-head h2 {
        font-size: 18px;
        line-height: 1.35;
    }
}

@media (min-width: 769px) {
    .learn-themes-body {
        display: block !important;
    }
}
