/* === 全局容器 === */
ai {
    display: block;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Serif SC', serif;
    line-height: 1.8;
    color: #e8e4f0;
    background: 
        linear-gradient(160deg, #1a1a2e 0%, #16213e 40%, #1a1a2e 100%),
        radial-gradient(circle at 25% 75%, rgba(180, 168, 201, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 75% 25%, rgba(212, 165, 116, 0.05) 0%, transparent 50%);
    padding: 28px;
    border-radius: 10px;
    box-shadow: 
        0 6px 28px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(180, 168, 201, 0.08);
    position: relative;
    overflow: hidden;
}

ai::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(232, 228, 240, 0.003) 2px, rgba(232, 228, 240, 0.003) 4px);
    z-index: -1;
    pointer-events: none;
}

/* === 隐藏思维链 === */
ai > :first-child {
    display: none;
}

/* === 前置状态栏 === */
.status-bar {
    margin-bottom: 28px;
    position: relative;
}

.status-bar::before {
    content: '🌙';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    opacity: 0.6;
}

.status-bar pre {
    background: rgba(22, 20, 46, 0.92);
    border: 1px solid rgba(184, 168, 201, 0.3);
    border-left: 3px solid #d4a574;
    border-radius: 6px;
    padding: 18px 22px;
    color: #e0d8f0;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.7;
    overflow-x: auto;
    box-shadow: 
        0 3px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(232, 228, 240, 0.02);
    position: relative;
    z-index: 1;
}

/* === 正文区域 === */
.text-content {
    background: rgba(22, 20, 46, 0.65);
    border-left: 3px solid #b8a9c9;
    padding: 24px 28px;
    margin-bottom: 28px;
    border-radius: 6px;
    position: relative;
    box-shadow: 
        inset 0 0 0 1px rgba(180, 168, 201, 0.04),
        0 3px 10px rgba(0, 0, 0, 0.3);
}

.text-content::before {
    content: '◆';
    position: absolute;
    right: 16px;
    top: -10px;
    font-size: 16px;
    color: rgba(212, 165, 116, 0.3);
}

.text-content p {
    margin: 0 0 18px 0;
    text-indent: 2em;
    font-size: 16px;
    color: #e8e4f0 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    line-height: 1.85;
}

.text-content p:last-child {
    margin-bottom: 0;
}

/* === 对话颜色系统 === */

