/* MOAI AI Commando - Refactored for Flow Layout (like Yori&Jori) */

.moai-ai-commando {
    background: #FFFFFF;
}

.moai-ai-commando .bd-lg.padding_sub_tb {
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 25px 80px;
}

/* Page Header */
.moai-ai-commando-header {
    margin-bottom: 20px;
}

.moai-ai-commando-title {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: 35px;
    line-height: 44px;
    letter-spacing: -1.75px;
    color: #000000;
    margin: 0 0 12px;
}

.moai-ai-commando-subtitle {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 17px;
    line-height: 21px;
    letter-spacing: -0.51px;
    color: #949494;
    margin: 0;
}

/* Section Titles */
.section-title-1 {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: 35px;
    line-height: 44px;
    letter-spacing: -1.75px;
    color: #000000;
    margin: 30px 0 20px;
}

.section-title-2 {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: 35px;
    line-height: 44px;
    letter-spacing: -1.75px;
    color: #000000;
    margin: 50px 0 20px;
}

/* Frame 430 - Hero Section */
.frame-430 {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 600px;
    margin: 0 auto 30px;
    border-radius: 15px;
    overflow: hidden;
}

.frame-430-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Hex Icon Styles - 3D Flip Card */
.hex-icon {
    position: absolute;
    width: 100px;
    height: 90px;
    z-index: 2;
    cursor: pointer;
    perspective: 1000px;
    pointer-events: auto;
}

.hex-icon-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
}

/* 호버 시 flip 효과 (disabled가 아닌 경우에만) */
.hex-icon:not(.disabled):hover .hex-icon-inner {
    transform: rotateY(180deg);
}

/* 앞면 (아이콘) */
.hex-icon-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* hex-icon-front 내부 요소 위치 (부모 기준) */
.hex-icon-front .hex-bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.hex-icon-front .hex-inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 뒷면 (썸네일) - 육각형 모양 with 입체감 */
.hex-icon-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* 뒷면 외곽 테두리 (입체감 - 바깥쪽 그림자) */
.hex-icon-back::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #e0e0e0 0%, #a0a0a0 50%, #707070 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    -webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    z-index: 1;
    /* 3D 볼륨감을 위한 그림자 */
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.4)) drop-shadow(-1px -1px 2px rgba(255, 255, 255, 0.3));
}

/* 뒷면 내부 콘텐츠 영역 (썸네일이 들어가는 곳) */
.hex-icon-back::after {
    content: '';
    position: absolute;
    width: 85%;
    height: 85%;
    background: linear-gradient(180deg, #f8f8f8 0%, #d8d8d8 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    -webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    z-index: 2;
}

/* 뒷면 썸네일 이미지 - zoom-in 효과 */
.hex-icon-back .hex-thumb {
    width: 80%;
    height: 80%;
    object-fit: cover;
    transform: scale(1);
    /* flip 완료 후 천천히 zoom-in (0.6s 딜레이 후 1.5s 동안 zoom) */
    transition: transform 1.5s ease 0.5s;
    z-index: 3;
    position: relative;
    /* 썸네일도 육각형으로 클리핑 */
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    -webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* 호버 시 천천히 zoom-in */
.hex-icon:not(.disabled):hover .hex-icon-back .hex-thumb {
    transform: scale(1.25);
}

/* 썸네일이 없을 때 기본 배경 */
.hex-icon-back .hex-thumb[src=""],
.hex-icon-back .hex-thumb:not([src]) {
    display: none;
}

/* hex-inner 아이콘 필터 및 크기 */
.hex-icon .hex-inner {
    filter: grayscale(100%) brightness(1.0);
    max-width: 50px;
    max-height: 50px;
}

.hex-icon.active .hex-inner {
    filter: none;
}

/* Center Thumbnail */
.center-thumb {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 2;
    perspective: 800px;
}

.thumb-image {
    position: relative;
    width: 250px;
    height: 230px;
    cursor: pointer;
    transform-style: preserve-3d;
}

/* Center thumbnail flip-out: 0 → 90deg (first half) */
.thumb-image.flip-out {
    animation: centerFlipOut 0.3s ease-in forwards;
}

/* Center thumbnail flip-in: -90deg → 0 (second half) */
.thumb-image.flip-in {
    animation: centerFlipIn 0.3s ease-out forwards;
}

@keyframes centerFlipOut {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(90deg);
    }
}

@keyframes centerFlipIn {
    0% {
        transform: rotateY(-90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.thumb-shape {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.star-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 230px;
    height: 200px;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
}

/* Episode Thumbnail Image inside hexagon */
.thumb-content-img {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 192px;
    object-fit: cover;
    z-index: 3;
    transition: opacity 0.25s ease;
    /* 납작한 육각형 (가로로 넓은 형태) - Star.svg 모양에 맞춤 */
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    pointer-events: none;
}

/* Flip 완료 후 썸네일이 등록된 경우: 이미지만 연하게 + 재생 아이콘 표시 */
.thumb-image.has-thumb .thumb-content-img {
    opacity: 0.55;
}

.thumb-play-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 220px;
    height: 192px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none; /* 클릭은 기존 thumb-image로 전달 */
    z-index: 6;
    transition: opacity 0.22s ease, transform 0.22s ease;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    -webkit-clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.thumb-image.has-thumb .thumb-play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.thumb-play-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.62);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    position: relative;
    transform: scale(0.94);
    transition: transform 0.22s ease;
}

.thumb-image.has-thumb .thumb-play-icon {
    transform: scale(1);
}

.thumb-play-icon::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-35%, -50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 14px solid rgba(255, 255, 255, 0.95);
    transition: transform 0.22s ease;
}

/* hover 시 "클릭 가능" 느낌 연출 */
.thumb-image.has-thumb:hover .thumb-play-overlay {
    background: rgba(0, 0, 0, 0.26);
}

.thumb-image.has-thumb:hover .thumb-play-icon {
    /* "살짝 커지는" 느낌만 주도록 은은한 펄스 */
    animation: thumbPlayPulse 0.9s ease-in-out infinite;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32);
}

.thumb-image.has-thumb:hover .thumb-play-icon::before {
    transform: translate(-33%, -50%);
}

@keyframes thumbPlayPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .thumb-image.has-thumb:hover .thumb-play-icon {
        animation: none;
    }
}

.thumb-title {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: 28px;
    line-height: normal;
    letter-spacing: -1.4px;
    color: #FFFFFF;
    text-align: center;
    white-space: nowrap;
}

/* ========================================
   Book Flip Container - Real Page Turn Effect
   ======================================== */

/* Hide radio buttons */
.book-state {
    position: absolute;
    left: -9999px;
}

.book-flip-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 50px;
}

/* 3D Book Container */
.book-3d {
    position: relative;
    width: 100%;
}

/* Base - Fixed book background */
.book-base {
    position: relative;
    z-index: 1;
    border-radius: 15px;
    overflow: hidden;
}

.book-base-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Fixed Left Page - Always visible */
.book-left-fixed {
    position: absolute;
    top: 7%;
    left: 5%;
    width: 43%;
    height: 82%;
    z-index: 2;
    overflow: hidden;
}

.book-content-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Fixed Right Page - Appears after flip (Play and Learn) */
.book-right-fixed {
    position: absolute;
    top: 7%;
    left: 52%;
    width: 42%;
    height: 82%;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease 0.5s;
    overflow-y: auto;
    background: #FDFCFF;
    padding: 15px 20px;
    box-sizing: border-box;
    border-radius: 0 12px 12px 0;
}

/* Show right fixed content after flip */
#book-back:checked ~ .book-3d .book-right-fixed {
    opacity: 1;
    pointer-events: auto;
}

