﻿/* Base Styles */
body {
    background-color: transparent;
    /* Move BG to #global-bg */
    color: #F0F0F0;
    font-family: sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    /* [v316.2] Disable double-tap zoom */
}

/* [v316.2] Disable pinch zoom globally */
* {
    touch-action: pan-x pan-y;
}

/* ============================================
   [v307.8] SAGE THEME COLOR SYSTEM
   Dynamic accent colors per Sage character.
   Applied via .sage-theme-{id} class on body.
   ============================================ */

/* Default Theme (Solomon/Hideyoshi - Gold) */
:root {
    --sage-accent: #D4AF37;
    --sage-accent-rgb: 212, 175, 55;
    --sage-glow: rgba(212, 175, 55, 0.4);
}

/* [v308.34] Sage Theme Variables - Body OR Modal Context
   Supports both body.sage-theme-* (standard) and .sage-theme-* (modal overlays) */

/* Jeanne d'Arc - Lily White (白百合) */
body.sage-theme-jeanne,
.sage-theme-jeanne {
    --sage-accent: #FFF8E7;
    --sage-accent-rgb: 255, 248, 231;
    --sage-glow: rgba(255, 248, 231, 0.5);
}

/* King Arthur - Royal Blue */
body.sage-theme-arthur,
.sage-theme-arthur {
    --sage-accent: #1E4A7A;
    --sage-accent-rgb: 30, 74, 122;
    --sage-glow: rgba(30, 74, 122, 0.4);
}

/* Sherlock Holmes - Victorian Grey */
body.sage-theme-holmes,
.sage-theme-holmes {
    --sage-accent: #7A7A7A;
    --sage-accent-rgb: 122, 122, 122;
    --sage-glow: rgba(122, 122, 122, 0.4);
}

/* Ryoma Sakamoto - Ocean Teal */
body.sage-theme-ryoma,
.sage-theme-ryoma {
    --sage-accent: #2F8F8F;
    --sage-accent-rgb: 47, 143, 143;
    --sage-glow: rgba(47, 143, 143, 0.4);
}

/* Cheshire Cat - Neon Pink (不思議の国) */
body.sage-theme-cheshire,
.sage-theme-cheshire {
    --sage-accent: #FF69B4;
    --sage-accent-rgb: 255, 105, 180;
    --sage-glow: rgba(255, 105, 180, 0.4);
}

/* Himiko - Shrine Crimson (神宮朱・彼岸花) */
body.sage-theme-himiko,
.sage-theme-himiko {
    --sage-accent: #C41E3A;
    --sage-accent-rgb: 196, 30, 58;
    --sage-glow: rgba(196, 30, 58, 0.4);
}

/* King Solomon - Royal Purple (王者紫・魔術王) */
body.sage-theme-solomon,
.sage-theme-solomon {
    --sage-accent: #7B2D8E;
    --sage-accent-rgb: 123, 45, 142;
    --sage-glow: rgba(123, 45, 142, 0.4);
}

/* Hideyoshi Toyotomi - Gold (Same as default) */
body.sage-theme-hideyoshi,
.sage-theme-hideyoshi {
    --sage-accent: #D4AF37;
    --sage-accent-rgb: 212, 175, 55;
    --sage-glow: rgba(212, 175, 55, 0.4);
}

/* Zhuge Liang - Bamboo Green */
body.sage-theme-zhuge,
.sage-theme-zhuge {
    --sage-accent: #4A9D5D;
    --sage-accent-rgb: 74, 157, 93;
    --sage-glow: rgba(74, 157, 93, 0.4);
}


/* [Fix v57.2] Global Background Layer */
#global-bg {
    /* Default Background (Safety Fallback) */
    background-color: #050810;
    background-image: url('../assets/images/ui/bg_default.webp');
    background-size: cover;
    background-position: center;

    /* [Fix v57.3] Mobile Scroll Jump Fix */
    /* Use svh (Small Viewport Height) to ignore address bar expansion */
    height: 100svh;
    width: 100vw;
    position: fixed;
    inset: 0;
    z-index: -1;
    transform: translateZ(0);
    /* Hardware Acceleration */
    will-change: transform;
    /* Hint to browser to optimize */
}

/* Time-Aware Backgrounds (Targeting the Layer) */
body.bg-morning #global-bg {
    background-image: url('../assets/images/ui/bg_sanctuary_morning.webp');
}

body.bg-day #global-bg {
    background-image: url('../assets/images/ui/bg_sanctuary_day.webp');
}

body.bg-sunset #global-bg {
    background-image: url('../assets/images/ui/bg_sanctuary_sunset.webp');
}

body.bg-night #global-bg {
    background-image: url('../assets/images/ui/bg_sanctuary_night.webp');
}

/* Mobile Background Overrides */
@media (max-width: 768px) {

    /* PC Logic is fine, but we swap the Image Source for Mobile */
    body.bg-morning #global-bg {
        background-image: url('../assets/images/ui/bg_sanctuary_morning_mobile.webp');
    }

    body.bg-day #global-bg {
        background-image: url('../assets/images/ui/bg_sanctuary_day_mobile.webp');
    }

    body.bg-sunset #global-bg {
        background-image: url('../assets/images/ui/bg_sanctuary_sunset_mobile.webp');
    }

    body.bg-night #global-bg {
        background-image: url('../assets/images/ui/bg_sanctuary_night_mobile.webp');
    }
}

/* Note: Adjusted image path to be relative to css file, likely needs to go up one level then assets.
   Wait, if the css is in /css/style.css, and assets are in /assets
   Then url should be '../assets/...'
   Original was url('assets/...') because it was in index.html.
   I should update the URLs.
*/

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

/* 3D Card Animation */
.perspective-1000 {
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    margin: 0 auto;
    /* Ensure centering */
}

.flipped .card-inner,
.rotate-y-180 {
    transform: rotateY(180deg);
}

.card-back,
.card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 1rem;
}

.card-front {
    transform: rotateY(180deg);
}

