/* =============================================================
   3D 가상 동화책 전시관 (exhibition.css)
   Warm Ivory (#FAF8F5) / Deep Forest (#234236) / Terracotta (#C86D51)
   Noto Serif KR + Pretendard Variable
   ============================================================= */

:root {
    --ex-bg: #FAF8F5;
    --ex-surface: #FFFFFF;
    --ex-surface-soft: #F3EDE3;
    --ex-primary: #234236;
    --ex-primary-dark: #183027;
    --ex-primary-soft: #E6EFEA;
    --ex-accent: #C86D51;
    --ex-accent-dark: #AD583E;
    --ex-accent-soft: #F9EAE5;
    --ex-text: #1F2421;
    --ex-muted: #5E5A54;
    --ex-border: #E3DACB;
    --ex-hud-bg: rgba(250, 248, 245, 0.88);
    --ex-hud-text: #1F2421;
    --ex-radius: 16px;
    --ex-shadow: 0 12px 32px rgba(35, 66, 54, 0.14);
}

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

html, body {
    width: 100%;
    height: 100%;
    background: var(--ex-bg);
    color: var(--ex-text);
    font-family: 'Pretendard Variable', 'Pretendard', 'Noto Sans KR', system-ui, -apple-system, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.is-3d {
    overflow: hidden;
}

.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button, a, select { cursor: pointer; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--ex-accent);
    outline-offset: 2px;
}

/* ---------------- 좌측 상단: 타이틀 + 기수 + Gallery Map ---------------- */
.ex-tl-cluster {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 40;
    width: 248px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.ex-brand-card,
.ex-minimap-card {
    pointer-events: auto;
    background: var(--ex-hud-bg);
    color: var(--ex-hud-text);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--ex-border);
    border-radius: 16px;
    box-shadow: var(--ex-shadow);
}

.ex-brand-card {
    padding: 12px 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ex-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ex-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--ex-border);
    background: var(--ex-surface);
    color: var(--ex-primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.ex-icon-btn svg { width: 17px; height: 17px; }
.ex-icon-btn:hover { background: var(--ex-primary-soft); border-color: var(--ex-primary); }

.ex-title-group { min-width: 0; flex: 1; }

.ex-eyebrow-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1px;
}

.ex-eyebrow {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    color: var(--ex-accent-dark);
}

.ex-pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--ex-accent-soft);
    color: var(--ex-accent-dark);
    white-space: nowrap;
}

.ex-board-title {
    font-family: 'Noto Serif KR', 'Pretendard Variable', serif;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.28;
    color: var(--ex-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-cohort-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.ex-cohort-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--ex-border);
    background: var(--ex-surface);
    color: var(--ex-primary);
}
.ex-cohort-wrap svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ex-accent); }

.ex-cohort-select {
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ex-text);
    outline: none;
}

.ex-count-chip {
    padding: 5px 9px;
    border-radius: 10px;
    background: var(--ex-primary-soft);
    color: var(--ex-primary);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Gallery Map 미니맵 */
.ex-minimap-card {
    padding: 10px 12px 11px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ex-minimap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ex-minimap-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--ex-primary);
}
.ex-minimap-title svg { width: 14px; height: 14px; color: var(--ex-accent); }

.ex-minimap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ex-muted);
}
.ex-minimap-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ex-dot-me, .ex-dot-art {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.ex-dot-me { background: var(--ex-primary); }
.ex-dot-art { background: var(--ex-accent); }

.ex-minimap-canvas-wrap {
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--ex-border);
    background: rgba(255, 255, 255, 0.7);
}

#ex-minimap {
    display: block;
    width: 100%;
    height: auto;
    cursor: pointer;
}

/* ---------------- 우측 상단 액션 버튼 ---------------- */
.ex-tr-cluster {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ex-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 6px 18px rgba(35, 66, 54, 0.12);
}

.ex-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.ex-btn-primary {
    background: var(--ex-primary);
    color: #FAF8F5;
}
.ex-btn-primary:hover { background: var(--ex-primary-dark); }

.ex-btn-accent {
    background: var(--ex-accent);
    color: #FFFFFF;
}
.ex-btn-accent:hover { background: var(--ex-accent-dark); }

.ex-btn-surface {
    background: var(--ex-hud-bg);
    backdrop-filter: blur(12px);
    color: var(--ex-primary);
    border-color: var(--ex-border);
}
.ex-btn-surface:hover { background: var(--ex-surface); border-color: var(--ex-primary); }

.ex-btn-soft {
    background: var(--ex-primary-soft);
    color: var(--ex-primary);
    box-shadow: none;
}
.ex-btn-soft:hover { background: var(--ex-surface-soft); }

.ex-btn-ghost {
    background: var(--ex-surface);
    color: var(--ex-text);
    border-color: var(--ex-border);
    box-shadow: none;
}
.ex-btn-ghost:hover { background: var(--ex-surface-soft); }

