* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    overflow: hidden;
    background: #0a0a0a;
    color: #ffffff;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

#canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 授業概要オーバーレイ（左側固定） - テーマカラーの縁を背景に */
.overlay-info {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    max-width: 90vw;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 0;
    background: rgba(140, 38, 57, 0.5);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(242, 228, 230, 0.2);
    overflow: hidden;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
}

.overlay-header {
    padding: 60px 32px 32px;
    text-align: left;
    pointer-events: auto;
}

.overlay-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.overlay-theme {
    font-size: 15px;
    color: #F2E4E6;
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.overlay-main {
    padding: 0 32px;
    overflow-y: auto;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 38, 57, 0.3) transparent;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.overlay-main::-webkit-scrollbar {
    width: 6px;
}

.overlay-main::-webkit-scrollbar-track {
    background: transparent;
}

.overlay-main::-webkit-scrollbar-thumb {
    background: rgba(140, 38, 57, 0.3);
    border-radius: 3px;
}

.overlay-main::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 38, 57, 0.5);
}

.overlay-description {
    max-width: 800px;
    width: 100%;
    padding: 0;
    pointer-events: auto;
    margin-bottom: 16px;
}

.overlay-description-content {
    padding: 16px;
    border: none;
    border-radius: 8px;
    background: rgba(242, 228, 230, 0.1);
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    overflow: hidden;
}

.overlay-description-content.collapsed {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
}

