*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #5B7FFF;
    --primary-dark: #4A6AE0;
    --bg: #EDEDED;
    --bg-chat: #F7F7F7;
    --bubble-assistant: #FFFFFF;
    --bubble-user: #5B7FFF;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --text-light: #999999;
    --border: #E0E0E0;
    --correction-bg: #F0F7FF;
    --correction-border: #B8D4FE;
    --success: #2FBF71;
    --warn: #F5A623;
    --danger: #E74C3C;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

.page {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* 防止移动端浏览器工具栏/地址栏收缩时页面抖动 */
    overflow: hidden;
}

.chat-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    box-shadow: var(--shadow);
}

@media (min-width: 481px) {
    .chat-container {
        height: 90vh;
        max-height: 800px;
        border-radius: var(--radius);
        overflow: hidden;
    }
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.chat-header .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B8EFF, #5B7FFF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s;
}

.chat-header .avatar:hover {
    transform: scale(1.05);
}

.chat-header .avatar:active {
    transform: scale(0.95);
}

.chat-header .header-info {
    flex: 1;
    min-width: 0;
}

.chat-header .name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-header .status {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.chat-header .push-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.chat-header .status {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.energy-pill {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #F0F4FF;
    color: var(--primary);
    white-space: nowrap;
}

.energy-pill.lv-energetic {
    background: #E9F8F0;
    color: #1F9D5B;
}

.energy-pill.lv-normal {
    background: #F0F4FF;
    color: var(--primary);
}

.energy-pill.lv-low {
    background: #FFF6E8;
    color: #C77A22;
}

.energy-pill.lv-verylow,
.energy-pill.lv-depleted {
    background: #FDECEC;
    color: #C0392B;
}

.chat-header .push-btn:hover {
    background: var(--bg);
}

.character-panel {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.character-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.character-panel-header .close-panel {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-light);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.character-panel-header .close-panel:hover {
    background: var(--bg);
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    background: var(--bg-chat);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.character-card:hover {
    background: #FFFFFF;
    border-color: var(--border);
}

.character-card.active {
    background: #FFFFFF;
    border-color: var(--primary);
}

.character-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B8EFF, #5B7FFF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.character-card-info {
    flex: 1;
    min-width: 0;
}

.character-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.character-card-tagline {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.character-card-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.ios-guide-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.ios-guide-banner .close-guide {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0.8;
}

.ios-guide-banner .close-guide:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.scroll-anchor {
    height: 1px;
    width: 100%;
}

.welcome-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 16px;
    margin: auto 0;
}

.welcome-avatar {
    font-size: 56px;
    animation: wave 1.5s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

.welcome-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 280px;
}

.start-btn {
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    padding: 12px 28px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.start-btn:hover {
    background: var(--primary-dark);
}

.message-row {
    display: flex;
    margin-bottom: 4px;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.user-bubble {
    background: var(--bubble-user);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.assistant-bubble {
    background: var(--bubble-assistant);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
}

.message-text {
    font-size: 15px;
}

.user-bubble .message-text {
    font-size: 15px;
}

.correction-block {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: var(--correction-bg);
    border-left: 3px solid var(--correction-border);
    border-radius: 0 8px 8px 0;
}

.correction-label {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
}

.correction-original {
    font-size: 12px;
    color: var(--text-light);
    text-decoration: line-through;
    margin-bottom: 4px;
    word-break: break-word;
}

.correction-text {
    font-size: 14px;
    color: var(--primary-dark);
    font-weight: 500;
    margin-bottom: 4px;
}

.explanation-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.translation-toggle {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px 0;
    background: none;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s;
}

.translation-toggle:hover {
    color: var(--primary);
}

.translation-text {
    margin-top: 8px;
    padding: 8px 10px;
    background: #F5F5F5;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 18px;
}

.typing .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #C0C0C0;
    animation: bounce 1.4s ease-in-out infinite;
}

.typing .dot:nth-child(1) { animation-delay: 0s; }
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.chat-input-area {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: #FFFFFF;
    border-top: 1px solid var(--border);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 22px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    outline: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--primary);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #FFFFFF;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
}

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
}

.recording-hint {
    color: #E74C3C;
    animation: pulse 1s ease-in-out infinite;
}

.voice-status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
}

.voice-cancel-btn {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bubble-assistant);
    color: var(--primary-dark);
    font: inherit;
    cursor: pointer;
}

.voice-cancel-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 云端语音轨标识：仅命中高级轨时展示，便于确认当前生效的语音能力 */
.voice-mode-badge {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 8px;
    background: #EAF3FF;
    color: #2F80ED;
    font-size: 10px;
    line-height: 16px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.speak-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    opacity: 0.6;
    transition: opacity 0.2s, background 0.2s;
    flex-shrink: 0;
}

.speak-btn:hover {
    opacity: 1;
    background: var(--bg);
}

.voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #F0F0F0;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.voice-btn:hover:not(:disabled) {
    background: #E0E0E0;
}