.glow-text {
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.glow-button {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Animation */
.modal-enter {
    transform: translateY(100%);
    opacity: 0;
}

.modal-enter-active {
    transform: translateY(0);
    opacity: 1;
    transition: all 0.3s ease-out;
}

.modal-exit {
    transform: translateY(0);
    opacity: 1;
}

.modal-exit-active {
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease-in;
}

.text-shadow-gold {
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.5);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out forwards;
}

/* Art Nouveau Texture for Modal */
.modal-texture {
    background-color: #050810;
    background-image:
        radial-gradient(circle at 50% 10%, #1a1c2c 0%, #050810 100%),
        repeating-linear-gradient(45deg, rgba(212, 175, 55, 0.03) 0px, rgba(212, 175, 55, 0.03) 1px, transparent 1px, transparent 10px);
}

/* Typing indicator */
.typing-dot {
    animation: typing 1.4s infinite ease-in-out both;
    background-color: #D4AF37;
    border-radius: 50%;
    display: inline-block;
    height: 4px;
    width: 4px;
    margin: 0 1px;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Vibrating Animation for Shuffle */
.vibrating {
    animation: vibrate 0.1s linear infinite;
}

@keyframes vibrate {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

/* Suspense Overlay Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 1s ease-out forwards;
}

@keyframes scaleIn {
    from {
        width: 0;
        opacity: 0;
    }

    to {
        width: 4rem;
        /* w-16 */
        opacity: 1;
    }
}

.animate-scale-in {
    animation: scaleIn 0.8s ease-out forwards;
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .8;
    }
}

/* [v308.25] Vinyl Record Spin Animation for Jukebox */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* [v308.26] Chronicle Revelation System - Persona 5 Style */
@keyframes revelationTitle {
    0% {
        opacity: 0;
        transform: scale(1.5) translateY(20px);
        letter-spacing: 0.5em;
    }

    50% {
        opacity: 1;
        transform: scale(1.1) translateY(0);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        letter-spacing: 0.2em;
    }
}

@keyframes revelationSlash {
    0% {
        transform: translateX(-100%) rotate(-45deg);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateX(200%) rotate(-45deg);
        opacity: 0;
    }
}

.revelation-slash-1 {
    background: linear-gradient(135deg, transparent 45%, rgba(212, 175, 55, 0.3) 50%, transparent 55%);
    animation: revelationSlash 0.8s ease-out forwards;
}

.revelation-slash-2 {
    background: linear-gradient(135deg, transparent 45%, rgba(212, 175, 55, 0.2) 50%, transparent 55%);
    animation: revelationSlash 0.8s ease-out 0.1s forwards;
}

/* Chronicle Card Styles */
.chronicle-card.unlocked:hover {
    transform: translateX(4px);
}

.chronicle-card.locked {
    filter: grayscale(0.5);
}

/* Content Reading Mode */
.chronicle-content p {
    text-indent: 1em;
    margin-bottom: 1.5em;
}

.chronicle-content p:first-letter {
    font-size: 1.5em;
    color: var(--sage-accent, #D4AF37);
}

/* [v150.0] Sage Icon Float Animation (Modal Wizard) */
@keyframes iconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.animate-float {
    animation: iconFloat 4s ease-in-out infinite;
}

/* Holy Reveal Effect (God Ray / Flash) */
@keyframes holyFlash {
    0% {
        filter: brightness(3) drop-shadow(0 0 60px rgba(255, 215, 0, 0.8));
        transform: scale(1.05);
    }

    100% {
        filter: brightness(1) drop-shadow(0 0 10px rgba(212, 175, 55, 0.3));
        transform: scale(1);
    }
}

/* [v305.27] Card Crescendo: Aftermath Glow (pulsing gold border) */
@keyframes cardAftermath {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(212, 175, 55, 0.4), 0 0 30px rgba(212, 175, 55, 0.2);
        border-color: rgba(212, 175, 55, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.7), 0 0 50px rgba(212, 175, 55, 0.4);
        border-color: rgba(212, 175, 55, 0.9);
    }
}

.holy-reveal {
    animation: holyFlash 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards,
        cardAftermath 2s ease-in-out 1.2s 3;
    /* Starts after flash, pulses 3 times */
    z-index: 50;
}


/* Share Card Overlay */
.share-canvas-container {
    background-image: radial-gradient(circle at center, #1a1c2c 0%, #000000 100%);
}

.share-card-frame {
    border: 1px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.15);
    background: rgba(5, 8, 16, 0.8);
    position: relative;
    overflow: hidden;
}

.share-card-frame::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    pointer-events: none;
}

.share-screenshot-flash {
    animation: flash 0.3s ease-out;
}

@keyframes flash {
    0% {
        background: rgba(255, 255, 255, 0);
    }

    50% {
        background: rgba(255, 255, 255, 0.8);
    }

    100% {
        background: rgba(255, 255, 255, 0);
    }
}

/* Custom Scrollbar for Book */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(212, 175, 55, 0.3);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(212, 175, 55, 0.6);
}

/* Premium Card Gleam Effect */
.premium-card {
    position: relative;
    overflow: hidden;
}

.premium-card::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0) 40%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0) 60%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(30deg);
    animation: gleam 6s infinite ease-in-out;
    pointer-events: none;
}

@keyframes gleam {

    0%,
    80% {
        transform: translate(-50%, -50%) rotate(30deg);
        opacity: 0;
    }

    85% {
        opacity: 1;
    }

    90%,
    100% {
        transform: translate(50%, 50%) rotate(30deg);
        opacity: 0;
    }
}

/* Book Animation */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s ease-out forwards;
}

