/* ===== Font ===== */
@font-face {
    font-family: 'Cubic';
    src: url('fonts/Cubic-11.woff2') format('woff2'),
        url('fonts/Cubic-11.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Cubic', 'Microsoft YaHei', 'Microsoft JhengHei', sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body { width: 100%; height: 100%; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: #000; color: #fff; }

/* 全螢幕模式 — 完全覆蓋 */
:fullscreen {
    background: #000;
    width: 100vw !important;
    height: 100vh !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
:-webkit-full-screen {
    background: #000;
    width: 100vw !important;
    height: 100vh !important;
}
::backdrop { background: #000; }
::-webkit-backdrop { background: #000; }

.phase { position: fixed; top: 0; left: 0; width: 100%; height: 100%; min-height: 100vh; min-height: 100dvh; display: none; justify-content: center; align-items: center; z-index: 1; background: #000; }
.phase.active { display: flex; z-index: 10; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Particle Background Canvas ===== */
.particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ===== Title Screen ===== */
#titlePhase {
    background: #0a0510;
    cursor: pointer;
    flex-direction: column;
}
.title-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: chapterFadeIn 2s ease;
}
.title-logo {
    font-size: 52px;
    font-weight: bold;
    color: #ff6b8a;
    letter-spacing: 8px;
    text-shadow: 0 0 60px rgba(255,107,138,0.5), 0 0 120px rgba(255,107,138,0.2);
}
.title-tap {
    margin-top: 40px;
    font-size: 14px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 4px;
    animation: pulse 2s ease-in-out infinite;
}

@media (max-width: 768px) {
    .title-logo { font-size: 40px; letter-spacing: 6px; }
}

/* ===== Phase 0: Chapter Title ===== */
#chapterPhase {
    background: #0a0510;
    cursor: pointer;
    flex-direction: column;
}
.chapter-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: chapterFadeIn 2s ease;
}
@keyframes chapterFadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
.chapter-label {
    font-size: 16px;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: rgba(255,107,138,0.6);
}
.chapter-title {
    font-size: 36px;
    font-weight: bold;
    color: #ff6b8a;
    letter-spacing: 3px;
    text-shadow: 0 0 40px rgba(255,107,138,0.4), 0 0 80px rgba(255,107,138,0.15);
    text-align: center;
    line-height: 1.4;
}
.chapter-tap {
    margin-top: 40px;
    font-size: 14px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
.chapter-tap.visible {
    opacity: 1;
    visibility: visible;
    animation: pulse 2s ease-in-out infinite;
}

@media (max-width: 768px) {
    .chapter-title { font-size: 28px; }
    .chapter-label { font-size: 13px; letter-spacing: 4px; }
}

/* ===== Phase 1: Intro ===== */
#introPhase { background: #000; padding-bottom: 10%; }
#introVideo { width: 100%; height: 100%; object-fit: contain; background: transparent; z-index: 1; position: relative; }
.tap-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; display: flex; justify-content: center; align-items: center; font-size: 28px; color: #fff; background: rgba(0,0,0,0.6); cursor: pointer; animation: pulse 2s ease-in-out infinite; }
.tap-overlay.hidden { display: none; }

/* ===== Phase 2: Interview ===== */
#interviewPhase { background: #000; flex-direction: column; }
#introPhase, #mvPhase { background: #000; }
.interview-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
.interview-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.45; filter: blur(3px); }

.interview-content { position: relative; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: 100%; height: 100%; }
.interview-content.live2d-mode { background: transparent; }

/* 問題文字 - 左上角打字機風格 */
.question-banner {
    position: fixed;
    top: 18%;
    left: 20px;
    z-index: 20;
    pointer-events: none;
    animation: slideDown 0.8s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
.question-text {
    font-size: 24px;
    color: #ff6b8a;
    line-height: 1.6;
    text-align: left;
    letter-spacing: 2px;
}
.question-text .cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #ff6b8a;
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 0.6s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.question-hint { display: none; }

/* Live2D Canvas - 全螢幕 */
.interview-main { width: 100%; height: 100%; position: relative; }
.live2d-area { width: 100%; height: 100%; }
#live2dCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

/* 底部按鈕面板 */
.action-bar { display: none; }
.btn-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 20px calc(env(safe-area-inset-bottom, 12px) + 16px);
    background: none;
    z-index: 20;
}
.btn-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
}
.game-btn {
    font-family: 'Cubic', 'Microsoft JhengHei', sans-serif;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 12px 24px;
    white-space: nowrap;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    outline: none;
    flex: 1;
    max-width: 160px;
}
.game-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.15); }
.game-btn.active { background: #ff6b8a; color: #fff; border-color: #ff6b8a; box-shadow: 0 0 16px rgba(255,107,138,0.4); }
.game-btn img { width: 16px; height: 16px; vertical-align: middle; margin-right: 4px; pointer-events: none; }
/* 判定按鈕 — 主行動按鈕 */
.game-btn.btn-submit {
    background: #ff6b8a;
    color: #fff;
    border-color: #ff6b8a;
    box-shadow: 0 0 20px rgba(255,107,138,0.3);
}
.game-btn.btn-submit:active { transform: scale(0.95); background: #e84570; }

/* Round 2 問題文字縮小避免被切 */
.punch-active .question-banner { top: 8%; }
.punch-active .question-text { font-size: 16px; }

/* ===== Punch Game Overlay (Round 2) ===== */
.punch-overlay {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 25;
    padding: 12px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85) 30%);
    pointer-events: none;
}
.punch-overlay > * { pointer-events: auto; }
.punch-dialogue {
    background: rgba(30,15,50,0.92);
    border-left: 3px solid #f72585;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.6;
    color: #eee;
    max-width: 360px;
    text-align: center;
    animation: punchDialogueFadeIn 0.4s ease;
}
.punch-dialogue .speaker { color: #f72585; font-weight: bold; }
@keyframes punchDialogueFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.punch-bar-wrap {
    width: 100%;
    max-width: 300px;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}
.punch-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f72585, #ff1744);
    border-radius: 4px;
    transition: width 0.05s;
}
.punch-info {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    min-height: 20px;
}
.punch-btns {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}
.punch-btn {
    flex: 1;
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.35);
    padding: 16px 8px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.1s;
}
.punch-btn:active { transform: scale(0.95); }
.punch-btn:disabled { border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.3); cursor: default; }
.punch-btn-dual {
    font-size: 24px;
    padding: 20px 8px;
}
.punch-dual {
    max-width: 300px;
}

