/* ===== Back Button (← 左上角) ===== */
.system-back-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 92;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(20, 15, 40, 0.75);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    cursor: pointer;
    pointer-events: auto;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.system-back-btn:hover {
    background: rgba(30, 20, 60, 0.85);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}
.system-back-btn.hidden {
    display: none;
}

/* ===== System Menu (⚙ 右下角) ===== */
.system-menu {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 92;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    pointer-events: none;
}

.system-menu.hidden {
    display: none;
}

.system-menu-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(30, 20, 50, 0.7);
    color: #ccc;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s, color 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    line-height: 1;
    flex-shrink: 0;
}

.system-menu-btn:hover {
    background: rgba(60, 40, 90, 0.95);
    color: #fff;
    transform: scale(1.1);
}

.system-clock {
    white-space: nowrap;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(30, 25, 45, 0.65);
    padding: 2px 10px;
    border-radius: 8px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.system-menu-panel {
    position: absolute;
    bottom: 40px;
    right: 0;
    min-width: 160px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: rgba(30, 25, 45, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 8px 0;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.system-menu-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.system-menu-group {
    padding: 0 6px;
}

.system-menu-group + .system-menu-group {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    padding-top: 4px;
}

.system-menu-group-title {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    padding: 2px 8px 2px;
    letter-spacing: 0.5px;
}

.system-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #ddd;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sm-item-icon {
    width: 16px; height: 16px;
    opacity: 0.7;
    filter: brightness(1.2);
    flex-shrink: 0;
}
.system-menu-item:hover .sm-item-icon { opacity: 1; }
.sm-gear-icon {
    width: 18px; height: 18px;
    opacity: 0.85;
    filter: brightness(1.1);
}

.system-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.system-menu-item:active {
    background: rgba(255, 255, 255, 0.15);
}

/* ===== Save/Load Modal ===== */
.save-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: saveModalFadeIn 0.2s ease-out;
}

@keyframes saveModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.save-modal-panel {
    background: linear-gradient(145deg, #2a2240, #1e1833);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    width: 680px;
    max-width: 95%;
    max-height: 85%;
    max-height: min(85%, calc(100dvh - 40px));
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    animation: saveModalSlideIn 0.25s ease-out;
    overflow: hidden;
}

@keyframes saveModalSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.save-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.save-modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
}

.save-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 22px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.save-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Slot grid */
.save-slot-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px 20px 20px;
    overflow-y: auto;
}

.save-slot-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    position: relative;
    min-height: 100px;
}

.save-slot-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.save-slot-card:active {
    transform: translateY(0);
}

/* Empty slot */
.slot-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.3);
    gap: 6px;
}

.slot-empty-icon {
    font-size: 28px;
    opacity: 0.5;
}

.slot-empty-text {
    font-size: 13px;
}

/* Slot with data */
.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.slot-id {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: bold;
}

.slot-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.25);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.slot-delete-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
}

.slot-timestamp {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.slot-scene {
    font-size: 13px;
    color: #b8a9d4;
    margin-bottom: 8px;
}

.slot-preview {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.slot-preview-item {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Confirm dialog (inline) */
.slot-confirm {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 35, 0.95);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 2;
    animation: saveModalFadeIn 0.15s;
}

.slot-confirm-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-align: center;
}

.slot-confirm-buttons {
    display: flex;
    gap: 8px;
}

.slot-confirm-btn {
    padding: 5px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.slot-confirm-btn:hover {
    opacity: 0.85;
}

.slot-confirm-yes {
    background: #e76f8a;
    color: #fff;
}

.slot-confirm-no {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Toast notification inside modal */
.save-toast {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: #4a3;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    animation: saveToastIn 0.3s ease-out;
    pointer-events: none;
    z-index: 3;
}

.save-toast.error {
    background: #c44;
}

@keyframes saveToastIn {
    from { transform: translateX(-50%) translateY(10px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ===== Room Background Image ===== */
.room-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
}

/* ===== Girl Home Map (CSS fallback) ===== */
.ghm-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #2a1f3d, #1a1228);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.ghm-title {
    font-size: 22px;
    color: #e8d0f0;
    margin-bottom: 24px;
    text-shadow: 0 2px 8px rgba(180, 120, 220, 0.3);
}

.ghm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    max-width: 460px;
    width: 100%;
}

.ghm-room {
    background: linear-gradient(145deg, rgba(180, 120, 220, 0.15), rgba(140, 80, 180, 0.08));
    border: 1px solid rgba(180, 120, 220, 0.25);
    border-radius: 14px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.ghm-room:hover {
    background: linear-gradient(145deg, rgba(180, 120, 220, 0.28), rgba(140, 80, 180, 0.15));
    border-color: rgba(200, 150, 240, 0.45);
    transform: translateY(-3px);
}

.ghm-room:active {
    transform: translateY(0);
}

.ghm-room-wide {
    grid-column: 1 / -1;
}

.ghm-room-emoji {
    font-size: 32px;
}

.ghm-room-label {
    font-size: 14px;
    color: #d0b8e8;
}

/* ===== Asset Upload Choice Dialog ===== */
.asset-choice-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: saveModalFadeIn 0.2s ease-out;
}

.asset-choice-panel {
    background: linear-gradient(145deg, #2a2240, #1e1833);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    animation: saveModalSlideIn 0.25s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.asset-choice-title {
    font-size: 17px;
    font-weight: bold;
    color: #fff;
}

.asset-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.asset-choice-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #fff;
    font-size: 15px;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.asset-choice-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.asset-choice-btn:active {
    transform: translateY(0);
}

.asset-choice-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.asset-choice-cancel {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.asset-choice-cancel:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
}