.ex-icon-circle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--ex-border);
    background: var(--ex-hud-bg);
    backdrop-filter: blur(12px);
    color: var(--ex-primary);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(35, 66, 54, 0.12);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.ex-icon-circle-btn svg { width: 18px; height: 18px; }
.ex-icon-circle-btn:hover { background: var(--ex-surface); border-color: var(--ex-primary); }

/* ---------------- 안내 배너 ---------------- */
.ex-notice-banner {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 38;
    max-width: min(440px, calc(100vw - 540px));
    background: var(--ex-hud-bg);
    backdrop-filter: blur(12px);
    color: var(--ex-text);
    border: 1px solid var(--ex-accent);
    border-left: 4px solid var(--ex-accent);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.8rem;
    box-shadow: var(--ex-shadow);
}

.ex-notice-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--ex-muted);
    display: grid;
    place-items: center;
    border-radius: 8px;
    flex-shrink: 0;
}
.ex-notice-close svg { width: 15px; height: 15px; }
.ex-notice-close:hover { background: var(--ex-surface-soft); color: var(--ex-text); }

/* ---------------- 3D WebGL 스테이지 ---------------- */
.ex-stage-3d {
    position: fixed;
    inset: 0;
    z-index: 1;
}

#ex-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    touch-action: none;
}

/* 근접 작품 프롬프트 */
.ex-near-prompt {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    z-index: 34;
    background: var(--ex-hud-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--ex-accent);
    border-radius: 16px;
    padding: 9px 12px 9px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--ex-shadow);
    max-width: calc(100vw - 32px);
}

.ex-near-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ex-near-tag {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--ex-accent-dark);
    letter-spacing: 0.04em;
}

.ex-near-info strong {
    font-family: 'Noto Serif KR', serif;
    font-size: 0.94rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
}

.ex-near-author {
    font-size: 0.75rem;
    color: var(--ex-muted);
}

.ex-near-prompt kbd {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.72rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

/* ---------------- 좌측 하단: Deep Forest 알약형 채팅 ---------------- */
.ex-bl-cluster {
    position: fixed;
    left: 16px;
    bottom: 18px;
    z-index: 35;
    width: min(300px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ex-chat-feed {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 150px;
    overflow: hidden;
}

.ex-chat-bubble-line {
    align-self: flex-start;
    max-width: 100%;
    background: rgba(35, 66, 54, 0.86);
    color: #FAF8F5;
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 14px 14px 14px 4px;
    font-size: 0.8rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    word-break: break-word;
}
.ex-chat-bubble-line strong {
    color: #F4B9A6;
    margin-right: 6px;
    font-weight: 700;
}

.ex-chat-pill {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 4px 5px 4px 14px;
    border-radius: 999px;
    background: #234236;
    color: #FAF8F5;
    border: 1px solid rgba(250, 248, 245, 0.18);
    box-shadow: 0 10px 26px rgba(24, 48, 39, 0.34);
}

.ex-chat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #C86D51;
    flex-shrink: 0;
}

.ex-chat-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: #FAF8F5;
    font-size: 0.86rem;
    outline: none;
}
.ex-chat-input::placeholder {
    color: rgba(250, 248, 245, 0.72);
}

.ex-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #C86D51;
    color: #FFFFFF;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background-color 0.16s ease;
}
.ex-chat-send svg { width: 16px; height: 16px; }
.ex-chat-send:hover { background: #AD583E; }

/* ---------------- 중앙 하단: 메인 알약형 컨트롤 바 ---------------- */
.ex-bc-cluster {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 36;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ex-control-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--ex-hud-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow);
    max-width: calc(100vw - 32px);
}

.ex-control-bar .ex-bl-cluster {
    position: relative;
    left: auto;
    bottom: auto;
    z-index: auto;
    width: clamp(180px, 22vw, 265px);
    flex: 0 1 auto;
    margin-right: 6px;
}
.ex-control-bar .ex-chat-feed {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 0;
    width: min(300px, 75vw);
}
.ex-control-bar .ex-chat-pill { height: 42px; }
.ex-ctrl-btn.ex-ctrl-upload {
    background: #C86D51;
    color: #fff;
    min-width: 112px;
}
.ex-ctrl-btn.ex-ctrl-upload:hover { background: #ad583e; }
.ex-ctrl-upload.hidden { display: none; }

.ex-ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 7px 14px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--ex-primary);
    font-size: 0.83rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.16s ease, color 0.16s ease;
}
.ex-ctrl-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.ex-ctrl-btn:hover { background: var(--ex-primary-soft); }
.ex-ctrl-btn.is-active {
    background: var(--ex-primary);
    color: #FAF8F5;
}
.ex-ctrl-btn:disabled { opacity: 0.42; cursor: default; }

