/* ========================================
   CSS CUSTOM PROPERTIES - THEME VARIABLES
   ======================================== */

/* Default Theme: Autumn */
html,
:root {
    /* Background colors */
    --bg-gradient-start: #105610 !important;
    --bg-gradient-end: #a94610 !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 255, 255, 0.95) !important;
    --result-gradient-start: #e8762e !important;
    --result-gradient-end: #d96619 !important;

    /* Text colors */
    --heading-primary: #7a2a1f !important;
    --heading-secondary: #5a1010 !important;
    --heading-tertiary: #5d4e37 !important;
    --text-primary: #555 !important;
    --text-secondary: #666 !important;
    --text-light: #999 !important;
    --text-white: white !important;

    /* Accent colors */
    --accent-primary: #4a7c3c !important;
    --accent-primary-dark: #2d5016 !important;
    --accent-secondary: #5a7a47 !important;
    --accent-tertiary: #7a6952 !important;

    /* Button colors */
    --button-gradient-start: #4a7c3c !important;
    --button-gradient-end: #2d5016 !important;
    --button-shadow: rgba(74, 124, 60, 0.4) !important;

    /* Border colors */
    --border-light: #eee !important;
    --border-medium: #ddd !important;
    --border-accent: #5a7a47 !important;

    /* Background variations */
    --bg-light: #f9f9f9 !important;
    --bg-white: white !important;
    --bg-hover: #f0f5ef !important;

    /* Error colors */
    --error-bg: #ffebee !important;
    --error-border: #ef5350 !important;
    --error-text: #c62828 !important;

    /* Fate die */
    --fate-die-bg: #611 !important;

    /* Scrollbar colors */
    --scrollbar-track: #f1f1f1 !important;
    --scrollbar-thumb: #5a7a47 !important;
    --scrollbar-thumb-hover: #4a6a37 !important;

    /* Shadows */
    --shadow-primary: rgba(0, 0, 0, 0.3) !important;
    --shadow-secondary: rgba(0, 0, 0, 0.2) !important;

    /* Close button */
    --close-btn-bg: rgba(122, 42, 31, 0.1) !important;
    --close-btn-bg-hover: rgba(122, 42, 31, 0.2) !important;
    --close-btn-color: #7a2a1f !important;

    /* Link container hover gradient */
    --link-hover-gradient-start: rgba(74, 124, 60, 0.03) !important;
    --link-hover-gradient-end: rgba(45, 80, 22, 0.03) !important;

    /* History */
    --history-border-shadow: rgba(90, 122, 71, 0.15) !important;

    /* Result text shadow */
    --result-text-shadow: rgba(0, 0, 0, 0.2) !important;
}

/* Light Theme */
html.light-theme,
html.light-theme:root,
body.light-theme {
    --bg-gradient-start: #f5f5f5 !important;
    --bg-gradient-end: #e0e0e0 !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 255, 255, 0.98) !important;
    --result-gradient-start: #90CAF9 !important;
    --result-gradient-end: #64B5F6 !important;

    --heading-primary: #333 !important;
    --heading-secondary: #444 !important;
    --heading-tertiary: #555 !important;
    --text-primary: #444 !important;
    --text-secondary: #666 !important;

    --accent-primary: #2196F3 !important;
    --accent-primary-dark: #1976D2 !important;
    --accent-secondary: #1e88e5 !important;
    --accent-tertiary: #90a4ae !important;

    --button-gradient-start: #2196F3 !important;
    --button-gradient-end: #1976D2 !important;
    --button-shadow: rgba(33, 150, 243, 0.4) !important;

    --border-accent: #1e88e5 !important;

    --bg-hover: #e3f2fd !important;

    --fate-die-bg: #1976D2 !important;

    --scrollbar-thumb: #2196F3 !important;
    --scrollbar-thumb-hover: #1976D2 !important;

    --close-btn-bg: rgba(33, 33, 33, 0.08) !important;
    --close-btn-bg-hover: rgba(33, 33, 33, 0.15) !important;
    --close-btn-color: #333 !important;

    --link-hover-gradient-start: rgba(33, 150, 243, 0.03) !important;
    --link-hover-gradient-end: rgba(25, 118, 210, 0.03) !important;

    --history-border-shadow: rgba(33, 150, 243, 0.15) !important;
}

/* Dark Theme */
html.dark-theme,
html.dark-theme:root,
body.dark-theme {
    --bg-gradient-start: #1a1a1a !important;
    --bg-gradient-end: #2d2d2d !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(40, 40, 40, 0.95) !important;
    --result-gradient-start: #5D4037 !important;
    --result-gradient-end: #3E2723 !important;

    --heading-primary: #fff !important;
    --heading-secondary: #eee !important;
    --heading-tertiary: #ddd !important;
    --text-primary: #ccc !important;
    --text-secondary: #aaa !important;
    --text-light: #888 !important;

    --accent-primary: #4CAF50 !important;
    --accent-primary-dark: #388E3C !important;
    --accent-secondary: #66bb6a !important;
    --accent-tertiary: #757575 !important;

    --button-gradient-start: #4CAF50 !important;
    --button-gradient-end: #388E3C !important;
    --button-shadow: rgba(76, 175, 80, 0.4) !important;

    --border-light: #444 !important;
    --border-medium: #555 !important;
    --border-accent: #66bb6a !important;

    --bg-light: #2a2a2a !important;
    --bg-white: #333 !important;
    --bg-hover: #3a3a3a !important;

    --error-bg: #3d1f1f !important;
    --error-border: #c62828 !important;
    --error-text: #ef5350 !important;

    --fate-die-bg: #1b5e20 !important;

    --scrollbar-track: #2a2a2a !important;
    --scrollbar-thumb: #4CAF50 !important;
    --scrollbar-thumb-hover: #388E3C !important;

    --close-btn-bg: rgba(255, 255, 255, 0.1) !important;
    --close-btn-bg-hover: rgba(255, 255, 255, 0.15) !important;
    --close-btn-color: #fff !important;

    --link-hover-gradient-start: rgba(76, 175, 80, 0.05) !important;
    --link-hover-gradient-end: rgba(56, 142, 60, 0.05) !important;

    --history-border-shadow: rgba(76, 175, 80, 0.2) !important;
}