/* Grand Entrance Animations */
@keyframes kenBurns {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

.animate-ken-burns {
    animation: kenBurns 20s ease-out infinite alternate;
}

@keyframes entranceFlash {
    0% {
        background-color: rgba(212, 175, 55, 0);
    }

    50% {
        background-color: rgba(212, 175, 55, 0.3);
    }

    100% {
        background-color: rgba(0, 0, 0, 0);
    }
}

.entrance-exit-flash {
    animation: entranceFlash 0.8s ease-out forwards;
}

.entrance-fade-content {
    animation: fadeOut 0.5s ease-in forwards;
}

/* Report/Book Typography */
.book-text {
    font-family: 'Zen Old Mincho', serif;
    line-height: 2.0;
    /* Loose line height for historical feel */
    font-weight: 500;
}

.book-title {
    font-family: 'Zen Old Mincho', serif;
    font-weight: 900;
}

/* =========================================
   DIALOGUE SCREEN REFINEMENT (v5.4)
   ========================================= */

/* Sage Bubble: Parchment Style (Enhanced) */
.sage-bubble {
    /* Old Paper Gradient: Radar + Linear */
    background-color: #fdfbf7;
    background-image:
        radial-gradient(circle at top left, transparent 0%, rgba(200, 160, 80, 0.1) 100%),
        linear-gradient(to bottom right, #fdfbf7 0%, #f0e6d2 50%, #e6dcb8 100%);

    /* Strong Gold Border */
    border: 2px solid #d4af37;
    border-radius: 12px;

    color: #2a2210;
    font-family: 'Zen Old Mincho', serif;
    font-weight: 600;
    /* Bolder text for readability */
    line-height: 1.9;
    letter-spacing: 0.05em;

    /* Depth & Glow */
    box-shadow:
        3px 6px 15px rgba(0, 0, 0, 0.5),
        /* Drop Shadow */
        inset 0 0 30px rgba(184, 134, 11, 0.15),
        /* Inner Aging */
        0 0 8px rgba(212, 175, 55, 0.4);
    /* Outer Gold Glow */

    position: relative;
    border-top-left-radius: 0;
    margin-bottom: 8px;
}

/* [v305.27] Oracle Bubble: Enhanced for Reading Results */
.sage-bubble--oracle {
    /* DRAMATIC: Distinct golden background for oracle messages */
    background: linear-gradient(135deg,
            #fdfbf7 0%,
            #f8f0dc 30%,
            #f0e6c8 70%,
            #e8dbb0 100%) !important;

    /* THICK gold left accent - very visible */
    border-left: 6px solid #D4AF37 !important;

    /* STRONG gold glow - unmissable */
    box-shadow:
        3px 6px 15px rgba(0, 0, 0, 0.5),
        inset 0 0 40px rgba(184, 134, 11, 0.25),
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 60px rgba(212, 175, 55, 0.3) !important;

    /* Fast pulsing animation */
    animation: oraclePulse 2s ease-in-out infinite;
}

@keyframes oraclePulse {

    0%,
    100% {
        box-shadow:
            3px 6px 15px rgba(0, 0, 0, 0.5),
            inset 0 0 40px rgba(184, 134, 11, 0.25),
            0 0 30px rgba(212, 175, 55, 0.6),
            0 0 60px rgba(212, 175, 55, 0.3);
        border-left-color: #D4AF37;
    }

    50% {
        box-shadow:
            3px 6px 15px rgba(0, 0, 0, 0.5),
            inset 0 0 50px rgba(184, 134, 11, 0.35),
            0 0 50px rgba(212, 175, 55, 0.8),
            0 0 100px rgba(212, 175, 55, 0.5);
        border-left-color: #FFD700;
    }
}

/* User Bubble: Glass Style */
.user-bubble {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f1f5f9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    border-radius: 1rem;
    border-top-right-radius: 0;
}

/* System Tachie (Portrait) Container */
/* Immersive Tachie Container (Left Aligned) */
/* Immersive Tachie Container (Left Aligned) */
.tachie-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Behind UI */
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);

    /* Smooth Fade Mask at Bottom/Left */
    -webkit-mask-image: linear-gradient(to top, transparent 0%, black 20%),
        linear-gradient(to right, transparent 0%, black 10%);
    mask-image: linear-gradient(to top, transparent 0%, black 20%),
        linear-gradient(to right, transparent 0%, black 10%);

    transform: translateX(-50px) scale(0.95);
    transform-origin: bottom center;
}

/* Mobile Adjustments for Tachie */
@media (max-width: 768px) {
    .tachie-container {
        /* Reset fixed positioning for the new flex layout */
        position: relative !important;
        left: auto !important;
        width: 100% !important;
        height: 100% !important;
        transform: none !important;
        opacity: 1 !important;
        /* [v314.7] REMOVED mask-image - was causing feet to fade on session screen */
        /* mask-image: linear-gradient(to top, transparent 0%, black 15%) !important; */
        /* -webkit-mask-image: linear-gradient(to top, transparent 0%, black 15%) !important; */
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }

    #mentor-tachie-container img {
        /* Ensure the image aligns to bottom center on mobile */
        object-position: bottom center !important;
    }
}

/* PC Override for specific mentor screen layout (Matches lg breakpoint) */
@media (min-width: 1024px) {
    #mentor-screen .tachie-container {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none !important;
        opacity: 1 !important;
        mask-image: none;
        -webkit-mask-image: none;
    }
}

.tachie-active {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.tachie-breathing {
    animation: tachieBreath 6s ease-in-out infinite;
}

/* [v89.0] Subtle Breath: Reduced magnitude for stable presence */
@keyframes tachieBreath {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1.005) translateY(-2px);
    }
}

/* Mentor Text Panel (Right-Aligned Floating) */
.mentor-text-panel {
    z-index: 10;
    /* Above Tachie */
}

/* [MOD v26.3] History Modal Z-Index Fix */
#history-modal {
    z-index: 75 !important;
    /* Higher than entrance-screen (z-40) and everything else */
}

/* =========================================
   Z-INDEX MANAGEMENT (v26.3)
   Standardized stacking context for all layers
   ========================================= */

/* Base Layers */
.z-base {
    z-index: 0;
}

.z-tachie {
    z-index: 10;
}

/* Tachie Characters */
.z-ui-base {
    z-index: 20;
}

/* Basic UI Elements */

/* Floating Elements */
.z-float {
    z-index: 30;
}

/* Floating keywords, particles */
.z-header {
    z-index: 40;
}

/* Fixed Headers/Controls */

/* Modal Layers (Standard) */
/* Sage Intro, Settings, simple dialogs */
.z-modal-std {
    z-index: 50;
}

#sage-intro-modal,
#menu-modal {
    z-index: 50;
}

/* Modal Layers (High Priority) */
/* Article Viewer, Detailed Reports, History */
.z-modal-high {
    z-index: 75;
}

#article-modal,
#history-modal,
#report-modal {
    z-index: 75 !important;
}

/* Modal Layers (Critical) */
/* Errors, Alerts, Loading Screens */
.z-modal-crit {
    z-index: 100;
}

#loading-screen,
#error-modal,
.suspense-overlay {
    z-index: 100;
}

/* =========================================
   SAGE CHAT LAYOUT OPTIMIZATION (v29.5 - EMERGENCY FIX)
   - Force Transparency on Container
   - Force Gradient Mask with !important
   - Ensure visual blending
   ========================================= */

