/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B35;
    --secondary-color: #F7931E;
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #EEEEEE;
    --success-color: #52C41A;
    --error-color: #FF4D4F;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 页面容器 */
#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-color);
    position: relative;
    padding-bottom: 70px;
}

.page {
    display: none;
    min-height: 100vh;
    padding-bottom: 80px;
}

.page.active {
    display: block;
}

/* 排行榜广告位 */
.rank-ad-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 10px;
    border-radius: 12px;
    padding: 12px 15px;
    cursor: pointer;
    transition: transform 0.2s;
}

.rank-ad-banner:active {
    transform: scale(0.98);
}

.rank-ad-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.rank-ad-icon {
    font-size: 24px;
}

.rank-ad-text {
    flex: 1;
    font-size: 14px;
    margin: 0 10px;
}

.rank-ad-btn {
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
}

/* 头部导航 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.user-info {
    font-size: 14px;
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.back-btn {
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.page-title {
    font-size: 17px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.quiz-progress {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
}

/* 答题头部右侧区域 */
.quiz-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 倒计时容器 */
.timer-container {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 44px;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: #fff;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-progress.urgent {
    stroke: #FF4D4F;
}

.timer-text {
    font-size: 16px;
    font-weight: 700;
    color: white;
    z-index: 1;
}

.timer-text.urgent {
    color: #FF4D4F;
}

/* 超时结果样式 */
.result-text.timeout {
    color: #FF4D4F;
}

/* 超时选择弹窗 */
.timeout-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.timeout-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    animation: slideUp 0.3s ease;
}

.timeout-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.timeout-title {
    font-size: 22px;
    font-weight: 700;
    color: #FF4D4F;
    margin-bottom: 12px;
}

.timeout-question {
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-color);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    line-height: 1.5;
    text-align: left;
}

.timeout-subtitle {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.timeout-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    background: var(--bg-color);
}

.timeout-btn.skip {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
}

.timeout-btn.task {
    background: white;
    border: 2px solid var(--border-color);
}

.timeout-btn.task:hover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 53, 0.05);
}

.timeout-btn .btn-icon {
    font-size: 24px;
}

.timeout-btn .btn-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.timeout-btn .btn-desc {
    font-size: 12px;
    opacity: 0.8;
}

.timeout-btn .btn-reward {
    background: linear-gradient(135deg, #52C41A, #73D13D);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.timeout-divider {
    font-size: 13px;
    color: var(--text-light);
    margin: 8px 0;
    position: relative;
}

.timeout-divider::before,
.timeout-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 60px;
    height: 1px;
    background: var(--border-color);
}

.timeout-divider::before {
    left: 20px;
}

.timeout-divider::after {
    right: 20px;
}

.timeout-btn.share {
    background: linear-gradient(135deg, #07C160, #10B981);
    color: white;
    border: none;
}

.timeout-btn.share:hover {
    background: linear-gradient(135deg, #059142, #07C160);
}

.timeout-btn.ad {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    border: none;
}

.timeout-btn.ad:hover {
    background: linear-gradient(135deg, #E55A2B, #FF6B35);
}

.timeout-btn.item {
    background: linear-gradient(135deg, #722ED1, #B37FEB);
    color: white;
    border: none;
}

.timeout-btn.item:hover {
    background: linear-gradient(135deg, #531dab, #722ED1);
}

.more-items {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color);
    text-align: center;
}

.btn-more {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-more .arrow {
    transition: transform 0.3s;
}

.btn-more:hover .arrow {
    transform: translateX(4px);
}

/* 广告弹窗 */
.ad-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.ad-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 360px;
    overflow: hidden;
}

.ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-color);
    font-size: 16px;
    font-weight: 500;
}

.ad-header .btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.ad-body {
    padding: 40px 20px;
    text-align: center;
}

.ad-image {
    cursor: pointer;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-color), #f0f0f0);
    border-radius: 12px;
    transition: all 0.3s;
}

.ad-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ad-image span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.ad-image p {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ad-image .ad-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.ad-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.timeout-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.timeout-remain {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Hero区域 */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px 24px;
    text-align: center;
}

.hero h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.3;
}

.hero p {
    font-size: 15px;
    opacity: 0.9;
    margin-bottom: 24px;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 统计栏 */
.stats-bar {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    margin: -20px 16px 20px;
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 10;
}

.stat-item {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 板块标题 */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
}

.more-link {
    margin-left: auto;
    font-size: 13px;
    color: var(--primary-color);
    text-decoration: none;
}

/* 板块网格 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 16px 20px;
}

.category-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.category-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.category-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.category-count {
    font-size: 12px;
    color: var(--text-light);
}

/* 排行榜预览 */
.rank-preview {
    background: var(--card-bg);
    margin: 0 16px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    margin-right: 12px;
}

.rank-num.top3 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

.rank-num.normal {
    background: var(--bg-color);
    color: var(--text-secondary);
}

.rank-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    margin-right: 12px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 15px;
    font-weight: 500;
}

.rank-score {
    font-size: 13px;
    color: var(--text-light);
}

.rank-points {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

/* 答题页面 */
.quiz-container {
    padding: 20px 16px;
}

.question-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.question-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.question-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.6;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-item:hover {
    border-color: var(--primary-color);
}

.option-item.correct {
    border-color: var(--success-color);
    background: rgba(82, 196, 26, 0.05);
}

.option-item.wrong {
    border-color: var(--error-color);
    background: rgba(255, 77, 79, 0.05);
}

.option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.option-item.correct .option-letter {
    background: var(--success-color);
    color: white;
}

.option-item.wrong .option-letter {
    background: var(--error-color);
    color: white;
}

.option-text {
    font-size: 15px;
    flex: 1;
}

.quiz-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* 答题结果弹窗 */
.answer-result {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.answer-result > div {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.result-text {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.result-text.correct {
    color: var(--success-color);
}

.result-text.wrong {
    color: var(--error-color);
}

.explanation {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: left;
    background: var(--bg-color);
    padding: 16px;
    border-radius: 12px;
}

/* 排行榜页面 */
.rank-tabs {
    display: flex;
    background: var(--card-bg);
    padding: 4px;
    margin: 16px;
    border-radius: 12px;
}

.rank-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.rank-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.rank-list {
    background: var(--card-bg);
    margin: 0 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 登录页面 */
.login-container {
    padding: 40px 24px;
    text-align: center;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-container h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-container > p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form input {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
}

.login-form input:focus {
    border-color: var(--primary-color);
}

.code-input {
    display: flex;
    gap: 12px;
}

.code-input input {
    flex: 1;
}

.btn-code {
    background: var(--bg-color);
    border: none;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 14px;
    color: var(--primary-color);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-code:disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

.login-tips {
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-light);
}

/* 结果页面 */
.result-container {
    padding: 40px 24px;
    text-align: center;
}

.result-score {
    margin-bottom: 16px;
}

.score-num {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.score-label {
    font-size: 24px;
    color: var(--text-secondary);
}

.result-detail {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.result-reward {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(247, 147, 30, 0.1));
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 32px;
    font-size: 16px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 20px;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 22px;
}

.nav-text {
    font-size: 11px;
}

/* 响应式适配 */
@media (max-width: 360px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero h1 {
        font-size: 24px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page.active {
    animation: fadeIn 0.3s ease;
}