/* 컨트롤 팝오버 */
.ex-popover {
    background: var(--ex-surface);
    color: var(--ex-text);
    border: 1px solid var(--ex-border);
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 18px 42px rgba(24, 48, 39, 0.22);
    min-width: 260px;
}

.ex-popover-head {
    margin-bottom: 10px;
    font-size: 0.88rem;
    color: var(--ex-primary);
}

.ex-move-hints {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--ex-muted);
    margin-bottom: 12px;
}
.ex-move-hints div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ex-move-hints span { font-weight: 700; color: var(--ex-text); }
.ex-move-hints kbd {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 2px;
    border-radius: 5px;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    font-size: 0.74rem;
    color: var(--ex-text);
}

.ex-popover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ex-chip-btn {
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    color: var(--ex-primary);
    font-size: 0.76rem;
    font-weight: 700;
    padding: 6px 11px;
    border-radius: 999px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ex-chip-btn:hover { background: var(--ex-primary-soft); border-color: var(--ex-primary); }

.ex-react-popover {
    min-width: unset;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
}

.ex-emote-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    font-size: 1.25rem;
    display: grid;
    place-items: center;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ex-emote-btn:hover { border-color: var(--ex-accent); background: var(--ex-accent-soft); }

.ex-share-popover {
    width: min(300px, calc(100vw - 32px));
}

.ex-share-qr-box {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1px solid var(--ex-border);
}
.ex-share-qr-box svg { width: 132px; height: 132px; display: block; }

.ex-share-url-row {
    display: flex;
    gap: 6px;
}
.ex-share-url-row input {
    flex: 1;
    min-width: 0;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    font-size: 0.78rem;
}

/* 모바일/토글 가상 터치 패드 */
.ex-touch-pad {
    position: fixed;
    left: 16px;
    bottom: 78px;
    z-index: 34;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    user-select: none;
    -webkit-user-select: none;
}

.ex-pad-mid { display: flex; gap: 6px; }

.ex-pad-btn {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    border: 1px solid var(--ex-border);
    background: var(--ex-hud-bg);
    backdrop-filter: blur(8px);
    color: var(--ex-primary);
    display: grid;
    place-items: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
    touch-action: none;
}
.ex-pad-btn svg { width: 20px; height: 20px; }
.ex-pad-btn.is-active, .ex-pad-btn:active {
    background: var(--ex-primary);
    color: #FAF8F5;
    border-color: var(--ex-primary);
}

/* ---------------- 우측 슬라이드 사이드 패널 (#ex-work-panel) ---------------- */
.ex-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 62;
    background: rgba(18, 28, 24, 0.08);
    pointer-events: none;
}

.ex-work-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: clamp(360px, 34vw, 480px);
    max-width: 100vw;
    z-index: 70;
    background: var(--ex-bg);
    border-left: 1px solid var(--ex-border);
    box-shadow: -14px 0 42px rgba(24, 48, 39, 0.24);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(0);
    /* WebGL 렌더링이 느린 기기에서도 패널 전체가 즉시 화면 안에 놓인다. */
}

@keyframes exSlideInRight {
    from { transform: translateX(100%); opacity: 0.7; }
    to { transform: translateX(0); opacity: 1; }
}

/* 패널 상단: Deep Forest (#234236) */
.ex-panel-top {
    background: #234236;
    color: #FAF8F5;
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ex-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ex-panel-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ex-trailer-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(250, 248, 245, 0.14);
    color: #FAF8F5;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.ex-trailer-tag svg { width: 13px; height: 13px; color: #F4B9A6; }

.ex-panel-nav-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ex-panel-nav-btn,
.ex-panel-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(250, 248, 245, 0.22);
    background: rgba(250, 248, 245, 0.08);
    color: #FAF8F5;
    display: grid;
    place-items: center;
    transition: background-color 0.16s ease;
}
.ex-panel-nav-btn svg,
.ex-panel-close svg { width: 17px; height: 17px; }
.ex-panel-nav-btn:hover,
.ex-panel-close:hover { background: rgba(250, 248, 245, 0.2); }

.ex-panel-player-shell {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #14261F;
    border: 1px solid rgba(250, 248, 245, 0.16);
}

.ex-media-tabs {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    gap: 4px;
    background: rgba(17, 30, 25, 0.78);
    backdrop-filter: blur(8px);
    padding: 3px;
    border-radius: 999px;
}

.ex-media-tab {
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #E5E7EB;
    font-size: 0.72rem;
    font-weight: 600;
}
.ex-media-tab.active {
    background: #C86D51;
    color: #FFFFFF;
}