/* Winter Theme */
html.winter-theme,
html.winter-theme:root,
body.winter-theme {
    --bg-gradient-start: #e1f5fe !important;
    --bg-gradient-end: #42a5f5 !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 255, 255, 0.97) !important;
    --result-gradient-start: #00bcd4 !important;
    --result-gradient-end: #0097a7 !important;

    --heading-primary: #1a237e !important;
    --heading-secondary: #283593 !important;
    --heading-tertiary: #3949ab !important;
    --text-primary: #333 !important;
    --text-secondary: #555 !important;

    --accent-primary: #5e35b1 !important;
    --accent-primary-dark: #4527a0 !important;
    --accent-secondary: #7e57c2 !important;
    --accent-tertiary: #00d4ff !important;

    --button-gradient-start: #5e35b1 !important;
    --button-gradient-end: #4527a0 !important;
    --button-shadow: rgba(94, 53, 177, 0.4) !important;

    --border-accent: #7e57c2 !important;

    --bg-hover: #e8eaf6 !important;

    --fate-die-bg: #283593 !important;

    --scrollbar-thumb: #5e35b1 !important;
    --scrollbar-thumb-hover: #4527a0 !important;

    --close-btn-bg: rgba(26, 35, 126, 0.08) !important;
    --close-btn-bg-hover: rgba(26, 35, 126, 0.15) !important;
    --close-btn-color: #1a237e !important;

    --link-hover-gradient-start: rgba(94, 53, 177, 0.03) !important;
    --link-hover-gradient-end: rgba(69, 39, 160, 0.03) !important;

    --history-border-shadow: rgba(94, 53, 177, 0.15) !important;
}

/* Seasonal Effects Animations */

/* Winter - Snowflakes falling with rotation */
@keyframes snowfall-0 {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
    }
}

@keyframes snowfall-1 {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
    }
    50% {
        transform: translateY(50vh) translateX(calc(var(--drift) * 0.5)) rotate(calc(var(--rotation) * 0.5));
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
    }
}

@keyframes snowfall-2 {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
    }
    33% {
        transform: translateY(33vh) translateX(calc(var(--drift) * -0.3)) rotate(calc(var(--rotation) * 0.33));
    }
    66% {
        transform: translateY(66vh) translateX(calc(var(--drift) * 0.6)) rotate(calc(var(--rotation) * 0.66));
    }
    100% {
        transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
    }
}

/* Autumn - Leaves swaying back and forth */
@keyframes leaffall-0 {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
    }
    25% {
        transform: translateY(25vh) translateX(var(--sway)) rotate(calc(var(--rotation) * 0.25));
    }
    50% {
        transform: translateY(50vh) translateX(0) rotate(calc(var(--rotation) * 0.5));
    }
    75% {
        transform: translateY(75vh) translateX(calc(var(--sway) * -1)) rotate(calc(var(--rotation) * 0.75));
    }
    100% {
        transform: translateY(100vh) translateX(0) rotate(var(--rotation));
    }
}

@keyframes leaffall-1 {
    0% {
        transform: translateY(-50px) translateX(0) rotate(0deg);
    }
    20% {
        transform: translateY(20vh) translateX(calc(var(--sway) * -0.5)) rotate(calc(var(--rotation) * 0.2));
    }
    40% {
        transform: translateY(40vh) translateX(var(--sway)) rotate(calc(var(--rotation) * 0.4));
    }
    60% {
        transform: translateY(60vh) translateX(calc(var(--sway) * -0.8)) rotate(calc(var(--rotation) * 0.6));
    }
    80% {
        transform: translateY(80vh) translateX(calc(var(--sway) * 0.6)) rotate(calc(var(--rotation) * 0.8));
    }
    100% {
        transform: translateY(100vh) translateX(0) rotate(var(--rotation));
    }
}