/* Sheet - The flipping page (BookBlock bb-vertical style) */
.book-sheet {
    position: absolute;
    top: 7%;
    left: 52%;
    width: 43%;
    height: 82%;
    z-index: 10;
    -webkit-perspective: 1300px;
    perspective: 1300px;
    transform: rotateY(0deg);
    transform-style: preserve-3d;
    transform-origin: left center;
    transition: transform 0.8s ease-in-out, left 0.8s ease-in-out;
}

/* 아이콘 변경 시 빠른 책장 넘기기 효과 */
.book-sheet.quick-flip {
    transition-duration: 0.35s !important;
}

/* Sheet faces */
.sheet-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    cursor: pointer;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Front face - right page content (6-12 list, visible initially) */
.sheet-front {
    background: #FDFCFF;
    z-index: 2;
    border-radius: 0 12px 12px 0;
}

/* Back face - detail left content (Go Back + detail, visible after flip on LEFT side) */
.sheet-back {
    transform: rotateY(180deg);
    background: #FDFCFF;
    border-radius: 12px 0 0 12px;
}

/* Sheet content padding */
.sheet-content {
    padding: 15px 20px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Detail left content - 스크롤 허용 */
.sheet-content.book-detail-left {
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.2vw, 16px);
}

.book-detail-left .detail-section-title {
    margin-bottom: clamp(5px, 0.8vw, 12px);
}

.book-detail-left .detail-section {
    margin-bottom: clamp(3px, 0.5vw, 8px);
}

.book-detail-left .materials-container {
    margin-top: auto;
}

/* Custom scrollbar for book areas */
.sheet-face::-webkit-scrollbar,
.book-right-fixed::-webkit-scrollbar {
    width: 6px;
}

.sheet-face::-webkit-scrollbar-track,
.book-right-fixed::-webkit-scrollbar-track {
    background: transparent;
}

.sheet-face::-webkit-scrollbar-thumb,
.book-right-fixed::-webkit-scrollbar-thumb {
    background: #CEC9E1;
    border-radius: 3px;
}

.sheet-face::-webkit-scrollbar-thumb:hover,
.book-right-fixed::-webkit-scrollbar-thumb:hover {
    background: #A9A3C4;
}

/* Flip state - BookBlock bb-vertical style: rotateY + shift left */
#book-back:checked ~ .book-3d .book-sheet {
    transform: rotateY(-180deg);
    left: 48%;
}

/* Hide entire left fixed content when flipped */
#book-back:checked ~ .book-3d .book-left-fixed {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease 0.3s;
}

/* BookBlock-style shadow overlays on sheet faces */
.sheet-front::after,
.sheet-back::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.8s ease-in-out;
}

/* Front face: darken shadow as page flips away (bb-flipoverlay) */
.sheet-front::after {
    background: rgba(0, 0, 0, 0.2);
}

/* Back face: shadow that fades out as page settles (bb-overlay) */
.sheet-back::after {
    background: rgba(0, 0, 0, 0.6);
    opacity: 1;
}

/* When flipped: front darkens, back lightens */
#book-back:checked ~ .book-3d .book-sheet .sheet-front::after {
    opacity: 0.8;
}

#book-back:checked ~ .book-3d .book-sheet .sheet-back::after {
    opacity: 0;
}

/* Shadow on left fixed page during flip (page shadow cast by flipping sheet) */
.book-left-fixed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

#book-back:checked ~ .book-3d .book-left-fixed::after {
    opacity: 0.4;
}

/* Legacy compatibility */
.book-section {
    display: none;
}

.book-detail-section {
    display: none;
}

.book-bg {
    display: none;
}

.book-page {
    display: none;
}

/* Book Content */
.book-content {
    position: absolute;
    left: 5%;
    top: 7%;
    right: 5%;
    bottom: 7%;
    display: flex;
    gap: 3%;
    z-index: 2;
    overflow: hidden;
}

/* Left Column */
.book-left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Book Header with Robot */
.book-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.book-text-container {
    padding-top: 30px;
}

.book-title {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: clamp(22px, 2.6vw, 36px);
    line-height: 1.25;
    letter-spacing: -1.8px;
    color: #8568F8;
    margin-bottom: clamp(4px, 0.5vw, 8px);
}

.book-description {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(12px, 1.3vw, 18px);
    line-height: 1.35;
    letter-spacing: -0.9px;
    color: #000000;
    margin: 0;
}

.robot-container {
    width: clamp(80px, 10vw, 150px);
    height: clamp(65px, 8.5vw, 120px);
    flex-shrink: 0;
}

.robot-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dictionary List */
.dict-list-left {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 0.9vw, 12px);
}

.dict-list-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 0.9vw, 12px);
    max-height: 100%;
    overflow-y: auto;
}

/* Dictionary Item */
.dict-item {
    position: relative;
    width: 100%;
    height: clamp(45px, 5vw, 65px);
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 clamp(8px, 1vw, 15px) 0 clamp(10px, 1.2vw, 18px);
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center center;
}

/* 호버 시 Glow 효과 (scale 제거 - overflow hidden 영역에서 잘림 방지) */
.dict-item:not(.disabled):hover {
    background: #F3F4F6;
    border-color: #8B5CF6;
    border-width: 2px;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5), 0 0 20px rgba(139, 92, 246, 0.3);
}

.dict-item:not(.disabled):hover .dict-text {
    color: #8568F8;
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

/* Active 상태 - 기본으로 Glow 효과 적용 */
.dict-item.active {
    background: #EDE9FE;
    border-color: #8B5CF6;
    border-width: 2px;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5), 0 0 20px rgba(139, 92, 246, 0.3);
}

.dict-item.active .dict-text {
    color: #8568F8;
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

.dict-item.tall {
    height: clamp(60px, 6.5vw, 85px);
    align-items: flex-start;
    padding-top: clamp(8px, 1vw, 14px);
}

.dict-item.short {
    height: clamp(40px, 4.2vw, 55px);
}

/* Disabled Dictionary Item */
.dict-item.disabled {
    background: #E5E5E5;
    border-color: #D1D5DB;
    cursor: not-allowed;
    opacity: 0.6;
}

.dict-item.disabled:hover {
    background: #E5E5E5;
    border-color: #D1D5DB;
}

.dict-item.disabled .dict-num {
    background: #9CA3AF;
}

.dict-item.disabled .dict-text {
    color: #9CA3AF;
}

/* Number Circle */
.dict-num {
    width: clamp(22px, 2.2vw, 30px);
    height: clamp(22px, 2.2vw, 30px);
    background: #000000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(12px, 1.3vw, 18px);
    line-height: 1.2;
    color: #FFFFFF;
    margin-right: clamp(6px, 0.8vw, 12px);
    flex-shrink: 0;
}

.dict-item.active .dict-num {
    background: #8B5CF6;
}

/* Item Text */
.dict-text {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: clamp(13px, 1.6vw, 22px);
    line-height: 1.3;
    letter-spacing: -0.66px;
    color: #000000;
}

/* Book Detail Section */
.book-detail-section {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto 50px;
}

.book-detail-bg {
    width: 100%;
    height: auto;
    display: block;
}

.book-detail-wrapper {
    position: absolute;
    left: 5%;
    top: 7%;
    right: 5%;
    bottom: 7%;
    z-index: 2;
    display: flex;
    gap: 5%;
    align-items: flex-start;
    overflow: hidden;
}

/* Book Detail Left Content */
.book-detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 20px);
}

