/**
 * One Card Tarot CSS
 * Responsive design with BEM methodology and smooth animations
 */

/* Container */
/* CSS Variables for Responsive Card Sizing */
:root {
    /* Default card size (for 7 cards or less) */
    --card-width: 120px;
    --card-height: 204px;
    --card-overlap: 0px;
    --card-gap: 8px;
}

/* Dynamic sizing based on card count */
[data-count="22"] {
    --card-width: 90px;
    --card-height: 153px;
    --card-overlap: 65%;
    --card-gap: 8px;
}

[data-count="32"] {
    --card-width: 75px;
    --card-height: 127px;
    --card-overlap: 72%;
    --card-gap: 6px;
}

[data-count="64"] {
    --card-width: 60px;
    --card-height: 102px;
    --card-overlap: 80%;
    --card-gap: 4px;
}

[data-count="78"] {
    --card-width: 50px;
    --card-height: 85px;
    --card-overlap: 84%;
    --card-gap: 2px;
}

.oct-container {
    max-width: clamp(320px, 100vw, 1440px);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 3rem);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden; /* Prevent horizontal overflow */
    overflow-y: visible; /* Don't clip vertically */
    box-sizing: border-box;
    width: 100%;
}

/* Hide scrollbars on the main container as well */
.oct-container {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.oct-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for webkit browsers */
}

/* Responsive spacing for horizontal arch */
.oct-container.oct-deck--horizontal.oct-deck--arch {
    /* padding: clamp(0.5rem, 2vw, 2rem) clamp(1rem, 3vw, 3rem); */
    padding-left: 0px;
    padding-right: 120px;
    padding-bottom: 120px;
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 1440px;
    box-sizing: border-box;
    -ms-overflow-style: none;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

/* Hide scrollbars for webkit browsers */
.oct-container.oct-deck--horizontal.oct-deck--arch::-webkit-scrollbar {
    display: none;
}

/* Steps */
.oct-step {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.oct-step--active {
    display: block;
    opacity: 1;
}

/* Deck entrance animation preparation */
.oct-step#oct-deck-step {
    overflow: visible; /* Ensure slide-in animation is visible */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Animation classes for deck entrance */
.oct-deck--entering .oct-card {
    opacity: 0;
    transform: translateX(-100%);
}

.oct-deck--entering.oct-deck--animate .oct-card {
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1), 
                opacity 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.oct-deck--visible .oct-card {
    opacity: 1;
    transform: translateX(0);
}

/* Card selection animation classes */
.oct-card--moving-to-center {
    position: fixed !important;
    z-index: 10000;
    transition: all 0.9s cubic-bezier(0.34, 1.56, 0.64, 1); /* Smooth bounce easing */
    pointer-events: none;
    will-change: transform, left, top;
}

.oct-card--exiting {
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.6, 1), opacity 0.6s cubic-bezier(0.4, 0.0, 0.6, 1);
    transform: translateX(120vw) scale(0.8); /* Slide further out and shrink slightly */
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.oct-card--selected-center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 1001;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Typography */
.oct-heading {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #2c1810;
    font-weight: 600;
}

.oct-prompt {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #555;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Compact typography for horizontal arch */
.oct-container.oct-deck--horizontal.oct-deck--arch .oct-heading {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.oct-container.oct-deck--horizontal.oct-deck--arch .oct-prompt {
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Question Form */
.oct-question-form {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.oct-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #444;
}

.oct-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.oct-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Buttons */
.oct-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: transparent;
    min-width: 120px;
}

.oct-button:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.oct-button--primary {
    background-color: #d4af37;
    color: white;
}

.oct-button--primary:hover:not(:disabled) {
    background-color: #b8941f;
    transform: translateY(-1px);
}

.oct-button--secondary {
    background-color: #6c757d;
    color: white;
    margin-top: 1.5rem;
}

.oct-button--secondary:hover:not(:disabled) {
    background-color: #545b62;
    transform: translateY(-1px);
}

.oct-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Deck Grid - Default Horizontal Line Layout */
.oct-deck {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 470px));
    gap: 1rem;
    padding: 0;
    justify-content: center;
    max-width: 100%;
}

/* Horizontal Line Layout - Tighter spacing */
.oct-container.oct-deck--horizontal.oct-deck--line .oct-deck {
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .oct-deck {
        gap: 1.5rem;
    }
    
    .oct-container.oct-deck--horizontal.oct-deck--line .oct-deck {
        gap: 0.8rem;
    }
}

@media (min-width: 1024px) {
    .oct-deck {
        gap: 2rem;
    }
    
    .oct-container.oct-deck--horizontal.oct-deck--line .oct-deck {
        gap: 1rem;
    }
}

/* Arch Layout Container - Responsive */
.oct-arch {
    position: relative;
    /* Width and height are now set dynamically by JavaScript */
    perspective: 1600px;
    overflow: visible;
    /* Margin is set dynamically by JavaScript */
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    transform-origin: center center;
    transition: transform 0.3s ease;
}

/* Enhanced Responsive Arch Layout Cards */
.oct-arch .oct-card {
    position: absolute;
    width: 470px; /* Default width, overridden by JavaScript */
    height: 800px; /* Default height, overridden by JavaScript */
    transform-origin: 50% 50%;
    will-change: transform, width, height;
    transition: transform .28s ease, filter .28s ease, width .3s ease, height .3s ease;
    border-radius: clamp(8px, calc(var(--scale, 1) * 12px), 16px);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,.35));
    cursor: pointer;
    pointer-events: auto;
    /* Enhanced transform using CSS custom properties with responsive scale */
    transform: translate3d(var(--x, 0), var(--y, 0), 0) rotate(var(--rot, 0rad)) scale(var(--scale, 1));
    /* Mobile scroll snap behavior */
    scroll-snap-align: center;
    /* Ensure smooth responsive transitions */
    box-sizing: border-box;
}

