/* ========== Characters ページ ========== */
.characters-wrapper {
    padding: 0 0 80px;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 16px;
}

.character-icon {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #2a2a32;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.character-icon:hover {
    transform: translateY(-4px);
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-hover);
}

.character-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.character-icon:hover img {
    transform: scale(1.06);
}

.character-icon .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: var(--color-text-subtle);
    padding: 4px;
    text-align: center;
    word-break: break-all;
}

/* ========== ライトボックス（中央ピックアップ） ========== */
.char-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: charFadeIn 0.25s ease;
}

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

.char-lightbox.active {
    display: flex;
}

.char-lightbox-panel {
    position: relative;
    width: min(920px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: charScaleIn 0.3s ease;
}

@keyframes charScaleIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.char-lightbox-close {
    position: absolute;
    top: -44px;
    right: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.char-lightbox-close:hover {
    background: rgba(255, 107, 107, 0.5);
}

.char-lightbox-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    color: #fff;
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 0.04em;
}

.char-lightbox-frame {
    position: relative;
    width: 100%;
    background: #1a1a1f;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-hover);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: calc(92vh - 100px);
}

.char-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.char-lightbox-image.zoomed {
    cursor: zoom-out;
}

.char-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 5;
}

.char-lightbox-nav:hover:not(:disabled) {
    background: rgba(255, 107, 107, 0.7);
    transform: translateY(-50%) scale(1.05);
}

.char-lightbox-nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.char-lightbox-nav.prev { left: 12px; }
.char-lightbox-nav.next { right: 12px; }

.char-lightbox-nav.prev::before,
.char-lightbox-nav.next::before {
    font-size: 1.25rem;
    line-height: 1;
}

.char-lightbox-nav.prev::before { content: '←'; }
.char-lightbox-nav.next::before { content: '→'; }

.char-lightbox-counter {
    margin-top: 14px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.char-lightbox-empty {
    padding: 48px 24px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-align: center;
}

@media (max-width: 768px) {
    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }

    .char-lightbox {
        padding: 16px;
    }

    .char-lightbox-close {
        top: -40px;
        right: 4px;
    }

    .char-lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .char-lightbox-nav.prev { left: 8px; }
    .char-lightbox-nav.next { right: 8px; }
}
