/* ========================================
   骰魂 Dice Soul - Main Styles
   ======================================== */

/* ---------- CSS Variables ---------- */
:root {
    /* Colors - Dark Fantasy Theme */
    --color-bg-dark: #0a0a0f;
    --color-bg-medium: #12121a;
    --color-bg-light: #1a1a25;
    --color-surface: #222233;
    --color-surface-hover: #2a2a3f;

    --color-primary: #8b5cf6;
    --color-primary-glow: rgba(139, 92, 246, 0.4);
    --color-secondary: #06b6d4;
    --color-accent: #f59e0b;

    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.4);
    --color-success: #22c55e;
    --color-heal: #4ade80;
    --color-shield: #60a5fa;

    --color-text: #f1f5f9;
    --color-text-dim: #94a3b8;
    --color-text-muted: #64748b;

    /* Dice Class Colors */
    --dice-steel: #6b7280;
    --dice-blood: #dc2626;
    --dice-jade: #fef3c7;
    --dice-mage: #7c3aed;

    /* Typography */
    --font-main: 'Noto Sans TC', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--color-primary-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg-dark);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 背景層次效果 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        /* 神秘符文圖案 */
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5 L35 25 L55 30 L35 35 L30 55 L25 35 L5 30 L25 25 Z' fill='none' stroke='rgba(139,92,246,0.08)' stroke-width='1'/%3E%3C/svg%3E"),
        /* 漸層光暈 */
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(239, 68, 68, 0.05) 0%, transparent 50%);
    background-size: 60px 60px, 100% 100%, 100% 100%, 100% 100%;
    pointer-events: none;
    z-index: -2;
}

/* 動態光點效果 */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(2px 2px at 40% 70%, rgba(6, 182, 212, 0.3), transparent),
        radial-gradient(2px 2px at 60% 20%, rgba(245, 158, 11, 0.3), transparent),
        radial-gradient(2px 2px at 80% 60%, rgba(139, 92, 246, 0.3), transparent),
        radial-gradient(3px 3px at 10% 80%, rgba(239, 68, 68, 0.2), transparent),
        radial-gradient(2px 2px at 90% 40%, rgba(6, 182, 212, 0.4), transparent);
    background-size: 200% 200%;
    animation: floatingParticles 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes floatingParticles {
    0%, 100% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 100% 50%;
    }
    50% {
        background-position: 50% 100%;
    }
    75% {
        background-position: 0% 50%;
    }
}

/* ---------- Game Container ---------- */
#game-container {
    max-width: 1200px;
    height: 100vh;
    margin: 0 auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    position: relative;
    overflow: hidden;
}

/* ---------- Header ---------- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
}

.game-title {
    font-size: var(--font-size-xl);
    font-weight: 900;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--color-primary-glow);
}

.round-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
}

.round-label {
    color: var(--color-text-dim);
    font-size: var(--font-size-sm);
}

.round-number {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-accent);
}

/* ---------- Section Titles ---------- */
.section-title {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-sm);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: var(--font-main);
    font-size: var(--font-size-lg);
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: var(--font-size-xl);
}

.btn-roll {
    background: linear-gradient(135deg, var(--color-primary), #6d28d9);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px var(--color-primary-glow);
}

.btn-roll:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--color-primary-glow);
}

.btn-roll:active:not(:disabled) {
    transform: translateY(0);
}

.btn-confirm {
    background: linear-gradient(135deg, var(--color-success), #16a34a);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-confirm:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(34, 197, 94, 0.4);
}

.btn-restart {
    background: linear-gradient(135deg, var(--color-secondary), #0891b2);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-restart:hover {
    transform: translateY(-2px);
}

/* ---------- Overlay ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.overlay-content {
    background: var(--color-surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    text-align: center;
    max-width: 400px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.overlay-content h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-md);
}

.overlay-content p {
    color: var(--color-text-dim);
    margin-bottom: var(--space-xl);
}

/* ---------- Utility Classes ---------- */
.text-danger {
    color: var(--color-danger);
}

.text-success {
    color: var(--color-success);
}

.text-heal {
    color: var(--color-heal);
}

.text-shield {
    color: var(--color-shield);
}

.text-muted {
    color: var(--color-text-muted);
}

/* ---------- Animations ---------- */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

@keyframes float {

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

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

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-shake {
    animation: shake 0.5s;
}

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