.ex-work-media-stage {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ex-work-media-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ex-work-media-stage video {
    width: 100%;
    height: 100%;
    background: #000;
    display: block;
}

.ex-iframe-wrap {
    width: 100%;
    height: 100%;
    background: #000;
}
.ex-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.ex-video-fallback {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 3;
    padding: 7px 11px;
    border: 1px solid rgba(250, 248, 245, 0.48);
    border-radius: 999px;
    background: rgba(35, 66, 54, 0.88);
    color: #FAF8F5;
    font-size: 0.7rem;
    font-weight: 700;
}
.ex-video-fallback:hover { background: #C86D51; }

.ex-trailer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.ex-trailer-toggle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 3;
    height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(250, 248, 245, 0.35);
    background: rgba(24, 48, 39, 0.82);
    color: #FAF8F5;
    font-size: 0.72rem;
    font-weight: 600;
}
.ex-trailer-toggle:hover { background: #C86D51; border-color: #C86D51; }

.ex-panel-story {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ex-work-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ex-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(250, 248, 245, 0.16);
    color: #FAF8F5;
}

.ex-badge-accent {
    background: #C86D51;
    color: #FFFFFF;
}

.ex-work-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.38rem;
    font-weight: 700;
    line-height: 1.3;
    color: #FAF8F5;
}

.ex-work-author-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.84rem;
    color: rgba(250, 248, 245, 0.84);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(250, 248, 245, 0.16);
}

.ex-work-author { font-weight: 700; color: #F5C3B3; }
.ex-work-date { font-size: 0.76rem; color: rgba(250, 248, 245, 0.72); }

.ex-work-body {
    font-size: 0.88rem;
    line-height: 1.66;
    color: rgba(250, 248, 245, 0.92);
    white-space: pre-wrap;
    word-break: break-word;
}

.ex-work-ext-wrap {
    padding-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ex-flipbook-cta {
    background: #FAF8F5;
    color: #234236;
    border: 1px solid rgba(250, 248, 245, 0.35);
    cursor: pointer;
}
.ex-flipbook-cta:hover {
    background: #EDE4D4;
}

.ex-ebook-cta {
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #C86D51;
    color: #FFFFFF;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background-color 0.16s ease;
}
.ex-ebook-cta svg { width: 17px; height: 17px; }
.ex-ebook-cta:hover { background: #AD583E; }

/* 패널 하단: Warm Ivory (#FAF8F5) 카드 */
.ex-panel-bottom {
    background: #FAF8F5;
    color: #1F2421;
    padding: 18px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.ex-clap-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #FFFFFF;
    border: 1px solid #E3DACB;
}

.ex-clap-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid #E3DACB;
    background: #FAF8F5;
    color: #1F2421;
    font-weight: 700;
    font-size: 0.88rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.ex-clap-btn:hover { border-color: #C86D51; background: #F9EAE5; }
.ex-clap-btn.active {
    background: #C86D51;
    color: #FFFFFF;
    border-color: #C86D51;
}

.ex-sync-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #5E5A54;
}

.ex-guestbook {
    background: #FFFFFF;
    border: 1px solid #E3DACB;
    border-radius: 16px;
    padding: 15px 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ex-guestbook-head {
    display: flex;
    align-items: center;
    gap: 7px;
}
.ex-guestbook-head h3 {
    font-size: 0.94rem;
    font-weight: 700;
    color: #234236;
}
.ex-cmt-count-badge {
    padding: 1px 8px;
    border-radius: 999px;
    background: #E6EFEA;
    color: #234236;
    font-size: 0.74rem;
    font-weight: 700;
}

.ex-cmt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.ex-cmt-empty {
    font-size: 0.82rem;
    color: #5E5A54;
    padding: 8px 2px;
}

.ex-cmt-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #FAF8F5;
    border: 1px solid #E3DACB;
    border-radius: 12px;
    padding: 10px 11px;
    font-size: 0.84rem;
}

.ex-cmt-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #234236;
    color: #FAF8F5;
    font-size: 0.76rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.ex-cmt-avatar.is-admin {
    background: #C86D51;
}

.ex-cmt-main { flex: 1; min-width: 0; }

.ex-cmt-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}

.ex-cmt-author { font-weight: 700; font-size: 0.8rem; color: #234236; }
.ex-cmt-time { font-size: 0.72rem; color: #5E5A54; }
.ex-cmt-text { color: #1F2421; line-height: 1.5; word-break: break-word; }

.ex-cmt-del {
    border: none;
    background: transparent;
    color: #5E5A54;
    font-size: 0.72rem;
    padding: 2px 5px;
    border-radius: 6px;
}
.ex-cmt-del:hover { background: #FEE2E2; color: #B91C1C; }

.ex-cmt-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ex-cmt-inputs {
    display: flex;
    gap: 6px;
}

.ex-cmt-author-in {
    width: 96px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #E3DACB;
    background: #FAF8F5;
    font-size: 0.82rem;
}

.ex-cmt-body-in {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #E3DACB;
    background: #FAF8F5;
    font-size: 0.82rem;
}

/* ---------------- 2D 카드 전시관 폴백 ---------------- */
.ex-stage-2d {
    min-height: 100vh;
    padding: 18px 20px 132px;
    padding-left: 284px;
    background: var(--ex-bg);
}

.ex-2d-inner {
    max-width: 1120px;
    margin: 56px auto 0;
}

.ex-2d-hero {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 22px;
}

.ex-2d-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    background: var(--ex-primary-soft);
    color: var(--ex-primary);
    margin-bottom: 8px;
}

.ex-2d-hero h2 {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.7rem;
    margin-bottom: 6px;
}

.ex-2d-hero p {
    color: var(--ex-muted);
    font-size: 0.92rem;
}

.ex-2d-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}

.ex-2d-card {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}
.ex-2d-card:hover {
    border-color: var(--ex-accent);
    box-shadow: var(--ex-shadow);
}

.ex-2d-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--ex-surface-soft);
    display: block;
}

.ex-2d-body {
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.ex-2d-card-title {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--ex-text);
}

.ex-2d-card-author {
    font-size: 0.82rem;
    color: var(--ex-muted);
}

.ex-2d-card-excerpt {
    font-size: 0.84rem;
    color: var(--ex-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-2d-card-foot {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--ex-primary);
    font-weight: 600;
    border-top: 1px solid var(--ex-border);
}

/* ---------------- 로딩 · 모달 · 드로어 ---------------- */
.ex-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    background: var(--ex-bg);
    display: grid;
    place-items: center;
    padding: 20px;
}

.ex-loading-card {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 20px;
    padding: 34px 30px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--ex-shadow);
}

.ex-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid var(--ex-border);
    border-top-color: var(--ex-primary);
    margin: 0 auto 16px;
    animation: exSpin 0.9s linear infinite;
}

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

