/* ==========================================
   万界叙事引擎・告死鸟协议 UI
   暗色战术风 / 冷冽幽冥美学
   ========================================== */

/* -------- 根容器与全局基调 -------- */
.message-content,
body {
    background: #05070a;
}

.message-content {
    max-width: 820px;
    margin: 20px auto;
    padding: 0;
    color: #c8d0d8;
    font-family: 'Segoe UI', 'Noto Sans SC', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    background:
        linear-gradient(180deg, rgba(10, 14, 20, 0.98) 0%, rgba(5, 8, 12, 0.99) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.008) 2px,
            rgba(255, 255, 255, 0.008) 3px
        );
    border: 1px solid #1a2028;
    border-radius: 4px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 20px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 120px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
}

/* 顶部血红警示条 */
.message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        #8b0000 20%,
        #cc1a1a 50%,
        #8b0000 80%,
        transparent 100%);
    box-shadow: 0 0 12px rgba(204, 26, 26, 0.6);
    z-index: 10;
}

/* 底部扫描线动画 */
.message-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent, rgba(220, 230, 240, 0.4), transparent);
    animation: scan-line 8s linear infinite;
    pointer-events: none;
    z-index: 5;
}

@keyframes scan-line {
    0% { transform: translateY(0); opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { transform: translateY(800px); opacity: 0; }
}

/* -------- 正文排版 -------- */
.message-content p {
    margin: 12px 20px;
    text-indent: 2em;
    color: #b8c0c8;
    letter-spacing: 0.02em;
}

.message-content hr {
    border: none;
    height: 1px;
    margin: 18px 20px;
    background: linear-gradient(90deg,
        transparent,
        rgba(139, 0, 0, 0.4) 20%,
        rgba(220, 230, 240, 0.3) 50%,
        rgba(139, 0, 0, 0.4) 80%,
        transparent);
    position: relative;
}

.message-content hr::after {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #05070a;
    padding: 0 10px;
    color: #8b0000;
    font-size: 8px;
    letter-spacing: 4px;
}

/* -------- details 折叠块通用样式 -------- */
.message-content details {
    margin: 10px 18px;
    background: linear-gradient(180deg, rgba(18, 24, 32, 0.95) 0%, rgba(12, 16, 22, 0.95) 100%);
    border: 1px solid #222a34;
    border-left: 2px solid #8b0000;
    border-radius: 2px;
    padding: 0;
    position: relative;
    transition: all 0.3s ease;
}

.message-content details:hover {
    border-left-color: #cc1a1a;
    box-shadow:
        -2px 0 12px rgba(204, 26, 26, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.4);
}

.message-content details[open] {
    border-left-color: #cc1a1a;
    background: linear-gradient(180deg, rgba(22, 28, 36, 0.98) 0%, rgba(14, 18, 24, 0.98) 100%);
}

.message-content summary {
    cursor: pointer;
    padding: 10px 16px;
    font-weight: 600;
    color: #d8e0e8;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: linear-gradient(90deg, rgba(139, 0, 0, 0.08) 0%, transparent 100%);
    list-style: none;
    position: relative;
    user-select: none;
    transition: all 0.2s;
}

.message-content summary::-webkit-details-marker {
    display: none;
}

.message-content summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 10px;
    color: #8b0000;
    transition: transform 0.25s ease;
    font-size: 12px;
}

.message-content details[open] > summary::before {
    transform: rotate(90deg);
    color: #cc1a1a;
}

.message-content summary:hover {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(204, 26, 26, 0.15) 0%, transparent 100%);
}

.message-content details > *:not(summary) {
    padding: 0 16px 12px 16px;
}

/* -------- 世界现状顶部栏（blockquote） -------- */
.message-content blockquote {
    margin: 14px 18px;
    padding: 14px 18px;
    background:
        linear-gradient(135deg, rgba(20, 26, 34, 0.95) 0%, rgba(10, 14, 20, 0.95) 100%);
    border: 1px solid #2a3240;
    border-left: 3px solid #cc1a1a;
    border-radius: 2px;
    color: #b0b8c0;
    font-size: 13px;
    position: relative;
    box-shadow:
        inset 0 0 40px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.3);
}

.message-content blockquote::before {
    content: '// TACTICAL INTEL';
    position: absolute;
    top: -8px;
    left: 12px;
    background: #05070a;
    padding: 0 8px;
    color: #8b0000;
    font-size: 9px;
    letter-spacing: 0.25em;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 700;
}

.message-content blockquote p {
    margin: 4px 0;
    text-indent: 0;
    color: #c0c8d0;
}

/* 【世界现状】标题 */
.message-content > p:has-text('【世界现状】'),
.message-content p strong:first-child {
    color: #cc1a1a;
}

/* -------- 强调标题 【xxx】 -------- */
.message-content p {
    position: relative;
}

/* -------- 玩家档案 / 交互对象 内部结构 -------- */
.message-content details ul {
    list-style: none;
    padding-left: 0;
    margin: 6px 0;
}

