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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: url('../assets/底图-剧情简介、阵营选择和文创商城的背景图.png') center top;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

/* 为二级页面添加背景遮罩 */
body.secondary-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 248, 220, 0.9);
    z-index: -1;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 414px;
    margin: 0 auto;
    position: relative;
}

/* 主页面样式 */
.main-content {
    flex: 1;
    padding: 20px 16px 80px;
}

.map-section {
    margin-bottom: 30px;
    text-align: center;
}

.game-title {
    margin-bottom: 20px;
}

.main-title {
    font-size: 36px;
    font-weight: 700;
    color: #8b4513;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

.sub-title {
    font-size: 16px;
    font-weight: 500;
    color: #d2691e;
    margin-bottom: 0;
    letter-spacing: 1px;
    opacity: 0.9;
}

.map-image {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.feature-cards {
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #f5e6a3;
    flex: 0 0 auto;
    min-width: 110px;
    width: calc(33.333% - 8px);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 8px;
}

.card h3 {
    font-size: 14px;
    color: #8b4513;
    font-weight: 600;
    margin-top: 4px;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 414px;
    background: rgba(255, 248, 220, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid #e6d47a;
    display: flex;
    padding: 8px 0;
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 0 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.nav-item:hover {
    background: rgba(255, 215, 0, 0.2);
}

.nav-item.active {
    background: rgba(255, 165, 0, 0.3);
    color: #8b4513;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 12px;
    font-weight: 500;
}

/* 二级页面通用样式 */
.page-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: rgba(255, 248, 220, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e6d47a;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #8b4513;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.back-btn:hover {
    background: rgba(139, 69, 19, 0.1);
}

.page-header h1 {
    font-size: 20px;
    color: #8b4513;
    font-weight: 600;
}

.page-content {
    flex: 1;
    padding: 20px 16px 80px;
}

/* 剧情简介页样式 */
.story-image-container {
    margin-bottom: 24px;
    text-align: center;
}

.story-image {
    width: 100%;
    max-width: 380px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.story-text {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #f5e6a3;
}

.story-text p {
    font-size: 16px;
    line-height: 1.8;
    color: #4a4a4a;
    text-align: justify;
}

/* 游玩攻略页样式 */
.guide-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #f5e6a3;
}

.guide-content h2 {
    font-size: 20px;
    color: #8b4513;
    margin-bottom: 20px;
    text-align: center;
}

.guide-section {
    margin-bottom: 24px;
}

.guide-section h3 {
    font-size: 18px;
    color: #d2691e;
    margin-bottom: 12px;
    font-weight: 600;
}

.faction-list {
    margin: 16px 0;
}

.faction-item {
    background: rgba(255, 248, 220, 0.8);
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid #ffa500;
}

.faction-item strong {
    color: #8b4513;
}

.tips {
    background: rgba(255, 215, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #ffd700;
    font-weight: 500;
    color: #8b4513;
}

.guide-section ul {
    margin-left: 20px;
}

.guide-section li {
    margin-bottom: 8px;
    color: #4a4a4a;
}

.farewell {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #8b4513;
    margin-top: 20px;
    padding: 16px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 8px;
}

/* 阵营选择页样式 */
.factions-image-container {
    margin-bottom: 24px;
    text-align: center;
}

.factions-image {
    width: 100%;
    max-width: 380px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.selection-prompt {
    text-align: center;
    margin-bottom: 24px;
}

.selection-prompt h2 {
    font-size: 20px;
    color: #8b4513;
    font-weight: 600;
}

.faction-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.faction-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #f5e6a3;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.faction-btn:hover {
    background: rgba(255, 248, 220, 0.95);
    border-color: #ffa500;
    transform: translateY(-1px);
}

.faction-btn.selected {
    background: rgba(255, 165, 0, 0.2);
    border-color: #ff8c00;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.3);
}

.faction-name {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #8b4513;
    margin-bottom: 4px;
}

.faction-desc {
    display: block;
    font-size: 14px;
    color: #666;
}

.start-game-container {
    text-align: center;
}

.start-game-btn {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.start-game-btn:enabled:hover {
    background: linear-gradient(135deg, #ff8c00, #ff7f00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

.start-game-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* 文创商城页样式 */
.shop-banner {
    margin-bottom: 20px;
    text-align: center;
}

.banner-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.shop-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #f5e6a3;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 150px;
}

.tab-btn:hover {
    border-color: #ffa500;
}

.tab-btn.active {
    border-color: #ff8c00;
    background: rgba(255, 165, 0, 0.2);
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.3);
}

.tab-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.products-container {
    text-align: center;
}

.products-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 阵营选择提示样式 */
.faction-prompt-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.faction-prompt-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #f5e6a3;
    max-width: 400px;
    width: 100%;
}

.prompt-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.faction-prompt-card h2 {
    font-size: 24px;
    color: #8b4513;
    margin-bottom: 16px;
    font-weight: 600;
}

.faction-prompt-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 16px;
}

.prompt-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.select-faction-btn,
.back-home-btn {
    padding: 14px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.select-faction-btn {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: white;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.3);
}

.select-faction-btn:hover {
    background: linear-gradient(135deg, #ff8c00, #ff7f00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

.back-home-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #8b4513;
    border: 2px solid #f5e6a3;
}

.back-home-btn:hover {
    background: rgba(255, 248, 220, 0.95);
    border-color: #ffa500;
}

/* 探索进度页样式 */
.current-faction {
    background: rgba(255, 255, 255, 0.95);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid #f5e6a3;
}

.current-faction h2 {
    font-size: 18px;
    color: #8b4513;
}

.current-faction span {
    color: #ff8c00;
    font-weight: 600;
}

.progress-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 2px solid #f5e6a3;
}

.progress-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.progress-image {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 8px;
}

.progress-info h3 {
    font-size: 16px;
    color: #8b4513;
    margin-bottom: 12px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffa500, #ff8c00);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.clues-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid #f5e6a3;
}

.clues-section h3 {
    font-size: 18px;
    color: #8b4513;
    margin-bottom: 16px;
}

.clues-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.clue-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #f5e6a3;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clue-item:hover {
    border-color: #ffa500;
    transform: scale(1.05);
}

.clue-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-clues-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.empty-clues-message small {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    display: block;
}

.return-home-container {
    text-align: center;
}

.return-home-btn {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 140, 0, 0.3);
}

.return-home-btn:hover {
    background: linear-gradient(135deg, #ff8c00, #ff7f00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

/* 平板和桌面端适配 */
@media (min-width: 768px) {
    .app-container {
        max-width: 768px;
    }

    .main-content {
        padding: 40px 32px 80px;
    }

    .main-title {
        font-size: 48px;
    }

    .sub-title {
        font-size: 20px;
    }

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

    .page-content {
        padding: 40px 32px 80px;
    }

    .faction-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .shop-tabs {
        max-width: 400px;
        margin: 0 auto 20px;
    }
}

@media (min-width: 1024px) {
    .app-container {
        max-width: 1024px;
    }

    .main-content {
        padding: 60px 48px 80px;
    }

    .page-content {
        padding: 60px 48px 80px;
    }

    .feature-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

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

/* 线索发现动画样式 */
.clue-discovery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    cursor: pointer;
}

.clue-discovery-overlay.show {
    opacity: 1;
}

.clue-discovery-overlay.hide {
    opacity: 0;
}

.clue-discovery-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.5);
    transition: transform 0.5s ease;
}

.clue-discovery-overlay.show .clue-discovery-container {
    transform: scale(1);
}

.clue-discovery-overlay.hide .clue-discovery-container {
    transform: scale(0.8);
}

.clue-discovery-image {
    width: 82%;
    height: auto;
    border-radius: 12px;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    animation: clueGlow 2s ease-in-out infinite alternate;
}

.clue-glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.2) 40%, transparent 70%);
    z-index: 1;
    animation: glowPulse 1.5s ease-in-out infinite;
}

.clue-discovery-text {
    margin-top: 24px;
    font-size: 24px;
    font-weight: 600;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    text-align: center;
    animation: textGlow 1s ease-in-out infinite alternate;
}

/* 线索发现动画关键帧 */
@keyframes clueGlow {
    0% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
        filter: brightness(1);
    }
    100% {
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.9), 0 0 100px rgba(255, 165, 0, 0.4);
        filter: brightness(1.1);
    }
}

@keyframes glowPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 165, 0, 0.8);
    }
}

/* 移动端触摸反馈 */
.card:active,
.faction-btn:active,
.nav-item:active,
.start-game-btn:active,
.tab-btn:active,
.return-home-btn:active,
.back-btn:active,
.select-faction-btn:active,
.back-home-btn:active {
    transform: scale(0.98);
    opacity: 0.8;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #ffa500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}