/* Spring - Rain falling straight down */
@keyframes rainfall {
    0% {
        transform: translateY(-50px);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* Stars - Twinkling stars (opacity only) */
@keyframes startwinkle-0 {
    0%, 100% {
        opacity: var(--opacity);
    }
    50% {
        opacity: calc(var(--opacity) * 0.3);
    }
}

@keyframes startwinkle-1 {
    0%, 100% {
        opacity: var(--opacity);
    }
    30% {
        opacity: calc(var(--opacity) * 0.5);
    }
    70% {
        opacity: var(--opacity);
    }
}

@keyframes startwinkle-2 {
    0%, 100% {
        opacity: var(--opacity);
    }
    25% {
        opacity: calc(var(--opacity) * 0.2);
    }
    50% {
        opacity: calc(var(--opacity) * 0.6);
    }
    75% {
        opacity: calc(var(--opacity) * 0.4);
    }
}

.seasonal-effect {
    will-change: transform;
}

/* Spring Theme */
html.spring-theme,
html.spring-theme:root,
body.spring-theme {
    --bg-gradient-start: #e8f5e9 !important;
    --bg-gradient-end: #4caf50 !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 255, 255, 0.97) !important;
    --result-gradient-start: #ec407a !important;
    --result-gradient-end: #d81b60 !important;

    --heading-primary: #2e7d32 !important;
    --heading-secondary: #388e3c !important;
    --heading-tertiary: #43a047 !important;
    --text-primary: #424242 !important;
    --text-secondary: #616161 !important;

    --accent-primary: #66bb6a !important;
    --accent-primary-dark: #43a047 !important;
    --accent-secondary: #81c784 !important;
    --accent-tertiary: #ffd700 !important;

    --button-gradient-start: #66bb6a !important;
    --button-gradient-end: #43a047 !important;
    --button-shadow: rgba(102, 187, 106, 0.4) !important;

    --border-accent: #81c784 !important;

    --bg-hover: #f1f8e9 !important;

    --fate-die-bg: #388e3c !important;

    --scrollbar-thumb: #66bb6a !important;
    --scrollbar-thumb-hover: #43a047 !important;

    --close-btn-bg: rgba(46, 125, 50, 0.08) !important;
    --close-btn-bg-hover: rgba(46, 125, 50, 0.15) !important;
    --close-btn-color: #2e7d32 !important;

    --link-hover-gradient-start: rgba(102, 187, 106, 0.05) !important;
    --link-hover-gradient-end: rgba(67, 160, 71, 0.05) !important;

    --history-border-shadow: rgba(102, 187, 106, 0.15) !important;
}

/* Summer Theme */
html.summer-theme,
html.summer-theme:root,
body.summer-theme {
    --bg-gradient-start: #fff3e0 !important;
    --bg-gradient-end: #ff9800 !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 255, 255, 0.97) !important;
    --result-gradient-start: #42a5f5 !important;
    --result-gradient-end: #1e88e5 !important;

    --heading-primary: #e65100 !important;
    --heading-secondary: #ef6c00 !important;
    --heading-tertiary: #f57c00 !important;
    --text-primary: #424242 !important;
    --text-secondary: #616161 !important;

    --accent-primary: #ffa726 !important;
    --accent-primary-dark: #f57c00 !important;
    --accent-secondary: #ffb74d !important;
    --accent-tertiary: #ff6b6b !important;

    --button-gradient-start: #ffa726 !important;
    --button-gradient-end: #f57c00 !important;
    --button-shadow: rgba(255, 167, 38, 0.4) !important;

    --border-accent: #ffb74d !important;

    --bg-hover: #fff8e1 !important;

    --fate-die-bg: #f57c00 !important;

    --scrollbar-thumb: #ffa726 !important;
    --scrollbar-thumb-hover: #f57c00 !important;

    --close-btn-bg: rgba(230, 81, 0, 0.08) !important;
    --close-btn-bg-hover: rgba(230, 81, 0, 0.15) !important;
    --close-btn-color: #e65100 !important;

    --link-hover-gradient-start: rgba(255, 167, 38, 0.05) !important;
    --link-hover-gradient-end: rgba(245, 124, 0, 0.05) !important;

    --history-border-shadow: rgba(255, 167, 38, 0.15) !important;
}

/* Stars Theme */
html.stars-theme,
html.stars-theme:root,
body.stars-theme {
    --bg-gradient-start: #0a0e27 !important;
    --bg-gradient-end: #4a148c !important;
    --bg-gradient: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(30, 20, 50, 0.92) !important;
    --result-gradient-start: #5b21b6 !important;
    --result-gradient-end: #4c1d95 !important;

    --heading-primary: #e0e7ff !important;
    --heading-secondary: #c7d2fe !important;
    --heading-tertiary: #a5b4fc !important;
    --text-primary: #d1d5db !important;
    --text-secondary: #9ca3af !important;
    --text-light: #6b7280 !important;

    --accent-primary: #818cf8 !important;
    --accent-primary-dark: #6366f1 !important;
    --accent-secondary: #a5b4fc !important;
    --accent-tertiary: #fbbf24 !important;

    --button-gradient-start: #818cf8 !important;
    --button-gradient-end: #6366f1 !important;
    --button-shadow: rgba(129, 140, 248, 0.5) !important;

    --border-light: #4b5563 !important;
    --border-medium: #6b7280 !important;
    --border-accent: #a5b4fc !important;

    --bg-light: #1f2937 !important;
    --bg-white: #374151 !important;
    --bg-hover: #4b5563 !important;

    --error-bg: #3d1f3d !important;
    --error-border: #c62828 !important;
    --error-text: #ef5350 !important;

    --fate-die-bg: #4f46e5 !important;

    --scrollbar-track: #1f2937 !important;
    --scrollbar-thumb: #818cf8 !important;
    --scrollbar-thumb-hover: #6366f1 !important;

    --close-btn-bg: rgba(129, 140, 248, 0.1) !important;
    --close-btn-bg-hover: rgba(129, 140, 248, 0.2) !important;
    --close-btn-color: #e0e7ff !important;

    --link-hover-gradient-start: rgba(129, 140, 248, 0.05) !important;
    --link-hover-gradient-end: rgba(99, 102, 241, 0.05) !important;

    --history-border-shadow: rgba(129, 140, 248, 0.2) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.4) !important;
}

/* Stars theme: top-to-bottom gradient instead of diagonal */
html.stars-theme body {
    background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%) !important;
}