.overlay-description-close {
    width: 100%;
    padding: 12px 16px;
    margin-top: 16px;
    background: rgba(242, 228, 230, 0.15);
    border: 1px solid rgba(242, 228, 230, 0.3);
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.overlay-description-close:hover {
    background: rgba(242, 228, 230, 0.25);
    border-color: rgba(242, 228, 230, 0.5);
    color: #FFFFFF;
}

.overlay-description-close .close-text {
    font-weight: 500;
}

.overlay-description-close .close-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.overlay-description-open {
    width: 100%;
    padding: 12px 16px;
    background: rgba(242, 228, 230, 0.15);
    border: 1px solid rgba(242, 228, 230, 0.3);
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.overlay-description-open:hover {
    background: rgba(242, 228, 230, 0.25);
    border-color: rgba(242, 228, 230, 0.5);
    color: #FFFFFF;
}

.overlay-description-open .open-text {
    font-weight: 500;
}

.overlay-description-open .open-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.overlay-description-open.hidden {
    display: none;
}

.overlay-text {
    font-size: 15px;
    line-height: 1.8;
    color: #FFFFFF;
    margin: 0 0 24px 0;
    text-align: left;
    letter-spacing: 0.01em;
}

.overlay-text strong {
    color: #F2E4E6;
    font-weight: 600;
}

.overlay-instruction {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    padding: 0;
    margin: 32px 0 0 0;
    line-height: 1.7;
    border: none;
    background: none;
    letter-spacing: 0.01em;
}

.overlay-footer {
    padding: 20px 32px;
    text-align: left;
    pointer-events: auto;
}

.overlay-footer p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05em;
    margin: 0;
    font-weight: 400;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(140, 38, 57, 0.1);
    border-top-color: #8C2639;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    font-size: 16px;
    color: #ffffff;
}

.hidden {
    display: none !important;
}

.controls {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.btn {
    padding: 12px 24px;
    background: rgba(242, 228, 230, 0.15);
    border: 1px solid rgba(242, 228, 230, 0.3);
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background: rgba(242, 228, 230, 0.25);
    border-color: rgba(242, 228, 230, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 228, 230, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(140, 38, 57, 0.5);
    backdrop-filter: blur(10px);
    z-index: 200;
    overflow-y: auto;
    padding: 40px;
}

.detail-content {
    max-width: 1600px;
    margin: 0 auto;
    padding-top: 0;
}

.detail-header {
    margin-bottom: 40px;
    text-align: center;
}

.detail-header h2 {
    font-size: 40px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #FFFFFF;
}

.detail-header p {
    font-size: 22px;
    color: #F2E4E6;
}

.detail-media {
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(242, 228, 230, 0.1);
    border: 1px solid rgba(242, 228, 230, 0.2);
    position: relative;
}

.detail-media-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.detail-media iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.youtube-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9のアスペクト比 */
    height: 0;
    overflow: hidden;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-slider {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9のアスペクト比（YouTubeと同じ） */
    height: 0;
    overflow: hidden;
    background: #000;
}

.image-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.slider-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.slider-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.slider-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ffffff;
    font-size: 14px;
}

.detail-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    width: 100%;
}

.nav-presentation-btn {
    padding: 12px 24px;
    background: rgba(242, 228, 230, 0.15);
    border: 1px solid rgba(242, 228, 230, 0.3);
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-presentation-btn:hover {
    background: rgba(242, 228, 230, 0.25);
    border-color: rgba(242, 228, 230, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 228, 230, 0.2);
}

.nav-prev-btn {
    margin-right: auto;
}

.nav-next-btn {
    margin-left: auto;
}

.nav-btn-icon {
    font-size: 16px;
    display: inline-flex;
    align-items: center;
}

.nav-btn-text {
    font-size: 14px;
}

.btn-link {
    text-decoration: none;
    display: inline-block;
}

@media (max-width: 768px) {
    .overlay-info {
        width: 100%;
        max-width: 100vw;
    }

    .overlay-header {
        padding: 56px 24px 24px;
    }

    .overlay-title {
        font-size: 20px;
    }

    .overlay-theme {
        font-size: 13px;
    }

    .overlay-main {
        padding: 0 24px;
    }

    .overlay-text {
        font-size: 14px;
        line-height: 1.75;
        margin-bottom: 20px;
    }

    .overlay-instruction {
        font-size: 12px;
        margin-top: 24px;
    }

    .overlay-footer {
        padding: 16px 24px;
    }

    .overlay-footer p {
        font-size: 10px;
    }

    .overlay-close {
        top: 16px;
        right: 16px;
    }

    .detail-view {
        padding: 24px 16px;
    }

    .detail-content {
        padding-top: 0;
    }

    .detail-header {
        margin-bottom: 32px;
    }

    .detail-header h2 {
        font-size: 28px;
    }

    .detail-header p {
        font-size: 18px;
    }

    .detail-media {
        margin-bottom: 32px;
    }

    .image-slider {
        padding-bottom: 56.25%;
        /* 16:9のアスペクト比を維持 */
    }

    .controls {
        top: 10px;
        left: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* モード切り替えボタン */
.mode-toggle-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.mode-toggle-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mode-toggle-btn i {
    font-size: 16px;
}

.mode-toggle-btn span {
    font-size: 14px;
}

.mode-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mode-toggle-btn:active {
    transform: translateY(0);
}

/* グループリストビュー */
.group-list-view {
    width: 100%;
    margin-top: 0;
    padding-top: 0;
    pointer-events: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.group-list-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    padding-top: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.group-list-items::-webkit-scrollbar {
    width: 6px;
}

.group-list-items::-webkit-scrollbar-track {
    background: transparent;
}

.group-list-items::-webkit-scrollbar-thumb {
    background: rgba(140, 38, 57, 0.3);
    border-radius: 3px;
}

.group-list-items::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 38, 57, 0.5);
}

.group-list-item {
    width: 100%;
    min-height: 80px;
    background: rgba(242, 228, 230, 0.1);
    border: 1px solid rgba(242, 228, 230, 0.2);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.group-list-item:hover,
.group-list-item.hovered {
    transform: translateX(4px);
    background: rgba(242, 228, 230, 0.2);
    border-color: rgba(242, 228, 230, 0.4);
    box-shadow: 0 4px 12px rgba(242, 228, 230, 0.2);
}

.group-list-thumbnail {
    width: 100px;
    min-width: 100px;
    height: 80px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    flex-shrink: 0;
}

.group-list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.group-list-item:hover .group-list-thumbnail img {
    transform: scale(1.05);
}

.group-list-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 20px;
}

.group-list-info {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.group-list-title {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-list-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.3;
}

@media (max-width: 768px) {
    .group-list-item {
        min-height: 70px;
    }

    .group-list-thumbnail {
        width: 80px;
        min-width: 80px;
        height: 70px;
    }

    .group-list-title {
        font-size: 12px;
    }

    .group-list-meta {
        font-size: 10px;
    }

    .group-list-items {
        gap: 10px;
        max-height: 300px;
    }
}