/* 她（银发少女）的对话——粉色 #FF69B6 */
text span[style*="color:#FF69B6"],
span[style*="color:#FF69B6"] {
    color: #ff69b6 !important;
    font-weight: 500;
    text-shadow: 
        0 0 5px rgba(255, 105, 182, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 你（用户）的对话——蓝色 #4DA6FF */
text span[style*="color:#4DA6FF"],
span[style*="color:#4DA6FF"] {
    color: #4da6ff !important;
    font-weight: 400;
    text-shadow: 
        0 0 4px rgba(77, 166, 255, 0.2),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

/* 她心理活动——浅紫 #B8A9C9 */
text span[style*="color:#B8A9C9"],
span[style*="color:#B8A9C9"] {
    color: #b8a9c9 !important;
    font-style: italic;
    opacity: 0.9;
    text-shadow: 
        0 0 4px rgba(184, 168, 201, 0.25),
        0 1px 1px rgba(0, 0, 0, 0.35);
    background: rgba(184, 168, 201, 0.08);
    padding: 0 4px;
    border-radius: 2px;
}

/* === 折叠块通用样式 === */
details {
    background: rgba(22, 20, 46, 0.8);
    border: 1px solid rgba(184, 168, 201, 0.25);
    border-radius: 8px;
    margin-bottom: 18px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

details:hover {
    border-color: rgba(184, 168, 201, 0.4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

details[open] {
    background: rgba(26, 22, 46, 0.92);
    border-color: rgba(184, 168, 201, 0.45);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

details summary {
    background: linear-gradient(90deg, rgba(40, 32, 62, 0.85) 0%, rgba(30, 24, 50, 0.85) 100%);
    padding: 14px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    color: #e0d8f0;
    user-select: none;
    transition: all 0.25s ease;
    border-bottom: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: '▾';
    font-size: 12px;
    color: #d4a574;
    margin-left: auto;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

details[open] summary::after {
    transform: rotate(180deg);
}

details summary:hover {
    background: linear-gradient(90deg, rgba(70, 55, 100, 0.35) 0%, rgba(50, 40, 78, 0.35) 100%);
    color: #f0e8f8;
}

details summary:hover::after {
    opacity: 1;
}

details[open] summary {
    border-bottom-color: rgba(184, 168, 201, 0.3);
    margin-bottom: 16px;
    background: linear-gradient(90deg, rgba(90, 68, 120, 0.45) 0%, rgba(60, 46, 90, 0.45) 100%);
}

details section {
    padding: 18px 22px;
    color: #e0d8f0;
    position: relative;
}

details pre {
    background: rgba(18, 16, 40, 0.9);
    border: 1px solid rgba(184, 168, 201, 0.25);
    border-left: 3px solid #b8a9c9;
    border-radius: 5px;
    padding: 16px 20px;
    color: #e0d8f0;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13.5px;
    line-height: 1.7;
    overflow-x: auto;
    margin: 10px 0;
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.25);
}

/* === 标题样式 === */
details h4 {
    color: #d4a574;
    font-size: 14.5px;
    margin: 18px 0 10px 0;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(184, 168, 201, 0.25);
    font-weight: 600;
    letter-spacing: 0.3px;
    position: relative;
}

details h4:first-child {
    margin-top: 0;
}

details h4::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, #d4a574, transparent);
}

/* === 表格样式 === */
details table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 14px 0;
    font-size: 13.5px;
    background: rgba(20, 18, 42, 0.7);
    border: 1px solid rgba(184, 168, 201, 0.2);
    border-radius: 5px;
    overflow: hidden;
}

details table thead {
    background: linear-gradient(90deg, rgba(65, 50, 95, 0.8) 0%, rgba(42, 32, 70, 0.8) 100%);
}

details table th {
    padding: 12px 10px;
    text-align: left;
    color: #f0e8f8;
    font-weight: 600;
    border-bottom: 2px solid rgba(184, 168, 201, 0.4);
}

details table td {
    padding: 10px;
    border-bottom: 1px solid rgba(42, 32, 70, 0.5);
    color: #e0d8f0;
    transition: all 0.2s ease;
}

details table tbody tr:last-child td {
    border-bottom: none;
}

details table tbody tr:hover {
    background: rgba(140, 106, 160, 0.06);
}

details table tbody tr:hover td {
    color: #f0e8f8;
}

/* === 列表样式 === */
details ul {
    list-style: none;
    padding-left: 0;
    margin: 10px 0;
}

details ul li {
    padding: 7px 0 7px 22px;
    position: relative;
    color: #e0d8f0;
    border-bottom: 1px solid rgba(47, 37, 65, 0.35);
    transition: all 0.2s ease;
}

details ul li:last-child {
    border-bottom: none;
}

details ul li:hover {
    background: rgba(140, 106, 160, 0.04);
    padding-left: 26px;
}

details ul li::before {
    content: "◇";
    position: absolute;
    left: 0;
    color: #b8a9c9;
    font-size: 13px;
    opacity: 0.7;
}

/* === 行动选项面板 === */
.choice-panel {
    background: 
        linear-gradient(145deg, rgba(32, 26, 54, 0.92) 0%, rgba(22, 18, 46, 0.92) 100%);
    border: 1px solid rgba(184, 168, 201, 0.3);
    border-top: 2px solid #d4a574;
    border-radius: 8px;
    padding: 22px 26px;
    margin-top: 30px;
    box-shadow: 
        0 6px 24px rgba(100, 70, 140, 0.18),
        inset 0 1px 0 rgba(232, 228, 240, 0.03);
    position: relative;
}

.choice-panel,
.choice-panel * {
    color: #f0e8f8 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

.choice-panel pre {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 14.5px;
    line-height: 1.9;
    font-family: 'PingFang SC', 'Noto Serif SC', serif;
}

.choice-list {
    list-style: none;
    padding-left: 0;
    margin: 18px 0 0 0;
}

.choice-list li {
    margin: 14px 0;
    padding: 16px 22px;
    background: rgba(28, 22, 50, 0.65);
    border: 1px solid rgba(184, 168, 201, 0.25);
    border-left: 4px solid #b8a9c9;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    color: #f0e8f8 !important;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.7;
}

.choice-list li:hover {
    background: rgba(40, 30, 60, 0.8);
    border-color: #d4a574;
    border-left-color: #d4a574;
    transform: translateX(6px);
    color: #fff8f8 !important;
    box-shadow: 
        0 4px 16px rgba(160, 120, 100, 0.2),
        inset 0 0 0 1px rgba(212, 165, 116, 0.1);
}

.choice-list li:active {
    transform: translateX(3px);
    transition: transform 0.08s ease;
}

.choice-list li strong,
.choice-list li b {
    color: #d4a574 !important;
    text-shadow: 0 0 6px rgba(212, 165, 116, 0.35);
}

/* === 段落文本通用 === */
details p {
    margin: 10px 0;
    line-height: 1.8;
    color: #e0d8f0;
}

/* === 强调/数值高亮 === */
details strong,
.status-bar pre strong {
    color: #d4a574;
    font-weight: 600;
    text-shadow: 0 0 4px rgba(212, 165, 116, 0.25);
}

/* === NTR场景专属面板（暗紫红氛围） === */
.ntr-scene-only {
    border-color: rgba(160, 60, 80, 0.5) !important;
    background: rgba(28, 18, 30, 0.85) !important;
}

.ntr-scene-only summary {
    background: linear-gradient(90deg, rgba(100, 30, 52, 0.45) 0%, rgba(70, 20, 38, 0.45) 100%) !important;
    color: #e8c8c8 !important;
}

.ntr-scene-only summary:hover {
    background: linear-gradient(90deg, rgba(120, 40, 62, 0.55) 0%, rgba(85, 25, 45, 0.55) 100%) !important;
}

/* === 颜色辅助类 === */
.highlight-gold {
    color: #d4a574 !important;
}

.highlight-pink {
    color: #ff69b6 !important;
}

.highlight-purple {
    color: #b8a9c9 !important;
}

/* === 滚动条 === */
ai ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

ai ::-webkit-scrollbar-track {
    background: rgba(20, 18, 42, 0.5);
    border-radius: 4px;
}

ai ::-webkit-scrollbar-thumb {
    background: rgba(184, 168, 201, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(20, 18, 42, 0.5);
}

ai ::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 168, 201, 0.5);
}

/* === 响应式 === */
@media (max-width: 768px) {
    ai {
        padding: 16px;
    }
    
    .status-bar pre,
    .choice-panel pre {
        font-size: 13px;
        padding: 14px 16px;
    }
    
    text p {
        font-size: 15px;
    }
    
    details table {
        font-size: 13px;
    }
    
    details table th,
    details table td {
        padding: 9px 7px;
    }
    
    .choice-list li {
        padding: 14px 18px;
        margin: 12px 0;
    }
    
    details summary {
        padding: 13px 16px;
        font-size: 14px;
    }
    
    details section {
        padding: 14px 16px;
    }
}

/* === 动画 === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

ai {
    animation: fadeInUp 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

details[open] section {
    animation: slideIn 0.35s ease;
}