/*css\components\dialog.css*/
/* ===== NPC 底部对话框（外观对齐天赋石面板 #gemPanel / css/pages/TFS.css） ===== */
#bottomDialog {
    position: fixed;
    bottom: 350px;
    left: 53%;
    transform: translateX(-50%) translateY(20px);
    width: 680px;
    height: auto;
    background: #332b20;
    border: 3px solid #c0b380;
    border-radius: 8px;
    padding: 10px;
    font-family: "微软雅黑", SimSun;
    z-index: 5000;
    box-shadow: 0 0px 30px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    gap: 16px;
    box-sizing: border-box;
}

#bottomDialog.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#bottomDialog .dialog-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* 左侧画像 */
#bottomDialog .dialog-left {
    flex-shrink: 0;
    width: 160px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

#bottomDialog .dialog-left img {
    max-width: 160px;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

/* 右侧 */
#bottomDialog .dialog-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#bottomDialog .dialog-top {
    margin-bottom: 24px;
    min-height: 60px;
}

#bottomDialog .dialog-name {
    color: #ffffff;
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 6px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

/* 对白：超出就滚轮，但不显示滚动条 */
#bottomDialog .dialog-message {
    color: #e9e9e9;
    font-size: 16px;
    line-height: 1.6;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: pre-line;
}

#bottomDialog .dialog-message::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* 还有下一句时可点击：右下角闪烁三角提示 */
#bottomDialog .dialog-message.has-next {
    cursor: pointer;
}

#bottomDialog .dialog-message.has-next::after {
    content: ' ▼';
    color: #eed442;
    font-size: 16px;
    animation: dialogNextBlink 1.2s ease-in-out infinite;
}

@keyframes dialogNextBlink {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}

/* 任务区：固定高度，任务多了内部滚轮（不显示滚动条），绝不撑破对话框 */
#bottomDialog .dialog-task {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid #4a3a2a;
    border-radius: 6px;
    padding: 8px 12px;
    overflow: hidden;
}

#bottomDialog .dialog-task-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 124px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#bottomDialog .dialog-task-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

#bottomDialog .dialog-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    background: #2b1b0f;
    border: 1px solid #4a3a2a;
    border-radius: 4px;
    color: #ddd;
    font-size: 16px;
}

#bottomDialog .dialog-task-item .task-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#bottomDialog .dialog-task-btn {
    padding: 3px 12px;
    background: linear-gradient(to bottom, #ff9900, #ff6600);
    border: 1px solid #ffd700;
    border-radius: 4px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
}

#bottomDialog .dialog-task-btn:hover {
    filter: brightness(1.1);
}

/* 任务奖励行：夹在对话内容与文字按钮之间（选中任务时才有） */
#bottomDialog .dialog-reward {
    padding: 4px 2px 4px 10px;
    color: #eed442;
    font-size: 15px;
    letter-spacing: 0.5px;
}

/* 任务文字按钮：任务名金色 + （已完成）绿色 */
#bottomDialog .dialog-option-task {
    color: #eed442;
}

#bottomDialog .dialog-option-name {
    color: #eed442;
}

#bottomDialog .dialog-option-done {
    color: #4ad24a;
}

/* 按钮区 */
#bottomDialog .dialog-buttons {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
}

#bottomDialog .dialog-buttons::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, rgba(192, 179, 128, 0.1), rgba(192, 179, 128, 0.8), rgba(192, 179, 128, 0.1));
    pointer-events: none;
}


#bottomDialog .dialog-option {
    margin-bottom: 10px;
    width: 400px;
    padding: 2px 2px 2px 10px;
    border-radius: 6px;
    color: #eed442;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
}

#bottomDialog .dialog-option:hover {
    background: linear-gradient(to right, #ecdfa834, #ece9cb00);
}

/* NPC 对话遮罩 */
.npc-dialog-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: none;
}

.npc-dialog-mask.show {
    display: block;
    pointer-events: auto;
}