/* Responsive card classes for JavaScript targeting */
.oct-arch .oct-card--responsive {
    /* Enhanced responsive behavior */
    min-width: 60px;  /* Minimum card width for readability */
    min-height: 102px; /* Minimum card height maintaining aspect ratio */
}

.oct-arch .oct-card--scaled {
    /* Additional styles for heavily scaled cards */
    border-radius: clamp(4px, calc(var(--scale, 1) * 8px), 12px);
    /* Adjust text size if cards contain text content */
    font-size: calc(var(--scale, 1) * 1rem);
}

/* Enhanced hover effects with responsive scaling */
.oct-arch .oct-card:hover,
.oct-arch .oct-card:focus-visible {
    transform: translate3d(var(--x), var(--y), 0) rotate(var(--rot)) scale(var(--scale, 1)) translateY(calc(var(--scale, 1) * 10px));
    filter: drop-shadow(0 calc(var(--scale, 1) * 12px) calc(var(--scale, 1) * 20px) rgba(0,0,0,.45));
    z-index: 9999; /* Ensure hovered card appears on top */
    outline: none;
    /* Smooth hover transition */
    transition: transform .28s ease, filter .28s ease;
}

/* Enhanced mobile scroll behavior */
.oct-arch--mobile-scroll {
    /* Ensure smooth horizontal scrolling */
    touch-action: pan-x;
    scroll-snap-type: x mandatory;
}

.oct-mobile-scroll {
    /* Enhanced mobile container scrolling */
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    scroll-padding-left: 50%;
    scroll-padding-right: 50%;
}

