ai {
    /* Custom properties for theme */
    --c-primary: #a31a1a; /* Main accent - user's original */
    --c-secondary: #ff4d4d; /* Brighter accent - user's original */
    --c-bg-dark: #0a0a0a; /* Deepest background */
    --c-bg-medium: #1e1e1e; /* Card/section background */
    --c-text-light: #d1d1d1; /* Main text */
    --c-text-medium: #b0b0b0; /* Secondary text */
    --c-border-subtle: #333; /* Subtle borders */
    --c-indicator-high: #ff4d4d; /* High value indicator */
    --c-indicator-medium: #d1b000; /* Medium value indicator (e.g., for defense) */
    --c-indicator-low: #555; /* Low value indicator */

    display: block;
    position: relative;
    padding: 10px;
    margin-bottom: 15px;
    background: var(--c-bg-dark);
    border-radius: 8px;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--c-text-light);
    line-height: 1.6;
    font-size: 15px;
    overflow: hidden; /* For pseudo-element borders */
    box-shadow: 0 0 10px rgba(var(--c-primary), 0.2); /* Soft glow */
}

/* Pseudo-element for a subtle, pulsing border effect */
ai::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, var(--c-secondary), var(--c-primary));
    z-index: -1;
    border-radius: 10px;
    filter: blur(5px);
    opacity: 0.3;
    animation: ai-pulse 4s infinite alternate ease-in-out;
}

@keyframes ai-pulse {
    0% { opacity: 0.2; transform: scale(0.99); }
    100% { opacity: 0.4; transform: scale(1.01); }
}

/* Header styling */
ai hd {
    display: block;
    font-size: 1.2em; /* ~18px */
    font-weight: bold;
    color: var(--c-secondary);
    text-align: center;
    padding: 10px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--c-border-subtle);
    text-shadow: 0 0 5px rgba(var(--c-secondary), 0.5);
    letter-spacing: 1px;
}

/* Article/main content */
ai article {
    padding: 5px 10px;
    margin-bottom: 15px;
    color: var(--c-text-light);
}

ai p {
    margin-bottom: 1em;
}

/* Details/Summary for status panel */
ai details {
    background: var(--c-bg-medium);
    border: 1px solid var(--c-border-subtle);
    border-radius: 6px;
    margin-top: 15px;
    overflow: hidden; /* Ensure rounded corners for content */
}

ai summary {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    font-weight: bold;
    color: var(--c-secondary);
    background: var(--c-bg-medium);
    cursor: pointer;
    border-bottom: 1px solid var(--c-border-subtle);
    user-select: none;
    transition: background 0.2s ease;
}

ai summary:hover {
    background: #2a2a2a;
}

ai details[open] summary {
    border-bottom-color: transparent; /* Hide border when open */
    background: #2a2a2a;
}

ai summary::before {
    content: '▶'; /* Right arrow */
    margin-right: 8px;
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

ai details[open] summary::before {
    content: '▼'; /* Down arrow */
    transform: rotate(90deg); /* Visual rotation for a smoother transition */
}

/* Status panel content */
ai details p {
    padding: 8px 15px;
    margin-bottom: 0; /* Reset default p margin */
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 8px 15px; /* Gap between items */
    border-bottom: 1px dashed rgba(var(--c-border-subtle), 0.5); /* Subtle separator */
    font-size: 0.9em; /* Smaller font for status details */
    color: var(--c-text-medium);
    align-items: center;
}

ai details p:last-of-type {
    border-bottom: none;
}

ai details p[t]::before { /* Section titles like "基本", "数值" */
    content: attr(t);
    font-weight: bold;
    color: var(--c-primary);
    margin-right: 10px;
    flex-basis: 100%; /* Make title take full width on new line */
    font-size: 1em;
    margin-bottom: 5px;
}

ai f { /* Primary info like Name, Age */
    font-weight: bold;
    color: var(--c-text-light);
    display: inline-block;
}

ai d { /* Detail info */
    display: inline-block;
    white-space: nowrap; /* Prevent breaking in the middle of a detail item */
}

/* Level/Value indicator styles */
ai d[lv] {
    position: relative;
    padding-left: 15px; /* Space for the indicator dot */
}

ai d[lv]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--c-indicator-low); /* Default */
    box-shadow: 0 0 5px rgba(var(--c-indicator-low), 0.5);
}

/* Specific color for high values (e.g., Shame) */
ai d[lv="85"]::before,
ai d[lv="90"]::before { /* Assuming 85 and 90 are "high" */
    background-color: var(--c-indicator-high);
    box-shadow: 0 0 8px rgba(var(--c-indicator-high), 0.7);
}

/* Specific color for low/medium values (e.g., Trust) */
ai d[lv="20"]::before {
    background-color: var(--c-indicator-medium); /* Or a dimmer primary */
    box-shadow: 0 0 5px rgba(var(--c-indicator-medium), 0.5);
}


/* Navigation/Action choices */
ai nav {
    display: flex;
    flex-direction: column; /* Stack buttons vertically */
    gap: 10px;
    margin-top: 20px;
    padding: 0 10px;
}

ai b { /* Action buttons */
    display: block;
    padding: 12px 15px;
    background: var(--c-bg-medium);
    border: 1px solid var(--c-border-subtle);
    border-radius: 6px;
    color: var(--c-text-light);
    text-align: center;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

ai b:hover {
    background: var(--c-bg-dark);
    border-color: var(--c-primary);
    color: var(--c-secondary);
    box-shadow: 0 0 10px rgba(var(--c-primary), 0.4);
    transform: translateY(-2px);
}

ai b::before { /* Decorative corner or line */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--c-primary);
    transition: width 0.2s ease;
}

ai b:hover::before {
    width: 100%;
    opacity: 0.2;
}

ai b[t]::after { /* Action number */
    content: attr(t);
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    font-size: 0.8em;
    font-weight: bold;
    color: rgba(var(--c-text-light), 0.5);
    transition: color 0.2s ease;
}

ai b:hover[t]::after {
    color: var(--c-secondary);
}

/* Remove default padding from p inside details as it's handled by the p itself */
ai details p:not([t]) {
    padding-left: 15px;
    padding-right: 15px;
}

/* Small adjustments for really small screens */
@media (max-width: 480px) {
    ai {
        padding: 8px;
        font-size: 14px;
    }
    ai hd {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    ai summary {
        padding: 8px 12px;
        font-size: 0.95em;
    }
    ai details p {
        padding: 6px 12px;
        font-size: 0.85em;
        gap: 5px 10px;
    }
    ai nav {
        gap: 8px;
        padding: 0 8px;
    }
    ai b {
        padding: 10px 12px;
        font-size: 0.9em;
    }
}