.go-back {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #333333;
    padding: clamp(4px, 0.5vw, 6px) clamp(10px, 1.2vw, 16px);
    border-radius: 41px;
    width: clamp(100px, 10vw, 140px);
    height: clamp(32px, 3vw, 42px);
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.go-back:hover {
    background: #444444;
}

.go-back-text {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: clamp(14px, 1.6vw, 22px);
    line-height: normal;
    letter-spacing: -1.1px;
    color: #FFFFFF;
    white-space: nowrap;
}

.detail-title {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 700 !important;
    font-size: clamp(16px, 1.8vw, 24px);
    line-height: normal;
    letter-spacing: -1.1px;
    color: #000000;
    margin: 0;
}

.detail-desc {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(12px, 1.3vw, 18px);
    line-height: 1.4;
    letter-spacing: -0.9px;
    color: #000000;
    margin: 0;
}

.detail-section {
    display: flex;
    flex-direction: column;
}

.detail-section-title {
    margin-bottom: clamp(10px, 1.5vw, 20px);
}

.detail-label {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 700 !important;
    font-size: clamp(14px, 1.6vw, 20px);
    line-height: 1.4;
    letter-spacing: -1.1px;
    color: #000000;
    margin-bottom: 0;
}

.detail-text {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(11px, 1.1vw, 15px);
    line-height: 1.6;
    letter-spacing: -0.9px;
    color: #000000;
    margin: 0;
}

.detail-text-goal {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 400;
    font-size: clamp(11px, 1.1vw, 15px);
    line-height: 1.6;
    letter-spacing: -0.9px;
    color: #000000;
    margin-top: 3px;
}

/* Materials Section */
.materials-container {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.materials-images {
    position: relative;
    width: 100%;
    max-width: clamp(280px, 30vw, 400px);
    background: #F4F4F4;
    border-radius: 15px;
    margin-top: clamp(5px, 0.7vw, 10px);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
}


/* Material Item Container - 세로 리스트 (썸네일 + 제목 + 다운로드 버튼) */
.material-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.material-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.material-item-title {
    flex: 1;
    font-size: 11px;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

/* Material Thumbnail - clickable */
.material-item img.material-thumb {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.material-item img.material-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Material Action Button (download/play) */
.material-action-btn {
    flex-shrink: 0;
    padding: 4px;
    border-radius: 5px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.material-action-btn:hover {
    transform: scale(1.1);
}

.material-action-btn svg {
    width: 20px;
    height: 20px;
}

/* Download button style (활동지, 사진) */
.material-action-btn.btn-download {
    background: rgba(0, 0, 0, 0.7);
}

.material-action-btn.btn-download:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Play button style (영상, 슬라이드) */
.material-action-btn.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.material-action-btn.btn-play:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* Audio button style (음원) */
.material-action-btn.btn-audio {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.material-action-btn.btn-audio:hover {
    background: linear-gradient(135deg, #0e8a7f 0%, #2ed96d 100%);
}

/* Legacy Material Download Button (backward compatibility) */
.material-download-btn {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px;
    border-radius: 5px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.material-download-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.material-download-btn svg {
    width: 20px;
    height: 20px;
}

/* No materials message */
.no-materials {
    width: 100%;
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
}

/* Legacy styles (deprecated) */
.material-img-1 {
    position: absolute;
    left: 6%;
    top: 22%;
    width: 50%;
    height: 55%;
    object-fit: contain;
}

.material-img-2 {
    position: absolute;
    left: 62%;
    top: 10%;
    width: 30%;
    height: 80%;
    object-fit: contain;
}

.download-btn {
    position: absolute;
    background: #000000;
    padding: clamp(4px, 0.4vw, 6px);
    border-radius: 6px;
    width: clamp(22px, 2.2vw, 30px);
    height: clamp(22px, 2.2vw, 30px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.download-btn:hover {
    background: #333333;
}

.download-btn-1 {
    left: 48%;
    top: 62%;
}

.download-btn-2 {
    left: 84%;
    top: 75%;
}

/* Play and Learn Section */
.play-learn-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.play-learn-content {
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 20px);
    overflow-y: auto;
    padding-right: 10px;
}

/* Hide default scrollbar */
.play-learn-content::-webkit-scrollbar {
    width: 6px;
}

.play-learn-content::-webkit-scrollbar-thumb {
    background: #CEC9E1;
    border-radius: 3px;
}

.play-learn-title {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-weight: 800;
    font-size: clamp(12px, 1.4vw, 18px);
    line-height: 1.4;
    letter-spacing: -1.1px;
    color: #000000;
}

.play-learn-text {
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-size: clamp(12px, 1.3vw, 18px);
    line-height: 1.6;
    letter-spacing: -0.9px;
    color: #000000;
}

/* Play and Learn - CKEditor HTML 태그 스타일 지원 */
.play-learn-text h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 0.67em 0;
}

.play-learn-text h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.83em 0;
}

.play-learn-text h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin: 1em 0;
}

.play-learn-text h4 {
    font-size: 1em;
    font-weight: bold;
    margin: 1.33em 0;
}

.play-learn-text strong,
.play-learn-text b {
    font-weight: bold;
}

.play-learn-text em,
.play-learn-text i {
    font-style: italic;
}

.play-learn-text u {
    text-decoration: underline;
}

.play-learn-text s,
.play-learn-text strike {
    text-decoration: line-through;
}

.play-learn-text ol {
    list-style-type: decimal;
    padding-left: clamp(15px, 1.8vw, 25px);
    margin: 0;
}

.play-learn-text ul {
    list-style-type: disc;
    padding-left: clamp(15px, 1.8vw, 25px);
    margin: 0;
}

.play-learn-text li {
    margin-bottom: 0;
}

/* Play and Learn 테이블 스타일 */
.play-learn-text table {
    border-collapse: collapse;
    border: 1px solid #333;
    margin: 10px 0;
}

.play-learn-text table td,
.play-learn-text table th {
    border: 1px solid #333;
    padding: 8px 12px;
}

/* inline style 우선 적용 허용 */
.play-learn-text [style] {
    /* inline style이 적용되도록 함 */
}

/* Custom Scrollbar - Hide on new layout */
.custom-scrollbar {
    display: none;
}

/* Hex Icons Grid Container */
.hex-icons-grid {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Desktop Hex Icon Positions - Percentage 기반 (브라우저 크기 변경시 비율 유지) */
/* 왼쪽 세로줄 아이콘들 (아이콘 1, 2, 3) - 약 19% */
.hex-icon[data-icon="1"] {
    left: 19%;
    top: 12%;
}
.hex-icon[data-icon="2"] {
    left: 19%;
    top: 32%;
}
.hex-icon[data-icon="3"] {
    left: 19%;
    top: 52%;
}

/* 오른쪽 세로줄 아이콘들 (아이콘 12, 11, 10) - 약 74% */
.hex-icon[data-icon="12"] {
    left: 74%;
    top: 12%;
}
.hex-icon[data-icon="11"] {
    left: 74%;
    top: 32%;
}
.hex-icon[data-icon="10"] {
    left: 74%;
    top: 52%;
}

/* 아래쪽 가로줄 아이콘들 (아이콘 4, 5, 6, 7, 8, 9) - 72% */
.hex-icon[data-icon="4"] {
    left: 19%;
    top: 72%;
}
.hex-icon[data-icon="5"] {
    left: 30%;
    top: 72%;
}
.hex-icon[data-icon="6"] {
    left: 41%;
    top: 72%;
}
.hex-icon[data-icon="7"] {
    left: 52%;
    top: 72%;
}
.hex-icon[data-icon="8"] {
    left: 63%;
    top: 72%;
}
.hex-icon[data-icon="9"] {
    left: 74%;
    top: 72%;
}

/* ========================================
   Mobile Responsive (max-width: 980px)
   ======================================== */
@media (max-width: 980px) {
    .moai-ai-commando .bd-lg.padding_sub_tb {
        max-width: 580px;
        padding: 28px 16px 60px;
    }

    /* Page Header */
    .moai-ai-commando-header {
        margin-bottom: 16px;
    }

    .moai-ai-commando-title {
        font-size: 28px;
        line-height: 36px;
    }

    .moai-ai-commando-subtitle {
        font-size: 14px;
        line-height: 18px;
    }

    /* Section Titles */
    .section-title-1,
    .section-title-2 {
        font-size: 24px;
        line-height: 32px;
        margin: 20px 0 16px;
    }

    /* Frame 430 - Mobile Layout */
    .frame-430 {
        height: auto;
        min-height: 500px;
        padding-bottom: 20px;
        border-radius: 10px;
    }

    .frame-430-bg {
        object-fit: cover;
        min-height: 500px;
    }

    /* Center Thumbnail - Move to top */
    .center-thumb {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 100%;
        padding: 30px 20px 20px;
        margin: 0 auto;
    }

    .thumb-image {
        width: 180px;
        height: 165px;
    }

    .star-overlay {
        width: 300px;
        height: 145px;
    }

    .thumb-content-img {
        width: 160px;
        height: 140px;
    }

    .thumb-play-overlay {
        width: 160px;
        height: 140px;
    }

    .thumb-play-icon {
        width: 43px;
        height: 43px;
    }

    .thumb-play-icon::before {
        border-top-width: 8px;
        border-bottom-width: 8px;
        border-left-width: 13px;
    }

    .thumb-title {
        font-size: 20px;
        letter-spacing: -1px;
        white-space: normal;
        text-align: center;
    }

    /* Hex Icons Grid - Mobile 4x3 layout */
    .hex-icons-grid {
        position: relative;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        column-gap: 2px;
        row-gap: 15px;
        width: 100%;
        max-width: 320px;
        height: auto;
        padding: 0 10px 20px;
        margin: 0 auto;
    }

    .hex-icon {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        width: 100%;
        height: 58px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* hex-icon-inner도 중앙 정렬을 위해 크기 고정 */
    .hex-icon .hex-icon-inner {
        width: 62px;
        height: 56px;
        position: relative;
    }

    .hex-icon .hex-icon-front {
        width: 100%;
        height: 100%;
    }

    .hex-icon .hex-bg {
        width: 62px;
        height: 56px;
    }

    .hex-icon .hex-inner {
        max-width: 30px;
        max-height: 30px;
    }

    /* Frame 430 - flex column for mobile */
    .frame-430 {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Book Flip Container - Mobile (BookBlock bb-horizontal calendar flip) */
    .book-flip-container {
        margin-bottom: 30px;
        background: linear-gradient(180deg, #FDFCFF 0%, #F8F6FF 100%);
        border: 8px solid #8B5CF6;
        overflow: visible;
        border-radius: 24px;
        box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
        perspective: 1300px;
    }

    .book-3d {
        aspect-ratio: auto;
        display: flex;
        flex-direction: column;
        transform-origin: center top;
    }

    /* Hide desktop shadow overlays on mobile */
    .sheet-front::after,
    .sheet-back::after,
    .book-left-fixed::after {
        display: none !important;
    }

    .book-base {
        display: none;
    }

    /* Mobile: Stack layout instead of side-by-side */
    .book-left-fixed {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        padding: 35px 20px 10px;
        order: 1;
        opacity: 1;
        transform: perspective(800px) rotateY(0deg);
        /* REVERSE Phase2: appear AFTER detail collapses (0.3s delay) */
        transition: opacity 0.2s ease 0.3s, transform 0.3s ease 0.3s, max-height 0.3s ease 0.2s;
        max-height: 2000px;
        overflow: hidden;
    }

    .book-sheet {
        order: 2;
        opacity: 1;
        transition: opacity 0.2s ease, transform 0.4s ease;
    }

    .book-right-fixed {
        display: block !important; /* Override .book-base display:none to allow transitions */
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        height: auto;
        padding: 25px 20px;
        order: 3;
        background: transparent;
        border-radius: 0;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transform: perspective(800px) rotateY(90deg);
        /* REVERSE Phase1: disappear immediately (collapse fast) */
        transition: opacity 0.2s ease, transform 0.3s ease, max-height 0.3s ease;
    }

    #book-back:checked ~ .book-3d .book-right-fixed {
        opacity: 1;
        max-height: 2000px;
        overflow: visible;
        transform: perspective(800px) rotateY(0deg);
        /* FORWARD Phase2: appear after front disappears (sync with sheet-back) */
        transition: opacity 0.2s ease 0.3s, transform 0.3s ease 0.3s, max-height 0.3s ease 0.25s;
    }

    /* Sheet - Mobile: rotateY half-flip effect (like hex-icon) */
    .book-sheet {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        transform: none !important;
        transform-style: flat;
        padding: 0 20px 25px;
    }

    .sheet-face {
        position: relative;
        width: 100%;
        height: auto;
        border-radius: 12px;
        background: transparent !important;
        box-shadow: none !important;
    }

    .sheet-front {
        display: block;
        visibility: visible;
    }

    .sheet-back {
        display: block;
        visibility: hidden;
    }

    /* When flipped - show back, hide front */
    #book-back:checked ~ .book-3d .book-sheet .sheet-front {
        visibility: hidden;
    }

    #book-back:checked ~ .book-3d .book-sheet .sheet-back {
        visibility: visible;
    }

    /* Override flip state for mobile - no position shift, no 3D rotation on container */
    #book-back:checked ~ .book-3d .book-sheet {
        left: auto;
        transform: none !important;
    }

    /* Hide left content when flipped - rotateY out (forward transition) */
    #book-back:checked ~ .book-3d .book-left-fixed {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        transform: perspective(800px) rotateY(90deg);
        /* FORWARD Phase1: disappear together with sheet-front (0-0.3s) */
        transition: opacity 0.1s ease 0.2s, transform 0.3s ease, max-height 0.3s ease;
    }

    /* Sheet front: default = reverse transition (appearing when Go Back) */
    .sheet-front {
        opacity: 1;
        max-height: 2000px;
        transform: perspective(800px) rotateY(0deg) !important;
        /* REVERSE Phase2: appear after sheet-back disappears (0.3s delay) */
        transition: opacity 0.1s ease 0.35s, transform 0.3s ease 0.3s, max-height 0.3s ease 0.3s, visibility 0s ease 0s;
    }

    /* Sheet back: default = reverse transition (disappearing when Go Back) */
    .sheet-back {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transform: perspective(800px) rotateY(90deg) !important;
        /* REVERSE Phase1: disappear first (0-0.3s), collapse max-height early */
        transition: opacity 0.1s ease 0.2s, transform 0.3s ease, max-height 0.3s ease, visibility 0s ease 0.3s;
    }

    /* Flipped: front rotates out (forward transition) */
    #book-back:checked ~ .book-3d .book-sheet .sheet-front {
        opacity: 0;
        max-height: 0;
        transform: perspective(800px) rotateY(90deg) !important;
        overflow: hidden;
        /* FORWARD Phase1: disappear first (0-0.3s), then hide */
        transition: opacity 0.1s ease 0.2s, transform 0.3s ease, max-height 0.3s ease, visibility 0s ease 0.3s;
    }

    /* Flipped: back rotates in (forward transition) */
    #book-back:checked ~ .book-3d .book-sheet .sheet-back {
        opacity: 1;
        max-height: 2000px;
        transform: perspective(800px) rotateY(0deg) !important;
        padding-top: 35px;
        overflow: visible;
        /* FORWARD Phase2: appear after front disappears (0.3s delay) */
        transition: opacity 0.1s ease 0.35s, transform 0.3s ease 0.3s, max-height 0.3s ease 0.25s, visibility 0s ease 0s;
    }

    .sheet-content {
        padding: 0;
    }

    .book-content-left {
        gap: 15px;
    }

    .book-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .book-text-container {
        padding-top: 0;
        text-align: center;
    }

    .book-title {
        font-size: 28px;
        line-height: 36px;
    }

    .book-description {
        font-size: 16px;
        line-height: 22px;
    }

    .robot-container {
        width: 120px;
        height: 95px;
    }

    /* Dictionary List - Single column */
    .dict-list-left,
    .dict-list-right {
        width: 100%;
        gap: 10px;
        display: flex;
        flex-direction: column;
    }

    .dict-item {
        height: 55px;
        padding: 0 12px 0 15px;
    }

    .dict-item.tall {
        height: 70px;
        padding-top: 10px;
    }

    .dict-item.short {
        height: 50px;
    }

    .dict-num {
        width: 26px;
        height: 26px;
        font-size: 14px;
        margin-right: 10px;
    }

    .dict-text {
        font-size: 16px;
        line-height: 20px;
    }

    /* Book Detail Left - Mobile */
    .book-detail-left {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    /* 모바일에서는 페이지네이션 없이 세로 스크롤 */
    .book-pages-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
        overflow: visible;
    }

    .book-page-item {
        position: relative;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .book-page-item.prev {
        transform: none;
    }

    .book-pages-container-right {
        display: flex;
        flex-direction: column;
        gap: 20px;
        overflow: visible;
    }

    .book-page-item-right {
        position: relative;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .book-page-item-right.prev {
        transform: none;
    }

    /* 모바일에서 페이지 네비게이션 숨김 */
    .book-page-nav {
        display: none;
    }

    .go-back {
        width: 120px;
        height: 36px;
    }

    .go-back-text {
        font-size: 18px;
    }

    .detail-title,
    .detail-label {
        font-size: 18px;
    }

    .detail-desc,
    .detail-text,
    .detail-text-goal {
        font-size: 15px;
    }

    .materials-images {
        max-width: 100%;
    }

    .material-img-1 {
        left: 15px;
        top: 35px;
        width: 150px;
        height: 80px;
    }

    .material-img-2 {
        left: 180px;
        top: 15px;
        width: 90px;
        height: 125px;
    }

    .download-btn-1 {
        left: 140px;
        top: 95px;
    }

    .download-btn-2 {
        left: 245px;
        top: 115px;
    }

    /* Play and Learn - Full width */
    .play-learn-wrapper {
        width: 100%;
    }

    .play-learn-content {
        max-height: none;
    }

    .play-learn-title {
        font-size: 18px;
    }

    .play-learn-text {
        font-size: 15px;
    }
}

/* Small mobile (max-width: 520px) - Yori&Jori와 동일 기준 */
@media (max-width: 520px) {
    .moai-ai-commando .bd-lg.padding_sub_tb {
        padding: 20px 12px 40px;
    }

    .moai-ai-commando-title {
        font-size: 24px;
        line-height: 30px;
    }

    .section-title-1,
    .section-title-2 {
        font-size: 20px;
        line-height: 26px;
    }

    .thumb-image {
        width: 150px;
        height: 138px;
    }

    .thumb-content-img {
        width: 138px;
        height: 120px;
    }

    .thumb-title {
        font-size: 18px;
    }

    /* hex-icon 간격 유지 (기존 이슈 해결: 촘촘한 간격) */
    .hex-icons-grid {
        column-gap: 2px;
        row-gap: 12px;
        max-width: 300px;
        padding: 0 10px 20px;
    }

    .hex-icon {
        height: 52px;
    }

    .hex-icon .hex-icon-inner {
        width: 58px;
        height: 52px;
    }

    .hex-icon .hex-bg {
        width: 58px;
        height: 52px;
    }

    .hex-icon .hex-inner {
        max-width: 26px;
        max-height: 26px;
    }

    .book-title {
        font-size: 24px;
        line-height: 30px;
    }

    .dict-text {
        font-size: 14px;
        line-height: 18px;
    }

    .material-img-2 {
        left: 150px;
    }

    .download-btn-2 {
        left: 215px;
    }

    .star-overlay {
        width: 120px;
        height: 145px;
    }
}

/* Extra small mobile (max-width: 320px) - Yori&Jori와 동일 기준 */
@media (max-width: 320px) {
    .moai-ai-commando .bd-lg.padding_sub_tb {
        padding: 16px 10px 30px;
    }

    .moai-ai-commando-title {
        font-size: 20px;
        line-height: 26px;
    }

    .section-title-1,
    .section-title-2 {
        font-size: 18px;
        line-height: 24px;
    }

    .thumb-image {
        width: 130px;
        height: 120px;
    }

    .thumb-content-img {
        width: 118px;
        height: 105px;
    }

    .thumb-title {
        font-size: 16px;
    }

    /* hex-icon 간격 유지 (기존 이슈 해결: 촘촘한 간격) */
    .hex-icons-grid {
        column-gap: 1px;
        row-gap: 10px;
        max-width: 280px;
        padding: 0 8px 16px;
    }

    .hex-icon {
        height: 48px;
    }

    .hex-icon .hex-icon-inner {
        width: 52px;
        height: 48px;
    }

    .hex-icon .hex-bg {
        width: 52px;
        height: 48px;
    }

    .hex-icon .hex-inner {
        max-width: 24px;
        max-height: 24px;
    }

    /* Book flip container - 테두리 유지 (기존 이슈 해결: 두꺼운 책 테두리) */
    .book-flip-container {
        border-width: 6px;
        border-radius: 20px;
    }

    .book-content,
    .book-detail-wrapper {
        padding: 25px 18px;
        margin: 8px;
    }

    .book-title {
        font-size: 20px;
        line-height: 26px;
    }

    .book-description {
        font-size: 14px;
        line-height: 20px;
    }

    .dict-item {
        height: 48px;
        padding: 0 10px 0 12px;
    }

    .dict-num {
        width: 22px;
        height: 22px;
        font-size: 12px;
        margin-right: 8px;
    }

    .dict-text {
        font-size: 13px;
        line-height: 16px;
    }

    .detail-title,
    .detail-label,
    .go-back-text,
    .play-learn-title {
        font-size: 16px;
    }

    .detail-desc,
    .detail-text,
    .detail-text-goal,
    .play-learn-text {
        font-size: 13px;
    }


    .material-img-1 {
        left: 10px;
        top: 30px;
        width: 120px;
        height: 70px;
    }

    .material-img-2 {
        left: 140px;
        top: 15px;
        width: 70px;
        height: 100px;
    }

    .download-btn-1 {
        left: 110px;
        top: 85px;
    }

    .download-btn-2 {
        left: 190px;
        top: 95px;
    }
}

/* Side banner is hidden via JavaScript in moai_ai_commando.js */

/* ============================================================
   Book Navigation Arrows (책 양쪽 화살표 버튼)
   ============================================================ */

/* 책 양쪽 화살표 버튼 */
.book-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.9);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.book-nav-arrow:hover {
    background: #7C3AED;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.book-nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.book-nav-arrow:disabled:hover {
    transform: translateY(-50%);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.book-nav-prev {
    left: -24px;
}

.book-nav-next {
    right: -24px;
}

/* 페이지 인디케이터 (하단) */
.book-page-indicator-bottom {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'SUIT', 'Noto Sans KR', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* book-detail-left 내부 화살표 버튼 위치 조정 */
.book-detail-left .book-nav-prev {
    left: -60px;
}

.book-detail-left .book-nav-next {
    right: -60px;
}

.book-detail-left .book-page-indicator-bottom {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

/* 콘텐츠 래퍼 - 실제 콘텐츠를 감싸서 페이지 넘기기에 사용 */
.book-content-wrapper {
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    flex: 1;
}

/* 3D 책 페이지 넘기기 효과 */
.book-base.flipping {
    perspective: 2000px;
}

.book-base.flipping .book-content-wrapper {
    transform-style: preserve-3d;
}

/* 다음 페이지로 넘길 때 */
.book-base.flipping-next .book-content-wrapper {
    animation: pageFlipNext 0.6s ease-in-out;
}

/* 이전 페이지로 넘길 때 */
.book-base.flipping-prev .book-content-wrapper {
    animation: pageFlipPrev 0.6s ease-in-out;
}

@keyframes pageFlipNext {
    0% {
        transform-origin: left center;
    }
    30% {
        transform: perspective(2000px) rotateY(-15deg);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: perspective(2000px) rotateY(0deg);
        box-shadow: none;
    }
}

@keyframes pageFlipPrev {
    0% {
        transform-origin: right center;
    }
    30% {
        transform: perspective(2000px) rotateY(15deg);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: perspective(2000px) rotateY(0deg);
        box-shadow: none;
    }
}

/* ============================================================
   Calendar Flip Effect - Mobile Only (BookBlock bb-horizontal style)
   탁상달력 세로 넘기기 효과 (모바일에서만 JS 2-phase animation으로 적용)
   ============================================================ */

/* Calendar flip 중에는 개별 요소의 CSS transition 비활성화 (이중 애니메이션 방지) */
.book-3d.calendar-flipping .sheet-front,
.book-3d.calendar-flipping .sheet-back,
.book-3d.calendar-flipping .book-left-fixed,
.book-3d.calendar-flipping .book-right-fixed {
    transition: none !important;
}

/* Phase 1: 아래에서 위로 들어올림 (0 → -90deg) */
.book-3d.calendar-flip-out {
    animation: calendarFlipOut 0.35s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

/* Phase 2: 위에서 아래로 내려오며 나타남 (90deg → 0) */
.book-3d.calendar-flip-in {
    animation: calendarFlipIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Quick calendar flip (아이콘 변경 시) */
.book-3d.calendar-quick-flip-out {
    animation: calendarFlipOut 0.2s ease-in forwards;
}

.book-3d.calendar-quick-flip-in {
    animation: calendarFlipIn 0.2s ease-out forwards;
}

@keyframes calendarFlipOut {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(-90deg);
    }
}

@keyframes calendarFlipIn {
    0% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

/* play-learn-wrapper 레이아웃 조정 - 스크롤 허용 */
.play-learn-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* ============================================================
   MOAI AI Popup Modal Styles (영상 + 슬라이드 팝업)
   ============================================================ */

/* Body overflow when popup is open */
body.moai-ai-popup-open {
    overflow: hidden;
}

/* Modal Container */
.moai-ai-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.moai-ai-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

/* Popup Container */
.moai-ai-popup-container {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 1200px;
    width: 90%;
    max-height: 65vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* Close Button */
.moai-ai-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.moai-ai-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #000;
}

/* Popup Content Layout - New Structure */
.moai-ai-popup-content {
    display: grid;
    grid-template-columns: 4fr 1fr;
    grid-template-rows: 1fr;
    min-height: 350px;
    max-height: 65vh;
    flex: 1;
    overflow: hidden;
}

/* ============================================================
   Left: Player Section (Video or Slideshow)
   ============================================================ */
.moai-ai-popup-player-section {
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.moai-ai-popup-player-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Video Area */
.moai-ai-popup-video-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

/* Slideshow Area */
.moai-ai-popup-slideshow-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
    min-height: 280px;
}

.moai-ai-popup-slideshow-area img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    margin: auto;
}

/* Slideshow Expand (Fullscreen) Button - 슬라이드 영역 오른쪽 상단 */
.moai-ai-ss-expand-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
    z-index: 10;
}

.moai-ai-ss-expand-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Slideshow Navigation */
.moai-ai-popup-ss-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 5;
}

.moai-ai-popup-ss-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.moai-ai-popup-ss-nav.prev {
    left: 12px;
}

.moai-ai-popup-ss-nav.next {
    right: 12px;
}

/* Slideshow Controls (bottom) */
.moai-ai-popup-ss-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 30px;
    z-index: 5;
}

.moai-ai-popup-ss-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.moai-ai-popup-ss-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.moai-ai-popup-ss-counter {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

/* Title Bar (bottom of player) */
.moai-ai-popup-title-bar {
    background: #333;
    padding: 12px 16px;
    color: #fff;
}

.moai-ai-popup-title {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   Right: Thumbnail List Section
   ============================================================ */
.moai-ai-popup-thumbs-section {
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e0e0e0;
    overflow: hidden;
    min-height: 0;
}

.moai-ai-popup-thumbs-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    overflow-y: auto;
}

/* Thumbnail Item - 이미지만 표시 */
.moai-ai-popup-thumb-item {
    display: block;
    padding: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    overflow: hidden;
    flex-shrink: 0;
}

.moai-ai-popup-thumb-item:hover {
    border-color: #c5c5ff;
    transform: scale(1.02);
}

.moai-ai-popup-thumb-item.active {
    border-color: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Thumbnail Image - 꽉 차게 표시 */
.moai-ai-popup-thumb-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    object-fit: cover;
    display: block;
    background: #ddd;
}

/* Thumbnail Info - 숨김 */
.moai-ai-popup-thumb-info {
    display: none;
}

.moai-ai-popup-thumb-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
    margin-bottom: 4px;
}

.moai-ai-popup-thumb-type.video {
    background: #fee2e2;
    color: #dc2626;
}

.moai-ai-popup-thumb-type.slide {
    background: #dbeafe;
    color: #2563eb;
}

.moai-ai-popup-thumb-title {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scrollbar for thumbnail list */
.moai-ai-popup-thumbs-list::-webkit-scrollbar {
    width: 6px;
}

.moai-ai-popup-thumbs-list::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 3px;
}

.moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Firefox scrollbar */
.moai-ai-popup-thumbs-list {
    scrollbar-width: thin;
    scrollbar-color: #888 #e0e0e0;
}

/* Legacy: Video Section (Left) - kept for compatibility */
.moai-ai-popup-video-section {
    flex: 2;
    background: #e8e8e8;
    display: flex;
    flex-direction: column;
}

.moai-ai-popup-video-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Month Badge - 숨김 처리 */
.moai-ai-popup-month-badge {
    display: none;
}

/* Video Thumbnail */
.moai-ai-popup-video-thumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.moai-ai-popup-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play Button */
.moai-ai-popup-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.moai-ai-popup-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.9;
}

/* Video Player */
.moai-ai-popup-video-player {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 300px;
}

.moai-ai-popup-video-player video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 비디오 다운로드 방지 */
    pointer-events: auto;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 비디오 다운로드 버튼 숨기기 */
.moai-ai-popup-video-player video::-webkit-media-controls-enclosure {
    overflow: hidden;
}

.moai-ai-popup-video-player video::-webkit-media-controls-panel {
    width: calc(100% + 30px);
}

/* 다운로드 버튼 숨기기 (Chrome) */
.moai-ai-popup-video-player video::-internal-media-controls-download-button {
    display: none !important;
}

.moai-ai-popup-video-player video::-webkit-media-controls-download-button {
    display: none !important;
}

/* Video Fullscreen Button - 비디오 영역 오른쪽 상단 배치 */
.moai-ai-video-fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
    z-index: 10;
}

.moai-ai-video-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Fullscreen mode styles */
.moai-ai-popup-video-player.video-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #000 !important;
    border-radius: 0 !important;
}

.moai-ai-popup-video-player.video-fullscreen video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

body.video-fullscreen-active {
    overflow: hidden;
}

/* 동영상 전체화면 모드에서 버튼들 위치 조정 */
body.video-fullscreen-active .moai-ai-popup-close {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 100000 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 48px !important;
    height: 48px !important;
}

body.video-fullscreen-active .moai-ai-popup-close:hover {
    background: rgba(255, 255, 255, 1) !important;
}

/* 전체화면 모드에서 확대/축소 버튼 위치 - 닫기 버튼 바로 아래 */
body.video-fullscreen-active .moai-ai-video-fullscreen-btn {
    position: fixed !important;
    top: 76px !important;  /* 닫기 버튼(top:20px + height:48px) + 8px 간격 */
    right: 20px !important;
    z-index: 100000 !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
}

body.video-fullscreen-active .moai-ai-video-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
}

/* Video Title Bar */
.moai-ai-popup-video-title-bar {
    background: #333;
    padding: 12px 16px;
    color: #fff;
}

.moai-ai-popup-video-title {
    font-size: 14px;
    font-weight: 500;
}

/* Slide Section (Right) */
.moai-ai-popup-slide-section {
    flex: 0.8;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    align-self: stretch;
}

.moai-ai-popup-slide-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Slide Container - Vertical Scroll */
.moai-ai-popup-slide-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
}