#session-screen .tachie-container {
    /* [FORCE] Ensure no background interferes */
    background-color: transparent !important;
    background: transparent !important;

    /* [FIX] Fix Mobile Positioning: Use absolute so it doesn't push footer off screen */
    position: absolute !important;
    top: 0;
    left: 0;

    /* Flexbox for easier alignment */
    display: flex !important;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Behind chat */
    pointer-events: none;
    /* Pass clicks through */

    /* [v314.7] Prevent horizontal overflow from large tachie images */
    overflow: hidden !important;

    /* [v314.7] Remove bottom fade mask - show full tachie including feet */
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

#session-screen #tachie-img {
    /* [v314.7] Flexbox centering - let parent container handle horizontal centering */
    position: relative;
    /* Changed from absolute - now respects parent flexbox */

    /* Base (Mobile) */
    width: auto;
    height: 100%;
    /* [v314.7] Increased from 95% to reach bottom */
    max-width: 115%;
    object-fit: contain;

    /* Anchor to bottom of image content */
    object-position: bottom center !important;

    /* Solid Presence */
    opacity: 1;
    display: block;

    /* Ensure no margin interference */
    margin: 0;
}

/* Tablet (Portrait/Landscape) */
@media (min-width: 768px) {
    #session-screen #tachie-img {
        height: 95%;
        max-width: 90%;
        object-fit: contain;
        object-position: bottom center !important;
    }
}

/* PC (Desktop) */
@media (min-width: 1024px) {
    #session-screen #tachie-img {
        height: 95%;
        max-width: 60%;
        object-fit: contain;
        object-position: bottom center !important;
    }
}

/* =========================================
   MIRROR INPUT OVERLAY (v33.5)
   ========================================= */
#mirror-overlay {
    background: radial-gradient(circle at center, #1a1c2c 0%, #000000 100%);
}

#mirror-overlay.hidden {
    pointer-events: none;
    opacity: 0;
}

#mirror-overlay:not(.hidden) {
    pointer-events: auto;
    opacity: 1;
}

.mirror-input-field {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(212, 175, 55, 0.5);
    color: #F0F0F0;
    font-family: 'Zen Old Mincho', serif;
    font-size: 1.5rem;
    text-align: center;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.mirror-input-field:focus {
    outline: none;
    border-bottom: 1px solid rgba(212, 175, 55, 1);
    box-shadow: 0 10px 20px -10px rgba(212, 175, 55, 0.2);
}

.mirror-input-field::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-size: 1rem;
}

/* Mirror Ripple Effect */
@keyframes mirrorRipple {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.3;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.5;
    }
}

.mirror-reflection {
    animation: mirrorRipple 8s ease-in-out infinite;
}

/* =========================================
   SACRED SCROLL PATTERN (v62.1 - Dramatic Redesign)
   Premium collapsible reading with ornate styling
   ========================================= */

/* Scroll Content Container */
.scroll-content {
    position: relative;
    overflow: hidden;
    transition: max-height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Collapsed State */
.scroll-collapsed {
    max-height: 7em;
}

/* Expanded State */
.scroll-expanded {
    max-height: 3000px;
}

/* Fade Gradient - Mystery Veil */
.scroll-gradient {
    position: absolute;
    bottom: 3.5em;
    left: 0;
    right: 0;
    height: 4em;
    background: linear-gradient(to bottom,
            rgba(253, 251, 247, 0) 0%,
            rgba(240, 230, 210, 0.95) 70%,
            rgba(230, 220, 184, 1) 100%);
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* Expand Button - Ornate Sacred Style */
.scroll-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75em;
    width: 100%;
    margin-top: 1em;
    padding: 0.75em 1.5em;
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.08) 0%,
            rgba(184, 134, 11, 0.15) 50%,
            rgba(212, 175, 55, 0.08) 100%);
    border: none;
    border-radius: 0;
    position: relative;
    color: #6b5a3d;
    font-family: 'Zen Old Mincho', serif;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Ornate Border Lines */
.scroll-expand-btn::before,
.scroll-expand-btn::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(212, 175, 55, 0.6) 20%,
            rgba(212, 175, 55, 0.8) 50%,
            rgba(212, 175, 55, 0.6) 80%,
            transparent 100%);
}

.scroll-expand-btn::before {
    top: 0;
}

.scroll-expand-btn::after {
    bottom: 0;
}

.scroll-expand-btn:hover {
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.15) 0%,
            rgba(184, 134, 11, 0.25) 50%,
            rgba(212, 175, 55, 0.15) 100%);
    color: #4a3d28;
    letter-spacing: 0.25em;
}

.scroll-expand-btn:active {
    transform: scale(0.98);
}

/* Icon Animation */
.scroll-expand-icon {
    display: inline-block;
    font-size: 0.7em;
    opacity: 0.7;
    transition: all 0.4s ease;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    50% {
        transform: translateY(2px);
        opacity: 1;
    }
}

.scroll-expand-text {
    text-transform: uppercase;
}

/* =========================================
   SCROLL CEREMONY OVERLAY (v62.2)
   Dramatic unveiling effect
   ========================================= */

/* Dark curtain overlay */
.scroll-ceremony-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 90;
    pointer-events: none;
    transition: background 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.scroll-ceremony-overlay.active {
    background: rgba(5, 8, 16, 0.85);
    pointer-events: auto;
}

/* Focused bubble rises above overlay */
.scroll-focused-container {
    position: relative;
    z-index: 95 !important;
}

.scroll-focused {
    position: relative;
    z-index: 95;

    /* Sacred glow effect */
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.4),
        0 0 60px rgba(212, 175, 55, 0.2),
        0 0 100px rgba(212, 175, 55, 0.1),
        inset 0 0 30px rgba(184, 134, 11, 0.1) !important;

    /* Subtle scale for emphasis */
    transform: scale(1.02);
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Enhanced border when focused */
.scroll-focused::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2px solid rgba(212, 175, 55, 0.6);
    border-radius: 14px;
    pointer-events: none;
    animation: scrollGlowPulse 2s ease-in-out infinite;
}

@keyframes scrollGlowPulse {

    0%,
    100% {
        opacity: 0.6;
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
    }
}

