:root {
    --accent: #af52de;
    --text-main: #1d1d1f;
    --text-sub: #86868b;
    --bg-gray: #f2f2f7;
    --radius-card: 10px;
    --nav-bg: rgba(255, 255, 255, 0.75);
    --danger: #ff3b30;
    --transition-standard: 0.4s cubic-bezier(0.2, 1, 0.2, 1);
    --transition-fast: 0.2s ease;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.05), 0 10px 25px rgba(0,0,0,0.08);
    --modal-bg: rgba(255, 255, 255, 0.8);
    --menu-bg: rgba(255, 255, 255, 0.75); /* 调整为更透明的背景 */
    --border-light: rgba(0,0,0,0.08);
}

/* 深色模式变量 */
body.dark-mode {
    --text-main: #ffffff;
    --text-sub: #a1a1a6;
    --bg-gray: #000000;
    --nav-bg: rgba(28, 28, 30, 0.75);
    --modal-bg: rgba(28, 28, 30, 0.8);
    --menu-bg: rgba(44, 44, 46, 0.75); /* 调整深色模式下的透明度 */
    --border-light: rgba(255,255,255,0.15);
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; -ms-overflow-style: none; }

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro", sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-main);
    height: 100svh; 
    width: 100vw;
    overflow: hidden;
    user-select: none;
    transition: background-color 0.3s ease;
}

.app-container { 
    display: flex; 
    height: 100%; 
    width: 100%; 
}

.main-layout { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    position: relative; 
    background: transparent !important;
}

.header { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 80px; 
    padding-top: env(safe-area-inset-top); 
    background: var(--nav-bg) !important; 
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    z-index: 1000;
    border-bottom: 0.5px solid var(--border-light);
    display: flex; 
    align-items: center; 
    box-sizing: content-box;
}

.header-content {
    height: 80px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    width: 100%; 
    padding: 0 24px;
    box-sizing: border-box;
}

.header-left { display: flex; align-items: center; flex: 1; overflow: hidden; }
.brand-wrapper { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.brand-icon-pro { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #af52de, #5e5ce6); flex-shrink: 0; }
#brandTitle { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; margin: 0; }

.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.action-btn {
    width: 40px; height: 40px; 
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; 
    color: var(--text-main); 
    background: var(--menu-bg);
    border: 1px solid var(--border-light);
    cursor: pointer; 
    transition: all var(--transition-fast);
}

.action-btn:active { transform: scale(0.9); background: rgba(0,0,0,0.05); }

body.edit-mode #editBtn {
    color: var(--danger);
    border-color: var(--danger);
}

.content { 
    flex: 1; 
    overflow-y: auto; 
    padding-top: 10px;
    padding-left: 24px;
    padding-right: 24px;
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    grid-template-rows: min-content;
    align-content: start;
    gap: 20px;
    background: transparent !important;
}

@media (min-width: 768px) {
    .content {
        padding-left: 48px;
        padding-right: 48px;
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 24px;
    }
}

.grid-footer-spacer {
    grid-column: 1 / -1;
    height: 80px; 
    pointer-events: none;
}

.podcast-card { 
    position: relative; 
    cursor: pointer; 
    transition: transform var(--transition-standard), opacity var(--transition-standard); 
    animation: cardFadeIn 0.6s cubic-bezier(0.2, 1, 0.2, 1) both;
    aspect-ratio: 1/1;
    border-radius: var(--radius-card);
    overflow: visible;
}

body:not(.edit-mode) .podcast-card {
    transition: none; 
}

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

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: var(--card-cover);
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-fast);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.podcast-card:active .card-inner { transform: scale(0.96); }

.card-info { 
    padding: 12px 10px 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7)); 
    pointer-events: none;
}

.card-info h3 { 
    font-size: 13px; 
    margin: 0; 
    font-weight: 700; 
    color: #fff; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.card-info p { 
    font-size: 10px; 
    color: rgba(255,255,255,0.8); 
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1500; display: none; align-items: center; justify-content: center;
    transition: opacity 0.3s ease;
}

.episode-modal {
    background: var(--modal-bg); 
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    width: 92%; max-width: 550px; height: 80vh;
    border-radius: 24px; 
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3); 
    border: 0.5px solid var(--border-light); 
    overflow: hidden;
    animation: modalSlide 0.4s cubic-bezier(0.2, 1, 0.2, 1);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

.modal-content { flex: 1; overflow-y: auto; padding: 10px 16px; background: transparent !important; }

.episode-list-item { 
    display: flex; align-items: center; padding: 12px; border-radius: 14px; cursor: pointer; 
    transition: background 0.2s ease, transform 0.2s ease; 
}
.episode-list-item:active { transform: scale(0.97); background: rgba(120,120,120,0.1); }