/* Gothic Theme */
html.gothic-theme,
html.gothic-theme:root,
body.gothic-theme {
    --bg-gradient-start: #1a0a1a !important;
    --bg-gradient-end: #2d1a2d !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(20, 10, 20, 0.85) !important;
    --result-gradient-start: #6a0dad !important;
    --result-gradient-end: #4a0a7a !important;

    --heading-primary: #d8b4e2 !important;
    --heading-secondary: #c299d8 !important;
    --heading-tertiary: #b088c5 !important;
    --text-primary: #d4c5d8 !important;
    --text-secondary: #b8a5bc !important;
    --text-light: #8a7a8e !important;
    --text-white: #f0e8f0 !important;

    --accent-primary: #8b4789 !important;
    --accent-primary-dark: #6a2c68 !important;
    --accent-secondary: #9d5b9b !important;
    --accent-tertiary: #7a4477 !important;

    --button-gradient-start: #8b4789 !important;
    --button-gradient-end: #6a2c68 !important;
    --button-shadow: rgba(139, 71, 137, 0.5) !important;

    --border-light: #3d2a3d !important;
    --border-medium: #4d3a4d !important;
    --border-accent: #9d5b9b !important;

    --bg-light: #2a1a2a !important;
    --bg-white: #3a2a3a !important;
    --bg-hover: #4a3a4a !important;

    --error-bg: #3d1a2a !important;
    --error-border: #a82255 !important;
    --error-text: #ef5589 !important;

    --fate-die-bg: #000000 !important;

    --scrollbar-track: #2a1a2a !important;
    --scrollbar-thumb: #8b4789 !important;
    --scrollbar-thumb-hover: #6a2c68 !important;

    --close-btn-bg: rgba(139, 71, 137, 0.15) !important;
    --close-btn-bg-hover: rgba(139, 71, 137, 0.25) !important;
    --close-btn-color: #d8b4e2 !important;

    --link-hover-gradient-start: rgba(139, 71, 137, 0.08) !important;
    --link-hover-gradient-end: rgba(106, 44, 104, 0.08) !important;

    --history-border-shadow: rgba(139, 71, 137, 0.25) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.5) !important;
}

/* Gothic theme: use background image */
html.gothic-theme body {
    background: url('backgrounds/gotham.png') center center / cover no-repeat fixed !important;
}

/* Gothic theme: dice styling with black background and yellow text */
html.gothic-theme .fate-die {
    background-color: #000000 !important;
    color: #FFD700 !important;
}

html.gothic-theme .die {
    background-color: #000000 !important;
    color: #FFD700 !important;
    border-color: #FFD700 !important;
}

/* Gothic theme: make dice highlights more distinct */
html.gothic-theme .die-highlight-high {
    border: 3px solid #00FF00 !important;
    box-shadow: 0 0 10px #00FF00, 0 2px 4px var(--shadow-primary) !important;
}

html.gothic-theme .die-highlight-low {
    border: 3px solid #FF4500 !important;
    box-shadow: 0 0 10px #FF4500, 0 2px 4px var(--shadow-primary) !important;
}

/* Cthulhu Theme */
html.cthulhu-theme,
html.cthulhu-theme:root,
body.cthulhu-theme {
    --bg-gradient-start: #0a0a0a !important;
    --bg-gradient-end: #1a1a2e !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(15, 15, 20, 0.88) !important;
    --result-gradient-start: #4a0e4e !important;
    --result-gradient-end: #2a0a3a !important;

    --heading-primary: #7fb069 !important;
    --heading-secondary: #6a9b5e !important;
    --heading-tertiary: #b388eb !important;
    --text-primary: #c4d8c4 !important;
    --text-secondary: #a0b8a0 !important;
    --text-light: #788878 !important;
    --text-white: #e8f5e8 !important;

    --accent-primary: #3fb57a !important;
    --accent-primary-dark: #2e7d52 !important;
    --accent-secondary: #4fc98a !important;
    --accent-tertiary: #8e4ec6 !important;

    --button-gradient-start: #3fb57a !important;
    --button-gradient-end: #2e7d52 !important;
    --button-shadow: rgba(63, 181, 122, 0.5) !important;

    --border-light: #2a2a3a !important;
    --border-medium: #3a3a4a !important;
    --border-accent: #4fc98a !important;

    --bg-light: #1a1a2a !important;
    --bg-white: #252535 !important;
    --bg-hover: #353545 !important;

    --error-bg: #2a1a1f !important;
    --error-border: #c62852 !important;
    --error-text: #ef5577 !important;

    --fate-die-bg: #1a4d2e !important;

    --scrollbar-track: #1a1a2a !important;
    --scrollbar-thumb: #3fb57a !important;
    --scrollbar-thumb-hover: #2e7d52 !important;

    --close-btn-bg: rgba(63, 181, 122, 0.15) !important;
    --close-btn-bg-hover: rgba(63, 181, 122, 0.25) !important;
    --close-btn-color: #7fb069 !important;

    --link-hover-gradient-start: rgba(63, 181, 122, 0.08) !important;
    --link-hover-gradient-end: rgba(46, 125, 82, 0.08) !important;

    --history-border-shadow: rgba(63, 181, 122, 0.25) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.6) !important;
}

/* Cthulhu theme: use background image */
html.cthulhu-theme body {
    background: url('backgrounds/cthulhu.png') center center / cover no-repeat fixed !important;
}

/* Cthulhu theme: dice styling with dark background and eldritch green text */
html.cthulhu-theme .fate-die {
    background-color: #0a0a0a !important;
    color: #7fb069 !important;
    border: 2px solid #3fb57a !important;
    box-shadow: 0 0 8px rgba(63, 181, 122, 0.3) !important;
}