/* =========================================
   ORACLE'S THRONE - v105.0 (Divine Presence 2.0)
   Sage Avatar Breathing Animation
   ========================================= */

.sage-avatar-breathing {
    animation: sageAvatarBreathing 4s ease-in-out infinite;
}

@keyframes sageAvatarBreathing {

    0%,
    100% {
        box-shadow:
            0 0 50px rgba(212, 175, 55, 0.7),
            0 0 80px rgba(212, 175, 55, 0.3);
    }

    50% {
        box-shadow:
            0 0 70px rgba(212, 175, 55, 0.9),
            0 0 100px rgba(212, 175, 55, 0.4);
    }
}

/* PC Enhanced Breathing */
@media (min-width: 1024px) {
    .sage-avatar-breathing {
        animation: sageAvatarBreathingPC 4s ease-in-out infinite;
    }

    @keyframes sageAvatarBreathingPC {

        0%,
        100% {
            box-shadow:
                0 0 100px rgba(212, 175, 55, 0.8),
                0 0 150px rgba(212, 175, 55, 0.3);
        }

        50% {
            box-shadow:
                0 0 120px rgba(212, 175, 55, 1.0),
                0 0 180px rgba(212, 175, 55, 0.5);
        }
    }
}

/* Hover: Pause breathing and intensify glow */
.sage-avatar-breathing:hover {
    animation-play-state: paused;
    box-shadow:
        0 0 80px rgba(212, 175, 55, 1.0),
        0 0 120px rgba(212, 175, 55, 0.6) !important;
}

@media (min-width: 1024px) {
    .sage-avatar-breathing:hover {
        box-shadow:
            0 0 140px rgba(212, 175, 55, 1.0),
            0 0 200px rgba(212, 175, 55, 0.7) !important;
    }
}

/* =========================================
   GRIMOIRE MODAL - PC Background (v128.1)
   Uses landscape leather texture on PC
   ========================================= */

@media (min-width: 1024px) {
    #history-content {
        background: #1a120a url('../assets/images/ui/grimoire_leather_pc.webp') center/cover no-repeat !important;
    }
}

/* =========================================
   SACRED FLAME ANIMATIONS (v305.6)
   Centralized flame effects for ritual modals
   ========================================= */

@keyframes flame-flicker {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-2px) scale(1.05);
        opacity: 0.9;
    }
}

@keyframes flame-gather {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }

    30% {
        transform: translateY(0) scale(1.5);
        opacity: 1;
    }

    70% {
        transform: translateY(0) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-20px) scale(0);
        opacity: 0;
    }
}

@keyframes flame-glow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(255, 150, 50, 0.5);
    }

    50% {
        text-shadow: 0 0 30px rgba(255, 150, 50, 0.8), 0 0 60px rgba(255, 100, 0, 0.5);
    }
}

@keyframes text-fade-in {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-flame-1 {
    animation: flame-flicker 0.8s ease-in-out infinite;
}

.animate-flame-2 {
    animation: flame-flicker 0.8s ease-in-out infinite 0.2s;
}

.animate-flame-3 {
    animation: flame-flicker 0.8s ease-in-out infinite 0.4s;
}

.flame-offering-flame {
    animation: flame-gather 2s ease-in-out forwards;
}

.flame-offering-text {
    animation: text-fade-in 0.8s ease-out 1s forwards, flame-glow 2s ease-in-out infinite 1s;
    opacity: 0;
}

/* =========================================
   [v305.27] SUGGESTION CHIPS - Digital Luxury
   "Choosing is a sacred act."
   ========================================= */

.suggestion-chip {
    /* DRAMATIC: Strong gold gradient background */
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(0, 0, 0, 0.6) 100%);
    border: 2px solid rgba(212, 175, 55, 0.6);
    color: #D4AF37;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(212, 175, 55, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    letter-spacing: 0.08em;
    font-weight: 600;
}

.suggestion-chip:hover {
    /* DRAMATIC: Bright gold on hover */
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.5) 0%, rgba(212, 175, 55, 0.2) 100%);
    border-color: #D4AF37;
    color: #FFD700;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.5),
        0 0 60px rgba(212, 175, 55, 0.3),
        inset 0 0 30px rgba(212, 175, 55, 0.15);
    transform: translateY(-4px) scale(1.02);
}

.suggestion-chip .chip-icon {
    display: inline-block;
    margin-right: 4px;
    opacity: 0.7;
    transition: all 0.3s;
}

.suggestion-chip:hover .chip-icon {
    opacity: 1;
    animation: iconPulse 0.6s ease-in-out;
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

.suggestion-chip.chip-selected {
    animation: chipSelect 0.3s ease-out forwards;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.6) 0%, rgba(212, 175, 55, 0.3) 100%);
    color: #000;
}

@keyframes chipSelect {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.95);
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.8);
    }

    100% {
        transform: scale(1);
    }
}

.suggestion-chip:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =========================================
   ORACLE'S STAGE v306.0
   Session Screen Redesign
   ========================================= */

/* Sage Stage: 60vh with bottom alignment */
.sage-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: hidden;
    /* Stage inherits the domain background from session-screen */
    background: inherit;
    background-size: cover;
    background-position: center;
}

/* Ensure tachie is always visible in Stage */
#sage-stage .tachie-container {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 5;
}

/* [v314.7] CONSOLIDATED: #tachie-img styles moved to #session-screen #tachie-img (L1033)
   Single Source of Truth - DO NOT ADD duplicate tachie-img rules here */

/* Sacred Divider animation */
.sacred-divider {
    animation: dividerGlow 3s ease-in-out infinite;
}

@keyframes dividerGlow {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
    }
}

/* Session Footer styling */
.session-footer {
    background: #0a0806;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
}

/* Dialogue Area Background - Distinct from Stage */
#session-screen #chat-container {
    background: linear-gradient(to bottom,
            #12100d 0%,
            #0a0806 100%);
    border-top: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
}

/* [v314.7] REMOVED: #sage-stage media queries - consolidated in #session-screen #tachie-img */

/* =========================================
   SESSION UI MASTERPIECE v307.0
   「対話」を主役にするデザイン革命
   妥協なき傑作 - Blood Oath
   ========================================= */

/* ------------------------------------------
   SAGE SCROLL - 古代巻物スタイル v307.1
   「神託」として読まれるべきテキスト
   ------------------------------------------ */

