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

:root {
    --primary: #9B59B6;
    --primary-dark: #8E44AD;
    --secondary: #3498DB;
    --accent: #F39C12;
    --bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E8E8E8;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #2ECC71;
    --error: #E74C3C;
    --detective: #E67E22;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #FDF2E9 0%, #F5EEF8 100%);
    min-height: 100vh;
    color: var(--text);
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--detective) 0%, #D35400 100%);
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(230, 126, 34, 0.3);
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2.2em;
}

.logo h1 {
    color: white;
    font-size: 1.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 18px;
    border-radius: 12px;
}

.stat-icon {
    font-size: 1.3em;
}

.stat-label, .stat-value {
    color: white;
    font-weight: bold;
}

/* 模式选择 */
.mode-selector {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 8px 32px var(--shadow);
    text-align: center;
}

.mode-title {
    font-size: 1.6em;
    color: var(--detective);
    margin-bottom: 10px;
}

.mode-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.mode-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid var(--border);
    border-radius: 20px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: var(--detective);
    box-shadow: 0 15px 40px rgba(230, 126, 34, 0.2);
}

.mode-icon {
    font-size: 3.5em;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: var(--detective);
    font-size: 1.2em;
    margin-bottom: 10px;
}

.mode-card p {
    color: var(--text-light);
    font-size: 0.9em;
    line-height: 1.5;
}

/* 游戏主区域 */
.game-main {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 8px 32px var(--shadow);
}

.game-mode {
    animation: fadeIn 0.4s ease;
}

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

/* 案件信息 */
.case-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF5D6 100%);
    padding: 15px 20px;
    border-radius: 16px;
    margin-bottom: 25px;
}

.detective-avatar {
    font-size: 2.5em;
}

.case-desc h3 {
    color: var(--detective);
    font-size: 1.2em;
    margin-bottom: 5px;
}

.case-desc p {
    color: var(--text-light);
    font-size: 0.95em;
}

/* 找朋友模式 */
.radical-show {
    text-align: center;
    background: linear-gradient(135deg, #EBF5FB 0%, #D6EAF8 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    position: relative;
}

.radical-big {
    font-size: 5em;
    font-weight: bold;
    color: var(--secondary);
    text-shadow: 3px 3px 0 rgba(52, 152, 219, 0.2);
    animation: bounce 2s ease infinite;
}

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

.radical-name {
    font-size: 1.3em;
    color: var(--text);
    margin-top: 10px;
    font-weight: bold;
}

.info-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.info-btn:hover {
    background: #E67E22;
    transform: scale(1.05);
}

.friend-area {
    margin-bottom: 25px;
}

.area-title {
    color: var(--detective);
    font-size: 1.1em;
    margin-bottom: 20px;
    font-weight: bold;
}

.char-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.char-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    background: white;
    border: 3px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.char-option:hover {
    border-color: var(--secondary);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.2);
}

.char-option.selected {
    border-color: var(--secondary);
    background: #EBF5FB;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.3);
}

.char-option.correct {
    border-color: var(--success);
    background: #D5F5E3;
    animation: pulse 0.5s ease;
}

.char-option.wrong {
    border-color: var(--error);
    background: #FADBD8;
    animation: shake 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.word-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #F8F9FA;
    padding: 20px;
    border-radius: 16px;
    flex-wrap: wrap;
}

.preview-label {
    color: var(--text-light);
    font-size: 1.1em;
}

.preview-char {
    font-size: 3em;
    font-weight: bold;
    color: var(--detective);
    min-width: 80px;
    text-align: center;
}

/* 组合预览样式 */
.preview-radical {
    font-size: 2.5em;
    color: var(--secondary);
    font-weight: bold;
}

.preview-plus, .preview-equals {
    font-size: 1.5em;
    color: var(--text-light);
    font-weight: bold;
}

.preview-part {
    font-size: 2.5em;
    color: var(--accent);
    font-weight: bold;
}

.preview-result {
    font-size: 3em;
    color: var(--success);
    font-weight: bold;
}

.preview-result.preview-wrong {
    color: var(--error);
}

/* 送回家模式 */
.progress-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background: #F0F0F0;
    padding: 5px;
    border-radius: 20px;
}

