/* style.css - 极简社交风 (WeChat Style) + V2.0 完整版 */

:root {
    --bg-color: #ededed;        /* 微信背景灰 */
    --card-bg: #ffffff;
    --primary-green: #07c160;   /* 微信绿 */
    --danger-red: #fa5151;      /* 微信红 */
    --text-primary: #111111;
    --text-secondary: #7f7f7f;  /* 次要文字灰 */
    --border-color: #dcdcdc;    /* 分割线颜色 */
    --safe-bottom: env(safe-area-inset-bottom);
}

* { 
    box-sizing: border-box; 
    touch-action: manipulation; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-color);
    position: relative;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.hidden { 
    display: none !important; 
}

/* ==================== 开始界面样式 ==================== */
#start-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.start-container {
    text-align: center;
    color: white;
    max-width: 400px;
    width: 100%;
}

.game-title {
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.game-subtitle {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 40px 0;
    opacity: 0.9;
}

.talent-prompt {
    font-size: 16px;
    margin: 0 0 24px 0;
    opacity: 0.8;
}

.talent-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.talent-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-align: left;
}

.talent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.talent-card:active {
    transform: scale(0.98);
}

.talent-card.selected {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.2);
}

.talent-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.talent-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* ==================== 游戏界面样式 ==================== */
#game-screen {
    background: var(--bg-color);
}

/* 顶部栏 */
#stats-bar {
    background: #f7f7f7;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 15px;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 100;
    color: var(--text-primary);
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item span { 
    font-weight: bold; 
}

#debug-toggle {
    font-size: 18px;
    opacity: 0.3;
    cursor: pointer;
}

/* 游戏主区域 */
#game-container {
    flex: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
}

/* 事件卡片 */
#event-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.02);
    animation: popIn 0.3s ease-out;
}

.event-tag {
    display: inline-block;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f2f2f2;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
}

#event-proposer {
    margin: 0 0 12px 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

#event-proposer::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--primary-green);
    margin-right: 8px;
    border-radius: 2px;
}

#event-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin: 0;
    min-height: 60px;
}

/* 吐槽气泡 */
#feedback-area {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.chat-bubble {
    background: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    align-self: flex-start;
    border: 1px solid #ededed;
    position: relative;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.chat-avatar {
    width: 24px;
    height: 24px;
    background: #ddd;
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

@keyframes slideUp { 
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

/* 治愈彩蛋特效 */
.healing-event {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%) !important;
    border: 2px solid #ffb6b6 !important;
}

/* 底部操作区 */
#action-area {
    background: #f7f7f7;
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.choice-btn {
    flex: 1;
    padding: 14px 0;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.choice-btn:active { 
    filter: brightness(0.9); 
    transform: scale(0.98); 
}

.yes {
    background-color: var(--primary-green);
    color: white;
}

.no {
    background-color: #f2f2f2;
    color: var(--text-primary);
}

.no:active { 
    background-color: #e5e5e5; 
}

.next { 
    background-color: var(--primary-green); 
    color: white; 
}

.restart { 
    background-color: var(--danger-red); 
    color: white; 
}

/* 调试面板 */
#debug-panel {
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 12px;
    padding: 8px 16px;
    position: absolute;
    top: 50px;
    right: 0;
    left: 0;
    z-index: 90;
    backdrop-filter: blur(4px);
}

#debug-panel p { 
    margin: 4px 0; 
    display: flex; 
    justify-content: space-between; 
}

/* ==================== 结算界面样式 ==================== */
#result-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.result-container {
    width: 100%;
    max-width: 400px;
}

.result-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: popIn 0.4s ease-out;
}

.result-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0 0 24px 0;
}

.result-content {
    margin-bottom: 32px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 16px;
    color: var(--text-secondary);
}

.result-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-green);
}

.result-badge {
    font-size: 18px;
    font-weight: bold;
    color: #ff6b35;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-reason {
    font-size: 16px;
    color: var(--danger-red);
    font-weight: 500;
}

.result-talent {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* 成就徽章 */
.badge-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    margin: 15px 0; 
}

.badge { 
    background: #fff; 
    padding: 10px; 
    border-radius: 8px; 
    border: 1px solid #ddd; 
    text-align: center; 
    opacity: 0.5; 
    filter: grayscale(1); 
}

.badge.unlocked { 
    opacity: 1; 
    filter: grayscale(0); 
    border-color: #ff9800; 
    background: #fff8e1; 
}

.badge-name { 
    font-weight: bold; 
    color: #d84315; 
    font-size: 14px; 
}

.badge-desc { 
    font-size: 10px; 
    color: #666; 
    margin-top: 4px; 
}

#restart-game {
    width: 100%;
    padding: 16px;
    font-size: 18px;
}

/* ==================== 动画效果 ==================== */
@keyframes popIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 480px) {
    .game-title {
        font-size: 24px;
    }
    
    .game-subtitle {
        font-size: 18px;
    }
    
    .talent-card {
        padding: 16px;
    }
    
    .talent-name {
        font-size: 16px;
    }
    
    .talent-desc {
        font-size: 13px;
    }
    
    #stats-bar {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    #game-container {
        padding: 16px 12px;
    }
    
    #event-card {
        padding: 20px;
    }
    
    #event-text {
        font-size: 15px;
    }
    
    .choice-btn {
        font-size: 15px;
        padding: 12px 0;
    }
    
    .result-card {
        padding: 24px 20px;
    }
    
    .result-title {
        font-size: 20px;
    }
    
    .badge-grid {
        grid-template-columns: 1fr;
    }
}

/* 平板和桌面端优化 */
@media (min-width: 768px) {
    #app {
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
        border-radius: 12px;
        overflow: hidden;
        margin: 20px auto;
        max-height: calc(100vh - 40px);
    }
    
    .talent-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    #event-card {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1c1c1e;
        --card-bg: #2c2c2e;
        --text-primary: #ffffff;
        --text-secondary: #8e8e93;
        --border-color: #38383a;
    }
    
    #stats-bar {
        background: #2c2c2e;
        border-bottom-color: #38383a;
    }
    
    #action-area {
        background: #2c2c2e;
        border-top-color: #38383a;
    }
    
    .event-tag {
        background: #38383a;
        color: var(--text-secondary);
    }
    
    .no {
        background-color: #38383a;
        color: var(--text-primary);
    }
    
    .no:active {
        background-color: #48484a;
    }
    
    .result-item {
        border-bottom-color: #38383a;
    }
    
    .chat-bubble {
        background: #2c2c2e;
        border-color: #38383a;
        color: var(--text-primary);
    }
    
    .badge {
        background: #2c2c2e;
        border-color: #38383a;
    }
    
    .badge.unlocked {
        background: #3a2e1a;
        border-color: #ff9800;
    }
}