.sage-scroll {
    /* Ancient Parchment with Texture */
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 248, 230, 0.4) 0%, transparent 70%),
        radial-gradient(ellipse at 50% 100%, rgba(180, 140, 60, 0.15) 0%, transparent 60%),
        linear-gradient(to bottom,
            #f8f0dc 0%,
            #f0e6c8 20%,
            #ebe0b8 50%,
            #e5d8a8 80%,
            #ddd0a0 100%);

    /* Left Gold Border: The Scroll's Sacred Edge */
    border-left: 8px solid;
    border-image: linear-gradient(to bottom, #D4AF37 0%, #B8860B 50%, #8B6914 100%) 1;
    border-top: none;
    border-bottom: none;
    border-right: none;
    border-radius: 0 16px 16px 0;

    /* Scroll Shadow: Ancient Depth */
    box-shadow:
        inset 8px 0 20px rgba(139, 105, 20, 0.2),
        inset 0 4px 10px rgba(0, 0, 0, 0.08),
        inset 0 -4px 10px rgba(0, 0, 0, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(184, 134, 11, 0.25);

    /* Typography: Divine Authority */
    color: #3d3220;
    font-family: 'Zen Old Mincho', serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 2.0;
    letter-spacing: 0.08em;
    text-align: justify;

    /* Generous Padding for Readability */
    padding: 2rem 1.8rem 2rem 2.2rem;
    position: relative;
    margin-bottom: 16px;
    margin-left: 4px;

    /* Entrance Animation */
    animation: scrollReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Top/Bottom Decorative Lines - VISIBLE */
.sage-scroll::before,
.sage-scroll::after {
    content: '';
    position: absolute;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(184, 134, 11, 0.5) 10%,
            rgba(212, 175, 55, 0.8) 50%,
            rgba(184, 134, 11, 0.5) 90%,
            transparent 100%);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.sage-scroll::before {
    top: 1rem;
}

.sage-scroll::after {
    bottom: 1rem;
}

/* Oracle Reading: Extra Emphasis */
.sage-scroll--oracle {
    background: linear-gradient(135deg,
            #f8f0dc 0%,
            #f0e6c8 50%,
            #e8dbb0 100%);
    border-left-width: 7px;
    box-shadow:
        inset 3px 0 12px rgba(0, 0, 0, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(212, 175, 55, 0.4),
        0 0 60px rgba(212, 175, 55, 0.2);
    animation: scrollReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards,
        oracleBreath 3s ease-in-out 0.7s infinite;
}

@keyframes scrollReveal {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
        filter: blur(3px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes oracleBreath {

    0%,
    100% {
        box-shadow:
            inset 3px 0 12px rgba(0, 0, 0, 0.15),
            0 8px 32px rgba(0, 0, 0, 0.6),
            0 0 30px rgba(212, 175, 55, 0.4);
    }

    50% {
        box-shadow:
            inset 3px 0 12px rgba(0, 0, 0, 0.15),
            0 8px 32px rgba(0, 0, 0, 0.6),
            0 0 50px rgba(212, 175, 55, 0.6),
            0 0 80px rgba(212, 175, 55, 0.3);
    }
}

/* [v308.9] MEDITATION INDICATOR - Native CSS replacements for Tailwind */
.meditation-text {
    color: rgba(212, 175, 55, 0.8);
    font-style: italic;
}

.typing-dots-container {
    margin-left: 0.5rem;
    display: inline-flex;
    gap: 0.25rem;
    vertical-align: middle;
}

/* ------------------------------------------
   SESSION CTA BUTTONS - Glassmorphism Gold
   "認知的に沈んでいる" → "押したくなる神聖なボタン"
   ------------------------------------------ */

.session-footer-v2 {
    background: linear-gradient(to top,
            rgba(10, 8, 6, 0.98) 0%,
            rgba(18, 16, 13, 0.95) 100%);
    border-top: 2px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
}

.session-cta-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1rem 1.5rem;
    min-height: 70px;

    /* Glassmorphism */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* Minimal Border (Luxury) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;

    /* Shadow */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);

    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Shimmer Effect */
.session-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0) 0%,
            rgba(212, 175, 55, 0.15) 50%,
            rgba(212, 175, 55, 0) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.session-cta-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.session-cta-btn:hover::before {
    opacity: 1;
}

.session-cta-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.session-cta-icon {
    width: 28px;
    height: 28px;
    /* [v307.8] Theme-aware icon color */
    color: var(--sage-accent);
    transition: all 0.3s;
}

.session-cta-btn:hover .session-cta-icon {
    /* [v307.8] Brighten on hover using filter instead of hardcoded gold */
    color: var(--sage-accent);
    filter: brightness(1.3) drop-shadow(0 0 8px var(--sage-glow));
    transform: scale(1.1);
}

.session-cta-label {
    color: rgba(240, 240, 240, 0.9);
    font-family: 'Zen Old Mincho', serif;
    font-size: 12px;
    letter-spacing: 0.15em;
    transition: all 0.3s;
}

.session-cta-btn:hover .session-cta-label {
    color: #fff;
    /* [v307.8] Theme-aware glow */
    text-shadow: 0 0 10px var(--sage-glow);
}

/* ------------------------------------------
   SAGE BREATHING ANIMATION
   "静止画に見える" → "生きている賢者"
   ------------------------------------------ */

#session-screen #tachie-img {
    animation: sageTachieBreath 5s ease-in-out infinite;
}

@keyframes sageTachieBreath {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        /* Subtle breathing motion - lifts slightly for life-like presence */
        transform: scale(1.005) translateY(-2px);
    }
}

/* ------------------------------------------
   DIALOGUE AREA ENHANCEMENT
   ------------------------------------------ */

.dialogue-area {
    background: linear-gradient(to bottom,
            rgba(18, 16, 13, 0.9) 0%,
            rgba(10, 8, 6, 0.95) 100%);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* [v307.8] Legacy sage theme CSS removed - definitions now at lines 12-86 */

/* [v311.49] RITUAL CARDS CSS REMOVED - Ritual Quick Access grid deleted */

/* =========================================
   MYSTERY ORACLE CARD v307.2
   「封印された神託」- 期待感を高める
   ========================================= */

.oracle-sealed-card {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 320px;
    padding: 0;
    margin: 1rem auto;
    animation: oracleSealAppear 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.oracle-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg,
            rgba(26, 22, 18, 0.95) 0%,
            rgba(40, 32, 20, 0.9) 50%,
            rgba(26, 22, 18, 0.95) 100%);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(212, 175, 55, 0.2),
        inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.oracle-card-icon {
    position: relative;
}

.oracle-sage-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.6);
    object-fit: cover;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.oracle-card-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.oracle-card-title {
    font-family: 'Zen Old Mincho', serif;
    font-size: 18px;
    color: #D4AF37;
    letter-spacing: 0.2em;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.oracle-card-subtitle {
    font-family: 'Zen Old Mincho', serif;
    font-size: 11px;
    color: rgba(212, 175, 55, 0.6);
    letter-spacing: 0.15em;
}

.oracle-reveal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.15) 0%,
            rgba(184, 134, 11, 0.25) 100%);
    border: 1px solid rgba(212, 175, 55, 0.6);
    border-radius: 30px;
    color: #D4AF37;
    font-family: 'Zen Old Mincho', serif;
    font-size: 13px;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    animation: revealBtnPulse 2s ease-in-out infinite;
}

.oracle-reveal-btn:hover {
    background: linear-gradient(135deg,
            rgba(212, 175, 55, 0.3) 0%,
            rgba(184, 134, 11, 0.4) 100%);
    border-color: #D4AF37;
    color: #FFD700;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.oracle-reveal-icon {
    font-size: 10px;
    animation: iconGlow 1.5s ease-in-out infinite;
}

@keyframes oracleSealAppear {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes revealBtnPulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
    }

    50% {
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.4);
    }
}