/* ===================== 全局弹窗(Toast/Dialog) ===================== */
/* 容器：铺满屏幕，只做坐标参考，不参与排布 */
.game-toast {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.game-toast.hidden {
    display: none;
}

.game-toast-box {
    transform: translateX(-50%);
    pointer-events: none;
    position: absolute;
    left: 50%;
    background: transparent;
    animation: toastFadeOut 2s ease-in-out forwards;
    top: 250px;
}

.game-toast-content {
    padding: 0;
    color: #f5bb3f;
    font-size: 25px;
    text-align: center;
    line-height: 1.8;
    background: transparent;
    white-space: pre-line;
    text-shadow: 1px 1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, -1px -1px 0 #000, 2px 0px 0 #000, -2px 0px 0 #000, 0px 2px 0 #000, 0px -2px 0 #000;
}

/* ⚠️ 关键：keyframes 里必须带上 translateX(-50%)
   CSS 动画运行期间会「完全接管」transform 属性，会覆盖掉 .game-toast-box 上的
   translateX(-50%)（animation 的层叠优先级高于普通声明，连 inline style 也压得住）。
   若只写 translateY，元素左边缘就落在 50% 处 → 看起来偏右半个宽度，且文字越长偏得越多。 */
@keyframes toastFadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50px);
    }
}

/* ===================== 奖励浮窗（任务达成 / 自动发奖） ===================== */
/* 会消失的面板：一行一个奖励。复用 #gameToast 容器，无需额外 DOM */
.reward-toast-box {
    position: absolute;
    left: 50%;
    top: 260px;
    min-width: 240px;
    padding: 14px 34px;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid #c9a227;
    border-radius: 10px;
    box-shadow: 0 0 14px rgba(201, 162, 39, 0.55);
    pointer-events: none;
    animation: rewardFloatOut 2.8s ease-in-out forwards;
}

.reward-toast-title {
    color: #ffd45e;
    font-size: 24px;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
}

.reward-toast-row {
    color: #ffffff;
    font-size: 21px;
    text-align: center;
    line-height: 1.75;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
    /* 🔴 主人 2026-10-04：一种道具占一行、垂直排列（原来多行挤在一起不清爽） */
    display: block;
    white-space: nowrap;
}

/* 物品名（按品质上色，由 JS 内联 style.color 写入） */
.reward-toast-item {
    font-weight: bold;
}

/* 数量：保持默认白色，不随品质变色 */
.reward-toast-count {
    color: #ffffff;
}

/* ⚠️ 同 toastFadeOut：keyframes 必须带 translateX(-50%)，否则动画期间水平居中失效 */
@keyframes rewardFloatOut {
    0% {
        opacity: 0;
        transform: translate(-50%, 12px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -46px);
    }
}

.game-dialog {
    position: fixed;
    z-index: 999999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.game-dialog.hidden {
    display: none;
}

.game-dialog-box {
    width: 400px;
    background: #2b1b0f;
    border: 3px solid #ffd700;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.game-dialog-header {
    background: #3a2414;
    border-bottom: 2px solid #ffd700;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-dialog-header span {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
}

.game-dialog-close {
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.game-dialog-content {
    padding: 25px 20px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    line-height: 1.5;
}

.game-dialog-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 0 20px 20px 20px;
}

/*通用弹窗-按钮*/
.game-dialog-btn {
    width: 100px;
    height: 36px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.game-dialog-confirm {
    background: linear-gradient(to bottom, #ff9900, #ff6600);
    border: 2px solid #ffd700;
    color: #fff;
}

.game-dialog-cancel {
    background: #3a2f24;
    border: 2px solid #c0b380;
    color: #ffd700;
}

/* ============================================================
   通用「数量输入」弹窗（批量使用 / 批量出售 / 批量兑换 共用）
   —— 结构由 dialog.js showQuantityDialog 生成，样式全在这里
   ============================================================ */
.qty-dialog {
    text-align: center;
    padding: 6px 0 2px;
}

.qty-dialog-desc {
    font-size: 18px;
    color: #f5e6c8;
    margin-bottom: 14px;
    line-height: 1.5;
}

.qty-dialog-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qty-dialog-input {
    width: 190px;
    height: 42px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #ffe9a8;
    background: #1b1510;
    border: 2px solid #c0b380;
    border-radius: 6px;
    outline: none;
}

.qty-dialog-input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 6px rgba(255, 215, 0, .5);
}

.qty-dialog-max {
    width: 74px;
    height: 42px;
    font-size: 19px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(to bottom, #ff9900, #ff6600);
    border: 2px solid #ffd700;
    border-radius: 6px;
    cursor: pointer;
}

.qty-dialog-hint {
    margin-top: 10px;
    font-size: 15px;
    color: #b9a887;
}
/* 数量弹窗：越界红字（金币不足等） */
.qty-dialog-warn {
    margin-top: 8px;
    min-height: 20px;
    color: #ff5555;
    font-size: 13px;
    text-align: center;
}