* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    font-family: 'Arial', sans-serif;
    color: white;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overscroll-behavior-y: contain; /* 防止浏览器默认下拉刷新行为 */
    overflow-y: hidden; /* 禁止整个页面滚动 */
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
    pointer-events: none;
    display: flex;
    justify-content: flex-end;
    padding: 1rem;
}

h1 {
    margin-bottom: 1rem;
}

/* 语言选择器 - 使用相对定位 */
header .language-selector {
    position: relative;
    display: inline-flex;
    margin-left: 1rem;
    pointer-events: auto;
}

/* 刷新按钮 - 使用相对定位 */
header .refresh-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    margin-right: 0.5rem;
}

/* 公共按钮样式 */
.header-button {
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 0.7rem 1.2rem; /* 增加内边距，使按钮更大 */
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background-color 0.3s ease;
    min-height: 2.6rem; /* 确保两个按钮高度一致 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-button:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(0, 0, 0, 0.5);
}

/* 刷新按钮特定样式 */
.refresh-button {
    font-size: 1.6rem; /* 增大图标尺寸 */
    line-height: 1;
    text-align: center;
    min-width: 3rem; /* 增加最小宽度 */
}

/* 语言选择器特定样式 */
.language-selector {
    font-size: 1.2rem; /* 增大字体尺寸 */
    min-width: 4.5rem; /* 设置最小宽度与刷新按钮协调 */
    text-align: center;
}

.language-menu {
    position: fixed;
    top: 3.5rem;
    right: 1rem;
    background-color: transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.language-option {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    color: white;
    transition: background-color 0.2s;
}

.language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

main {
    flex: 1;
    padding: 2rem;
    padding-top: 4rem; /* 增加顶部间距，避免被语言选择器遮挡 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-y: hidden; /* 禁止main区域滚动 */
    position: relative; /* 设置相对定位，用于定位经文内容 */
}

.controls {
    display: none;
}

.quran-content {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: 10px;
    position: relative; /* 确保经文内容的定位正确 */
    z-index: 1; /* 确保在下拉指示器之上 */
    max-height: calc(100vh - 130px); /* 限制最大高度，减去头部和底部空间 */
    overflow-y: auto; /* 如果内容过多，允许滚动 */
    -webkit-overflow-scrolling: touch; /* 平滑滚动体验 */
    scrollbar-width: thin; /* 窄滚动条 */
}

/* 定制滚动条样式 */
.quran-content::-webkit-scrollbar {
    width: 5px; /* 设置滚动条宽度 */
}

.quran-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* 滚动条轨道背景 */
    border-radius: 10px;
}

.quran-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3); /* 滚动条滑块颜色 */
    border-radius: 10px;
}

.arabic-text {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
    line-height: 2;
    direction: rtl;
}

.translation-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.translation-text:before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.navigation-buttons {
    display: none;
}

.audio-player {
    padding: 1rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: transparent;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.play-btn {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 60px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.progress-container {
    flex: 1;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
}

.progress-bar {
    height: 100%;
    width: 0;
    background-color: rgba(255, 255, 255, 0.5);
    transition: width 0.1s linear;
}

.time-display {
    font-size: 0.9rem;
    min-width: 100px;
    text-align: right;
}

.quran-logo {
    margin-top: 3rem;
    text-align: center;
}

.quran-logo img {
    width: 80px;
    height: auto;
    opacity: 0.8;
}

@media (max-width: 768px) {
    header {
        padding: 0.8rem;
    }
    
    .header-button {
        padding: 0.6rem 1rem; /* 移动设备上也增加内边距 */
        min-height: 2.2rem; /* 移动设备上调整高度 */
    }
    
    .refresh-button {
        font-size: 1.4rem; /* 移动设备上调整图标大小 */
        min-width: 2.5rem; /* 移动设备上调整最小宽度 */
    }
    
    .language-selector {
        font-size: 1.1rem; /* 移动设备上调整字体大小 */
        min-width: 4rem; /* 移动设备上调整最小宽度 */
    }
    
    .language-menu {
        top: 3rem;
        right: 0.8rem;
    }
    
    .language-option {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    main {
        padding: 1rem;
        padding-top: 3rem; /* 移动版顶部间距调小 */
        padding-bottom: 80px; /* 为底部播放器留出空间 */
    }
    
    .quran-content {
        padding: 1.5rem;
        max-height: calc(100vh - 150px); /* 调整最大高度 */
    }
    
    .arabic-text {
        font-size: 1.8rem;
    }
    
    .audio-player {
        padding: 0.8rem;
    }
    
    .time-display {
        min-width: 80px;
        font-size: 0.8rem;
    }
    
    .play-btn {
        width: 50px;
        height: 36px;
    }
}

/* 适配移动设备触摸交互 */
@media (hover: none) and (pointer: coarse) {
    .quran-content {
        padding-bottom: 2rem;
    }
    
    /* 优化触摸区域 */
    .play-btn, 
    .progress-container {
        cursor: pointer;
    }
}

/* 小屏幕适配 */
@media (max-height: 700px) {
    .quran-content {
        padding: 1rem;
        margin-bottom: 3rem; /* 确保底部有足够空间 */
    }
    
    .arabic-text {
        font-size: 1.6rem; /* 缩小经文字体 */
        margin-bottom: 1rem; /* 减小间距 */
    }
    
    .translation-text {
        font-size: 1rem; /* 缩小翻译文本字体 */
    }
    
    .quran-logo {
        margin-top: 1.5rem; /* 减小上边距 */
    }
    
    .quran-logo img {
        width: 60px; /* 缩小logo尺寸 */
    }
}

/* 超小屏幕适配 */
@media (max-height: 568px) {
    .quran-content {
        padding: 0.8rem;
        margin-bottom: 3.5rem; /* 确保底部有更多空间 */
    }
    
    .arabic-text {
        font-size: 1.4rem; /* 进一步缩小经文字体 */
        margin-bottom: 0.8rem;
        line-height: 1.8; /* 减小行高 */
    }
    
    .translation-text {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .quran-logo {
        margin-top: 1rem;
    }
    
    .quran-logo img {
        width: 50px;
    }
}

/* 禁止双击缩放相关样式 */
html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}

/* 允许输入框和文本区域选择文本 */
input, textarea {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 刷新指示器修改 */
.refresh-indicator {
    background-color: transparent !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2; /* 确保刷新指示器在经文内容之上 */
}

/* 注意：下拉刷新容器的更详细样式在random-ayah.js文件中定义 */ 