/* ============================================================
   Mission Scene – Optimized & organized
   ============================================================ */

/* ---------- Container & visibility ---------- */
.mission-body.is-playing {
    position: absolute;
    inset: 0;
}

.mission-scene-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: none;
}

.mission-scene-container.is-on {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mission-list.is-hidden {
    display: none !important;
}

/* ---------- Layers ---------- */
.ms-dim {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ms-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transition: opacity 0.3s ease, filter 1s ease;
}

.ms-bg.is-on {
    display: block;
}

.mission-scene-container.is-shake {
    animation: ms-shake 0.45s ease;
}

.ms-rain {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 7;
}

.ms-flash {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 7;
    background: #fff;
}

.ms-flash.is-on {
    opacity: 0.85;
}

.ms-nv {
    position: absolute;
    inset: 0;
    z-index: 7;
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 255, 100, 0.25);
    transition: opacity 0.12s ease;
}

.ms-nv.is-on {
    opacity: 1;
}

/* ---------- Opening typewriter ---------- */
.ms-type {
    color: #fff;
    padding: 10px 20px;
    line-height: 1.55;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    display: none;
    text-align: left;
    width: 85%;
    max-width: 480px;
    box-sizing: border-box;
}

.ms-type.is-on {
    display: block;
}

/* ---------- Hint text ---------- */
.ms-hint {
    position: absolute;
    color: #fff;
    padding: 10px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    background: rgb(0 0 0 / 30%);
    height: 100%;
    width: 100%;
    display: none;
    line-height: 1.55;
    text-align: left;
    box-sizing: border-box;
}

.ms-hint.is-on {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---------- Dialogue layer ---------- */
.ms-dlg {
    width: 100%;
    z-index: 7;
    display: none;
}

.ms-dlg.is-on {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-top: auto;
}

.ms-chars {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    height: 300px;
}

.ms-slot {
    flex: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.ms-slot-c {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.ms-char {
    height: 100%;
    object-fit: contain;
    display: none;
    opacity: 0;
    transition: opacity 0.8s ease-out, filter 0.4s ease;
}

.ms-char.is-on {
    display: block;
    opacity: 1;
}

.ms-char.is-dim {
    filter: grayscale(1);
}

.ms-char.is-bright {
    filter: grayscale(0);
}
/* ---------- End / transition text ---------- */
.ms-end {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 1.2s ease;
}

.ms-end.is-on {
    display: flex;
}

.ms-end.is-show {
    opacity: 1;
}

.ms-end-msg {
    color: #fff;
    text-align: center;
    padding: 10px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    max-width: 90%;
}

/* ---------- Point indicator ---------- */
.ms-point {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 7;
    width: 14px;
    pointer-events: none;
    display: none;
    opacity: 0.9;
    animation: ms-next-bounce 1.2s ease-in-out infinite;
}

.ms-point.is-on {
    display: block;
}

/* ---------- Fade overlay (chuyển phase) ---------- */
.ms-fade {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.ms-fade.is-on {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Chapter dots (mission card) ---------- */
.chapter.npc-dots {
    position: absolute;
    bottom: 5px;
    left: 5px;
    height: 14px;
}

.chapter .npc-dot {
    width: 100%;
    height: 100%;
}