html.cthulhu-theme .die {
    background-color: #0a0a0a !important;
    color: #7fb069 !important;
    border: 2px solid #3fb57a !important;
    box-shadow: 0 0 8px rgba(63, 181, 122, 0.3) !important;
}

/* Cthulhu theme: make dice highlights more distinct with purple and green */
html.cthulhu-theme .die-highlight-high {
    border: 3px solid #7fb069 !important;
    box-shadow: 0 0 12px #7fb069, 0 2px 4px var(--shadow-primary) !important;
}

html.cthulhu-theme .die-highlight-low {
    border: 3px solid #b388eb !important;
    box-shadow: 0 0 12px #b388eb, 0 2px 4px var(--shadow-primary) !important;
}

/* Beach Theme */
html.beach-theme,
html.beach-theme:root,
body.beach-theme {
    --bg-gradient-start: #87CEEB !important;
    --bg-gradient-end: #f0e68c !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(255, 248, 240, 0.88) !important;
    --result-gradient-start: #ff7f50 !important;
    --result-gradient-end: #ff6347 !important;

    --heading-primary: #1e90ff !important;
    --heading-secondary: #4682b4 !important;
    --heading-tertiary: #cd853f !important;
    --text-primary: #4a4a4a !important;
    --text-secondary: #5a5a5a !important;
    --text-light: #7a7a7a !important;
    --text-white: #fffaf0 !important;

    --accent-primary: #20b2aa !important;
    --accent-primary-dark: #008b8b !important;
    --accent-secondary: #48d1cc !important;
    --accent-tertiary: #deb887 !important;

    --button-gradient-start: #20b2aa !important;
    --button-gradient-end: #008b8b !important;
    --button-shadow: rgba(32, 178, 170, 0.5) !important;

    --border-light: #e8dcc8 !important;
    --border-medium: #d4c4a8 !important;
    --border-accent: #48d1cc !important;

    --bg-light: #fff8f0 !important;
    --bg-white: #fffaf5 !important;
    --bg-hover: #fff0e0 !important;

    --error-bg: #ffe4e1 !important;
    --error-border: #ff6b6b !important;
    --error-text: #dc143c !important;

    --fate-die-bg: #1e90ff !important;

    --scrollbar-track: #f5deb3 !important;
    --scrollbar-thumb: #20b2aa !important;
    --scrollbar-thumb-hover: #008b8b !important;

    --close-btn-bg: rgba(30, 144, 255, 0.12) !important;
    --close-btn-bg-hover: rgba(30, 144, 255, 0.22) !important;
    --close-btn-color: #1e90ff !important;

    --link-hover-gradient-start: rgba(32, 178, 170, 0.06) !important;
    --link-hover-gradient-end: rgba(0, 139, 139, 0.06) !important;

    --history-border-shadow: rgba(32, 178, 170, 0.2) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.3) !important;
}

/* Beach theme: use background image */
html.beach-theme body {
    background: url('backgrounds/beach.png') center center / cover no-repeat fixed !important;
}

/* Beach theme: dice styling with ocean blue and sandy accents */
html.beach-theme .fate-die {
    background-color: #1e90ff !important;
    color: #fffaf0 !important;
    border: 2px solid #20b2aa !important;
    box-shadow: 0 0 8px rgba(32, 178, 170, 0.4) !important;
}

html.beach-theme .die {
    background-color: #1e90ff !important;
    color: #fffaf0 !important;
    border: 2px solid #20b2aa !important;
    box-shadow: 0 0 8px rgba(32, 178, 170, 0.4) !important;
}

/* Beach theme: dice highlights with coral and teal */
html.beach-theme .die-highlight-high {
    border: 3px solid #20b2aa !important;
    box-shadow: 0 0 12px #20b2aa, 0 2px 4px var(--shadow-primary) !important;
}

html.beach-theme .die-highlight-low {
    border: 3px solid #ff7f50 !important;
    box-shadow: 0 0 12px #ff7f50, 0 2px 4px var(--shadow-primary) !important;
}

/* Cyberpunk Theme */
html.cyberpunk-theme,
html.cyberpunk-theme:root,
body.cyberpunk-theme {
    --bg-gradient-start: #0a0a0f !important;
    --bg-gradient-end: #1a0a2e !important;
    --bg-gradient: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(10, 10, 20, 0.92) !important;
    --result-gradient-start: #00b4d8 !important;
    --result-gradient-end: #0077b6 !important;

    --heading-primary: #00ffff !important;
    --heading-secondary: #ff00ff !important;
    --heading-tertiary: #ec4899 !important;
    --text-primary: #e0e0ff !important;
    --text-secondary: #b0b0d0 !important;
    --text-light: #8080a0 !important;
    --text-white: #ffffff !important;

    --accent-primary: #00ffff !important;
    --accent-primary-dark: #00cccc !important;
    --accent-secondary: #ff00ff !important;
    --accent-tertiary: #ec4899 !important;

    --button-gradient-start: #8b5cf6 !important;
    --button-gradient-end: #6d28d9 !important;
    --button-shadow: rgba(139, 92, 246, 0.6) !important;

    --border-light: #2a2a4a !important;
    --border-medium: #3a3a5a !important;
    --border-accent: #ff00ff !important;

    --bg-light: #0f0f1a !important;
    --bg-white: #1a1a2e !important;
    --bg-hover: #2a2a4a !important;

    --error-bg: #2a0a1a !important;
    --error-border: #ff0066 !important;
    --error-text: #ff4488 !important;

    --fate-die-bg: #1a0a2e !important;

    --scrollbar-track: #0f0f1a !important;
    --scrollbar-thumb: #8b5cf6 !important;
    --scrollbar-thumb-hover: #6d28d9 !important;

    --close-btn-bg: rgba(0, 255, 255, 0.1) !important;
    --close-btn-bg-hover: rgba(0, 255, 255, 0.2) !important;
    --close-btn-color: #00ffff !important;

    --link-hover-gradient-start: rgba(139, 92, 246, 0.08) !important;
    --link-hover-gradient-end: rgba(109, 40, 217, 0.08) !important;

    --history-border-shadow: rgba(255, 0, 255, 0.25) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.5) !important;
}