.message-content details li {
    padding: 3px 0;
    color: #b8c0c8;
}

.message-content details p {
    margin: 6px 0;
    text-indent: 0;
    padding: 0;
    color: #b8c0c8;
    line-height: 1.85;
}

/* 中括号标题样式：【基础信息】【天赋词条】等 */
.message-content details p strong,
.message-content details strong {
    color: #e8eef4;
}

/* -------- 品级颜色系统 -------- */
.message-content .t-white {
    display: inline-block;
    color: #d8e0e8;
    background: linear-gradient(90deg, rgba(216, 224, 232, 0.08), transparent);
    padding: 2px 8px;
    border-left: 2px solid #a8b0b8;
    border-radius: 2px;
    margin: 2px 0;
}

.message-content .t-green {
    display: inline-block;
    color: #7dd87d;
    background: linear-gradient(90deg, rgba(125, 216, 125, 0.1), transparent);
    padding: 2px 8px;
    border-left: 2px solid #5cb85c;
    border-radius: 2px;
    margin: 2px 0;
    text-shadow: 0 0 4px rgba(125, 216, 125, 0.3);
}

.message-content .t-blue {
    display: inline-block;
    color: #5eb3ff;
    background: linear-gradient(90deg, rgba(94, 179, 255, 0.1), transparent);
    padding: 2px 8px;
    border-left: 2px solid #3d8bde;
    border-radius: 2px;
    margin: 2px 0;
    text-shadow: 0 0 4px rgba(94, 179, 255, 0.4);
}

.message-content .t-purple {
    display: inline-block;
    color: #c58fff;
    background: linear-gradient(90deg, rgba(197, 143, 255, 0.12), transparent);
    padding: 2px 8px;
    border-left: 2px solid #9d5ce8;
    border-radius: 2px;
    margin: 2px 0;
    text-shadow: 0 0 6px rgba(197, 143, 255, 0.5);
    box-shadow: inset 0 0 20px rgba(197, 143, 255, 0.05);
}

.message-content .t-gold {
    display: inline-block;
    color: #ffd76e;
    background: linear-gradient(90deg, rgba(255, 215, 110, 0.15), transparent);
    padding: 2px 8px;
    border-left: 2px solid #e8b748;
    border-radius: 2px;
    margin: 2px 0;
    text-shadow: 0 0 8px rgba(255, 215, 110, 0.6);
    box-shadow: inset 0 0 25px rgba(255, 215, 110, 0.08);
    font-weight: 600;
}

.message-content .t-red {
    display: inline-block;
    color: #ff5555;
    background: linear-gradient(90deg, rgba(255, 85, 85, 0.12), transparent);
    padding: 2px 8px;
    border-left: 2px solid #cc1a1a;
    border-radius: 2px;
    margin: 2px 0;
    text-shadow: 0 0 6px rgba(255, 85, 85, 0.5);
}

/* -------- 血条 / 体力条样式 -------- */
.message-content details p:has-text('生命值'),
.message-content details p:has-text('体力值'),
.message-content details p:has-text('晋升进度') {
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: 0.5px;
}

/* -------- 隐藏信息观测组件 -------- */
.observe-wrap-v2 {
    display: inline-block;
    position: relative;
    margin: 4px 0;
    cursor: pointer;
    outline: none;
}

.secret-trigger-v2 {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(90deg,
        rgba(139, 0, 0, 0.25),
        rgba(139, 0, 0, 0.1));
    border: 1px dashed #8b0000;
    border-radius: 3px;
    color: #ff6b6b;
    font-size: 12px;
    letter-spacing: 0.05em;
    transition: all 0.3s;
    user-select: none;
}

.secret-trigger-v2:hover {
    background: linear-gradient(90deg,
        rgba(204, 26, 26, 0.35),
        rgba(204, 26, 26, 0.15));
    border-color: #cc1a1a;
    color: #ff8888;
    box-shadow: 0 0 12px rgba(204, 26, 26, 0.4);
}

.secret-popup-v2 {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    max-width: 420px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #0a0e14 0%, #0f1419 100%);
    border: 1px solid #cc1a1a;
    border-left: 3px solid #cc1a1a;
    border-radius: 2px;
    color: #d8e0e8;
    font-size: 13px;
    line-height: 1.6;
    letter-spacing: 0.02em;
    z-index: 100;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 8px 32px rgba(204, 26, 26, 0.25),
        0 20px 60px rgba(0, 0, 0, 0.8);
    animation: popup-reveal 0.3s ease-out;
}

.secret-popup-v2::before {
    content: '◣ CLASSIFIED';
    display: block;
    color: #cc1a1a;
    font-size: 9px;
    letter-spacing: 0.3em;
    font-family: 'Consolas', 'Courier New', monospace;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(204, 26, 26, 0.4);
}

.observe-wrap-v2:hover .secret-popup-v2,
.observe-wrap-v2:focus .secret-popup-v2,
.observe-wrap-v2:focus-within .secret-popup-v2 {
    display: block;
}