.progress-fill {
    height: 20px;
    background: linear-gradient(90deg, var(--success), #58D68D);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-weight: bold;
    color: var(--text);
    padding-right: 10px;
}

.houses-area {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.house {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid var(--border);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    min-height: 120px;
    transition: all 0.3s ease;
}

.house.selected {
    border-color: var(--detective);
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.3);
}

.house-full {
    background: #D5F5E3;
    border-color: var(--success);
}

.house-radical {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.house-name {
    font-size: 0.9em;
    color: var(--text-light);
    margin-bottom: 10px;
}

.house-chars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
}

.house-char {
    background: white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 1.2em;
    border: 1px solid var(--border);
}

.chars-pool {
    background: #FFF9E6;
    border-radius: 16px;
    padding: 20px;
}

.pool-title {
    color: var(--detective);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.pool-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.pool-char {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    background: white;
    border: 3px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pool-char:hover {
    border-color: var(--detective);
    transform: translateY(-3px);
}

.pool-char.selected {
    border-color: var(--detective);
    background: #FDEBD0;
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.3);
}

.pool-char.matched {
    opacity: 0.3;
    pointer-events: none;
}

/* 学知识模式 */
.learn-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.nav-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--detective);
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-arrow:hover {
    background: #D35400;
    transform: scale(1.1);
}

.learn-title {
    color: var(--detective);
    font-size: 1.3em;
}

.learn-card {
    background: linear-gradient(135deg, #F5EEF8 0%, #EBDEF0 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    text-align: center;
}

.learn-radical {
    font-size: 5em;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
}

.learn-name {
    font-size: 1.4em;
    color: var(--text);
    margin-bottom: 5px;
    font-weight: bold;
}

.learn-meaning {
    font-size: 1.1em;
    color: var(--primary);
    margin-bottom: 20px;
}

.learn-examples h4 {
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1em;
}

.example-chars {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.example-char {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.learn-story {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    line-height: 1.8;
    color: var(--text);
}

.quiz-section {
    background: #EBF5FB;
    border-radius: 16px;
    padding: 25px;
}

.quiz-section h4 {
    color: var(--secondary);
    margin-bottom: 15px;
}

.quiz-question {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--text);
}

.quiz-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-option {
    padding: 15px 30px;
    font-size: 2em;
    background: white;
    border: 3px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-option:hover {
    border-color: var(--secondary);
}

.quiz-option.correct {
    border-color: var(--success);
    background: #D5F5E3;
}

.quiz-option.wrong {
    border-color: var(--error);
    background: #FADBD8;
}

/* 科普弹窗 */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.info-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: popIn 0.4s ease;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-light);
}

.modal-radical {
    font-size: 4em;
    text-align: center;
    color: var(--secondary);
    margin-bottom: 10px;
}

.modal-title {
    text-align: center;
    color: var(--detective);
    margin-bottom: 20px;
    font-size: 1.4em;
}

.modal-body {
    line-height: 1.8;
    color: var(--text);
}

.modal-body p {
    margin-bottom: 10px;
}

.modal-body ul {
    margin: 15px 0;
    padding-left: 25px;
}

.modal-body li {
    margin-bottom: 8px;
}

/* 按钮 */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    font-size: 1.05em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--detective) 0%, #D35400 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(230, 126, 34, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.4);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-3px);
}

.btn-large {
    padding: 16px 35px;
    font-size: 1.15em;
}

.btn-icon {
    font-size: 1.2em;
}

/* 成功动画 */
.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.success-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.success-content {
    background: white;
    border-radius: 30px;
    padding: 40px 60px;
    text-align: center;
    animation: popIn 0.5s ease;
}

.success-icon {
    font-size: 4em;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

.success-title {
    font-size: 1.8em;
    color: var(--success);
    margin-bottom: 10px;
}

.success-text {
    color: var(--text-light);
    margin-bottom: 20px;
}

.success-stars {
    font-size: 2em;
    margin-bottom: 25px;
    animation: starBounce 0.6s ease infinite alternate;
}

@keyframes starBounce {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* 提示 */
.game-tip {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    padding: 12px 25px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-tip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tip-icon {
    font-size: 1.3em;
}

.tip-text {
    font-weight: bold;
    color: var(--text);
}

/* 响应式 */
@media (max-width: 768px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .char-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .houses-area {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .radical-big {
        font-size: 3.5em;
    }
    
    .learn-radical {
        font-size: 3.5em;
    }
}