.ex-loading-card h2 { font-family: 'Noto Serif KR', serif; font-size: 1.15rem; margin-bottom: 6px; }
.ex-loading-card p { font-size: 0.86rem; color: var(--ex-muted); }

.ex-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.ex-modal-backdrop, .ex-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 28, 24, 0.58);
    backdrop-filter: blur(5px);
}

.ex-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--ex-surface);
    color: var(--ex-text);
    border: 1px solid var(--ex-border);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.ex-modal-sm { max-width: 450px; }

.ex-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ex-border);
}

.ex-modal-head h2 {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.12rem;
    font-weight: 700;
}

.ex-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ex-muted);
    display: grid;
    place-items: center;
}
.ex-close-btn svg { width: 18px; height: 18px; }
.ex-close-btn:hover { background: var(--ex-surface-soft); color: var(--ex-text); }

.ex-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ex-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ex-field label { font-size: 0.84rem; font-weight: 700; }

.ex-field input,
.ex-field textarea,
.ex-select-full {
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 11px;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    color: var(--ex-text);
}

.ex-opt-hint { font-weight: 500; font-size: 0.76rem; color: var(--ex-muted); }
.ex-req { color: var(--ex-accent); }
.ex-form-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ex-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }

.ex-muted-text { font-size: 0.84rem; color: var(--ex-muted); }
.ex-error-text { font-size: 0.84rem; color: #C23B2B; font-weight: 600; }

.ex-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.ex-avatar-style-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.ex-avatar-style {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 3px;
    min-height: 184px;
    padding: 10px;
    border: 2px solid var(--ex-border);
    border-radius: 16px;
    background: #FAF8F5;
    color: #234236;
    text-align: center;
}
.ex-avatar-style.active,
.ex-avatar-style[aria-pressed="true"] {
    border-color: #C86D51;
    background: #FFF4ED;
    box-shadow: 0 0 0 3px rgba(200, 109, 81, 0.13);
}
.ex-avatar-style-art {
    display: block;
    width: 66px;
    height: 132px;
    background-repeat: no-repeat;
    background-size: 400% 100%;
    background-position: left center;
}
.ex-avatar-style-forest { background-image: url('/images/exhibition/visitor-forest-turnaround-v1.png'); }
.ex-avatar-style-apricot { background-image: url('/images/exhibition/visitor-apricot-turnaround-v1.png'); }
.ex-avatar-style-teal { background-image: url('/images/exhibition/visitor-teal-turnaround-v1.png'); }
.ex-avatar-style strong { font-size: 0.86rem; }
.ex-avatar-style small { font-size: 0.71rem; color: #5E5A54; }

.ex-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ex-color-chip {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--ex-border);
    transition: box-shadow 0.15s ease;
}
.ex-color-chip.active {
    border-color: var(--ex-surface);
    box-shadow: 0 0 0 3px var(--ex-accent);
}

.ex-hat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.ex-hat-chip {
    min-height: 40px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
}
.ex-hat-chip.active {
    background: var(--ex-primary);
    color: #FAF8F5;
    border-color: var(--ex-primary);
}

/* 작품 빠른 목록 드로어 */
.ex-drawer {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    justify-content: flex-end;
}

.ex-drawer-panel {
    position: relative;
    z-index: 1;
    width: min(380px, 100vw);
    height: 100%;
    background: var(--ex-surface);
    color: var(--ex-text);
    border-left: 1px solid var(--ex-border);
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 36px rgba(0, 0, 0, 0.2);
}

.ex-catalog-list {
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.ex-catalog-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--ex-border);
    background: var(--ex-bg);
    text-align: left;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}