/* Cyberpunk theme: use background image */
html.cyberpunk-theme body {
    background: url('backgrounds/cyberpunk.png') center center / cover no-repeat fixed !important;
}

/* Cyberpunk theme: dice styling with neon glow */
html.cyberpunk-theme .fate-die {
    background-color: #0a0a0f !important;
    color: #00ffff !important;
    border: 2px solid #ff00ff !important;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.3) !important;
}

html.cyberpunk-theme .die {
    background-color: #0a0a0f !important;
    color: #00ffff !important;
    border: 2px solid #ff00ff !important;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.3) !important;
}

/* Cyberpunk theme: dice highlights with cyan and pink neon */
html.cyberpunk-theme .die-highlight-high {
    border: 3px solid #00ffff !important;
    box-shadow: 0 0 15px #00ffff, 0 0 30px rgba(0, 255, 255, 0.5), 0 2px 4px var(--shadow-primary) !important;
}

html.cyberpunk-theme .die-highlight-low {
    border: 3px solid #ec4899 !important;
    box-shadow: 0 0 15px #ec4899, 0 0 30px rgba(236, 72, 153, 0.5), 0 2px 4px var(--shadow-primary) !important;
}

/* Cyberpunk theme: neon glow on buttons */
html.cyberpunk-theme .roll-button {
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5), 0 0 30px rgba(139, 92, 246, 0.3) !important;
}

html.cyberpunk-theme .roll-button:hover {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.7), 0 0 40px rgba(139, 92, 246, 0.5), 0 5px 15px var(--button-shadow) !important;
}

/* Cyberpunk theme: neon glow on result display */
html.cyberpunk-theme .result-display {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4), 0 0 40px rgba(255, 0, 255, 0.2) !important;
}

/* Cyberpunk theme: container glow */
html.cyberpunk-theme .container {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.2), 0 0 60px rgba(0, 255, 255, 0.1) !important;
}

/* Halloween Theme - Red dominant with orange/yellow accents */
html.halloween-theme,
html.halloween-theme:root,
body.halloween-theme {
    --bg-gradient-start: #050303 !important;
    --bg-gradient-end: #0d0605 !important;
    --bg-gradient: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    --container-bg: rgba(12, 6, 6, 0.96) !important;
    --result-gradient-start: #b45309 !important;
    --result-gradient-end: #78350f !important;

    /* Red primary, orange secondary, yellow tertiary for variety */
    --heading-primary: #f87171 !important;
    --heading-secondary: #fb923c !important;
    --heading-tertiary: #fbbf24 !important;
    --text-primary: #d4c4b8 !important;
    --text-secondary: #a89888 !important;
    --text-light: #5c524a !important;
    --text-white: #fff5f5 !important;

    /* Red primary with orange accents */
    --accent-primary: #dc2626 !important;
    --accent-primary-dark: #991b1b !important;
    --accent-secondary: #f97316 !important;
    --accent-tertiary: #fbbf24 !important;

    /* Intense red button/header gradient */
    --button-gradient-start: #dc2626 !important;
    --button-gradient-end: #5c0a0a !important;
    --button-shadow: rgba(220, 38, 38, 0.6) !important;

    /* Warm border tones - reds with hint of brown */
    --border-light: #261816 !important;
    --border-medium: #3a2220 !important;
    --border-accent: #f97316 !important;

    /* Background variations with subtle warmth */
    --bg-light: #0c0706 !important;
    --bg-white: #180e0c !important;
    --bg-hover: #241614 !important;

    --error-bg: #2d0a0a !important;
    --error-border: #f87171 !important;
    --error-text: #fecaca !important;

    --fate-die-bg: #3d0a0a !important;

    --scrollbar-track: #0c0706 !important;
    --scrollbar-thumb: #991b1b !important;
    --scrollbar-thumb-hover: #b91c1c !important;

    /* Close button with yellow/gold accent for contrast */
    --close-btn-bg: rgba(251, 191, 36, 0.12) !important;
    --close-btn-bg-hover: rgba(251, 191, 36, 0.25) !important;
    --close-btn-color: #fbbf24 !important;

    --link-hover-gradient-start: rgba(220, 38, 38, 0.1) !important;
    --link-hover-gradient-end: rgba(249, 115, 22, 0.1) !important;

    --history-border-shadow: rgba(249, 115, 22, 0.3) !important;

    --result-text-shadow: rgba(0, 0, 0, 0.8) !important;
}

