/* Side Panel */
.mv-side-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 5vw;
    /* Changed from 80px to 5vw */
    z-index: 10;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #000;
    /* Static Backgrounds for Anti-Flickering */
    background-color: var(--bg-side);
    /* Serves as Arrow Area BG */
    transition: background-color var(--transition-theme);
}

.mv-side-panel::before {
    display: none;
}

.mv-side-panel::after {
    display: none;
}

/* Persistent Background Layer */
.side-panel-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 0; /* Behind content */
    pointer-events: none;
}

.bg-no {
    width: 100%;
    aspect-ratio: 62 / 152.07; /* PC specific ratio from mv_sidebar_numPCx.svg */
    background-color: var(--color-black);
    border-bottom: 1px solid #000;
    flex-shrink: 0;
}

.bg-text {
    flex-grow: 1;
    background-color: #fff;
    border-bottom: 1px solid #000;
}

.bg-arrow {
    width: 100%;
    aspect-ratio: 1 / 1; /* Arrow area is always square on PC */
    background-color: var(--bg-side);
    transition: background-color var(--transition-theme);
    flex-shrink: 0;
}

.side-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    z-index: 1;
    transition: opacity var(--transition-theme), z-index 0s var(--transition-theme);
    pointer-events: none;
    text-decoration: none;
    /* Remove underline from the whole link area */
    /* Prevent clicks when hidden if needed */
}

/* Visibility Control based on Body Theme Class */
.theme-1 .content-1,
.theme-2 .content-2,
.theme-3 .content-3,
.theme-4 .content-4,
.theme-5 .content-5,
.theme-6 .content-6,
.theme-7 .content-7 {
    opacity: 1;
    z-index: 2;
    transition: opacity var(--transition-theme), z-index 0s;
    pointer-events: auto;
}

/* Top Part: No */
.side-no {
    background-color: transparent;
    color: white;
    padding: 0;
    /* Removed padding to fit image strictly */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-shrink: 0;
    border-bottom: 1px solid #000;
    /* Height is now determined by the image itself on PC */
    border-bottom: none;
}

.no-image,
.side-no picture {
    width: 100%;
    height: auto;
    display: block;
    /* Remove bottom gap */
}

/* Middle Part: Text */
.side-text-area {
    flex-grow: 1;
    background-color: transparent;
    /* Set background directly */
    color: var(--color-black);
    writing-mode: vertical-rl;
    text-orientation: upright;
    padding: 1em 0.75em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-jp);
    font-weight: 700;
    font-size: 1.9vw;
    /* 38% of 5vw container width */
    letter-spacing: 0.2vw;
    /* 38% of 5vw container width */
    letter-spacing: 0.2vw;
    border-bottom: none;
    /* Add border directly */
    white-space: nowrap;
    overflow: hidden;
}

.vertical-text {
    /* Ensure vertical rhythm */
    line-height: 1.5;
}

/* Bottom Part: Arrow */
.side-arrow {
    width: 100%;
    height: auto;
    /* Changed from 80px to auto */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    /* Uses container's background */
    color: var(--color-black);
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    /* Remove padding */
}

.arrow-icon,
.side-arrow picture {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* -----------------------------------------------
   PC Portrait Layout (Screen is taller than it is wide)
   ----------------------------------------------- */
@media (min-width: 768px) and (orientation: portrait) {
    .mv-side-panel {
        width: 8vw;
        /* Changed from 10vw to 8vw */
    }

    .side-text-area {
        font-size: 3vw;
        /* 38% of 8vw */
        letter-spacing: 0.3vw;
    }

    .bg-no {
        aspect-ratio: 62 / 152.07; /* PC specific ratio from mv_sidebar_numPCx.svg */
    }
}


/* -----------------------------------------------
   Smartphone Layout (Bottom Horizontal Bar)
   ----------------------------------------------- */
@media (max-width: 767px) {
    .mv-side-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: auto;
        width: 100%;
        height: 60px;
        /* Reduced height for SP */
        flex-direction: row;
        border-left: none;
        border-top: 1px solid #000;
        z-index: 50;
        /* Ensure on top of main visual */
    }

    .mv-side-panel::before {
        display: none;
    }

    .mv-side-panel::after {
        display: none;
    }

    .side-content {
        flex-direction: row;
    }

    .side-panel-bg {
        flex-direction: row;
    }

    .bg-no {
        width: 50px;
        height: 100%;
        aspect-ratio: auto; /* Reset for SP fixed width */
        border-bottom: none;
        border-right: 1px solid #000;
    }

    .bg-text {
        border-bottom: none;
        border-right: 1px solid #000;
    }

    .bg-arrow {
        width: 60px;
        height: 100%;
        aspect-ratio: auto; /* Reset for SP fixed width */
    }

    .side-no {
        width: 50px;
        /* Changed from 70px to 50px based on user request */
        height: 100%;
        border-bottom: none;
        border-right: none;
        /* Handled directly now */
        padding: 0;
        /* Remove padding to make it tight */
        display: flex;
        align-items: center;
        /* Center vertically */
        justify-content: center;
        /* Center horizontally */
    }

    .no-image {
        height: 100%;
        /* Adjusted from 80% to 100% since PC layout removed base 120px height making this rely purely on flex height on SP */
        width: 100%;
        object-fit: contain;
    }

    .side-text-area {
        writing-mode: horizontal-tb;
        /* Reset to horizontal */
        text-orientation: mixed;
        flex-grow: 1;
        height: 100%;
        padding: 0 10px;
        border-bottom: none;
        border-right: none;
        /* Handled directly now */
        justify-content: center;
        align-items: center;
        font-size: 0.95rem;
        /* Slightly smaller for SP to fit */
        letter-spacing: 0.05rem;
    }

    .vertical-text {
        line-height: 1.2;
    }

    .side-arrow {
        width: 60px;
        /* Match panel height (60px) to make it a perfect square matching the image */
        height: 100%;
        padding: 0;
        /* Ensures no internal spacing */
    }

    .arrow-icon {
        width: 100%;
        height: 100%;
        object-fit: cover;
        /* Fill the area entirely */
    }
}