/* スライドショーモーダル */
.slideshow-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    overflow: hidden;
}
.slideshow-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}
.slideshow-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.slideshow-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    user-select: none;
    transition: opacity 0.15s ease;
    transform-origin: 0 0;
    cursor: grab;
}
.slideshow-image.zoomed {
    cursor: grab;
}
.slideshow-image.panning {
    cursor: grabbing;
    transition: none;
}
.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 2em;
    padding: 20px;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10000;
}
.slideshow-nav:hover {
    background: rgba(255, 255, 255, 0.5);
}
.slideshow-nav.prev {
    left: 10px;
}
.slideshow-nav.next {
    right: 10px;
}
.slideshow-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 2em;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10000;
}
.slideshow-close:hover {
    background: rgba(255, 255, 255, 0.5);
}
.slideshow-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10000;
}

/* ズームコントロール */
.slideshow-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10000;
}
.slideshow-zoom-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 1.2em;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.slideshow-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.slideshow-zoom-level {
    color: white;
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 12px;
    min-width: 48px;
    text-align: center;
    user-select: none;
}
.slideshow-zoom-reset {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 0.75em;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}
.slideshow-zoom-reset:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* スマホ版の調整 */
@media (max-width: 768px) {
    .slideshow-nav {
        font-size: 1.5em;
        padding: 15px;
        background: rgba(255, 255, 255, 0.2);
    }
    .slideshow-close {
        font-size: 1.5em;
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }
    .slideshow-counter {
        font-size: 1em;
        padding: 8px 16px;
        bottom: 10px;
    }
    .slideshow-zoom-controls {
        bottom: 10px;
        right: 10px;
        gap: 4px;
    }
    .slideshow-zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 1em;
    }
    .slideshow-zoom-level {
        font-size: 0.75em;
        padding: 3px 8px;
        min-width: 40px;
    }
}

/* スライドモーダル */
.slide-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    overflow: hidden;
}
.slide-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}
.slide-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.slide-content {
    max-width: 90%;
    max-height: 85%;
    overflow: hidden; /* スクロールバーを非表示 */
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}
.slide-content h1 {
    margin-top: 0;
    color: #333;
    border-bottom: 3px solid #0d6efd;
    padding-bottom: 10px;
}
.slide-content h2 {
    color: #555;
    margin-top: 1.5em;
}
.slide-content img {
    width: 100% !important;
    height: calc(85vh - 80px) !important; /* 画面高さの85% - padding分 */
    max-width: none !important;
    max-height: none !important;
    object-fit: contain; /* アスペクト比を維持しながら拡大 */
    display: block;
    margin: 20px auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.slide-content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
}
.slide-content table {
    margin: 20px auto;
    border-collapse: collapse;
}
.slide-content table th,
.slide-content table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
}
.slide-content table th {
    background: #f0f0f0;
}
.slide-content ul {
    list-style-type: disc;
    padding-left: 40px;
    margin: 15px 0;
}
.slide-content ol {
    list-style-type: decimal;
    padding-left: 40px;
    margin: 15px 0;
}
.slide-content li {
    margin: 8px 0;
    line-height: 1.6;
}
.slide-content p {
    margin: 15px 0;
    line-height: 1.6;
}
.slide-content strong,
.slide-content b {
    font-weight: bold;
    color: #222;
}
.slide-content em,
.slide-content i {
    font-style: italic;
}
.slide-content a {
    color: #0d6efd;
    text-decoration: underline;
}
.slide-content a:hover {
    color: #0a58ca;
}
.slide-content blockquote {
    border-left: 4px solid #0d6efd;
    padding-left: 20px;
    margin: 20px 0;
    color: #555;
    font-style: italic;
}
.slide-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}
.slide-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 2em;
    padding: 20px;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10000;
}
.slide-nav:hover {
    background: rgba(255, 255, 255, 0.5);
}
.slide-nav.prev {
    left: 10px;
}
.slide-nav.next {
    right: 10px;
}
.slide-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.slide-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 2em;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10000;
}
.slide-close:hover {
    background: rgba(255, 255, 255, 0.5);
}
.slide-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 10000;
}
.slide-help {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 15px;
    border-radius: 15px;
    z-index: 10000;
}

/* スマホ版のスライドモード調整 */
@media (max-width: 768px) {
    .slide-content {
        max-width: 95%;
        max-height: 80%;
        padding: 20px;
        font-size: 0.9em;
    }
    .slide-nav {
        font-size: 1.5em;
        padding: 15px;
        background: rgba(255, 255, 255, 0.2);
    }
    .slide-close {
        font-size: 1.5em;
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
    }
    .slide-counter {
        font-size: 1em;
        padding: 8px 16px;
        bottom: 10px;
    }
    .slide-help {
        display: none;
    }
}
