/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* 小程序风格容器 - 固定大小 */
#app {
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 850px;
    margin: 0 auto;
    background: #f8f8f8;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    contain: layout style paint;
}

/* 页面容器 */
.page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    height: 100%;
}

/* 顶部区域 - 固定高度 */
.header {
    flex-shrink: 0;
}

/* 中间内容区域 - 可滚动 */
.content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 8px;
    min-height: 0;
}

/* 隐藏滚动条但保持滚动功能 */
.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

/* 底部区域 - 固定高度 */
.footer {
    flex-shrink: 0;
    height: auto;
}

/* 固定底部导航栏 */
.fixed-bottom-nav {
    position: fixed;
    bottom: max(0px, calc((100vh - 850px) / 2));
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 1000;
    pointer-events: none;
}

.fixed-bottom-nav > * {
    pointer-events: auto;
}

/* 为内容区域留出底部空间 */
.page-container {
    padding-bottom: 80px;
}

/* 底部导航栏 - 胶囊形状 */
.bottom-nav {
    background: transparent;
    padding: 0;
    padding-bottom: calc(0px + env(safe-area-inset-bottom));
}

.bottom-nav > div {
    background: linear-gradient(135deg, rgba(59, 66, 96, 0.85) 0%, rgba(71, 85, 105, 0.85) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 4px 8px;
    margin: 0 8px 8px 8px;
    box-shadow: 0 -4px 20px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
}

/* 自定义动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in {
    animation: fadeIn 0.2s ease-out;
    transform: translateZ(0);
    will-change: opacity;
}

/* 播放按钮动画 */
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}
.playing-indicator::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #4F46E5;
    animation: pulse-ring 1.5s ease-out infinite;
}

/* 渐变背景 */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 卡片样式 */
.word-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.word-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* 底部导航栏 - 胶囊形状 */
.bottom-nav {
    background: transparent;
    padding: 0;
    padding-bottom: calc(0px + env(safe-area-inset-bottom));
}

.bottom-nav > div {
    background: linear-gradient(135deg, rgba(59, 66, 96, 0.85) 0%, rgba(71, 85, 105, 0.85) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 8px 12px;
    margin: 0 12px 12px 12px;
    box-shadow: 0 -4px 20px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bottom-nav button {
    -webkit-tap-highlight-color: transparent;
    background: none;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 16px;
    border-radius: 12px;
}

.bottom-nav button:active {
    transform: scale(0.92);
}

/* 导航项样式 */
.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
    transform: scale(0.92);
}

.nav-item.active {
    color: #fbbf24;
}

.nav-item.active .nav-icon-wrapper i {
    color: #fbbf24;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

.nav-item.active .nav-label {
    color: #fbbf24;
    font-weight: 700;
}

.nav-icon-wrapper {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2px;
}

.nav-item:not(.active) .nav-icon-wrapper i {
    color: #cbd5e1;
}

.nav-item:not(.active) .nav-label {
    color: #cbd5e1;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    font-weight: 500;
}

.nav-item.active .nav-label {
    color: #fbbf24;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    font-weight: 700;
}

.nav-item:not(.active):hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-item:not(.active):hover .nav-icon-wrapper i {
    color: #a5b4fc;
}

.nav-item:not(.active):hover .nav-label {
    color: #a5b4fc;
}

/* 按钮样式 */
button {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

button:active {
    transform: scale(0.95);
}

/* 进度条 */
.progress-bar {
    transition: width 0.3s ease;
}

/* 筛选标签 */
.filter-tag {
    white-space: nowrap;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* 单元选择按钮 */
.unit-btn {
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 13px;
    transition: all 0.2s ease;
}

/* 测试页面筛选标签 */
.test-filter-tag {
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;改
}

.test-filter-tag:hover {
    opacity: 0.9;
}

.test-filter-tag:active {
    transform: scale(0.95);
}

/* 首页学习统计卡片 */
.home-stats-card {
    min-width: 0;
}

.home-stats-number {
    font-size: 20px;
    line-height: 1.2;
    white-space: nowrap;
}

.home-stats-label {
    font-size: 11px;
    line-height: 1.3;
    margin-top: 4px;
}
