/* --- 画像表示モーダル（Zoom/Pan）専用（#myModal） --- */
/* 共通モーダル（.modal / .modal-content）は style.css 側で定義。 */
#myModal {
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#myModal.is-open {
    display: flex;
}

/* 外枠 - 最大サイズを制御 */
#myModal .modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    border: none;
    padding: 0;
    top: auto;
    left: auto;
    transform: none;
    overflow: hidden;
}

/* 中枠 - グラデーションと縁取りを適用 */
#myModal .modal-frame {
    position: relative;
    width: 90vw;
    height: 90vw;
    max-width: 90vw;
    max-height: 90vh;
    /*padding: 20px;*/
/* background: linear-gradient(135deg, 
        rgba(59, 63, 82, 0.9) 0%, 
        rgba(43, 47, 65, 0.9) 100%);

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5),
                inset 0 0 15px rgba(255, 255, 255, 0.1);*/
    border-radius: 12px;
    border: 2px solid #233c75;
    overflow: hidden;

    background-color: #23238947;
    box-shadow: inset 0px -10px 20px 0px rgb(95 37 37 / 85%), 5px 5px 10px 0px rgba(0, 0, 0, 0.3);
}

#myModal .modal-frame.is-neutral-bg {
    box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.3);
}

/* 画像コンテナ */
#myModal .modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-sizing: border-box;
}

/* 画像 - 背景透明、縁取りなし */
#myModal #modalImage {
    position: relative;
    cursor: grab;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    transform-origin: center center;
    image-rendering: high-quality;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#myModal #modalImage.is-grabbing {
    cursor: grabbing;
}

/* 画像拡大モーダル操作UI */
#myModal .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 1px solid #00a0ff;
    border-radius: 6px;
    background: rgba(0, 30, 60, 0.85);
    color: #00f0ff;
    font-size: 0;
    line-height: 0;
    text-align: center;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
}
#myModal .modal-close::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: center / contain no-repeat url("../../img/ui_button_close.png");
    transform: translate(-50%, -50%);
}

#myModal .modal-close::after {
    display: none;
}
#myModal .modal-close:hover,
#myModal .modal-close:focus {
    background: rgba(0, 80, 160, 0.95);
    color: #fff;
    border-color: #00f0ff;
    box-shadow: 0 0 12px #00f0ff88;
}

#myModal .modal-corner-tools {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 3;
}

#myModal .modal-bg-switcher {
    display: flex;
    gap: 6px;
    padding: 3px 8px;
    align-items: center;
    background: rgba(0, 30, 60, 0.7);
    border: 1px solid #1f3c75;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0, 160, 255, 0.2);
}

#myModal .modal-bg-btn {
    width: 10px;
    height: 28px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
    background: var(--bg-color, transparent);
    cursor: pointer;
    padding: 0;
}

#myModal .modal-bg-btn-default {
    background: #23238947;
}

#myModal .modal-bg-btn-white {
    background: #ffffff;
}

#myModal .modal-bg-btn-light {
    background: #f0f0f0;
}

#myModal .modal-bg-btn-mid {
    background: #b5b5b5;
}

#myModal .modal-bg-btn-dark {
    background: #6b6b6b;
}

#myModal .modal-bg-btn-darker {
    background: #1f1f1f;
}

#myModal .modal-bg-btn.is-active {
    outline: 2px solid #00f0ff;
    outline-offset: 2px;
}

#myModal .modal-help-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0;
    border-radius: 6px;
    border: 1px solid #00a0ff;
    background: rgba(0, 30, 60, 0.85);
    color: #00f0ff;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
}
#myModal .modal-help-toggle:hover,
#myModal .modal-help-toggle:focus {
    background: rgba(0, 80, 160, 0.95);
    color: #fff;
    border-color: #00f0ff;
    box-shadow: 0 0 12px #00f0ff88;
}

#myModal .modal-help-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    width: 70vw;
    max-width: 320px;
    background: rgba(0, 20, 40, 0.95);
    color: #e0f7fa;
    border: 1px solid #1f3c75;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    display: none;
    font-size: 13px;
    line-height: 1.4;
}
#myModal .modal-help-panel.is-open {
    display: block;
}
#myModal .modal-help-line {
    margin: 2px 0;
}

.upload-loader-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.25);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.upload-loader-modal.is-visible {
    display: flex;
}

.upload-loader-spinner {
    width: 60px;
    height: 60px;
    border: 7px solid #e0e8f0;
    border-top: 7px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