.episode-list-item.is-finished { opacity: 0.6; }
.episode-list-item.is-finished .ep-list-title { text-decoration: line-through; color: var(--text-sub); }
.finished-check { color: var(--accent); margin-left: auto; display: flex; align-items: center; }

.ep-list-cover { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; margin-right: 12px; flex-shrink: 0; }
.ep-list-info { flex: 1; overflow: hidden; padding-right: 8px; }

.ep-list-title { 
    font-size: 14px; 
    font-weight: 600; 
    white-space: normal;      
    word-break: break-word;   
    line-height: 1.4;         
    color: var(--text-main);
}
.ep-list-meta { font-size: 10px; color: var(--accent); margin-top: 4px; font-weight: 700; }

.mini-progress-bar { 
    width: 100%; 
    height: 2px; 
    background: transparent !important; 
    position: absolute; 
    bottom: 0; 
    left: 0; 
}
.mini-progress-fill { 
    height: 100%; 
    background: var(--accent); 
    width: 0%; 
    transition: width 0.1s linear; 
    box-shadow: 0 0 12px var(--accent); 
}

.delete-badge {
    position: absolute; top: -8px; right: -8px; width: 28px; height: 28px;
    background: var(--danger); border: 2px solid #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0.5); 
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); 
    z-index: 10;
    pointer-events: none; 
}
body.edit-mode .delete-badge { 
    opacity: 1; 
    transform: scale(1); 
    pointer-events: auto; 
}
body.edit-mode .podcast-card { animation: shake 0.5s infinite; }
body:not(.edit-mode) .podcast-card { animation: none !important; }

@keyframes shake { 0%,100%{transform:rotate(0.5deg)} 50%{transform:rotate(-0.5deg)} }

.inline-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 10px 0;
    height: 30px;
    background: transparent;
}
.header-left .brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.header-left .brand-wrapper:active { transform: scale(0.96); }
.brand-icon-pro { width: 32px; height: 32px; }
#brandTitle { font-size: 24px; font-weight: 800; margin: 0; }

.header-actions { display: flex; gap: 8px; position: relative; }

.dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background: var(--menu-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: 170px;
    display: none;
    flex-direction: column;
    padding: 6px;
    z-index: 2000;
    border: 0.5px solid var(--border-light);
    animation: menuFade 0.2s ease-out;
}
@keyframes menuFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.dropdown-menu.show { display: flex; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.menu-item:active { background: rgba(120,120,120,0.1); }
.menu-item.danger { color: #ff3b30; }
.menu-item.danger svg { color: #ff3b30; }
.menu-item svg { opacity: 0.8; flex-shrink: 0; }

.menu-divider {
    height: 0.5px;
    background: var(--border-light);
    margin: 6px 10px;
    opacity: 0.6;
}

.episode-list-item.is-playing {
    background: rgba(175, 82, 222, 0.1);
    border: 0.5px solid rgba(175, 82, 222, 0.2);
}

.custom-dialog-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(15px); /* 增加背景模糊 */
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.custom-dialog {
    background: var(--menu-bg); /* 使用统一的半透明变量 */
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    width: 100%;
    max-width: 320px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    text-align: center;
    animation: dialogPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 0.5px solid var(--border-light);
}
@keyframes dialogPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.dialog-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text-main); }
.dialog-msg { font-size: 14px; color: var(--text-sub); line-height: 1.5; margin-bottom: 20px; }
.dialog-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(120, 120, 120, 0.1);
    border: none;
    border-radius: 12px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.dialog-btns { display: flex; gap: 12px; }
.dialog-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-cancel { background: rgba(120, 120, 120, 0.1); color: var(--text-main); }
.btn-confirm { background: var(--accent); color: white; }
.btn-danger { background: #ff3b30; color: white; }
.dialog-btn:active { transform: scale(0.95); opacity: 0.8; }

.modal-podcast-info {
    padding: 24px 24px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}
.modal-pod-meta-row {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-right: 40px;
}
.modal-pod-cover {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.modal-pod-text h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
}
.modal-pod-author {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 4px;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(120, 120, 120, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}
.modal-close-btn:active {
    transform: scale(0.9);
    background: rgba(120, 120, 120, 0.2);
}

/* --- 新增加载动画样式 --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
body.dark-mode .loading-overlay { background: rgba(0, 0, 0, 0.6); }
.loading-overlay.is-active { display: flex; }
.spinner {
    width: 44px; height: 44px;
    border: 3.5px solid rgba(175, 82, 222, 0.15);
    border-top: 3.5px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 禁止图片和特定元素的系统默认菜单（移动端长按） */
img, .podcast-card, .mini-player, .p-overlay {
    -webkit-touch-callout: none; /* iOS Safari 禁止长按菜单 */
    -webkit-user-select: none;   /* Safari 禁止选择 */
    user-select: none;           /* 标准语法 */
}

/* 允许输入框等元素继续正常使用 */
input, textarea {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}