/* Custom scrollbar */
.moai-ai-popup-slide-container::-webkit-scrollbar {
    width: 8px;
}

.moai-ai-popup-slide-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.moai-ai-popup-slide-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.moai-ai-popup-slide-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Individual Slide - Always visible in vertical scroll mode */
.moai-ai-popup-slide {
    display: block;
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

.moai-ai-popup-slide.active {
    display: block;
}

.moai-ai-popup-slide img {
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.moai-ai-popup-slide canvas {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Slide Navigation Buttons - Hidden for vertical scroll mode */
.moai-ai-popup-slide-nav {
    display: none !important;
}

.moai-ai-popup-slide-nav:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-50%) scale(1.05);
}

.moai-ai-popup-slide-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.moai-ai-popup-slide-prev {
    left: 0;
}

.moai-ai-popup-slide-next {
    right: 0;
}

/* Slide Indicators - Hidden for vertical scroll mode */
.moai-ai-popup-slide-indicators {
    display: none !important;
}

.moai-ai-popup-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.moai-ai-popup-indicator:hover {
    background: #999;
}

.moai-ai-popup-indicator.active {
    background: #7c4dff;
    transform: scale(1.2);
}

/* No Slide Message */
.moai-ai-popup-no-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    font-size: 16px;
}

/* Loading Message */
.moai-ai-popup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 16px;
}