/* Halloween theme: ultra-dark background */
html.halloween-theme body {
    background: linear-gradient(180deg, #050303 0%, #0d0605 100%) !important;
}

/* Halloween theme: dice with red base and orange glow */
html.halloween-theme .fate-die {
    background-color: #0a0505 !important;
    color: #ff2d2d !important;
    border: 2px solid #991b1b !important;
    box-shadow: 0 0 12px rgba(185, 28, 28, 0.5), 0 0 20px rgba(180, 83, 9, 0.3) !important;
}

html.halloween-theme .die {
    background-color: #0a0505 !important;
    color: #ff2d2d !important;
    border: 2px solid #991b1b !important;
    box-shadow: 0 0 12px rgba(185, 28, 28, 0.5), 0 0 20px rgba(180, 83, 9, 0.3) !important;
}

/* Halloween theme: dice highlights - orange for high, deep red for low */
html.halloween-theme .die-highlight-high {
    border: 3px solid #fb923c !important;
    box-shadow: 0 0 16px #fb923c, 0 2px 4px var(--shadow-primary) !important;
}

html.halloween-theme .die-highlight-low {
    border: 3px solid #7f1d1d !important;
    box-shadow: 0 0 16px #991b1b, 0 2px 4px var(--shadow-primary) !important;
}

/* Halloween theme: red button with orange glow on hover */
html.halloween-theme .roll-button {
    box-shadow: 0 0 20px rgba(185, 28, 28, 0.5), 0 0 40px rgba(127, 29, 29, 0.4) !important;
}

html.halloween-theme .roll-button:hover {
    box-shadow: 0 0 25px rgba(185, 28, 28, 0.6), 0 0 50px rgba(249, 115, 22, 0.4), 0 5px 15px var(--button-shadow) !important;
}

/* Halloween theme: result display with orange glow */
html.halloween-theme .result-display {
    box-shadow: 0 0 30px rgba(180, 83, 9, 0.5), 0 0 60px rgba(120, 53, 15, 0.4) !important;
}

/* Halloween theme: container with yellow ambient glow */
html.halloween-theme .container {
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.25), 0 25px 70px rgba(0, 0, 0, 0.8) !important;
}

/* Halloween theme: Statistics label in bright red */
html.halloween-theme .stats-toggle {
    color: #ff2d2d !important;
}