/* 眼淚模式提示（疊在臉上、會漂移） */
/* ===== Tutorial Overlay ===== */
.tutorial-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 30;
    pointer-events: all;
    transition: opacity 0.5s ease;
}
.tutorial-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}
.tut-ring {
    position: absolute;
    width: 44px; height: 44px;
    border: 1.5px solid rgba(255, 107, 138, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: tutRingIn 0.4s ease forwards;
}
.tut-ring::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px solid rgba(255, 107, 138, 0.2);
    border-radius: 50%;
    animation: tutRingPulse 1.5s ease-in-out infinite;
}
.tut-ring[data-zone="browL"]  { animation-delay: 0s; }
.tut-ring[data-zone="browR"]  { animation-delay: 0.1s; }
.tut-ring[data-zone="eyeL"]   { animation-delay: 0.3s; }
.tut-ring[data-zone="eyeR"]   { animation-delay: 0.4s; }
.tut-ring[data-zone="mouth"]  { animation-delay: 0.6s; }
.tut-ring.active {
    border-color: rgba(255, 107, 138, 0.9);
    box-shadow: 0 0 16px rgba(255, 107, 138, 0.3);
}
.tut-finger {
    position: absolute;
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
    pointer-events: none;
}
.tut-finger.show { opacity: 1; }
.tut-finger.drag-up { transform: translate(-50%, -50%) translateY(-28px); }
.tut-finger.drag-down { transform: translate(-50%, -50%) translateY(28px); }
.tut-finger.drag-left { transform: translate(-50%, -50%) translateX(-28px); }
.tut-finger.drag-right { transform: translate(-50%, -50%) translateX(28px); }
.tut-finger.drag-center { transform: translate(-50%, -50%); }
.tut-text {
    position: absolute;
    bottom: max(env(safe-area-inset-bottom, 0px), 12%);
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 2px;
    text-align: center;
    line-height: 1.8;
    transition: opacity 0.3s ease;
    text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}
@keyframes tutRingIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes tutRingPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50%      { transform: scale(1.4); opacity: 0; }
}

