/* ========== CSS 变量 - 基于 Editorial 主题 ========== */
:root {
    --color-bg: #f5f6f7;
    --color-sidebar: #1f222a;
    --color-text: #3d4449;
    --color-text-light: #7f888f;
    --color-accent: #f56a6a;
    --color-accent-dark: #e05555;
    --color-white: #ffffff;
    --color-border: #e2e4e6;
    --color-shadow: rgba(31, 34, 42, 0.1);
    
    --font-serif: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 2px 8px var(--color-shadow);
    --shadow-md: 0 4px 16px var(--color-shadow);
    --shadow-lg: 0 8px 32px var(--color-shadow);
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== App 容器 ========== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--color-bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ========== 顶部导航栏 ========== */
.app-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.btn-back {
    width: 44px;
    height: 44px;
    border: none;
    background: none;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-back:active {
    background-color: var(--color-border);
    transform: scale(0.95);
}

.app-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-accent-dark);
    letter-spacing: 0.05em;
}

.header-spacer {
    width: 44px;
    flex-shrink: 0;
}

/* ========== 主内容区域 ========== */
.app-main {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.view {
    animation: fadeIn 0.3s ease;
}

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

/* ========== 第一级：分类卡片网格 ========== */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 8px 0;
}

.category-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card:active {
    transform: scale(0.96);
    box-shadow: var(--shadow-md);
}

.category-card:active::before {
    transform: scaleX(1);
}

.category-icon {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.category-name {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.08em;
}

.category-count {
    font-size: 13px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* ========== 第二级：主题列表 ========== */
.topics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-item {
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topic-item:active {
    background-color: #fdf2f2;
    border-color: var(--color-accent);
    transform: scale(0.98);
}

.topic-info {
    flex: 1;
}

.topic-name {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 500;
    color: var(--color-text);
}

.topic-lecture-count {
    font-size: 13px;
    color: var(--color-text-light);
    margin-top: 2px;
}

.topic-arrow {
    color: var(--color-text-light);
    font-size: 20px;
    flex-shrink: 0;
}

/* ========== 第三级：转轮选择器 ========== */
.wheel-container {
    position: relative;
    height: 320px;
    margin: 20px 0 24px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--color-white);
    box-shadow: var(--shadow-md);
}

.wheel-highlight {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    height: 60px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #fef5f5 0%, #fdf2f2 100%);
    border-radius: var(--radius-md);
    border: 1px solid #fcd5d5;
    z-index: 2;
    pointer-events: none;
}

.wheel-list {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 130px 24px;
    scrollbar-width: none;
    z-index: 3;  /* 加上这一行，让文字在高亮方框上面 */
    
}

.wheel-list::-webkit-scrollbar {
    display: none;
}

.wheel-item {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.wheel-item-content {
    font-family: var(--font-serif);
    font-size: 17px;
    color: var(--color-text-light);
    transition: all 0.3s ease;
    text-align: center;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
}

.wheel-item.active .wheel-item-content {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: var(--color-accent) !important;
    transform: scale(1.05);
}

.btn-play-lecture {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    background: var(--color-accent);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(245, 106, 106, 0.3);
    letter-spacing: 0.05em;
}

.btn-play-lecture:active {
    background: var(--color-accent-dark);
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(245, 106, 106, 0.2);
}

/* ========== 第四级：播放器 ========== */
.player-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 24px 20px 20px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.player-info {
    text-align: center;
    margin-bottom: 20px;
}

.player-lecture-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.05em;
}

.player-topic-name {
    font-size: 14px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* 进度条 */
.player-progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.player-time {
    font-size: 12px;
    color: var(--color-text-light);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: center;
}

.player-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.player-progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-progress-thumb {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    background: var(--color-accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
    box-shadow: 0 2px 6px rgba(245, 106, 106, 0.4);
    transition: left 0.1s linear;
    pointer-events: none;
}

/* 控制按钮 */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    margin-bottom: 20px;
}

.btn-control {
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--color-text);
    transition: all 0.2s ease;
}

.btn-control:active {
    transform: scale(0.9);
}

.btn-play-pause {
    width: 72px;
    height: 72px;
    background: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    box-shadow: 0 4px 16px rgba(245, 106, 106, 0.35);
    transition: all 0.3s ease;
}

.btn-play-pause:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(245, 106, 106, 0.25);
}

.btn-label {
    font-size: 11px;
    color: var(--color-text-light);
}

/* 速度控制 */
.player-speed-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.speed-label {
    font-size: 13px;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
}

.speed-buttons {
    display: flex;
    gap: 8px;
}

.btn-speed {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    border-radius: var(--radius-xl);
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-speed:active {
    transform: scale(0.95);
}

.btn-speed.active {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}

/* 讲座列表 */
.player-lecture-list {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.list-title {
    font-family: var(--font-serif);
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 12px;
    padding: 0 8px;
}

.lecture-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lecture-item {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--color-text);
}

.lecture-item:active {
    background-color: #fdf2f2;
}

.lecture-item.playing {
    background-color: #fef5f5;
    color: var(--color-accent);
    font-weight: 600;
}

.lecture-item-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.lecture-item.playing .lecture-item-icon {
    opacity: 1;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

/* ========== 响应式调整 ========== */
@media (max-width: 360px) {
    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .category-card {
        padding: 20px 12px;
    }
    
    .player-controls {
        gap: 20px;
    }
}

@media (min-width: 481px) {
    .app-container {
        border-left: 1px solid var(--color-border);
        border-right: 1px solid var(--color-border);
    }
}