/* 1. 全局与木质底板容器 */
.ui-frame {
    max-width: 850px;
    margin: 20px auto;
    background-color: #Fdf8e4; /* 羊皮纸底色 */
    background-image: url('data:image/svg+xml;utf8,%3Csvg width="100" height="100" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noise"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100" height="100" filter="url(%23noise)" opacity="0.05"/%3E%3C/svg%3E'); /* 粗糙羊皮纸质感 */
    color: #3e2723;
    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    border: 3px solid #8B5A2B;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), inset 0 0 40px rgba(139, 90, 43, 0.1);
    padding: 20px;
    line-height: 1.6;
    font-size: 15px;
}

/* 2. 折叠面板 (木牌按钮化) */
.ui-frame details {
    margin-bottom: 15px;
    background: #fffdf5; /* 内部内容底色 */
    border: 1px solid #d7ccc8;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ui-frame details[open] {
    padding-bottom: 10px;
}

/* 升级为整行宽度的木质按钮 */
.ui-frame summary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 18px;
    background: linear-gradient(180deg, #A0522D 0%, #8B5A2B 100%);
    color: #fff;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    border-bottom: 2px solid #5D4037;
    transition: all 0.2s ease;
    user-select: none;
    letter-spacing: 1px;
}

/* 隐藏默认箭头 (兼容各浏览器) */
.ui-frame summary::-webkit-details-marker { display: none; }
.ui-frame summary { list-style: none; }

/* 按钮悬停效果 */
.ui-frame summary:hover {
    background: linear-gradient(180deg, #bcaaa4 0%, #8D6E63 100%);
    color: #fff;
}

.ui-frame details[open] > summary {
    border-bottom: 2px solid #6d4c41;
    margin-bottom: 10px;
}

/* 3. 面板网格排版系统 (视觉整洁的核心) */
.ui-frame .panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 15px;
}

.ui-frame .panel-grid div {
    background: rgba(215, 204, 200, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid #8B5A2B;
}

.ui-frame .panel-grid .full-width {
    grid-column: span 2;
}

.ui-frame hr {
    border: none;
    border-top: 1px dashed #bcaaa4;
    margin: 15px;
}

/* 4. Galgame 对话系统 */
.ui-frame .gal-box {
    display: flex;
    align-items: flex-start;
    background: #fff;
    border: 2px solid #bcaaa4;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}

.ui-frame .gal-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #A0522D;
    background-color: #3e2723; /* 无图片时的纯黑剪影底色 */
    margin-right: 15px;
    flex-shrink: 0;
}

/* 模拟剪影效果：当没有src或图片加载失败时 */
.ui-frame .gal-avatar[src=""] {
    background-image: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffffff"%3E%3Cpath d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/%3E%3C/svg%3E');
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.8;
}

.ui-frame .gal-content {
    flex-grow: 1;
}

.ui-frame .gal-name {
    display: inline-block;
    font-weight: bold;
    color: #fff;
    background-color: #d32f2f; /* 妖尾热血红 */
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 5px;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.ui-frame .gal-dialogue {
    margin: 0;
    font-size: 16px;
    color: #3e2723;
}

/* 5. Tooltip 悬浮词机制 */
.ui-frame .tooltip {
    position: relative;
    cursor: help;
    color: #1976d2; /* 魔法蓝 */
    font-weight: bold;
    border-bottom: 1px dashed #1976d2;
    transition: color 0.2s;
}

.ui-frame .tooltip:hover {
    color: #d32f2f;
    border-bottom-color: #d32f2f;
}

/* 悬浮框样式 */
.ui-frame .tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 120%; /* 浮在文字上方 */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 250px; /* 防止过长 */
    background: #3e2723;
    color: #fdf6e3;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: normal;
    white-space: normal; /* 允许换行 */
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 100;
    pointer-events: none; /* 防止鼠标干扰 */
}

/* 小三角形指针 */
.ui-frame .tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #3e2723 transparent transparent transparent;
    z-index: 100;
}

/* 6. 系统提示信息 */
.ui-frame .sys-msg {
    text-align: center;
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #fbc02d;
    padding: 8px;
    margin: 15px auto;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    width: 80%;
    box-shadow: 0 2px 8px rgba(251, 192, 45, 0.2);
}

/* 7. 其他小元素排版 */
.ui-frame p {
    margin: 10px 15px;
    text-indent: 2em; /* 首行缩进 */
}

.ui-frame ul {
    margin: 5px 15px 15px 30px;
    padding: 0;
    line-height: 1.8;
}