.ex-catalog-item:hover { border-color: var(--ex-accent); background: var(--ex-surface-soft); }

.ex-catalog-thumb {
    width: 60px;
    height: 48px;
    border-radius: 9px;
    object-fit: cover;
    background: var(--ex-surface-soft);
    flex-shrink: 0;
}

.ex-catalog-meta { min-width: 0; flex: 1; }
.ex-catalog-meta strong {
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-catalog-meta span { font-size: 0.76rem; color: var(--ex-muted); }

.ex-toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: var(--ex-primary-dark);
    color: #FAF8F5;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

/* ---------------- 내장 PDF 플립북 + 목소리 읽어주기 모달 ---------------- */
.ex-flipbook-modal {
    z-index: 140;
    padding: 14px;
}

.ex-flipbook-modal .ex-modal-backdrop {
    background: rgba(14, 24, 20, 0.84);
    backdrop-filter: blur(8px);
}

.ex-flipbook-shell {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    height: min(92vh, 840px);
    background: #1B332A;
    color: #FAF8F5;
    border: 1px solid rgba(250, 248, 245, 0.16);
    border-radius: 22px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ex-flipbook-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: #14261F;
    border-bottom: 1px solid rgba(250, 248, 245, 0.12);
}

.ex-flipbook-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}

.ex-fb-badge {
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(200, 109, 81, 0.24);
    color: #F4B9A6;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.ex-flipbook-meta h2 {
    font-family: 'Noto Serif KR', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #FAF8F5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

.ex-fb-author {
    font-size: 0.8rem;
    color: rgba(250, 248, 245, 0.72);
    white-space: nowrap;
}

.ex-flipbook-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ex-fb-tool-btn {
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid rgba(250, 248, 245, 0.24);
    background: rgba(250, 248, 245, 0.08);
    color: #FAF8F5;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}
.ex-fb-tool-btn:hover { background: rgba(250, 248, 245, 0.18); }

.ex-fb-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(250, 248, 245, 0.2);
    background: rgba(250, 248, 245, 0.08);
    color: #FAF8F5;
    display: grid;
    place-items: center;
}
.ex-fb-close-btn svg { width: 18px; height: 18px; }
.ex-fb-close-btn:hover { background: rgba(200, 109, 81, 0.45); }

.ex-flipbook-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 58px;
    background: radial-gradient(circle at center, #26473A 0%, #162922 100%);
    overflow: hidden;
}

.ex-fb-book-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1800px;
}

.ex-fb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(250, 248, 245, 0.88);
    font-size: 0.9rem;
}

.ex-fb-book {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    padding: 10px;
    border-radius: 12px;
    background: #3A2A1E;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 235, 205, 0.15);
    perspective: 2200px;
    transform-style: preserve-3d;
}

.ex-fb-turn-sheet {
    position: absolute;
    top: 10px;
    bottom: 10px;
    z-index: 4;
    pointer-events: none;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}

.ex-fb-turn-sheet.is-spread-next {
    left: calc(50% + 2px);
    right: 10px;
    transform-origin: left center;
    animation: exLeafFlipNext 0.52s cubic-bezier(0.24, 0.68, 0.34, 1) forwards;
}

.ex-fb-turn-sheet.is-spread-prev {
    left: 10px;
    right: calc(50% + 2px);
    transform-origin: right center;
    animation: exLeafFlipPrev 0.52s cubic-bezier(0.24, 0.68, 0.34, 1) forwards;
}

.ex-fb-turn-sheet.is-single-next {
    left: 10px;
    right: 10px;
    transform-origin: left center;
    animation: exSingleLeafNext 0.46s cubic-bezier(0.26, 0.66, 0.35, 1) forwards;
}

.ex-fb-turn-sheet.is-single-prev {
    left: 10px;
    right: 10px;
    transform-origin: left center;
    animation: exSingleLeafPrev 0.46s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.ex-fb-turn-face {
    position: absolute;
    inset: 0;
    background: #FAF8F5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

.ex-fb-turn-front {
    border-radius: 0 4px 4px 0;
}

.ex-fb-turn-sheet.is-spread-prev .ex-fb-turn-front {
    border-radius: 4px 0 0 4px;
}

.ex-fb-turn-back {
    transform: rotateY(180deg);
    border-radius: 4px 0 0 4px;
}

.ex-fb-turn-sheet.is-spread-prev .ex-fb-turn-back {
    border-radius: 0 4px 4px 0;
}

.ex-fb-turn-sheet.is-single-next .ex-fb-turn-front,
.ex-fb-turn-sheet.is-single-prev .ex-fb-turn-front {
    border-radius: 6px;
}

.ex-fb-turn-face canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ex-fb-turn-sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(20, 14, 10, 0.24) 0%, rgba(255, 255, 255, 0.14) 22%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, 0.08) 100%);
    opacity: 0.72;
}