/* Halloween theme: Back button in orange */
html.halloween-theme .nav-button {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

html.halloween-theme .nav-button:hover {
    background: linear-gradient(135deg, #c2410c 0%, #a3520d 100%) !important;
    border-color: rgba(251, 191, 36, 0.5) !important;
}

/* ========================================
   SHARED BASE STYLES
   These provide consistent styling across all pages
   ======================================== */

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    min-height: 100vh;
    padding: 20px;
}

/* Container - stays above seasonal effects */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--container-bg, white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Container width utilities */
.container-tight { max-width: 600px; }
.container-wide { max-width: 1200px; }

/* Header */
.header {
    background: linear-gradient(135deg, var(--button-gradient-start, #667eea) 0%, var(--button-gradient-end, #764ba2) 100%);
    color: var(--text-white, white);
    padding: 20px 30px;
}

.header h1 {
    color: var(--text-white, white);
}

/* Content Area */
.content {
    padding: 30px;
    color: var(--text-primary, #333);
}

/* Footer */
.footer {
    padding: 20px 30px;
    background: var(--bg-light, #f8f9fa);
    border-top: 1px solid var(--border-light, #e0e0e0);
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 0.9em;
}

.footer p {
    margin-bottom: 10px;
}

.footer a {
    color: var(--accent-primary, #667eea);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.oddturnip-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 8px 15px;
    background: var(--bg-white, white);
    border: 2px solid var(--border-medium, #e0e0e0);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary, #333);
    font-weight: 600;
    transition: all 0.3s ease;
}

.oddturnip-link:hover {
    border-color: var(--accent-primary, #667eea);
    transform: translateY(-2px);
    text-decoration: none;
}

.oddturnip-link img {
    height: 24px;
    width: auto;
}

/* Link containers for index pages */
.link-container {
    display: block;
    border: 3px solid var(--accent-tertiary, #7a6952);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    background: var(--bg-white, white);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.link-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px var(--shadow-primary, rgba(0, 0, 0, 0.3));
    border-color: var(--accent-primary, #667eea);
    background: linear-gradient(135deg, var(--link-hover-gradient-start, rgba(102, 126, 234, 0.03)) 0%, var(--link-hover-gradient-end, rgba(118, 75, 162, 0.03)) 100%);
}

.link-container h2 {
    color: var(--accent-primary, #667eea);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.link-container:hover h2 {
    color: var(--accent-primary-dark, #5a6fd6);
}

.link-container p {
    color: var(--text-secondary, #666);
    margin-top: 10px;
    line-height: 1.6;
}

/* Section styling */
.section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-light, #eee);
}

.section h2 {
    color: var(--heading-tertiary, #555);
    margin-bottom: 15px;
}

.section p {
    color: var(--text-secondary, #666);
    line-height: 1.8;
    margin-bottom: 10px;
}

.section ul {
    list-style: disc;
    padding-left: 20px;
    margin: 10px 0;
}

.section li {
    color: var(--text-secondary, #666);
    line-height: 1.8;
    margin-bottom: 8px;
}

/* ========================================
   THEME SELECTOR STYLES
   ======================================== */

.theme-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-selector-wrapper label {
    font-size: 0.9em;
    white-space: nowrap;
}

/* Ensure labels in header have proper contrast */
.header label,
.header .theme-selector-wrapper label {
    color: var(--text-white, white);
}

/* Style checkbox in header for visibility */
.header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary, #667eea);
    cursor: pointer;
}

.theme-selector {
    padding: 8px 10px;
    font-size: 0.9em;
    border: 2px solid var(--border-medium);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.theme-selector:hover {
    border-color: var(--accent-secondary);
}

.theme-selector:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

/* ========================================
   THREE-COLUMN HEADER LAYOUT
   [Navigation] | [Title] | [Theme Selector]
   ======================================== */

.header-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

/* Left column: Navigation */
.header-nav {
    justify-self: start;
}

/* Center column: Title */
.header-title {
    text-align: center;
}

.header-title h1 {
    font-size: 1.8em;
    margin: 0;
    color: var(--text-white, white);
}

.header-title p {
    font-size: 0.95em;
    opacity: 0.9;
    margin-top: 5px;
    color: var(--text-white, white);
}

/* Right column: Theme selector */
.header-theme {
    justify-self: end;
}

/* Navigation button */
.nav-button {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white, white);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive: stack on small screens */
@media (max-width: 768px) {
    .header-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .header-nav,
    .header-theme {
        justify-self: center;
    }

    .header-title h1 {
        font-size: 1.5em;
    }
}

/* ========================================
   SHARED FORM CONTROLS
   Controls, buttons, and inputs used across pages
   ======================================== */

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    align-items: stretch;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group-inline {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}

.radio-label input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1em;
    white-space: nowrap;
}

select, input[type="text"] {
    padding: 12px;
    font-size: 1em;
    border: 2px solid var(--border-medium);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

select:hover, input[type="text"]:hover {
    border-color: var(--accent-secondary);
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

input[type="text"] {
    cursor: text;
    min-width: 120px;
}

.roll-button {
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--text-white);
    background: linear-gradient(135deg, var(--button-gradient-start) 0%, var(--button-gradient-end) 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.3s ease;
}

.roll-button:hover {
    box-shadow: 0 5px 15px var(--button-shadow);
}

.roll-button:active {
    transform: scale(0.98);
}

.error-message {
    background: var(--error-bg);
    border: 2px solid var(--error-border);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 20px;
    color: var(--error-text);
    font-weight: 500;
}

/* ========================================
   HISTORY SECTION
   Shared history display styles
   ======================================== */

.history-section {
    border-top: 2px solid var(--border-light);
    padding-top: 20px;
}

.roll-history {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 10px;
}

.history-entry {
    padding: 10px 15px;
    background: var(--bg-white);
    border-left: 4px solid var(--border-accent);
    margin-bottom: 10px;
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.95em;
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-entry:hover {
    background: var(--bg-hover);
    border: 2px solid var(--border-accent);
    border-left: 4px solid var(--border-accent);
    box-shadow: 0 2px 8px var(--history-border-shadow);
}

.history-entry:last-child {
    margin-bottom: 0;
}

.history-hand {
    padding: 15px;
    background: var(--bg-white);
    border-left: 4px solid var(--border-accent);
    margin-bottom: 15px;
    border-radius: 5px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-hand:hover {
    background: var(--bg-hover);
    border: 2px solid var(--border-accent);
    border-left: 4px solid var(--border-accent);
    box-shadow: 0 2px 8px var(--history-border-shadow);
}

.history-hand-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1em;
}

.history-hand ul {
    list-style-position: inside;
    color: var(--text-secondary);
    font-size: 0.95em;
    padding-left: 10px;
}

.history-hand li {
    margin: 5px 0;
}

/* Scrollbar styling */
.roll-history::-webkit-scrollbar {
    width: 8px;
}

.roll-history::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 10px;
}

.roll-history::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

.roll-history::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ========================================
   MODAL STYLES
   Shared modal/popup styles
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s ease;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    background: none;
    padding: 5px 10px;
    line-height: 1;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--accent-primary);
    transform: scale(1.2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   CARD DISPLAY STYLES
   Shared card display for Tarot and similar
   ======================================== */

.cards-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.card-position {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.card-label {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--heading-secondary);
    margin-bottom: 10px;
}

.card-display {
    background: transparent;
    border: none;
    padding: 20px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1em;
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-image {
    max-width: 150px;
    max-height: 250px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.card-image.reversed {
    transform: rotate(180deg);
}

.card-name {
    font-size: 0.95em;
    color: var(--text-primary);
    font-weight: 600;
}

.card-display:hover .card-image {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.card-display:hover .card-image.reversed {
    transform: rotate(180deg) scale(1.05);
}

/* Modal card styles */
.modal-card-image {
    max-width: 250px;
    max-height: 400px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin: 0 auto 20px;
    display: block;
}

.modal-card-image.reversed {
    transform: rotate(180deg);
}

.modal-card-name {
    color: var(--text-primary);
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 15px;
    padding-right: 40px;
}

.modal-card-orientation {
    color: var(--accent-primary);
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 15px;
}

.modal-card-meaning {
    color: var(--text-secondary);
    font-size: 1.1em;
    line-height: 1.8;
}

/* ========================================
   RESPONSIVE SHARED STYLES
   ======================================== */

@media (max-width: 768px) {
    .controls {
        padding: 15px;
    }

    .control-group-inline {
        flex-direction: column;
        gap: 10px;
    }

    .roll-button {
        width: 100%;
        padding: 14px 20px;
    }

    .cards-container {
        flex-direction: column;
    }

    .card-position {
        min-width: 100%;
    }

    .card-image {
        max-width: 120px;
        max-height: 200px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .modal-card-image {
        max-width: 180px;
        max-height: 300px;
    }

    .modal-card-name {
        font-size: 1.4em;
    }

    .modal-card-meaning {
        font-size: 1em;
    }
}