@keyframes popup-reveal {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -------- 记忆区专属样式 -------- */
.message-content details > details {
    margin: 8px 0;
    border-left: 2px solid #3d8bde;
}

.message-content details > details[open] {
    border-left-color: #5eb3ff;
}

/* 星记忆表格 */
.message-content table {
    width: calc(100% - 32px);
    margin: 10px 16px;
    border-collapse: collapse;
    font-size: 12px;
    background: rgba(10, 14, 20, 0.6);
    border: 1px solid #222a34;
}

.message-content th {
    background: linear-gradient(180deg, #1a2230 0%, #0f1620 100%);
    color: #5eb3ff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 2px solid #3d8bde;
}

.message-content td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(34, 42, 52, 0.6);
    color: #b8c0c8;
    vertical-align: top;
}

.message-content tr:hover td {
    background: rgba(94, 179, 255, 0.04);
    color: #d8e0e8;
}

.message-content tr:last-child td {
    border-bottom: none;
}

/* -------- 推荐行动 -------- */
.message-content > p:last-of-type,
.message-content ol,
.message-content ul {
    margin: 16px 20px;
}

/* 匹配 A. B. C. D. E. 开头的推荐行动 */
.message-content p {
    transition: all 0.2s;
}

/* -------- 小标题与特殊标记 -------- */
.message-content strong {
    color: #e8eef4;
    font-weight: 600;
}

.message-content em {
    color: #d8b4ff;
    font-style: italic;
}

/* 对话颜色（如果使用了引号） */
.message-content .male-speech {
    color: #7dc8ff;
    text-shadow: 0 0 4px rgba(125, 200, 255, 0.3);
}

.message-content .female-speech {
    color: #ff9ec7;
    text-shadow: 0 0 4px rgba(255, 158, 199, 0.3);
}

/* -------- 特殊：十字瞳孔装饰点 -------- */
.message-content summary::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background:
        linear-gradient(to bottom, transparent 40%, #cc1a1a 40%, #cc1a1a 60%, transparent 60%),
        linear-gradient(to right, transparent 40%, #cc1a1a 40%, #cc1a1a 60%, transparent 60%);
    opacity: 0.5;
    transition: all 0.3s;
}

.message-content details[open] > summary::after {
    opacity: 1;
    box-shadow: 0 0 8px rgba(204, 26, 26, 0.6);
}

/* -------- 推荐行动列表美化 -------- */
.message-content p:has-text('【推荐行动】') + * {
    background: linear-gradient(90deg, rgba(139, 0, 0, 0.05), transparent);
}

/* -------- 滚动条美化 -------- */
.message-content ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.message-content ::-webkit-scrollbar-track {
    background: #0a0e14;
}

.message-content ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b0000, #cc1a1a);
    border-radius: 3px;
}

.message-content ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #cc1a1a, #ff3333);
}

/* -------- 移动端适配 -------- */
@media (max-width: 768px) {
    .message-content {
        margin: 10px;
        font-size: 13px;
    }

    .message-content p {
        margin: 10px 14px;
    }

    .message-content details {
        margin: 8px 12px;
    }

    .message-content blockquote {
        margin: 10px 12px;
        padding: 12px 14px;
        font-size: 12px;
    }

    .message-content summary {
        padding: 10px 14px;
        font-size: 12px;
    }

    .message-content table {
        font-size: 11px;
        margin: 8px 10px;
        width: calc(100% - 20px);
    }

    .message-content th,
    .message-content td {
        padding: 6px 8px;
    }

    .secret-popup-v2 {
        min-width: 220px;
        max-width: 300px;
        font-size: 12px;
    }

    .message-content::after {
        display: none;
    }
}

/* -------- 加载进入动画 -------- */
.message-content {
    animation: tactical-boot 0.6s ease-out;
}

@keyframes tactical-boot {
    0% {
        opacity: 0;
        transform: translateY(10px);
        filter: brightness(0.3) blur(4px);
    }
    60% {
        filter: brightness(1.2) blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: brightness(1) blur(0);
    }
}

/* -------- 各级details层级视觉区分 -------- */
/* 一级：玩家档案/交互对象/世界信息 → 血红 */
.message-content > details {
    border-left-color: #8b0000;
}

/* 二级：星记忆配置/星记忆区 → 冷蓝 */
.message-content > details > details {
    border-left-color: #3d8bde;
}

/* 特殊：思维链用幽紫标记 */
.message-content > details:first-of-type {
    border-left-color: #9d5ce8;
    background: linear-gradient(180deg, rgba(24, 18, 32, 0.95) 0%, rgba(16, 12, 22, 0.95) 100%);
}

.message-content > details:first-of-type > summary::before {
    color: #9d5ce8;
}

.message-content > details:first-of-type[open] > summary::before {
    color: #c58fff;
}

.message-content > details:first-of-type:hover {
    box-shadow:
        -2px 0 12px rgba(157, 92, 232, 0.25),
        0 4px 20px rgba(0, 0, 0, 0.4);
}