@keyframes iconGlow {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 8px rgba(212, 175, 55, 0.8);
    }
}

/* Unsealing Animation */
.oracle-unsealing {
    animation: oracleUnseal 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes oracleUnseal {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(212, 175, 55, 0.6);
    }

    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Revealed Scroll Animation */
.oracle-revealed {
    animation: scrollRevealFromCard 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scrollRevealFromCard {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   [v307.8] SAGE THEME APPLICATION
   These rules override Tailwind classes to use
   dynamic --sage-accent colors per Sage.
   ============================================ */

/* Session Header Sage Name - Apply theme accent */
#session-sage-name {
    color: var(--sage-accent) !important;
    text-shadow: 0 0 15px var(--sage-glow);
}

/* The Sacred Scroll (Sage Message) - Theme accent border */
.scroll-container::before {
    border-color: var(--sage-accent) !important;
}

/* Session Footer CTA Button - Theme glow */
#session-screen button[class*="border-antique-gold"] {
    border-color: rgba(var(--sage-accent-rgb), 0.5) !important;
}

#session-screen button[class*="border-antique-gold"]:hover {
    border-color: var(--sage-accent) !important;
    box-shadow: 0 0 20px var(--sage-glow) !important;
}

/* [v308.5] Card borders remain gold - removed theme application */
/* Oracle Card Border - NOT themed (user preference) */

/* Post-Reading CTA - Theme accent text */
#post-reading-cta button:first-child {
    color: var(--sage-accent) !important;
    border-color: rgba(var(--sage-accent-rgb), 0.4) !important;
}

#post-reading-cta button:first-child:hover {
    border-color: var(--sage-accent) !important;
    background: rgba(var(--sage-accent-rgb), 0.1) !important;
}

/* Category Wizard Button - The main session CTA */
#category-wizard-btn {
    border-color: rgba(var(--sage-accent-rgb), 0.5) !important;
    color: var(--sage-accent) !important;
}

#category-wizard-btn:hover {
    box-shadow: 0 0 25px var(--sage-glow) !important;
}

/* ============================================
   [v307.8] MENTOR SCREEN THEME APPLICATION
   Navigation arrows, contract button, and
   decorative elements use sage theme colors.
   ============================================ */

/* Navigation Arrows - Theme accent */
#mentor-screen button[onclick*="changeSageIndex"] {
    color: var(--sage-accent) !important;
    border-color: rgba(var(--sage-accent-rgb), 0.5) !important;
    /* Note: Removed box-shadow to prevent rectangular glow on arrow shape */
}

#mentor-screen button[onclick*="changeSageIndex"]:hover {
    color: #fff !important;
    text-shadow: 0 0 15px var(--sage-glow);
}

/* Contract Button - Theme accent */
#mentor-contract-btn {
    border-color: rgba(var(--sage-accent-rgb), 0.5) !important;
    box-shadow: 0 0 25px var(--sage-glow) !important;
}

#mentor-contract-btn span {
    color: var(--sage-accent) !important;
}

#mentor-contract-btn:hover {
    border-color: var(--sage-accent) !important;
    box-shadow: 0 0 40px var(--sage-glow) !important;
}

#mentor-contract-btn:hover span {
    color: #fff !important;
}

/* Tachie Image Frame - Theme accent border */
#mentor-tachie-img {
    border-color: rgba(var(--sage-accent-rgb), 0.5) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 20px var(--sage-glow),
        inset 0 0 40px rgba(0, 0, 0, 0.2) !important;
}

/* Role Text (Vertical) - Theme accent */
#mentor-role-vertical {
    color: var(--sage-accent) !important;
    filter: drop-shadow(0 0 10px var(--sage-glow));
}

/* Exit Button - Theme accent */
#mentor-screen button[onclick*="activate('home')"] {
    border-color: rgba(var(--sage-accent-rgb), 0.3) !important;
    color: var(--sage-accent) !important;
}

#mentor-screen button[onclick*="activate('home')"]:hover {
    border-color: rgba(var(--sage-accent-rgb), 0.6) !important;
}

/* ============================================
   [v307.8] HOME SCREEN MENTOR AREA THEME
   Contracted mentor avatar and greeting use
   the mentor's theme color.
   ============================================ */

/* Mentor Avatar Border - Theme accent */
#mentor-greeting-container .sage-avatar-breathing {
    border-color: rgba(var(--sage-accent-rgb), 0.6) !important;
}

#mentor-greeting-container .sage-avatar-breathing:hover {
    border-color: var(--sage-accent) !important;
    box-shadow: 0 0 30px var(--sage-glow) !important;
}

