/* ========= AUDIO.CSS - 音频播放器通用样式（自适应滚动版） ========= */
/* 兼容性：Android 9.0+ / iOS 12+ / Chrome 70+ / Safari 12+ */
/* 老年人专用，极致简洁，大字体，操作简单 */

:root {
    --primary-color: #5a9c20;
    --primary-dark: #4a7c1a;
    --primary-light: #f0f7e6;
    --playing-color: #ff9900;
    --bg-color: #ffffff;
    --border-color: #e6f0d5;
    --text-color: #333333;
    --text-light: #666666;
}

.offline-indicator {
    position: fixed;
    top: 55px;
    left: 0;
    right: 0;
    background: #ff9900;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 18px;
    font-weight: bold;
    z-index: 9999;
    display: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.offline-indicator.show { display: block; }
.offline-indicator.online { background: #5a9c20; }

.audio-player-container {
    max-width: 800px;
    margin: 5px auto 20px auto;
    padding: 0 15px;
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(90, 156, 32, 0.15);
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-sizing: border-box;
    border: 2px solid var(--primary-light);
}

.playing-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, #f0f7e6 0%, #ffffff 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}
.playing-info { text-align: center; width: 100%; }
.playing-title {
    font-size: 26px;
    font-weight: bold;
    color: var(--primary-dark);
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 0 5px;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.status-timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    height: 40px;
    margin-bottom: 5px;
}
.status-text {
    font-size: 24px;
    color: var(--text-light);
    line-height: 1;
    flex-grow: 1;
    text-align: left;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
}
.play-status {
    font-size: 22px;
    color: var(--primary-color);
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 12px;
    min-width: 120px;
    text-align: center;
}
.play-status[data-status="buffering"] { color: #ff9900; animation: pulse 1.5s infinite; }
.play-status[data-status="playing"] { color: #5a9c20; }
.play-status[data-status="paused"] { color: #666666; }
.play-status[data-status="error"] { color: #e74c3c; }
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.sleep-timer {
    flex-shrink: 0;
    width: 110px;
    position: relative;
}
.timer-select {
    width: 100%;
    padding: 5px 6px;
    font-size: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    color: var(--text-color);
    cursor: pointer;
    font-weight: bold;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a9c20' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    background-color: var(--primary-light);
    height: 40px;
    line-height: 1.2;
    box-sizing: border-box;
}
.timer-select:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(90, 156, 32, 0.2);
}
.sleep-timer-countdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    font-size: 20px;
    color: #ff9900;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
    padding: 5px 0;
    background: rgba(255, 153, 0, 0.1);
    border-radius: 6px;
    z-index: 10;
    display: none;
}

.play-btn-center {
    padding: 20px 20px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.play-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #5a9c20 0%, #4a7c1a 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(90, 156, 32, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-btn:hover { transform: scale(1.05); box-shadow: 0 8px 20px rgba(90, 156, 32, 0.4); }
.play-btn:active { transform: scale(0.98); }
.play-btn.playing { background: linear-gradient(135deg, #4a7c1a 0%, #2a4a0f 100%); }
.play-icon { font-size: 44px; line-height: 1; display: block; }

.back-link-container {
    padding: 15px 20px 0 20px;
    flex-shrink: 0;
}
.back-link {
    display: inline-flex;
    align-items: center;
    font-size: 20px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    background: var(--primary-light);
    border-radius: 30px;
    border: 1px solid var(--primary-color);
    transition: all 0.2s;
}
.back-link:hover { background: var(--primary-color); color: white; }
.back-arrow { font-size: 24px; margin-right: 8px; }

.audio-description {
    padding: 20px;
    background: var(--primary-light);
    border-radius: 12px;
    margin: 20px 20px;
    border: 1px solid var(--border-color);
}
.audio-description h2 {
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}
.audio-description p {
    font-size: 18px;
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 15px;
}
.audio-description ul {
    list-style: none;
    padding: 0;
}
.audio-description li {
    font-size: 18px;
    padding: 8px 0 8px 30px;
    position: relative;
}
.audio-description li:before {
    content: "•";
    position: absolute;
    left: 10px;
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.related-audios {
    padding: 20px;
    background: white;
    border-top: 2px solid var(--border-color);
    margin-top: 10px;
}
.related-audios h3 {
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 20px;
}
.related-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.related-item {
    padding: 15px 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
}
.related-item:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}
.related-item a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}
.related-number {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 40px;
}
.related-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
    flex-grow: 1;
}

/* 隐藏音频列表（单页用） */
.audio-list { display: none; }

/* 浮动计数器图标 */
.counter-float-icon {
    position: fixed;
    bottom: 120px;
    right: 10%;
    /* 48px 视觉圆 = 点击区 */
    width: 48px;
    height: 48px;
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: none;
    transition: all 0.3s ease;
    border: 2px solid #a8d16a;
    color: #4a7c1a;
}
.counter-float-icon.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floatBounce 0.5s ease;
}
.counter-float-icon:hover {
    transform: scale(1.1);
}
.counter-float-icon:active { transform: scale(0.95); }
.counter-float-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
    text-align: center;
    padding: 0;
    box-sizing: border-box;
}
.counter-float-icon .icon {
    display: none;
}
.counter-float-icon .text {
    /* ===== 改动：20px → 26px，字占内径 59%，空白更少 ===== */
    font-size: 26px;
    font-weight: bold;
    line-height: 1;
    white-space: nowrap;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0;
}
@keyframes floatBounce {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
/* 呼吸灯效果（播放时）—— 全局 animation: none 会屏蔽，保留原结构 */
.counter-float-icon.playing { animation: pulseGlow 2s infinite; }
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(90, 156, 32, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(90, 156, 32, 0); }
    100% { box-shadow: 0 0 0 0 rgba(90, 156, 32, 0); }
}

.counter-iframe-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #5a9c20;
    animation: counterSlideIn 0.4s ease;
}
.counter-iframe-container.show { display: flex; }
@keyframes counterSlideIn {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.counter-iframe-header {
    padding: 2px 3px;
    background: linear-gradient(135deg, #5a9c20 0%, #4a7c1a 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.counter-iframe-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 22px;
    font-weight: bold;
}
.counter-icon { font-size: 22px; }
.close-counter-iframe {
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.close-counter-iframe:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }
.counter-iframe { flex: 1; width: 100%; border: none; border-radius: 0 0 25px 25px; }
.counter-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    animation: overlayFadeIn 0.3s ease;
}
.counter-overlay.show { display: block; }
@keyframes overlayFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* 响应式 */
@media (max-width: 768px) {
    .audio-player-container { margin: 5px auto 15px auto; padding: 0 10px; }
    .playing-title { font-size: 22px; }
    .status-text { font-size: 20px; }
    .play-status { font-size: 20px; min-width: 100px; }
    .timer-select { font-size: 18px; height: 36px; }
    .play-btn { width: 90px; height: 90px; }
    .play-icon { font-size: 38px; }
    .back-link { font-size: 18px; }
    .audio-description h2, .related-audios h3 { font-size: 20px; }
    .audio-description p, .audio-description li, .related-title { font-size: 17px; }
    .counter-float-icon {
        width: 48px;
        height: 48px;
        bottom: 100px;
    }
    .counter-float-icon .text {
        /* ===== 改动：20px → 26px ===== */
        font-size: 26px;
        height: 26px;
    }
}

/* 修正版：手机极小屏幕保持一行 */
@media (max-width: 480px) {
    .playing-title { font-size: 20px; }
    .status-timer-row {
        flex-wrap: nowrap;      /* 禁止换行 */
        height: auto;
        gap: 4px;
    }
    .status-text {
        font-size: 18px;
        white-space: nowrap;    /* 强制单行 */
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 1;
    }
    .play-status {
        font-size: 18px;
        min-width: auto;        /* 由内容决定宽度 */
        padding: 0 3px;
        flex-shrink: 0;
    }
    .sleep-timer {
        width: auto;            /* 自适应宽度 */
        min-width: 80px;
        flex-shrink: 0;
    }
    .timer-select {
        font-size: 16px;
        height: 34px;
        width: 100%;
    }
    .play-btn { width: 80px; height: 80px; }
    .play-icon { font-size: 34px; }
    .back-link { font-size: 16px; padding: 6px 12px; }
    .audio-description { padding: 15px; }
    .counter-float-icon {
        width: 48px;
        height: 48px;
        bottom: 90px;
    }
    .counter-float-icon .text {
        /* ===== 改动：18px → 24px ===== */
        font-size: 24px;
        height: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ========= 阅读入口条样式 ========= */
.yuedu-entry-bar {
    max-width: 800px;
    margin: 10px auto 6px auto;
    text-decoration: underline;
    background: linear-gradient(135deg, #fff8e1 0%, #f0f7e6 100%);
    border: 2px solid #5a9c20;
    border-radius: 12px;
    padding: 10px 16px;
    display: block;
    cursor: pointer;
    box-sizing: border-box;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

/* 阅读入口条悬停效果 */
.yuedu-entry-bar:hover {
    background: linear-gradient(135deg, #fef3d6 0%, #e8f5d6 100%);
}

/* 阅读入口条响应式 */
@media (max-width: 768px) {
    .yuedu-entry-bar {
        font-size: 18px;
        padding: 8px 12px;
        margin: 8px auto 4px auto;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .yuedu-entry-bar {
        font-size: 18px;
        padding: 3px 5px;
        margin: 6px auto 3px auto;
        border-radius: 8px;
    }
}

@media (max-width: 360px) {
    .yuedu-entry-bar {
        font-size: 16px;
        padding: 2px 5px;
    }
}

/* ========= 阅读提示文字（描述中） ========= */
.reading-hint {
    color: #5a9c20;
    font-weight: bold;
}