.voice-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-btn.recording {
    background: #FEE2E2;
}

.recording-pulse {
    animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* 音频按钮组：语音转文字 + 语音消息（占位），整体收窄以适配 375px 窄屏 */
.voice-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.voice-actions .voice-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

/* 占位按钮：低对比、无反馈，明确表达"尚未开放"而不是"点不动" */
.voice-btn.voice-btn-placeholder {
    background: #F7F7F7;
    color: var(--text-light);
    opacity: 0.4;
    cursor: not-allowed;
}

.voice-error {
    text-align: center;
    font-size: 12px;
    color: #E74C3C;
    padding: 4px 0;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.correction-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.correction-label-small {
    color: var(--text-light);
    font-size: 11px;
    margin-right: 4px;
}

.correction-pill {
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #FFFFFF;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.correction-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.correction-pill.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

#blazor-error-ui {
    display: none;
}

/* ==================== 社交壳（Phase A） ==================== */
.app-shell {
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    box-shadow: var(--shadow);
}

@media (min-width: 481px) {
    .app-shell {
        height: 90vh;
        max-height: 800px;
        border-radius: var(--radius);
        overflow: hidden;
    }
}

.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-chat);
}

.app-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 12px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
}

.app-header .app-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.app-header .app-action {
    margin-left: auto;
    font-size: 18px;
    line-height: 1;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.app-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 底部 Tab */
.tab-bar {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 0 6px;
    color: var(--text-light);
    font-size: 10px;
    text-decoration: none;
    position: relative;
    transition: color 0.15s;
}

.tab-item svg {
    width: 23px;
    height: 23px;
}

.tab-item.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-badge {
    position: absolute;
    top: 3px;
    left: 50%;
    margin-left: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #FF4D4F;
    color: #FFFFFF;
    border-radius: 9px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
}

/* 通用列表 */
.list-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    padding: 14px 18px 6px;
}

.list {
    background: #FFFFFF;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    position: relative;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.list-row + .list-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 72px;
    right: 0;
    height: 1px;
    background: var(--border);
}

.list-row:active {
    background: #F5F6FA;
}

.list-row.disabled {
    opacity: 0.55;
    cursor: default;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6B8EFF, #5B7FFF);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    color: #FFFFFF;
}

.avatar.plain {
    background: #EEF1F6;
}

.row-main {
    flex: 1;
    min-width: 0;
}

.row-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.row-sub {
    font-size: 12.5px;
    color: var(--text-light);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-side {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.row-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #FF4D4F;
    color: #FFFFFF;
    border-radius: 9px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 600;
}

.chip {
    font-size: 10px;
    font-weight: 500;
    color: var(--primary);
    background: #EDF2FF;
    padding: 1px 7px;
    border-radius: 5px;
}

.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.7;
}

