/* ============================================================
   character.css - 角色创建页 + 升级年代卡片 + 人物立绘 + BGM
   ============================================================ */

/* --- BGM 开关按钮 --- */
.bgm-toggle {
    position: fixed;
    left: 20px;
    bottom: 80px;
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--secondary-yellow);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}
.bgm-toggle:hover {
    transform: scale(1.1);
    background: rgba(212,165,116,0.3);
}

/* V3.2.7.9.6: PC 端喇叭按钮约束在 .scene（手机壳）左内侧
   .scene 居中 480px → 舞台左边 = 50vw - 240px
   按钮 left = 舞台左边 + 20 = 50vw - 220px
   用 max(20px, ...) 兜底小屏（按钮贴视口左边） */
@media (min-width: 769px) {
    .bgm-toggle {
        left: max(20px, calc(50vw - 220px));
    }
}
/* 移动端 480px：保留原始 left: 20px（在手机壳内） */
@media (max-width: 480px) {
    .bgm-toggle {
        left: 20px !important;
    }
}

/* V3.3.2: 顶栏 3 徽章（信用/段位/月卡）样式 */
#topbar-badges {
    display: flex;
    gap: 6px;
    align-items: center;
}
#credit-badge, #tier-badge, #monthly-card-badge {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    white-space: nowrap;
}
#credit-badge:hover, #tier-badge:hover, #monthly-card-badge:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* V3.3.2: 移动端 480px — 缩小徽章字号 + 紧凑布局 */
@media (max-width: 480px) {
    #topbar-badges {
        gap: 3px;
    }
    #credit-badge, #tier-badge, #monthly-card-badge {
        padding: 1px 3px;
        font-size: 11px;
    }
    #credit-badge span, #tier-badge span, #monthly-card-badge span {
        font-size: 11px !important;
    }
}

/* --- 角色创建场景 --- */
#scene-character {
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a1a 50%, #1a1a2a 100%);
}

.character-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}

.character-title {
    text-align: center;
    font-size: 24px;
    color: var(--secondary-yellow);
    margin-bottom: 8px;
    font-weight: bold;
}
.character-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 13px;
}

/* --- 头像预览区 --- */
.avatar-preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 4px solid var(--secondary-yellow);
    box-shadow: 0 0 20px rgba(212,165,116,0.4);
    margin-bottom: 12px;
}
.avatar-preview .character-avatar,
.avatar-preview .character-avatar-img {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.avatar-preview .character-avatar-img {
    object-fit: cover;
}

.name-preview {
    font-size: 20px;
    color: var(--secondary-yellow);
    font-weight: bold;
}

/* --- 头像选择网格 --- */
.section-title {
    font-size: 15px;
    color: var(--text-primary);
    margin: 16px 0 10px;
    font-weight: bold;
}

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

.avatar-option {
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.avatar-option:hover {
    background: rgba(212,165,116,0.15);
    border-color: var(--secondary-yellow);
}
.avatar-option.selected {
    background: rgba(212,165,116,0.25);
    border-color: var(--secondary-yellow);
    box-shadow: 0 0 12px rgba(212,165,116,0.5);
}
.avatar-option-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.avatar-option-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.upload-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(212,165,116,0.15);
    border: 1px dashed var(--secondary-yellow);
    border-radius: 8px;
    color: var(--secondary-yellow);
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.upload-btn:hover {
    background: rgba(212,165,116,0.3);
}

/* --- 昵称输入 --- */
.name-input {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}
.name-input:focus {
    border-color: var(--secondary-yellow);
    background: rgba(255,255,255,0.08);
}

/* --- 性别选择 --- */
.gender-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.gender-option {
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.gender-option:hover {
    background: rgba(212,165,116,0.15);
}
.gender-option input { display: none; }
.gender-option.checked {
    border-color: var(--secondary-yellow);
    background: rgba(212,165,116,0.2);
}
.gender-option-icon { font-size: 36px; margin-bottom: 6px; }
.gender-option-label { font-size: 13px; color: var(--text-primary); }

/* --- 完成按钮 --- */
.character-confirm-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
    color: #fff;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    margin-top: 24px;
    transition: all 0.2s;
}
.character-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(139,26,26,0.4);
}

/* ============================================================
   升级后的年代卡片（v2.1.1）
   ============================================================ */
.era-card-v2 {
    /* V3.2.7.6: 渐变在上 + 黑色遮罩在下，确保文字对比度 */
    background: linear-gradient(135deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.45) 100%), var(--era-bg, rgba(0,0,0,0.4));
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}
.era-card-v2::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 60%;
    z-index: 0;
    opacity: 0.3;
}
.era-card-v2 > * { position: relative; z-index: 1; }

.era-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.era-card-year {
    font-size: 22px;
    font-weight: bold;
    color: var(--secondary-yellow);
}
.era-card-difficulty {
    font-size: 11px;
    padding: 2px 8px;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    color: var(--text-secondary);
}

.era-card-city {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.era-card-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.era-card-fund {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-light) 100%);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.era-card-event {
    font-size: 12px;
    /* V3.2.7.6: 白色 + 文字阴影，在彩色背景上清晰可见 */
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
    line-height: 1.5;
    font-weight: 600;
}

.era-card-industries {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.era-card-industry {
    /* V3.2.7.6: 加深背景对比度 + 白字 */
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.era-card-figure {
    font-size: 11px;
    /* V3.2.7.6: 浅色 + 文字阴影 */
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.era-card-v2:hover, .era-card-v2:active {
    border-color: var(--secondary-yellow);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(212,165,116,0.3);
}

/* ============================================================
   人物立绘（CSS 艺术风格）
   ============================================================ */
.character-portrait {
    width: 100px;
    height: 140px;
    position: relative;
    margin: 0 auto;
}
.character-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #FFD4A3;
    border: 2px solid var(--secondary-yellow);
}
.character-head::before {
    /* 眼睛 */
    content: '';
    position: absolute;
    top: 22px;
    left: 12px;
    width: 6px;
    height: 6px;
    background: #333;
    border-radius: 50%;
    box-shadow: 20px 0 0 #333;
}
.character-head::after {
    /* 嘴 */
    content: '';
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 6px;
    border-bottom: 2px solid #333;
    border-radius: 0 0 12px 12px;
}
.character-body {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, #8B1A1A 0%, #C0392B 100%);
    border: 2px solid var(--secondary-yellow);
    border-radius: 30px 30px 0 0;
}
.character-body::before {
    /* 衣领 */
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: var(--secondary-yellow);
    border-radius: 0 0 50% 50%;
}

.character-portrait.female .character-head { background: #FFC1A0; }
.character-portrait.female .character-body { background: linear-gradient(135deg, #C0392B 0%, #E91E63 100%); }