/* Enhanced mobile responsive breakpoints */
@media (max-width: 768px) {
    .oct-container.oct-deck--horizontal.oct-deck--arch {
        /* Enhanced mobile wheel scrolling */
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        overflow-y: visible;
        /* Improved center initial view */
        scroll-padding-left: 50%;
        scroll-padding-right: 50%;
        /* Better touch interactions */
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .oct-arch {
        /* Enhanced arch container for mobile scrolling */
        min-width: max-content;
        /* Better mobile scaling */
        transform-origin: center top;
        /* Extra padding bottom for shadow space */
        padding-bottom: 60px;
        margin-bottom: 20px;
    }

    /* Responsive card scaling on mobile */
    .oct-arch .oct-card {
        /* Enhanced mobile card behavior */
        transition: transform .2s ease, filter .2s ease; /* Faster transitions on mobile */
    }

    /* Adjusted hover effects for mobile */
    .oct-arch .oct-card:hover,
    .oct-arch .oct-card:focus-visible {
        transform: translate3d(var(--x), var(--y), 0) rotate(var(--rot)) scale(var(--scale, 1)) translateY(calc(var(--scale, 1) * 6px));
    }

    /* Fix reading content responsiveness on mobile */
    .oct-reading__content {
        max-width: 90vw;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .oct-reading__question {
        max-width: 90vw;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .oct-reading__meaning {
        font-size: 1rem;
        padding: 0 0.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .oct-reading__card-name {
        font-size: 1.3rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 480px) {
    .oct-container.oct-deck--horizontal.oct-deck--arch {
        padding: clamp(0.25rem, 1vw, 0.5rem) clamp(0.5rem, 2vw, 1rem);
        /* Extra padding bottom for very small screens */
        padding-bottom: clamp(3rem, 6vw, 5rem);
    }

    .oct-arch {
        /* More padding for shadows on small screens */
        padding-bottom: 80px;
        margin-bottom: 30px;
    }

    /* Extra small screen optimizations */
    .oct-arch .oct-card {
        /* Even faster transitions for small screens */
        transition: transform .15s ease, filter .15s ease;
        /* Minimum readable size enforcement */
        min-width: 50px !important;
        min-height: 85px !important;
    }

    /* Reduced hover effect on very small screens */
    .oct-arch .oct-card:hover,
    .oct-arch .oct-card:focus-visible {
        transform: translate3d(var(--x), var(--y), 0) rotate(var(--rot)) scale(var(--scale, 1)) translateY(calc(var(--scale, 1) * 4px));
    }

    /* Even tighter reading content on very small screens */
    .oct-reading__content {
        max-width: 95vw;
        padding: 0 0.75rem;
    }

    .oct-reading__question {
        max-width: 95vw;
        padding: 0 0.75rem;
        font-size: 0.9rem;
    }

    .oct-reading__meaning {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .oct-reading__card-name {
        font-size: 1.2rem;
    }
}

/* Landscape orientation mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .oct-container.oct-deck--horizontal.oct-deck--arch {
        padding: clamp(0.25rem, 1vw, 0.5rem) clamp(1rem, 3vw, 2rem);
    }
    
    .oct-arch {
        /* Better landscape arch scaling */
        transform: scale(0.9);
        transform-origin: center center;
    }
}

/* High DPI/Retina display optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .oct-arch .oct-card {
        /* Crisper shadows on high DPI displays */
        filter: drop-shadow(0 calc(var(--scale, 1) * 4px) calc(var(--scale, 1) * 8px) rgba(0,0,0,.25));
    }
    
    .oct-arch .oct-card:hover,
    .oct-arch .oct-card:focus-visible {
        filter: drop-shadow(0 calc(var(--scale, 1) * 6px) calc(var(--scale, 1) * 12px) rgba(0,0,0,.35));
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .oct-arch .oct-card {
        transition: none;
    }
    .oct-arch .oct-card:hover,
    .oct-arch .oct-card:focus-visible {
        transform: translate3d(var(--x), var(--y), 0) rotate(var(--rot));
        z-index: 9999; /* Ensure hovered card appears on top even with reduced motion */
    }
    .oct-arch {
        transition: none;
    }
    .oct-container {
        scroll-behavior: auto;
    }
    
    /* Deck entrance - no slide animation for reduced motion */
    .oct-deck--entering .oct-card {
        opacity: 0;
        transform: none; /* No sliding */
    }
    
    .oct-deck--entering.oct-deck--animate .oct-card {
        transition: opacity 0.3s ease; /* Simple fade only */
    }
    
    .oct-deck--visible .oct-card {
        opacity: 1;
        transform: none;
    }
}


/* Card Styles */
.oct-card {
    width: 470px;
    height: 800px;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    padding: 0;
    transform-style: preserve-3d;
    perspective: 1000px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.oct-card:focus {
    outline: none;
}

/* Default hover for line layouts only */
.oct-deck--line .oct-card:hover:not(.oct-card--dimmed) {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Disable global hover for legacy arch layouts only - new arch uses CSS hover */
.oct-deck--arch .oct-deck:not(.oct-arch) .oct-card:hover {
    transform: none;
    box-shadow: inherit;
}

.oct-card--selected {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Removed z-index to maintain left-to-right stacking order */
}

.oct-card--dimmed {
    opacity: 0.5;
    transform: scale(0.95);
    filter: grayscale(0.5);
    cursor: default;
}

/* Disabled card state for state machine gating */
.oct-card--disabled {
    opacity: 0.4;
    filter: grayscale(50%) brightness(0.8);
    cursor: not-allowed;
    pointer-events: none !important;
    transition: all 0.3s ease;
}

.oct-card--disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none;
    border-radius: inherit;
}

/* Ensure disabled cards don't respond to hover */
.oct-card--disabled:hover,
.oct-card--disabled:focus,
.oct-card--disabled:focus-visible {
    transform: none !important;
    box-shadow: inherit !important;
    outline: none !important;
    filter: grayscale(50%) brightness(0.8) !important;
}

/* Visual indicator for disabled state */
.oct-card--disabled .oct-card__front::before {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    z-index: 11;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

/* Arch layout disabled cards */
.oct-arch .oct-card--disabled:hover,
.oct-arch .oct-card--disabled:focus-visible {
    transform: translate3d(var(--x), var(--y), 0) rotate(var(--rot)) !important;
    filter: grayscale(50%) brightness(0.8) drop-shadow(0 8px 16px rgba(0,0,0,.35)) !important;
}

/* Reduced motion support for disabled cards */
@media (prefers-reduced-motion: reduce) {
    .oct-card--disabled {
        transition: none;
    }
}

/* Card Inner Structure */
.oct-card__inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-origin: center center;
}

.oct-card__inner--flippable {
    cursor: pointer;
}

.oct-centered-card.oct-card--flipped .oct-card__inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.oct-card__face,
.oct-card__back,
.oct-card__front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0;
    overflow: hidden;
    transform-origin: center center;
}

.oct-card__front {
    transform: rotateY(180deg);
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    box-sizing: border-box;
}

.oct-card__back {
    background: linear-gradient(135deg, #2c1810 0%, #3d2517 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.oct-card__back-image {
    width: 80%;
    height: auto;
    opacity: 0.9;
}

/* Custom card back images (img tags) */
.oct-card__back img.oct-card__back-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
    opacity: 1;
}

/* Centered Card Display */
.oct-centered-card {
    width: 470px;
    height: 800px;
    margin: 0 auto 2rem;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transform-style: preserve-3d;
    perspective: 1000px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.oct-centered-card:focus {
    outline: none;
}

/* Flip Hint */
.oct-flip-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #d4af37;
    font-size: 0.8rem;
    text-align: center;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Card Content */
.oct-card__content {
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    box-sizing: border-box;
}


/* Card Images */
.oct-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fill container maintaining aspect ratio */
    border: none;
    border-radius: 0;
    background: transparent;
}

.oct-card__main-image {
    width: 100%;
    height: auto;
    max-height: 70%;
    max-width: 100%;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: block;
}

.oct-card__reversed {
    display: block;
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
    margin-top: 0.5rem;
}

/* Reading Panel */
.oct-reading-panel {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.oct-reading-panel--visible {
    opacity: 1;
    transform: translateY(0);
}

.oct-reading__question {
    text-align: center;
    font-style: italic;
    font-size: 1rem;
    color: #666;
    margin: 0.5rem auto 1.5rem;
    max-width: 600px;
    font-weight: 300;
}

.oct-reading__content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.oct-reading__card-name {
    font-size: 1.5rem;
    color: #2c1810;
    margin-bottom: 1rem;
    font-weight: 600;
}

.oct-reading__reversed {
    display: inline-block;
    font-size: 1rem;
    color: #666;
    font-weight: normal;
    margin-left: 0.5rem;
}

.oct-reading__meaning {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
    margin-bottom: 2rem;
}

/* Draw Again Button */
.oct-draw-again-btn {
    display: block;
    margin: 0 auto;
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    /* Scoped reduced motion - disable animations within plugin containers only */
    .oct-container *,
    .oct-container *::before,
    .oct-container *::after,
    .oct-reduce-motion *,
    .oct-reduce-motion *::before,
    .oct-reduce-motion *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.15s !important; /* Allow gentle fades */
        animation-delay: 0s !important;
        animation-fill-mode: forwards !important;
        scroll-behavior: auto !important;
    }
    
    /* Specific card animations */
    .oct-container .oct-card,
    .oct-container .oct-card:hover,
    .oct-container .oct-card--selected,
    .oct-container .oct-centered-card {
        transform: none !important;
        animation: none !important;
        transition: opacity 0.2s ease, box-shadow 0.15s ease !important;
    }
    
    .oct-container .oct-card__inner,
    .oct-container .oct-card__inner--flippable {
        transform: none !important;
        animation: none !important;
        transition: opacity 0.2s ease !important;
    }
    
    /* Disable flip animations but allow opacity change */
    .oct-container .oct-centered-card.oct-card--flipped .oct-card__inner {
        transform: none !important;
    }
    
    /* Show card content immediately for flipped cards */
    .oct-container .oct-card--flipped .oct-card__front {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .oct-container .oct-card--flipped .oct-card__back {
        opacity: 0 !important;
        transform: none !important;
    }
    
    /* Disable floating animations */
    .oct-container .oct-flip-hint {
        animation: none !important;
        opacity: 0.8 !important;
    }
    
    /* Reading panel - gentle fade only */
    .oct-container .oct-reading-panel {
        transform: none !important;
        transition: opacity 0.2s ease !important;
    }
    
    /* Disable any floating keyframe animations */
    .oct-float-keyframes,
    .oct-container [class*="oct-float"] {
        animation: none !important;
    }
    
    /* Disable parallax effects */
    .oct-container .oct-card:hover {
        transform: none !important;
    }
    
    /* Ensure video autoplay is disabled */
    .oct-container video.oct-card-media {
        animation: none !important;
        transform: none !important;
    }
    
    /* Alternative focus indicators for better accessibility */
    .oct-container .oct-card:focus {
        outline: 3px solid #d4af37 !important;
        outline-offset: 3px !important;
        box-shadow: 0 0 0 1px #d4af37 !important;
    }
    
    .oct-container .oct-button:focus {
        outline: 3px solid #d4af37 !important;
        outline-offset: 2px !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .oct-card {
        border: 2px solid currentColor;
    }
    
    .oct-card--selected {
        border-color: #d4af37;
        border-width: 3px;
    }
    
    .oct-button--primary {
        border: 2px solid currentColor;
    }
}

/* Responsive Container for Fixed Card Dimensions */
.oct-container {
    max-width: 100%;
    overflow-x: auto; /* Allow horizontal scroll on small screens */
}

/* Mobile Optimizations with Fixed Card Dimensions */
@media (max-width: 500px) {
    .oct-container {
        padding: 1rem 0.25rem;
    }

    .oct-heading {
        font-size: 1.5rem;
    }

    .oct-prompt {
        font-size: 1rem;
    }

    .oct-deck {
        gap: 0.5rem;
        justify-content: flex-start; /* Allow horizontal scrolling for small screens */
        overflow-x: auto;
        padding-bottom: 0.5rem; /* Space for scrollbar */
    }

    /* Scale cards down slightly on very small screens but maintain aspect ratio */
    .oct-card,
    .oct-centered-card {
        transform-origin: center;
        /* Cards maintain 470x800 but container scales */
    }

    .oct-deck--line .oct-card:hover:not(.oct-card--dimmed) {
        transform: translateY(-3px) scale(1.02);
    }
}

@media (max-width: 390px) {
    /* Extra small screens - maintain fixed card dimensions with horizontal scrolling */
    .oct-container {
        overflow-x: auto; /* Allow horizontal scrolling for the fixed-size centered card */
        padding: 1rem 0.5rem;
    }

    .oct-deck {
        justify-content: center;
        overflow-x: auto;
        padding: 0 1rem 0.5rem;
    }

    /* Centered card maintains fixed 470×800 dimensions - horizontal scroll if needed */
    .oct-centered-card {
        /* No width/height overrides - keep the fixed 470×800 dimensions */
        margin: 0 auto 2rem;
    }
}

/* Loading States */
.oct-container[data-loading="true"] .oct-deck {
    opacity: 0.5;
    pointer-events: none;
}

/* Error States */
.oct-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin-bottom: 1rem;
    text-align: center;
}

/* AI Reading Styles */
.oct-reading__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--color-text-secondary);
}

.oct-reading__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-top: 3px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.oct-reading__source {
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

.oct-reading__source small {
    font-size: 0.85em;
}

.oct-reading__error {
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 4px solid #e74c3c;
}

/* Admin AI Styles */
.oct-ai-section-description {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.oct-ai-notice {
    background: #fff3cd;
    color: #856404;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #ffeaa7;
    margin-top: 0.5rem;
}

.oct-ai-test-section {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Media Elements (Images and Videos) - Responsive scaling inside fixed 470×800 cards */
.oct-card-media {
    display: block;
    border-radius: 12px;
    object-fit: cover; /* Prevents cropping, maintains aspect ratio */
    object-position: center center; /* Center media within container */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: transparent;
}

/* Video-specific styling - Enhanced for fixed card dimensions */
video.oct-card-media {
    background: transparent;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; /* Prevents distortion */
    object-position: center center;
    display: block;
}

/* Ensure all media inside card faces scales properly in fixed 470×800 container */
.oct-card__front img,
.oct-card__front video,
.oct-card__back img,
.oct-card__back video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    object-position: center;
    border-radius: 0; /* Match card style */
}

/* Ensure card faces can properly contain and center media */
.oct-card__front,
.oct-card__back {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Motion preferences - Additional video and media handling */
@media (prefers-reduced-motion: reduce) {
    .oct-container .oct-card-media {
        animation: none !important;
        transition: opacity 0.2s ease !important;
    }
    
    /* Pause autoplay videos and show poster for reduced motion users */
    .oct-container video.oct-card-media {
        animation-play-state: paused !important;
    }
    
    .oct-container video.oct-card-media:not([controls]) {
        pointer-events: auto;
        cursor: pointer;
    }
    
    /* Show clear indication that video can be played manually */
    .oct-container video.oct-card-media::after {
        content: "▶ Tap to play video";
        position: absolute;
        bottom: 8px;
        left: 8px;
        right: 8px;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        text-align: center;
        z-index: 2;
        pointer-events: none;
    }
    
    /* Hide play indicator if video is actually playing */
    .oct-container video.oct-card-media:not([paused])::after {
        display: none;
    }
    
    /* Enhanced card states for keyboard users when motion is reduced */
    .oct-container .oct-card:focus-visible {
        background-color: rgba(212, 175, 55, 0.1) !important;
        border: 2px solid #d4af37 !important;
    }
}

/* Videos marked for reduced motion */
video.oct-reduce-motion {
    /* Additional styling for videos paused due to motion preferences */
    position: relative;
}

video.oct-reduce-motion::after {
    content: "⏸ Paused for reduced motion";
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    z-index: 1;
}

/* Enhanced video controls for accessibility */
video.oct-card-media:focus {
    outline: 3px solid #d4af37;
    outline-offset: 2px;
}


/* Print Styles */
@media print {
    .oct-card {
        break-inside: avoid;
    }
    
    .oct-deck {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .oct-button {
        display: none;
    }
    
    /* Hide videos in print */
    video.oct-card-media {
        display: none;
    }
}

/* Mystical Modal Styles */
.oct-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.oct-modal-overlay.oct-modal--visible {
    opacity: 1;
    visibility: visible;
}

.oct-modal-overlay.oct-modal--closing {
    opacity: 0;
    visibility: hidden;
}

.oct-modal-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    border-radius: 20px;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.oct-modal--visible .oct-modal-content {
    transform: scale(1) translateY(0);
}

.oct-modal-background {
    background: linear-gradient(135deg, 
        #1a0033 0%, 
        #2d1b69 20%, 
        #3b2f8a 40%, 
        #4a1c8a 60%, 
        #2d1b69 80%, 
        #1a0033 100%);
    background-size: 400% 400%;
    animation: oct-mystical-bg 8s ease-in-out infinite;
    padding: 3rem 2rem;
    position: relative;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes oct-mystical-bg {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.oct-mystical-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.oct-symbol {
    position: absolute;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.5rem;
    animation: oct-mystical-float 6s ease-in-out infinite;
}

.oct-symbol--star {
    animation-duration: 4s;
}

.oct-symbol--crescent {
    animation-duration: 7s;
    animation-delay: -2s;
}

.oct-symbol--sparkle {
    animation-duration: 5s;
    animation-delay: -1s;
}

@keyframes oct-mystical-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.7;
    }
}

.oct-modal-main {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    max-width: 500px;
    margin: 0 auto;
}

.oct-modal-header {
    margin-bottom: 2rem;
}

.oct-modal-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 300;
    margin: 0 0 1rem 0;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.oct-mystical-eye {
    display: inline-block;
    font-size: 0.8em;
    margin: 0 0.2em;
    animation: oct-eye-glow 3s ease-in-out infinite;
}

@keyframes oct-eye-glow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(173, 216, 230, 0.6));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(173, 216, 230, 0.9));
        transform: scale(1.1);
    }
}

.oct-moon-phases {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.oct-moon-phase {
    font-size: 1.2rem;
    opacity: 0.7;
    animation: oct-moon-pulse 4s ease-in-out infinite;
}

.oct-moon-phase:nth-child(1) { animation-delay: 0s; }
.oct-moon-phase:nth-child(2) { animation-delay: 0.8s; }
.oct-moon-phase:nth-child(3) { animation-delay: 1.6s; }
.oct-moon-phase:nth-child(4) { animation-delay: 2.4s; }
.oct-moon-phase:nth-child(5) { animation-delay: 3.2s; }

@keyframes oct-moon-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    20% { opacity: 1; transform: scale(1.2); }
}

.oct-modal-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 2rem 0;
    font-weight: 300;
}

.oct-question-form-modal {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.oct-input-group {
    position: relative;
}

.oct-modal-input {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 1rem;
    font-weight: 300;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.oct-modal-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.oct-modal-input:focus {
    outline: none;
    border-color: rgba(173, 216, 230, 0.8);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 20px rgba(173, 216, 230, 0.3);
    transform: scale(1.02);
}

.oct-modal-input[aria-invalid="true"] {
    border-color: rgba(255, 100, 100, 0.5);
}

.oct-modal-button {
    padding: 1rem 2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    background: linear-gradient(135deg, 
        rgba(173, 216, 230, 0.2) 0%, 
        rgba(100, 149, 237, 0.2) 100%);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.oct-modal-button:not(:disabled):hover {
    background: linear-gradient(135deg, 
        rgba(173, 216, 230, 0.4) 0%, 
        rgba(100, 149, 237, 0.4) 100%);
    border-color: rgba(173, 216, 230, 0.8);
    box-shadow: 0 0 30px rgba(173, 216, 230, 0.4);
    transform: translateY(-2px);
}

.oct-modal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.oct-modal-button:focus {
    outline: none;
    box-shadow: 0 0 30px rgba(173, 216, 230, 0.6);
}

.oct-modal-help {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-weight: 300;
    transition: color 0.3s ease;
}

/* Shake animation for mandatory modal */
.oct-modal--shake {
    animation: oct-modal-shake 0.5s ease-in-out;
}

@keyframes oct-modal-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Screen reader only class */
.oct-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;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .oct-modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .oct-modal-background {
        padding: 2rem 1.5rem;
        min-height: 400px;
    }
    
    .oct-modal-title {
        font-size: 2rem;
    }
    
    .oct-symbol {
        font-size: 1.2rem;
    }
    
    .oct-moon-phases {
        gap: 0.3rem;
    }
    
    .oct-moon-phase {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .oct-modal-background {
        padding: 1.5rem 1rem;
        min-height: 350px;
    }
    
    .oct-modal-title {
        font-size: 1.8rem;
    }
    
    .oct-modal-input {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .oct-modal-button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Enhanced reduced motion support for modal */
@media (prefers-reduced-motion: reduce) {
    /* Reduce modal animations for motion sensitivity */
    .oct-modal-overlay,
    .oct-modal-content,
    .oct-modal-input,
    .oct-modal-button {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    
    .oct-mystical-bg,
    .oct-mystical-float,
    .oct-eye-glow,
    .oct-moon-pulse {
        animation: none;
    }
    
    .oct-modal-background {
        background: #2d1b69; /* Static background */
    }
    
    .oct-symbol {
        opacity: 0.4;
        transform: none;
    }
    
    .oct-mystical-eye {
        transform: none;
        filter: none;
    }
}