.tear-hint-overlay {
    position: fixed;
    z-index: 25;
    pointer-events: none;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -50%);
    transition: left 1.2s cubic-bezier(.4,0,.2,1), top 1.2s cubic-bezier(.4,0,.2,1), opacity 0.3s ease;
}
.tear-hint-overlay.show {
    opacity: 1;
}
.tear-hint-ring {
    width: 56px;
    height: 56px;
    border: 2px solid rgba(100,200,255,0.6);
    border-radius: 50%;
    background: rgba(100,200,255,0.06);
    animation: tearRingPulse 1.6s ease-in-out infinite;
    position: relative;
}
.tear-hint-ring::after {
    content: '💧';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    animation: tearDropBounce 1.6s ease-in-out infinite;
}
.tear-hint-text {
    margin-top: 4px;
    font-family: 'Cubic', 'Microsoft JhengHei', sans-serif;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(180,220,255,0.9);
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(100,180,255,0.5);
    animation: tearTextFade 1.6s ease-in-out infinite;
}
@keyframes tearRingPulse {
    0%, 100% { transform: scale(0.8); opacity: 0.4; border-color: rgba(100,200,255,0.3); }
    50% { transform: scale(1.1); opacity: 1; border-color: rgba(100,200,255,0.8); }
}
@keyframes tearDropBounce {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-6px); }
}
@keyframes tearTextFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 舊按鈕樣式（用於其他 phase） */
.action-btn { font-family: 'Cubic', sans-serif; font-size: 18px; padding: 14px 40px; background: #ff6b8a; color: #fff; border: none; border-radius: 8px; cursor: pointer; transition: all 0.2s; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; }
.action-btn:hover { background: #ff4d73; transform: scale(1.05); }
.action-btn:active { transform: scale(0.95); }
.action-btn.secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.action-btn.secondary:hover { background: rgba(255,255,255,0.25); }
.action-btn.ticket-btn { background: #4ecdc4; }
.action-btn.ticket-btn:hover { background: #3dbdb5; }
.action-btn.follow-btn { background: #06c755; }
.action-btn.follow-btn:hover { background: #05b34c; }
.action-btn.follow-btn.pulse-cta { animation: pulse-glow 1.5s ease-in-out infinite; font-size: 18px; padding: 16px 28px; }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 8px rgba(6,199,85,0.3); } 50% { box-shadow: 0 0 24px rgba(6,199,85,0.6), 0 0 48px rgba(6,199,85,0.3); } }

/* ===== Phase 3: Loading ===== */
#loadingPhase { background: rgba(26,26,46,0.95); flex-direction: column; gap: 24px; }
.loading-content { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.loading-spinner { width: 50px; height: 50px; border: 3px solid rgba(255,107,138,0.2); border-top: 3px solid #ff6b8a; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 24px; color: #fff; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ===== Phase 4: Result ===== */
#resultPhase { background: #1a1a2e; flex-direction: column; }
.result-container { display: flex; flex-direction: column; align-items: center; gap: 24px; animation: scaleIn 0.6s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
.result-image { width: 80%; max-width: 600px; height: auto; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.6); }
.result-label { font-size: 32px; display: flex; align-items: center; gap: 12px; }
.result-prefix { color: rgba(255,255,255,0.7); }
.result-emotion { color: #ff6b8a; font-weight: bold; font-size: 40px; text-transform: uppercase; text-shadow: 0 0 20px rgba(255,107,138,0.5); }

/* ===== Skip Button ===== */
.skip-btn {
    font-family: 'Cubic', 'Microsoft JhengHei', sans-serif;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 10px 28px;
    border: 2px solid rgba(255,107,138,0.6);
    border-radius: 8px;
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    z-index: 30;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
}
.skip-btn:hover { background: rgba(255,107,138,0.2); color: #fff; }
.skip-btn:active { transform: scale(0.95); }
.skip-btn.mv-skip {
    position: absolute;
    bottom: 30px;
    right: 30px;
}
.skip-btn.intro-skip {
    position: absolute;
    bottom: 30px;
    right: 30px;
}

/* ===== Phase 5: MV ===== */
#mvPhase { background: #000; padding-bottom: 10%; }
#mvVideo { width: 100%; height: 100%; object-fit: contain; z-index: 1; position: relative; }

/* MV 字幕 — 黑框區域（絕對定位在螢幕底部黑色區域） */
.mv-subtitle {
    position: absolute;
    bottom: 26%;
    left: 0;
    right: 0;
    z-index: 15;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    /* 與 Chapter 1 統一風格 */
    font-family: 'Cubic', 'Microsoft JhengHei', sans-serif;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    text-transform: none;
    color: rgba(255, 107, 138, 0.85);
    text-shadow: 0 0 20px rgba(255, 107, 138, 0.4), 0 0 40px rgba(255, 107, 138, 0.15);
    line-height: 1.5;
    padding: 0 20px;
}
.mv-subtitle.visible {
    opacity: 1;
}

/* Karaoke lyrics */
.karaoke-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 6px;
}
.lyric-word {
    opacity: 0.25;
    color: rgba(255, 107, 138, 0.4);
    transition: opacity 0.3s, color 0.3s, text-shadow 0.3s;
    font-family: 'Cubic', sans-serif;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    text-transform: uppercase;
}
.lyric-spacer {
    width: 8px;
}
.lyric-word.revealed {
    opacity: 1;
    color: rgba(255, 107, 138, 0.95);
    text-shadow: 0 0 20px rgba(255,107,138,0.5), 0 0 40px rgba(255,107,138,0.2);
}
.lyric-word.active {
    animation: wordPulse 0.4s ease;
}
/* SAD 專屬藍色歌詞 */
.sad-theme .lyric-word {
    color: rgba(69, 123, 157, 0.4);
}
.sad-theme .lyric-word.revealed {
    color: rgba(100, 149, 237, 0.95);
    text-shadow: 0 0 20px rgba(69,123,157,0.5), 0 0 40px rgba(100,149,237,0.2);
}
@keyframes wordPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .mv-subtitle { font-size: 16px; letter-spacing: 3px; }
    .lyric-word { font-size: 16px; letter-spacing: 3px; }
}

/* ===== Round Gate (加好友解鎖 Round 2/3) ===== */
#roundGatePhase { background: #1a1a2e; flex-direction: column; }
.round-gate-container { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; max-width: 400px; width: 90%; background: rgba(0,0,0,0.75); border-radius: 16px; backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); animation: scaleIn 0.6s cubic-bezier(0.34,1.56,0.64,1); }
.round-gate-emoji { font-size: 56px; margin-bottom: 16px; }
.round-gate-title { font-family: 'Cubic', sans-serif; font-size: 22px; font-weight: bold; color: #ff6b8a; margin-bottom: 10px; }
.round-gate-desc { font-size: 16px; color: rgba(255,255,255,0.85); line-height: 1.7; margin-bottom: 28px; }
#roundGateBtn { display: inline-flex; align-items: center; justify-content: center; }
.round-gate-status { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 16px; min-height: 20px; }

/* ===== Phase 6: Ending ===== */
#endingPhase { background: #1a1a2e; flex-direction: column; }
.ending-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
.ending-bg img { width: 100%; height: 100%; object-fit: contain; opacity: 0.3; filter: blur(4px); }
.ending-content { position: relative; z-index: 5; max-width: 800px; width: 90%; max-height: 92vh; overflow-y: auto; padding: 24px 30px; background: rgba(0,0,0,0.75); border-radius: 16px; backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.1); animation: fadeIn 1s ease; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.ending-text { font-size: 16px; line-height: 1.8; color: #fff; text-align: center; }
.ending-text .ending-title { font-size: 24px; color: #ff6b8a; font-weight: bold; margin-bottom: 12px; display: block; }
.ending-text .ending-next { font-size: 16px; color: #ff6b8a; margin-top: 14px; display: block; }
.ending-text .ending-footer { font-size: 13px; color: rgba(255,255,255,0.5); margin-top: 10px; display: block; }
.ending-content::-webkit-scrollbar { width: 4px; }
.ending-content::-webkit-scrollbar-track { background: transparent; }
.ending-content::-webkit-scrollbar-thumb { background: rgba(255,107,138,0.3); border-radius: 4px; }

/* ===== Toast Notification ===== */
.game-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255, 107, 138, 0.95);
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.game-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Ending Buttons ===== */
.ending-content .action-btn {
    margin-top: 12px;
    width: 100%;
    max-width: 300px;
}

/* ===== Ending Credit (Audible Things) ===== */
.ending-credit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 32px;
    opacity: 0.7;
}
.ending-logo {
    width: 48px;
    height: auto;
}
.ending-present {
    font-size: 11px;
    letter-spacing: 3px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
}

/* ===== Responsive: Mobile Portrait ===== */
@media (max-width: 768px) {
    .question-text { font-size: 20px; }
    .game-btn { font-size: 11px; padding: 7px 12px; letter-spacing: 1px; }
    .btn-bar { gap: 6px; bottom: 90px; }
    .action-btn { font-size: 14px; padding: 10px 24px; }
    .result-image { width: 85%; max-width: 400px; }
    .result-label { font-size: 24px; }
    .result-emotion { font-size: 30px; }
    .ending-content { padding: 20px; }
    .ending-text { font-size: 14px; line-height: 1.7; }
    .ending-text .ending-title { font-size: 20px; }
}

/* ===== Responsive: Landscape ===== */
/* 橫向鎖定遮罩 */
#landscapeBlock {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #0a0510; z-index: 99999;
    justify-content: center; align-items: center;
}
.landscape-msg {
    color: #ff6b8a; font-size: 24px; text-align: center; line-height: 1.8;
    font-family: 'Cubic', sans-serif; letter-spacing: 2px;
}

@media (orientation: landscape) {
    #landscapeBlock { display: flex; }
    .phase { visibility: hidden; }
}

/* ===== Desktop ===== */
body.is-desktop { background: #05020a; }
body.is-desktop #landscapeBlock { display: none !important; }
body.is-desktop .phase {
    visibility: visible !important;
    left: 50%;
    width: 430px;
    margin-left: -215px;
    overflow: hidden;
}
body.is-desktop .btn-bar {
    left: 50%;
    width: 430px;
    margin-left: -215px;
    right: auto;
}
body.is-desktop #introVideo,
body.is-desktop #mvVideo {
    object-fit: contain;
}

/* ===== Round 3 Integrated Phases ===== */
.r3-phase {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  min-height: 100vh; min-height: 100dvh;
  display: none; justify-content: center; align-items: center;
  z-index: 1; background: #000;
}
.r3-phase.active { display: flex; z-index: 10; animation: fadeIn 0.5s ease; }

#r3-chapterPhase { background: #0a0510; cursor: pointer; flex-direction: column; }
#r3-interviewPhase { background: #000; flex-direction: column; }
#r3-resultPhase { background: #1a1a2e; flex-direction: column; }
#r3-mvPhase { background: #0a0510; padding-bottom: 10%; position: relative; overflow: hidden; }
#r3-endingPhase { background: #1a1a2e; flex-direction: column; }

#r3-live2dCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
#r3-mvVideo { width: 100%; height: 100%; object-fit: contain; z-index: 1; position: relative; }
#r3-mvParticleCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }

/* R3 question banner override — bottom positioned like round3.html */
#r3-interviewPhase .question-banner {
  position: fixed; bottom: 130px; left: 0; right: 0;
  top: auto;
  z-index: 20; pointer-events: none; text-align: center;
  padding: 0 16px; animation: none;
}
#r3-interviewPhase .question-bubble {
  display: inline-block; max-width: 90%;
  background: rgba(30,15,50,0.92); border: 1px solid rgba(247,37,133,0.4);
  border-radius: 12px; padding: 12px 20px;
}
#r3-interviewPhase .question-text {
  font-size: 16px; color: #ffffff; line-height: 1.6; font-weight: bold; letter-spacing: 1px;
  border-right: 2px solid rgba(255,107,138,0.8); padding-right: 2px;
  animation: blink-cursor 0.6s step-end infinite;
  text-align: center;
}
#r3-interviewPhase .question-text.done { border-right-color: transparent; animation: none; }
@keyframes blink-cursor { 50% { border-right-color: transparent; } }

/* R3 voice bar */
#r3-interviewPhase .voice-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 20px calc(env(safe-area-inset-bottom, 12px) + 16px);
  background: linear-gradient(transparent, rgba(0,0,0,0.85) 30%);
}
.voice-status { font-size: 13px; color: rgba(255,255,255,0.7); text-align: center; min-height: 20px; letter-spacing: 1px; }
.voice-meter { width: 100%; max-width: 300px; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.voice-meter-fill { height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, #00e676, #f72585); transition: width 0.05s; }
.voice-btns { display: flex; gap: 12px; width: 100%; max-width: 300px; }
.voice-btn {
  flex: 1; font-size: 14px; font-weight: bold; letter-spacing: 2px;
  padding: 14px 8px; border-radius: 12px; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s; border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.8);
}
.voice-btn:active { transform: scale(0.95); }
.voice-btn.primary { background: #f72585; color: #fff; border-color: #f72585; box-shadow: 0 0 20px rgba(247,37,133,0.3); }
.voice-btn.primary:active { background: #e01a70; }
.voice-btn.primary:disabled { background: rgba(247,37,133,0.4); opacity: 0.6; cursor: default; }
.voice-btn.next { background: rgba(76,201,240,0.15); border-color: rgba(76,201,240,0.5); color: #4cc9f0; }

/* R3 desktop mode */
body.is-desktop .r3-phase {
  visibility: visible !important;
  left: 50%;
  width: 430px;
  margin-left: -215px;
  overflow: hidden;
}
body.is-desktop #r3-interviewPhase .voice-bar {
  left: 50%; width: 430px; margin-left: -215px; right: auto;
}
body.is-desktop #r3-interviewPhase .question-banner {
  left: 50%; width: 430px; margin-left: -215px; right: auto;
}

/* R3 landscape block */
@media (orientation: landscape) and (max-height: 500px) {
  .r3-phase { visibility: hidden; }
}
body.is-desktop .r3-phase { visibility: visible !important; }
