/* 凡星 · FanXing - 极简未来风 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #050507;
    --bg-secondary: #0a0a0f;
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #808080;
    --border: rgba(255, 255, 255, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ========== 顶部标题 ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(180deg, var(--bg-primary) 0%, transparent 100%);
    position: relative;
    z-index: 10;
}

.header-content {
    text-align: left;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.abilities-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--accent);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.abilities-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px var(--accent-glow);
}

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

.voice-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.voice-toggle-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.voice-toggle-btn.on {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--accent);
}

.auth-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.auth-btn.logged-in {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--accent);
}

/* ========== 跳转确认弹窗 ========== */
.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
}

.confirm-modal.active {
    display: block;
}

.confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.confirm-content {
    position: relative;
    max-width: 420px;
    margin: 120px auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    animation: confirmIn 0.3s ease;
}

@keyframes confirmIn {
    from { opacity: 0; transform: scale(0.9) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.confirm-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.confirm-btn.confirm {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: var(--bg-primary);
}

.confirm-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ========== 核心炸点 ========== */
.hero {
    text-align: center;
    padding: 40px 24px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.hero-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hero-text.highlight {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* ========== 聊天区域 ========== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.chat-area::-webkit-scrollbar {
    width: 4px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    position: relative;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.6;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.save-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.save-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent);
}

/* ========== 底部输入区 ========== */
.footer {
    padding: 16px 24px 24px;
    background: linear-gradient(0deg, var(--bg-primary) 0%, transparent 100%);
}

.input-container {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.voice-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    animation: pulse 0.5s infinite;
}

.text-input-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
}

#text-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
}

#text-input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    border: none;
    color: var(--bg-primary);
    font-weight: 700;
}

.send-btn:hover:not(:disabled) {
    box-shadow: 0 0 25px var(--accent-glow);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 个人库固定入口 ========== */
.library-entry {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.library-btn {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--accent);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.library-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

/* ========== 凡星能力弹窗 ========== */
.abilities-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
}

.abilities-modal.active {
    display: block;
}

.abilities-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.abilities-content {
    position: relative;
    max-width: 500px;
    margin: 60px auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

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

.abilities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.abilities-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.abilities-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ability-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ability-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.ability-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ability-info {
    flex: 1;
}

.ability-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.ability-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .header, .hero, .chat-area, .footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .hero-text {
        font-size: 1rem;
    }
    
    .abilities-content {
        margin: 20px;
    }
}