.ex-fb-turn-sheet.is-spread-prev .ex-fb-turn-sheen {
    background: linear-gradient(270deg, rgba(20, 14, 10, 0.24) 0%, rgba(255, 255, 255, 0.14) 22%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, 0.08) 100%);
}

@keyframes exLeafFlipNext {
    0% { transform: rotateY(0deg); }
    45% { transform: rotateY(-88deg) scaleY(1.015); }
    100% { transform: rotateY(-180deg); }
}

@keyframes exLeafFlipPrev {
    0% { transform: rotateY(0deg); }
    45% { transform: rotateY(88deg) scaleY(1.015); }
    100% { transform: rotateY(180deg); }
}

@keyframes exSingleLeafNext {
    0% { transform: rotateY(0deg); opacity: 1; }
    65% { transform: rotateY(-78deg) scaleY(1.01); opacity: 0.88; }
    100% { transform: rotateY(-112deg); opacity: 0; }
}

@keyframes exSingleLeafPrev {
    0% { transform: rotateY(-104deg); opacity: 0.25; }
    55% { transform: rotateY(-28deg) scaleY(1.01); opacity: 0.96; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

.ex-fb-page {
    position: relative;
    background: #FAF8F5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.ex-fb-page-left {
    border-radius: 4px 0 0 4px;
    box-shadow: inset -14px 0 22px -12px rgba(25, 20, 14, 0.28);
}

.ex-fb-page-right {
    border-radius: 0 4px 4px 0;
    box-shadow: inset 14px 0 22px -12px rgba(25, 20, 14, 0.28);
}

.ex-fb-book.is-single .ex-fb-page-left {
    border-radius: 6px;
    box-shadow: none;
}

.ex-fb-book.is-single .ex-fb-spine,
.ex-fb-book.is-single .ex-fb-page-right,
.ex-fb-page.is-empty {
    display: none;
}

.ex-fb-spine {
    width: 4px;
    align-self: stretch;
    background: linear-gradient(90deg, rgba(20, 14, 10, 0.48), rgba(250, 248, 245, 0.16), rgba(20, 14, 10, 0.48));
}

.ex-fb-page canvas {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 235px);
    width: auto;
    height: auto;
}

.ex-fb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(250, 248, 245, 0.24);
    background: rgba(20, 38, 31, 0.84);
    color: #FAF8F5;
    display: grid;
    place-items: center;
    z-index: 5;
    transition: background-color 0.16s ease, transform 0.16s ease;
}
.ex-fb-nav:hover:not(:disabled) {
    background: #C86D51;
    border-color: #C86D51;
    transform: translateY(-50%) scale(1.06);
}
.ex-fb-nav:disabled { opacity: 0.32; cursor: not-allowed; }
.ex-fb-nav svg { width: 20px; height: 20px; }
.ex-fb-prev { left: 10px; }
.ex-fb-next { right: 10px; }

.ex-fb-caption {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: rgba(15, 29, 24, 0.94);
    border-top: 1px solid rgba(250, 248, 245, 0.1);
    min-height: 44px;
}

.ex-fb-caption-tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(250, 248, 245, 0.12);
    color: #F4B9A6;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
}

.ex-fb-caption p {
    font-size: 0.84rem;
    color: rgba(250, 248, 245, 0.92);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-flipbook-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 11px 18px;
    background: #14261F;
    border-top: 1px solid rgba(250, 248, 245, 0.12);
}

.ex-fb-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 180px;
}

.ex-fb-page-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #FAF8F5;
    white-space: nowrap;
}

#ex-fb-slider {
    flex: 1;
    max-width: 240px;
    accent-color: #C86D51;
    cursor: pointer;
}

