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

:root {
    --primary-color: #4A90E2;
    --secondary-color: #50E3C2;
    --accent-color: #FF6B6B;
    --success-color: #52C41A;
    --warning-color: #FAAD14;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --bg-primary: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --border-color: #E8E8E8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 屏幕管理 */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: block;
}

.screen.hidden {
    display: none;
}

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

/* 启动页 */
#splash-screen {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
}

.splash-content {
    text-align: center;
    color: white;
}

.logo {
    margin-bottom: 2rem;
}

.detective-cat {
    font-size: 6rem;
    display: block;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-text {
    font-size: 1.2rem;
    opacity: 0.8;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
}

/* 新手引导页 */
.guide-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.guide-card {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.guide-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.guide-card h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.guide-card p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.guide-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.guide-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s;
}

.dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: #357ABD;
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 主界面 */
.home-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1.5rem;
    color: white;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: var(--shadow-md);
}

.player-details {
    flex: 1;
}

.player-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.player-level span {
    font-size: 0.9rem;
    opacity: 0.9;
}

.exp-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-top: 0.3rem;
    overflow: hidden;
}

.exp-fill {
    height: 100%;
    background: white;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.currencies {
    display: flex;
    gap: 1.5rem;
}

.currency {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.currency .icon {
    font-size: 1.2rem;
}

.currency .value {
    font-weight: bold;
}

.home-content {
    padding: 2rem;
}

.detective-character {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.character {
    font-size: 5rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.character:hover {
    transform: scale(1.1);
}

.speech-bubble {
    position: absolute;
    top: -20px;
    right: 0;
    background: white;
    padding: 0.8rem 1.2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    font-size: 0.9rem;
    white-space: nowrap;
    animation: fadeIn 0.5s;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: white transparent transparent;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.mode-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.mode-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.nav-label {
    font-size: 0.75rem;
}

/* 页面头部 */
.screen-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.btn-back {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
}

.screen-header h2 {
    font-size: 1.3rem;
    font-weight: bold;
}

/* 学习模式 */
.learning-content {
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.learning-options h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.grid-size-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.grid-btn {
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.grid-btn:hover, .grid-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.content-type-selector {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.type-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.type-btn:hover, .type-btn.active {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
}

.disturbance-options {
    margin-bottom: 2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: white;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.start-btn {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.2rem;
    margin-top: 1rem;
}

/* 个人中心 */
.profile-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 3rem 2rem 2rem;
    text-align: center;
    color: white;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
}

.profile-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.player-title {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.exp-bar-large {
    position: relative;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.exp-bar-large .exp-fill {
    height: 100%;
    background: white;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.exp-text {
    position: absolute;
    right: 0;
    top: -25px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 2rem;
    margin-top: -1rem;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.3rem;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-menu {
    padding: 0 2rem 2rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    background: white;
    border: none;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.menu-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.menu-icon {
    font-size: 1.5rem;
    flex: 0 0 auto;
}

.menu-label {
    flex: 1;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
}

.menu-arrow {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* 比赛模式 */
.battle-content {
    padding: 2rem;
}

.player-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.player-stats .stat {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.player-stats .stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.player-stats .stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.battle-modes {
    display: grid;
    gap: 1rem;
}

.battle-mode {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.battle-mode:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.battle-mode .mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.battle-mode h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.battle-mode p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 排行榜 */
.ranking-content {
    padding: 2rem;
}

.ranking-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover, .tab-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.ranking-filters {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    flex: 1;
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover, .filter-btn.active {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
}

.ranking-list {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item.top-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.ranking-item.top-2 {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
}

.ranking-item.top-3 {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
}

.ranking-rank {
    font-size: 1.5rem;
    font-weight: bold;
    width: 40px;
    text-align: center;
}

.ranking-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.ranking-level {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ranking-time {
    font-weight: bold;
    color: var(--primary-color);
}

/* 闯关模式 */
.campaign-content {
    padding: 2rem;
}

.campaign-map {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.campaign-chapter {
    flex: 0 0 auto;
    min-width: 280px;
}

.chapter-title {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    border-radius: 10px 10px 0 0;
    font-weight: bold;
    text-align: center;
}

.chapter-levels {
    background: white;
    padding: 1rem;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-sm);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.level-item {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.level-item.locked {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.level-item.unlocked {
    background: var(--primary-color);
    color: white;
}

.level-item.completed {
    background: var(--success-color);
    color: white;
}

.level-item:hover:not(.locked) {
    transform: scale(1.1);
}

.level-number {
    font-size: 1.2rem;
    font-weight: bold;
}

.level-stars {
    font-size: 0.7rem;
    margin-top: 0.2rem;
}

/* 结果页面 */
.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.result-content h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 2rem;
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 1s infinite;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
}

.stat-item {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.stat-item .stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-item .stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.result-rewards {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.reward {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    border-radius: 25px;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reward-icon {
    font-size: 1.5rem;
}

.reward-value {
    font-weight: bold;
}

.result-stars {
    font-size: 3rem;
    margin-bottom: 2rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.result-actions button {
    min-width: 150px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .mode-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

    .level-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.8rem;
    }

    .detective-cat {
        font-size: 4rem;
    }

    .currencies {
        flex-direction: column;
        gap: 0.5rem;
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    .nav-label {
        font-size: 0.65rem;
    }
}
