* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f0e6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Noto Sans", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.reader-container {
    max-width: 600px;
    width: 100%;
    background: #fffcf8;
    border-radius: 32px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid #e2d8cc;
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 800px;
}

.location-bar {
    background: #f0ebe3;
    padding: 12px 20px;
    font-size: 14px;
    color: #8b7a66;
    border-bottom: 1px solid #e2d8cc;
    text-align: center;
    flex-shrink: 0;
}

.info-bar {
    background: #f0ebe3;
    padding: 6px 20px;
    font-size: 13px;
    color: #6b5e4e;
    border-bottom: 1px solid #e2d8cc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.identity-span, .stats-span {
    white-space: nowrap;
}

.friends-bar {
    background: #f0ebe3;
    padding: 4px 20px;
    font-size: 12px;
    color: #6b5e4e;
    border-bottom: 1px solid #e2d8cc;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    flex-shrink: 0;
}

.story-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 0 20px;
    background: #fffcf8;
    position: relative; 
}

.story-text {
    color: #2c2a28;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.action-area {
    padding: 12px 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fffcf8;
}

.option-btn {
    background: #f0ebe3;
    border: 1px solid #d9cebf;
    color: #5c4e3d;
    padding: 12px 16px;
    border-radius: 48px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: 0.1s;
    width: 100%;
}
.option-btn:active {
    transform: scale(0.98);
    background: #e6dfd5;
}

.path-map {
    background: #faf7f2;
    padding: 8px 20px;
    font-size: 11px;
    color: #b8ab9a;
    white-space: nowrap;
    overflow-x: auto;
    border-top: 1px solid #efe5da;
    font-family: monospace;
    flex-shrink: 0;
}

.utility-bar {
    display: flex;
    justify-content: space-evenly;
    padding: 12px 20px 20px;
    gap: 12px;
    border-top: 1px solid #efe5da;
    background: #fffcf8;
    flex-shrink: 0;
}
.util-btn {
    background: #fff;
    border: 1px solid #d9cebf;
    padding: 8px 12px;
    border-radius: 40px;
    color: #8b7a66;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
    text-align: center;
}
.util-btn:active {
    background: #f5efe8;
}

/* 营地按钮特殊样式 */
#campBtn {
    color: #8b6914;
}

.combat-log { max-height: 300px; overflow-y: auto; margin-bottom: 12px; }

/* 模态框背景 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 模态框内容 */
.modal-content {
    background-color: #fffcf8;
    border-radius: 20px;
    width: 80%;
    max-width: 400px;
    border: 1px solid #d9cebf;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-family: inherit;
}

.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2d8cc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #5c4e3d;
}

.modal-header .close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #8b7a66;
}

.modal-header .close:hover {
    color: #3a2e22;
}

.inventory-list {
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.inventory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #efe5da;
}

.inventory-item:last-child {
    border-bottom: none;
}

.item-name {
    font-size: 16px;
    color: #2c2a28;
}

.item-quantity {
    font-size: 14px;
    color: #8b7a66;
    margin-left: 8px;
}

.item-use-btn {
    background-color: #f0ebe3;
    border: 1px solid #d9cebf;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #5c4e3d;
}

.item-use-btn:active {
    background-color: #e6dfd5;
}

/* 技能按钮网格布局 */
.skill-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.skill-buttons .option-btn {
    width: 100%;
    margin: 0;
    padding: 10px 0;
    font-size: 14px;
}
@media (max-width: 480px) {
    .skill-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .skill-buttons .option-btn {
        font-size: 12px;
        padding: 8px 0;
    }
}

/* 浮动提示 */
.game-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 2000;
    pointer-events: none;
    animation: fadeOut 2s ease forwards;
}
@keyframes fadeOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* 信息弹出面板（复modal样式，居中） */
#infoPopup {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#infoPopup .modal-content {
    width: 80%;
    max-width: 400px;
    max-height: 80vh;
}

#infoPopup .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f0ebe3;
    border-bottom: 1px solid #e2d8cc;
    border-radius: 20px 20px 0 0;
}

#infoPopup .modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #3a2e22;
}


/* 伙伴列表样式 */
.friend-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #efe5da;
}
.friend-checkbox-item input {
    margin-right: 12px;
    transform: scale(1.2);
}
.friend-name {
    flex: 1;
}
.friend-level {
    color: #8b7a66;
    font-size: 12px;
}

/* 地图地点列表 */
.map-location {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin: 4px 0;
    background: #f0ebe3;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}
.map-location:hover {
    background: #e6dfd5;
}

.utility-bar {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    padding: 12px 20px 20px;
    gap: 12px;
    border-top: 1px solid #efe5da;
    background: #fffcf8;
    flex-shrink: 0;
}
.util-btn {
    background: #fff;
    border: 1px solid #d9cebf;
    padding: 8px 12px;
    border-radius: 40px;
    color: #8b7a66;
    font-size: 13px;
    cursor: pointer;
    flex: 1 0 auto;
    text-align: center;
    min-width: 70px;
}
@media (max-width: 480px) {
    .util-btn {
        font-size: 11px;
        padding: 6px 8px;
        min-width: 60px;
    }
}

.story-box {
    overflow-anchor: none;
}
.combat-log {
    overflow-anchor: none;
}

/* ==================== 状态页折叠面板 ==================== */
details {
    margin-top: 12px;
}

details > summary {
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}

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

details[open] > summary {
    color: #b35a2a;
}

/* ==================== 危险操作按钮 ==================== */
button.map-location[style*="color:#c0392b"] {
    background: #fff0f0;
    border-color: #e8a0a0;
}

button.map-location[style*="color:#c0392b"]:active {
    background: #ffe0e0;
    transform: scale(0.98);
}

/* 装备详情弹窗样式 */
#equipDetailContent .equip-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}
#equipDetailContent .equip-meta {
    font-size: 14px;
    color: #8b7a66;
    margin-bottom: 12px;
}
#equipDetailContent .equip-stats {
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid #e2d8cc;
}
#equipDetailContent .equip-stats div {
    padding: 2px 0;
}
#equipDetailContent .equip-effects {
    margin: 8px 0;
    padding: 8px 0;
    border-top: 1px solid #e2d8cc;
}
#equipDetailContent .equip-effects div {
    padding: 2px 0;
    color: #2c6b2c;
}
#equipDetailContent .equip-quality-normal { color: #8b7a66; }
#equipDetailContent .equip-quality-special { color: #2a7a9a; }
#equipDetailContent .equip-quality-rare { color: #c8a83a; }

/* 背包中装备名称带品质颜色 */
.inventory-item .item-name.quality-normal { color: #8b7a66; }
.inventory-item .item-name.quality-special { color: #2a7a9a; }
.inventory-item .item-name.quality-rare { color: #c8a83a; }

.story-text {
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform: translateY(15px);
    opacity: 0;
}
.story-text.slide-in {
    transform: translateY(0);
    opacity: 1;
}