/* ============================================
   [v308.7] ORACLE CARD - GOLD MAINTAINED
   Design Decision: 神聖領域（Oracle/Grimoire）は
   普遍的な金色で統一。暗いテーマカラーでも
   視認性を保証し、Digital Luxuryブランドを維持。
   賢者の個性はナビ/ヘッダー/グロー効果で表現。
   ============================================ */

/* ============================================
   [v328] DEALER UX REDESIGN
   吸収 → 散開 → 選択 → 退場
   GPU合成のみ（transform/opacity）
   ============================================ */

/* --- Absorption Phase --- */
.dealer-absorption-glow {
    animation: absorptionGlow 1.2s ease-in-out infinite;
}

@keyframes absorptionGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.7), 0 0 60px rgba(212, 175, 55, 0.3);
    }
}

.dealer-absorb-text {
    animation: absorbText 0.7s ease-in forwards;
}

@keyframes absorbText {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* --- Deck Stack: prevent mobile long-press image menu --- */
#deck-stack,
#deck-stack * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* --- Deck Waiting (touch-ready pulse) --- */
.dealer-deck-waiting {
    animation: deckWaiting 2s ease-in-out infinite;
    cursor: pointer;
}

@keyframes deckWaiting {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.03);
        box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    }
}

/* --- Deck Shuffle: per-card jitter (bottom=calm, top=chaotic) --- */
.dealer-shuffle-0 {
    animation: shuffle0 0.18s ease-in-out infinite;
}

.dealer-shuffle-1 {
    animation: shuffle1 0.16s ease-in-out infinite;
}

.dealer-shuffle-2 {
    animation: shuffle2 0.14s ease-in-out infinite;
}

.dealer-shuffle-3 {
    animation: shuffle3 0.12s ease-in-out infinite;
}

@keyframes shuffle0 {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-3px) translateX(1.5px) rotate(0.5deg);
    }
}

@keyframes shuffle1 {

    0%,
    100% {
        transform: translateY(-2px);
    }

    50% {
        transform: translateY(-7px) translateX(-2px) rotate(-0.8deg);
    }
}

@keyframes shuffle2 {

    0%,
    100% {
        transform: translateY(-4px);
    }

    50% {
        transform: translateY(-11px) translateX(3px) rotate(1.2deg);
    }
}

@keyframes shuffle3 {

    0%,
    100% {
        transform: translateY(-6px);
    }

    50% {
        transform: translateY(-16px) translateX(-4px) rotate(-1.8deg);
    }
}

.arc-card {
    position: absolute;
    width: 40px;
    height: 64px;
    background-image: url('../assets/images/ui/card_back.webp');
    background-size: cover;
    background-color: #1a1612;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    will-change: transform, opacity;
    transition: transform 1.0s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
    opacity: 0;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.arc-card.dealt {
    opacity: 1;
}

/* (lifted/ripple removed — Sacred Circle uses container rotation instead) */

/* --- Golden Flash (Culmination) --- */
.arc-golden-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.5) 0%, rgba(212, 175, 55, 0) 70%);
    pointer-events: none;
    z-index: 30;
    animation: goldenFlash 1.2s ease-out forwards;
}

@keyframes goldenFlash {
    0% {
        opacity: 0;
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* (convergence removed — Sacred Circle uses fade-out instead) */

/* --- Arc Instruction Pulse --- */
.arc-instruction-pulse {
    animation: arcInstructionPulse 2s ease-in-out infinite;
}

@keyframes arcInstructionPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

/* --- Card Deal (heavy fall from deck, 4-stage bounce) --- */
@keyframes cardDeal {
    0% {
        opacity: 0;
        transform: translateY(-80px) scale(0.5) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: translateY(6px) scale(1.04) rotate(var(--card-rot, 0deg));
    }

    75% {
        opacity: 1;
        transform: translateY(-2px) scale(0.99) rotate(var(--card-rot, 0deg));
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(var(--card-rot, 0deg));
    }
}

/* --- Card Chosen (mystical ascension: hold → glow → rise → dissolve) --- */
@keyframes cardChosen {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: brightness(1) drop-shadow(0 0 0 rgba(212, 175, 55, 0));
    }

    25% {
        opacity: 1;
        transform: scale(1.12) translateY(-4px);
        filter: brightness(1.35) drop-shadow(0 0 15px rgba(212, 175, 55, 0.8));
    }

    50% {
        opacity: 1;
        transform: scale(1.08) translateY(-16px);
        filter: brightness(1.2) drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
    }

    80% {
        opacity: 0.5;
        transform: scale(0.85) translateY(-45px);
        filter: brightness(1.5) drop-shadow(0 0 12px rgba(212, 175, 55, 0.3));
    }

    100% {
        opacity: 0;
        transform: scale(0.6) translateY(-60px);
        filter: brightness(1.6) drop-shadow(0 0 0 rgba(212, 175, 55, 0));
    }
}

/* --- Card Dismiss (sink into table) --- */
@keyframes cardDismiss {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(var(--card-rot, 0deg));
    }

    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* --- Slot Fill --- */
@keyframes slotFill {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    60% {
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.dealer-slot-fill {
    animation: slotFill 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* --- Touch Flash --- */
.dealer-card-touch-flash {
    animation: cardTouchFlash 0.3s ease-out;
}

@keyframes cardTouchFlash {
    0% {
        box-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }

    50% {
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.8), inset 0 0 15px rgba(212, 175, 55, 0.3);
    }

    100% {
        box-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }
}

/* --- Dealer Grid Card Base --- */
.dealer-card {
    background-color: #1a1612;
}

/* --- Dealer Grid Fog Mask (scroll edges) --- */
.dealer-grid-mask {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 3%, black 92%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 3%, black 92%, transparent 100%);
}

/* --- Dealer Slot Base --- */
.dealer-slot {
    transition: all 0.3s ease;
}

/* =========================================
   LUXURY TYPOGRAPHY UTILITIES
   ========================================= */

/* Western Headings (Cinzel) */
.luxury-heading {
    font-family: 'Cinzel', 'Shippori Mincho', serif;
    letter-spacing: 0.15em;
    font-weight: 400;
}

/* Japanese Headings (Shippori Mincho) */
.luxury-heading-jp {
    font-family: 'Shippori Mincho', 'Zen Old Mincho', serif;
    letter-spacing: 0.12em;
    font-weight: 400;
}