.ex-fb-tts-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ex-fb-speak-btn {
    min-height: 38px;
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    background: #C86D51;
    color: #FFFFFF;
    font-size: 0.84rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.ex-fb-speak-btn svg { width: 16px; height: 16px; }
.ex-fb-speak-btn:hover { background: #AD583E; }
.ex-fb-speak-btn.is-speaking { background: #2D6A4F; }

.ex-fb-stop-btn {
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid rgba(250, 248, 245, 0.25);
    background: rgba(250, 248, 245, 0.08);
    color: #FAF8F5;
    font-size: 0.8rem;
    font-weight: 600;
}
.ex-fb-stop-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ex-fb-rate-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: rgba(250, 248, 245, 0.84);
}
.ex-fb-rate-wrap select {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid rgba(250, 248, 245, 0.22);
    background: #1B332A;
    color: #FAF8F5;
    font-size: 0.78rem;
}

.ex-fb-voice-wrap select {
    max-width: 170px;
    text-overflow: ellipsis;
}

.ex-fb-autoturn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: rgba(250, 248, 245, 0.9);
    cursor: pointer;
    user-select: none;
}
.ex-fb-autoturn input { accent-color: #C86D51; }

.ex-work-media-stage.has-audio {
    aspect-ratio: auto;
    flex-direction: column;
    align-items: stretch;
}
.ex-work-media-stage.has-audio .ex-trailer-canvas {
    aspect-ratio: 16 / 9;
    height: auto;
}
.ex-work-media-stage.has-audio .ex-trailer-toggle {
    bottom: 62px;
}

.ex-trailer-audio-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #14261F;
    border-top: 1px solid rgba(250, 248, 245, 0.14);
}
.ex-trailer-audio-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: #F4B9A6;
    white-space: nowrap;
}
.ex-trailer-audio-bar audio {
    width: 100%;
    height: 34px;
    color-scheme: dark;
}
.ex-trailer-audio-prompt {
    position: absolute;
    left: 12px;
    bottom: 52px;
    z-index: 3;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(250, 248, 245, 0.35);
    background: rgba(200, 109, 81, 0.94);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.ex-fb-tool-btn.is-playing {
    background: #C86D51;
    border-color: #C86D51;
    color: #FFFFFF;
}

@media (max-width: 768px) {
    .ex-flipbook-modal { padding: 0; }
    .ex-flipbook-shell { width: 100%; height: 100%; border-radius: 0; }
    .ex-flipbook-stage { padding: 10px 44px; }
    .ex-fb-page canvas { max-height: calc(100vh - 255px); }
    .ex-fb-nav { width: 36px; height: 36px; }
    .ex-fb-prev { left: 6px; }
    .ex-fb-next { right: 6px; }
    .ex-flipbook-meta h2 { max-width: 170px; font-size: 0.92rem; }
    .ex-fb-author { display: none; }
    #ex-fb-mode-btn { display: none; }
    .ex-flipbook-foot { padding: 10px 12px; gap: 8px; }
    .ex-fb-pager { min-width: 100%; }
    #ex-fb-slider { max-width: none; }
    .ex-fb-voice-wrap select { max-width: 138px; }
}

@media (prefers-reduced-motion: reduce) {
    .ex-fb-turn-sheet {
        display: none !important;
        animation: none !important;
    }
}

/* ---------------- 반응형 (태블릿 / 모바일) ---------------- */
@media (max-width: 1024px) {
    .ex-notice-banner { max-width: calc(100vw - 32px); top: auto; bottom: 76px; }
    .ex-stage-2d { padding-left: 20px; padding-top: 230px; }
}

@media (max-width: 768px) {
    .ex-avatar-style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ex-tl-cluster {
        top: 10px;
        left: 10px;
        width: calc(100vw - 156px);
        max-width: 230px;
    }
    .ex-minimap-card {
        display: flex;
        align-self: flex-start;
        width: 154px;
        padding: 7px;
        gap: 5px;
        border-radius: 12px;
    }
    .ex-minimap-legend { display: none; }
    .ex-minimap-title { font-size: 0.68rem; }
    .ex-notice-banner {
        top: 160px;
        bottom: auto;
        left: 10px;
        transform: none;
        max-width: calc(100vw - 20px);
        max-height: 84px;
        overflow: auto;
        font-size: 0.72rem;
    }
    .ex-tr-cluster {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    .ex-tr-cluster .ex-btn span { display: none; }
    .ex-tr-cluster .ex-btn { min-height: 40px; padding: 8px 11px; }

    .ex-bc-cluster {
        bottom: 10px;
        width: calc(100vw - 20px);
    }
    .ex-control-bar {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 2px;
        border-radius: 22px;
        padding: 6px;
    }
    .ex-control-bar .ex-bl-cluster { flex: 1 0 100%; width: 100%; margin-right: 0; }
    .ex-control-bar .ex-chat-feed { bottom: calc(100% + 66px); }
    .ex-ctrl-btn { padding: 6px 4px; font-size: 0.68rem; gap: 3px; min-height: 36px; }
    .ex-ctrl-btn svg { width: 13px; height: 13px; }
    .ex-ctrl-btn.ex-ctrl-upload { min-width: 0; }
    .ex-touch-pad { bottom: 124px; left: 12px; }
    .ex-near-prompt { bottom: 126px; }

    .ex-panel-backdrop {
        background: rgba(18, 28, 24, 0.28);
        pointer-events: auto;
    }

    .ex-work-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 86vh;
        border-left: none;
        border-top: 1px solid var(--ex-border);
        border-radius: 22px 22px 0 0;
    }
    .ex-form-2col { grid-template-columns: 1fr; }
    .ex-hat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ex-stage-2d { padding-top: 136px; }
}

@keyframes exSlideInBottom {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}
