/* 主样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 头部样式 */
.app-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 主容器 */
.main-container {
    flex: 1;
    display: flex;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

/* NPC部分样式 */
.npc-section {
    margin-bottom: 30px;
}

.npc-section h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.vip-section h3 {
    color: #ff6b6b;
    border-bottom-color: #ff6b6b;
}

/* NPC选择器 */
.npc-selector {
    width: 280px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.npc-selector h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.npc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.npc-card {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    background: white;
    position: relative;
}

.npc-card:hover {
    background: var(--light-bg);
    transform: translateX(5px);
    box-shadow: var(--shadow-hover);
}

.npc-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
}

.npc-card.locked {
    opacity: 0.85;
}

.npc-avatar-container {
    position: relative;
    width: 70px;
    height: 70px;
    margin-right: 15px;
    flex-shrink: 0;
}

.npc-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.npc-info h4 {
    font-size: 14px;
    margin-bottom: 2px;
}

.npc-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 故事区域 */
.story-area {
    flex: 1;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.welcome-screen {
    padding: 60px 40px;
    text-align: center;
}

.welcome-screen h2 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.welcome-screen p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.features {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
}

.feature {
    text-align: center;
    max-width: 200px;
}

.feature-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
}

.feature h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 故事界面 */
.story-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.character-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(102,126,234,0.05), rgba(118,75,162,0.05));
}

.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.character-info {
    flex: 1;
}

.character-info h3 {
    font-size: 20px;
    margin-bottom: 5px;
}

.character-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.story-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fafafa;
}

/* 输入区域 */
.input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: white;
}

.prompt-suggestions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.suggestion {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.suggestion:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.input-controls {
    display: flex;
    gap: 10px;
}

#userPrompt {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
}

#userPrompt:focus {
    outline: none;
    border-color: var(--primary-color);
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.story-style {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

/* 右侧栏 */
.sidebar-right {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-panel,
.history-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.settings-panel h3,
.history-panel h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-secondary);
}

.setting-item select,
.setting-item input[type="range"] {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.setting-item input[type="range"] {
    padding: 0;
}

#creativityValue {
    display: inline-block;
    margin-left: 10px;
    font-size: 14px;
    color: var(--primary-color);
}

.story-history {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--light-bg);
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
}

.history-item h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.history-item p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 按钮样式 */
.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 8px 16px;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--light-bg);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

/* 加载提示 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .npc-selector {
        width: 100%;
        max-height: 200px;
    }
    
    .features {
        flex-direction: column;
        align-items: center;
    }
}

/* NPC卡片额外样式 */
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.vip-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.npc-country {
    font-size: 11px;
    color: #888;
    margin: 2px 0;
}

.npc-description {
    font-size: 11px;
    color: #666;
    margin: 4px 0;
    line-height: 1.3;
}

.npc-stats {
    margin-top: 8px;
    font-size: 11px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 3px 0;
    padding: 2px 0;
}

.stat-label {
    color: #888;
    font-weight: 500;
}

.stat-value {
    color: var(--primary-color);
    font-weight: 600;
}