.empty-state .emoji {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

/* ==================== 公共页（落地页 / 账号页） ==================== */
.public-page {
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    background: #FFFFFF;
}

.landing-page {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

.hero {
    background: linear-gradient(180deg, #F4F7FF 0%, #FFFFFF 100%);
    padding: 56px 28px 36px;
    text-align: center;
}

.hero h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.hero .tagline {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 14px auto 0;
    max-width: 320px;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 26px auto 0;
    max-width: 300px;
}

.btn-primary {
    display: block;
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    padding: 13px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 10px 22px rgba(91, 127, 255, 0.3);
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    display: block;
    background: #FFFFFF;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #F4F7FF;
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.hero-avatars {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 26px;
}

.avatar-large {
    font-size: 46px;
}

.features {
    padding: 26px 24px 8px;
}

.features h2,
.characters-preview h2,
.cta h2 {
    font-size: 19px;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.feature-card {
    background: var(--bg-chat);
    border-radius: var(--radius);
    padding: 16px;
}

.feature-icon {
    font-size: 22px;
}

.feature-card h3 {
    font-size: 13px;
    font-weight: 700;
    margin-top: 10px;
}

.feature-card p {
    font-size: 11.5px;
    color: var(--text-light);
    line-height: 1.55;
    margin-top: 6px;
}

.characters-preview {
    padding: 26px 24px;
}

.character-preview-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.character-preview-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.preview-avatar {
    font-size: 34px;
}

.character-preview-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-top: 8px;
}

.preview-location {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

.preview-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-top: 10px;
}

.preview-tag {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 999px;
}

.preview-tag.gentle {
    background: #EDF2FF;
    color: var(--primary);
}

.preview-tag.direct {
    background: #FFF1E6;
    color: #C77A22;
}

.cta {
    text-align: center;
    padding: 34px 24px;
    background: linear-gradient(180deg, #FFFFFF, #F4F7FF);
}

.cta p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0 18px;
}

.cta .btn-large {
    max-width: 300px;
    margin: 0 auto;
}

.landing-footer {
    padding: 26px 24px 34px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.landing-footer p {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.footer-disclaimer {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.7;
    margin-top: 12px;
}

/* 账号页 */
.account-page {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--bg-chat);
}

.account-card {
    width: 100%;
    max-width: 360px;
    background: #FFFFFF;
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
}

.account-card h1 {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
}

.account-sub {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    margin: 8px 0 20px;
    line-height: 1.6;
}

.account-card label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin: 14px 0 6px;
}

.account-card input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.account-card input:focus {
    border-color: var(--primary);
}

.account-message {
    margin-top: 14px;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.account-message.error {
    background: #FDECEC;
    color: #C0392B;
}

.account-message.success {
    background: #E9F8F0;
    color: #1F9D5B;
}

.account-card .btn-primary {
    width: 100%;
    margin-top: 18px;
}

.account-card .btn-primary:disabled {
    background: #B9C4E8;
    cursor: not-allowed;
    box-shadow: none;
}

.account-switch {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
    font-family: inherit;
}

.account-back {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 12.5px;
    color: var(--text-light);
    text-decoration: none;
}

/* ==================== 个人中心（我） ==================== */
.me-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 18px;
    background: linear-gradient(160deg, #5B7FFF, #7C93FF);
    color: #FFFFFF;
}

.me-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.me-info {
    flex: 1;
    min-width: 0;
}

.me-name {
    font-size: 18px;
    font-weight: 700;
}

.me-sub {
    font-size: 12px;
    opacity: 0.92;
    margin-top: 4px;
}

.me-action {
    background: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
    font-size: 12px;
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}

.card-plain {
    background: #FFFFFF;
    padding: 12px 18px;
}

.energy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.energy-label {
    width: 82px;
    font-size: 12.5px;
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.energy-bar {
    flex: 1;
    height: 9px;
    border-radius: 6px;
    background: #EDEFF4;
    overflow: hidden;
}

.energy-bar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #5B7FFF, #7FA0FF);
}

.energy-value {
    width: 62px;
    text-align: right;
    font-size: 11.5px;
    color: var(--text-light);
    flex-shrink: 0;
}

/* ==================== 动态 · 学习成长 ==================== */
.stat-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 12px 4px;
}

.stat-card {
    background: #FFFFFF;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}

.stat-value small {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-key {
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 6px;
}

.panel-card {
    background: #FFFFFF;
    border-radius: var(--radius);
    margin: 10px 12px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 96px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
}

.bar-fill {
    width: 100%;
    max-width: 22px;
    min-height: 3px;
    background: linear-gradient(180deg, #9DB6FF, #5B7FFF);
    border-radius: 6px 6px 4px 4px;
}

.bar-day {
    font-size: 10px;
    color: var(--text-light);
}

.tag-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.err-tag {
    font-size: 12px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #FFF3E8;
    color: #C77A22;
    font-weight: 500;
}

.muted {
    font-size: 12.5px;
    color: var(--text-light);
}

/* ==================== 桌面端布局（≥ 768px） ==================== */
/* 底部 Tab 变为左侧边栏；内容区加宽并居中显示。 */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

@media (min-width: 768px) {
    /* row-reverse：DOM 中在前的 app-body 落到右侧，TabBar 落到左侧成为边栏 */
    .app-shell {
        flex-direction: row-reverse;
        max-width: none;
        max-height: none;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        background: #F0F1F5;
    }

    .app-body {
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
        background: #F0F1F5;
    }

    .app-content {
        max-width: 760px;
        background: var(--bg-chat);
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        box-shadow: 0 0 40px rgba(30, 40, 80, 0.06);
    }

    /* 侧边栏导航 */
    .tab-bar {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        width: 96px;
        height: 100%;
        padding: 20px 12px 12px;
        gap: 8px;
        border-top: none;
        border-right: 1px solid var(--border);
        background: #FFFFFF;
    }

    .tab-item {
        flex: 0 0 auto;
        padding: 12px 0;
        border-radius: 12px;
        gap: 5px;
        font-size: 11px;
    }

    .tab-item:hover {
        background: #F5F7FF;
    }

    .tab-item.active {
        background: #EDF2FF;
    }

    /* 落地页在桌面端收窄、分栏 */
    .hero-content,
    .features,
    .characters-preview,
    .cta,
    .landing-footer {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }

    .hero {
        padding-top: 76px;
        padding-bottom: 48px;
    }

    .feature-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .character-preview-list {
        flex-direction: row;
    }

    .character-preview-card {
        flex: 1;
    }

}

/* ==================== 聊天三栏（桌面端主从布局） ==================== */
.chat-cols {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
}

/* 移动端：只保留中间聊天栏 */
.chat-col-list,
.chat-col-profile {
    display: none;
}

.chat-col-main {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.chat-col-main .chat-container {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
}

/* 聊天壳移动端不显示底部 Tab（聊天自带输入区） */
.chat-shell .tab-bar {
    display: none;
}

.chat-col-head {
    flex-shrink: 0;
    padding: 16px 18px 12px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.chat-col-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.list-row.active {
    background: #F0F4FF;
}

@media (min-width: 768px) {
    /* 聊天壳的正文不做宽度收敛，让三栏铺满 */
    .chat-shell .app-content {
        max-width: none;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    .chat-shell .tab-bar {
        display: flex;
    }

    .chat-col-list {
        display: flex;
        flex-direction: column;
        width: 300px;
        flex-shrink: 0;
        border-right: 1px solid var(--border);
        background: #FFFFFF;
    }

    .chat-col-profile {
        display: flex;
        flex-direction: column;
        width: 286px;
        flex-shrink: 0;
        border-left: 1px solid var(--border);
        background: #FFFFFF;
        overflow-y: auto;
    }

    .chat-col-main {
        justify-content: stretch;
    }

    .chat-col-main .chat-container {
        max-width: none;
    }

    /* 桌面端资料卡常驻右栏，隐藏聊天头部的资料浮层入口 */
    .profile-btn {
        display: none;
    }
}

/* ==================== 好友资料卡 ==================== */
.profile-card {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
}

.profile-hero {
    background: linear-gradient(160deg, #5B7FFF, #7C93FF);
    color: #FFFFFF;
    text-align: center;
    padding: 24px 18px 20px;
}

.profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.22);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 10px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
}

.profile-sub {
    font-size: 12.5px;
    opacity: 0.9;
    margin-top: 4px;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}

.profile-tags span {
    background: rgba(255, 255, 255, 0.2);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 999px;
}

.profile-section {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-section-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

.energy-text {
    font-size: 11.5px;
    color: var(--text-light);
    width: 64px;
    text-align: right;
    flex-shrink: 0;
}

.feed-grid {
    display: flex;
    gap: 10px;
}

.feed-item {
    flex: 1;
    background: var(--bg-chat);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 4px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}

.feed-item:hover:not(:disabled) {
    background: #F0F4FF;
}

.feed-item:active:not(:disabled) {
    transform: scale(0.97);
}

.feed-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feed-icon {
    font-size: 24px;
}

.feed-name {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-primary);
}

.feed-price {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.feed-energy {
    font-size: 10.5px;
    color: var(--success);
    font-weight: 600;
    margin-top: 2px;
}

.mem-tag {
    font-size: 12px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #EDF2FF;
    color: var(--primary);
    font-weight: 500;
}

.profile-loading {
    padding: 44px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* 资料卡浮层（移动端） */
.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

.profile-overlay-inner {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: 86vh;
    overflow-y: auto;
    background: #FFFFFF;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.profile-overlay-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.energy-row .energy-bar {
    flex: 1;
    height: 9px;
    border-radius: 6px;
    background: #EDEFF4;
    overflow: hidden;
}

.energy-row .energy-bar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #5B7FFF, #7FA0FF);
}

/* 法务/关于页与"我"页档位选择 */
.legal h2 { font-size: 15px; margin: 18px 0 6px; }
.legal p, .legal li { font-size: 14px; line-height: 1.7; }
.me-select { border: 1px solid #ddd; border-radius: 8px; padding: 4px 8px; font-size: 13px; background: #fff; }
.unread-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ff4d4f; margin-left: 6px; vertical-align: middle; }
a.list-row { text-decoration: none; color: inherit; display: block; }