/* Error Message */
.moai-ai-popup-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    text-align: center;
}

.moai-ai-popup-error p {
    margin-bottom: 16px;
}

/* Download Slide */
.moai-ai-popup-download-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.moai-ai-popup-download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    background: #7c4dff;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    transition: background 0.2s, transform 0.2s;
}

.moai-ai-popup-download-btn:hover {
    background: #651fff;
    transform: scale(1.02);
    color: #fff;
    text-decoration: none;
}

.moai-ai-popup-download-btn span {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================================
   Popup Responsive Styles
   ============================================================ */

/* Tablet */
@media (max-width: 768px) {
    .moai-ai-popup-container {
        max-width: 95%;
        max-height: 95vh;
        overflow: visible;
    }

    /* 모바일/태블릿에서 닫기 버튼과 확대 버튼 위치 조정 - 같은 컨테이너에서 위아래 배치 */
    .moai-ai-popup-close {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.9) !important;
    }

    .moai-ai-video-fullscreen-btn {
        position: absolute !important;
        top: 8px !important;
        left: 8px !important;
        right: auto !important;
        width: 36px;
        height: 36px;
        z-index: 10;
    }

    .moai-ai-ss-expand-btn {
        top: 8px !important;
        left: 8px !important;
        right: auto !important;
        width: 36px;
        height: 36px;
    }

    .moai-ai-popup-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .moai-ai-popup-content > * {
        max-width: 100%;
        overflow: hidden;
    }

    .moai-ai-popup-player-section {
        min-height: 280px;
        max-height: 60vh;
        position: relative;
        overflow: hidden;
        width: calc(95vw - 10px) !important;
        max-width: calc(95vw - 10px) !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    .moai-ai-popup-player-wrapper {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        overflow: hidden;
    }

    .moai-ai-popup-video-area {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        overflow: hidden;
    }

    .moai-ai-popup-slideshow-area {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 250px;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        box-sizing: border-box;
    }

    /* 모바일에서 슬라이드 화살표 */
    .moai-ai-popup-ss-nav {
        width: 40px;
        height: 40px;
        z-index: 100;
        background: rgba(0, 0, 0, 0.6);
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .moai-ai-popup-ss-nav.prev {
        left: 8px;
    }

    .moai-ai-popup-ss-nav.next {
        right: 8px;
    }

    .moai-ai-popup-ss-nav img {
        width: 20px;
        height: 20px;
    }

    /* 슬라이드쇼 이미지 - 화살표 공간 확보 */
    .moai-ai-popup-slideshow-area img,
    .moai-ai-popup-slideshow-area #popup-slideshow-img {
        max-width: calc(90vw - 100px) !important;
        width: auto !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block;
        object-fit: contain;
    }

    .moai-ai-popup-thumbs-section {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        min-height: auto;
        height: auto;
        overflow: hidden;
        width: calc(95vw - 10px) !important;
        max-width: calc(95vw - 10px) !important;
        box-sizing: border-box;
    }

    .moai-ai-popup-thumbs-list {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 8px;
        gap: 8px;
        scroll-behavior: smooth;
        width: 100%;
        max-width: 100%;
        align-items: flex-start;
        box-sizing: border-box;
    }

    .moai-ai-popup-thumb-item {
        flex-shrink: 0;
        width: 120px;
        min-width: 120px;
    }

    .moai-ai-popup-thumb-img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .moai-ai-popup-video-section {
        min-height: 250px;
    }

    .moai-ai-popup-video-thumb {
        min-height: 200px;
    }

    .moai-ai-popup-slide-section {
        padding: 16px;
    }

    .moai-ai-popup-slide-container {
        min-height: 200px;
    }

    .moai-ai-popup-slide img,
    .moai-ai-popup-slide canvas {
        max-height: 250px;
    }

    .moai-ai-popup-video-player video {
        max-height: none;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .moai-ai-popup-modal {
        align-items: center;
    }

    .moai-ai-popup-container {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 12px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .moai-ai-popup-content {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        min-height: 350px;
        display: grid;
        grid-template-rows: 1fr auto;
    }

    .moai-ai-popup-thumbs-section {
        height: auto;
        max-height: 120px;
        border-top: 1px solid #eee;
    }

    .moai-ai-popup-thumbs-list {
        scrollbar-width: auto;
        scrollbar-color: #666 #ddd;
    }

    /* 모바일 480px 가로 스크롤바 스타일 */
    .moai-ai-popup-thumbs-list::-webkit-scrollbar {
        height: 12px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-track {
        background: #ddd;
        border-radius: 6px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb {
        background: #666;
        border-radius: 6px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb:hover {
        background: #444;
    }

    .moai-ai-popup-player-section {
        width: 100%;
        max-width: 100%;
        overflow: visible;
        position: relative;
        padding: 0;
        box-sizing: border-box;
    }

    /* 슬라이드쇼 영역 */
    .moai-ai-popup-slideshow-area {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        position: relative;
        overflow: visible !important;
    }

    /* 슬라이드쇼 이미지 크기 조정 - 화살표 공간 확보 */
    .moai-ai-popup-slideshow-area img,
    .moai-ai-popup-slideshow-area #popup-slideshow-img {
        max-width: calc(100% - 80px) !important;
        width: auto !important;
        height: auto !important;
        max-height: 300px !important;
        margin: 0 auto !important;
        display: block;
        object-fit: contain;
    }

    .moai-ai-popup-close {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.9) !important;
    }

    /* 모바일에서 확대 버튼 - 닫기(X)와 겹침 방지 위해 왼쪽 상단 */
    .moai-ai-video-fullscreen-btn {
        top: 8px !important;
        left: 8px !important;
        right: auto !important;
        width: 36px;
        height: 36px;
        z-index: 10;
    }

    .moai-ai-ss-expand-btn {
        top: 8px !important;
        left: 8px !important;
        right: auto !important;
        width: 36px;
        height: 36px;
    }

    .moai-ai-popup-video-thumb {
        min-height: 180px;
    }

    .moai-ai-popup-play-btn svg {
        width: 48px;
        height: 48px;
    }

    .moai-ai-popup-slide-nav {
        width: 32px;
        height: 32px;
    }

    .moai-ai-popup-slide-nav svg {
        width: 18px;
        height: 18px;
    }

    .moai-ai-popup-indicator {
        width: 8px;
        height: 8px;
    }

    /* 썸네일 섹션 - 가로 스크롤 */
    .moai-ai-popup-thumbs-section {
        width: 100%;
        max-width: 100%;
        max-height: 130px;
        overflow: hidden;
        box-sizing: border-box;
    }

    .moai-ai-popup-thumbs-list {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: auto;
        scrollbar-color: #888 #e0e0e0;
        padding: 8px !important;
        gap: 8px;
        box-sizing: border-box !important;
    }

    /* 모바일 가로 스크롤바 스타일 */
    .moai-ai-popup-thumbs-list::-webkit-scrollbar {
        height: 10px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-track {
        background: #e0e0e0;
        border-radius: 5px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 5px;
    }

    .moai-ai-popup-thumbs-list::-webkit-scrollbar-thumb:hover {
        background: #666;
    }

    .moai-ai-popup-thumb-item {
        flex-shrink: 0;
        width: 70px;
        min-width: 70px;
    }

    .moai-ai-popup-thumb-img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    /* 슬라이드 화살표 - 패딩 영역 내 위치 */
    .moai-ai-popup-ss-nav {
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.6) !important;
        position: absolute;
        z-index: 100;
    }

    .moai-ai-popup-ss-nav.prev {
        left: 5px !important;
    }

    .moai-ai-popup-ss-nav.next {
        right: 5px !important;
    }

    .moai-ai-popup-ss-controls {
        padding: 6px 12px;
    }

    /* 모바일에서 책 페이지 네비게이션 숨김 (세로 스크롤로 대체) */
    .book-nav-arrow,
    .book-page-indicator-bottom {
        display: none !important;
    }

    /* 모바일에서는 일반 스크롤 허용 */
    .book-detail-left {
        overflow-y: auto;
    }

    .book-content-wrapper {
        transform: none !important;
    }
}

/* ============================================================
   Materials Slideshow Modal
   ============================================================ */
.moai-ss-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.moai-ss-modal.is-open {
    display: flex;
}

.moai-ss-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.moai-ss-panel {
    position: relative;
    width: min(1100px, calc(100vw - 24px));
    height: min(760px, calc(100vh - 24px));
    border-radius: 18px;
    background: #0b0b0b;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.moai-ss-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: #fff;
    flex: 0 0 auto;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
}

.moai-ss-title {
    font-family: 'SUIT', sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.4px;
    color: #fff;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.moai-ss-close {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #fff;
    font-size: 34px;
    line-height: 44px;
    opacity: 0.9;
}

.moai-ss-close:hover {
    opacity: 1;
}

.moai-ss-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 14px 10px;
}

.moai-ss-main {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    overflow: hidden;
    background: #111;
    position: relative;
}

.moai-ss-main img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.moai-ss-empty {
    color: rgba(255, 255, 255, 0.85);
    font-family: 'SUIT', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.2px;
}

.moai-ss-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 34px;
    line-height: 52px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 6;
}

.moai-ss-arrow:hover {
    background: rgba(0,0,0,0.6);
}

.moai-ss-arrow:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.moai-ss-arrow.left {
    left: 18px;
}

.moai-ss-arrow.right {
    right: 18px;
}

.moai-ss-controls {
    position: absolute;
    right: 18px;
    top: 18px;
    display: flex;
    gap: 10px;
    z-index: 8;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.moai-ss-btn {
    height: 38px;
    width: 38px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    font-family: 'SUIT', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -0.2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.moai-ss-btn:hover {
    background: rgba(0,0,0,0.6);
}

.moai-ss-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.moai-ss-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: rgba(255,255,255,0.95);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Print 버튼 레이블 - 화면에서 숨기고 스크린리더에만 보이게 */
.moai-ss-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* START 오버레이 */
.moai-ss-start {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 7;
}

.moai-ss-start-inner {
    width: min(520px, calc(100vw - 64px));
    padding: 26px 24px 22px;
    border-radius: 16px;
    background: rgba(255,255,255,0.98);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.28);
}

.moai-ss-start-title {
    margin: 0 0 10px;
    font-family: 'SUIT', sans-serif;
    font-weight: 900 !important;
    font-size: 28px;
    letter-spacing: -0.8px;
    color: #000;
}

.moai-ss-start-desc {
    margin: 0 0 18px;
    font-family: 'SUIT', sans-serif;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.6;
    letter-spacing: -0.3px;
    color: #333;
}

.moai-ss-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: #ff7c0a;
    color: #fff;
    font-family: 'SUIT', sans-serif;
    font-weight: 800 !important;
    font-size: 16px;
    letter-spacing: -0.3px;
}

.moai-ss-start-btn:hover {
    background: #e86d00;
}

.moai-ss-thumbs {
    flex: 0 0 auto;
    padding: 10px 14px 14px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.moai-ss-thumb {
    width: 92px;
    height: 62px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    cursor: pointer;
    flex: 0 0 auto;
}

.moai-ss-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.moai-ss-thumb.is-active {
    border-color: #ff7c0a;
    box-shadow: 0 0 0 2px rgba(255, 141, 26, 0.25);
}

/* UI visible state */
.moai-ss-panel.is-ui-visible .moai-ss-controls,
.moai-ss-panel.is-ui-visible .moai-ss-thumbs {
    opacity: 1;
    pointer-events: auto;
}

.moai-ss-panel.is-ui-visible .moai-ss-arrow {
    opacity: 1;
}

/* Fullscreen mode */
.moai-ss-panel.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
}

.moai-ss-panel.is-fullscreen .moai-ss-top {
    display: none;
}

.moai-ss-panel.is-fullscreen .moai-ss-stage {
    padding: 0 !important;
}

.moai-ss-panel.is-fullscreen .moai-ss-main {
    border-radius: 0 !important;
}

.moai-ss-panel.is-fullscreen .moai-ss-main img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
}

.moai-ss-panel.is-fullscreen .moai-ss-thumbs {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    border-top: none;
}

.moai-ss-panel.is-fullscreen .moai-ss-thumb {
    border-color: transparent;
}

.moai-ss-panel.is-fullscreen .moai-ss-thumb.is-active {
    border-color: #ff7c0a;
}

/* Mobile responsive */
@media (max-width: 700px) {
    /* 모바일 고정 헤더 좌우 여백 축소 + 메뉴 간 공백 제거 (이 페이지 전용) */
    .header .h_right_nav.on_pcheader {
        padding: 0 10px;
    }
    .header .h_right_subnav_navigator.on_pcheader {
        padding: 0 10px;
        top: 42px; /* nav 높이(42px)에 맞춤 - 1px gap 제거 */
    }
    .header .h_right_subnav.on_pcheader {
        padding: 0 10px;
    }

    .moai-ss-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        border-radius: 14px;
    }

    .moai-ss-thumb {
        width: 78px;
        height: 54px;
    }

    .moai-ss-arrow.left {
        left: 10px;
    }

    .moai-ss-arrow.right {
        right: 10px;
    }

    .moai-ss-controls {
        right: 12px;
        top: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}
