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

html, body, #root {
    height: 100%;
    width: 100%;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

::-webkit-scrollbar-thumb {
    background: #6b0f1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a1a28;
}

@keyframes float-ember {
    0% { transform: translateY(100vh) translateX(0) scale(0); opacity: 0; }
    10% { opacity: 1; transform: translateY(90vh) translateX(10px) scale(1); }
    90% { opacity: 0.6; }
    100% { transform: translateY(-10vh) translateX(-20px) scale(0.3); opacity: 0; }
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 20px rgba(212, 168, 71, 0.3), 0 0 40px rgba(212, 168, 71, 0.1); }
    50% { box-shadow: 0 0 30px rgba(212, 168, 71, 0.6), 0 0 60px rgba(212, 168, 71, 0.2); }
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(212, 168, 71, 0.4); }
    50% { border-color: rgba(212, 168, 71, 1); }
}

@keyframes typewriter-cursor {
    0%, 100% { border-right-color: rgba(212, 168, 71, 1); }
    50% { border-right-color: transparent; }
}

@keyframes dice-bounce {
    0% { transform: translateY(-200px) rotate(0deg) scale(1.5); opacity: 0; }
    30% { transform: translateY(0) rotate(180deg) scale(1); opacity: 1; }
    50% { transform: translateY(-60px) rotate(270deg) scale(1.1); }
    70% { transform: translateY(0) rotate(340deg) scale(1); }
    85% { transform: translateY(-20px) rotate(350deg) scale(1.02); }
    100% { transform: translateY(0) rotate(360deg) scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes glow-text {
    0%, 100% { text-shadow: 0 0 10px rgba(212, 168, 71, 0.5); }
    50% { text-shadow: 0 0 20px rgba(212, 168, 71, 0.8), 0 0 40px rgba(212, 168, 71, 0.3); }
}

@keyframes rollInitiative {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(180deg); opacity: 1; }
    100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

.ember {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #d4a847, #6b0f1a);
    border-radius: 50%;
    animation: float-ember linear infinite;
    pointer-events: none;
}

.pulse-gold {
    animation: pulse-gold 2s ease-in-out infinite;
}

.pulse-border {
    animation: pulse-border 2s ease-in-out infinite;
}

.dice-bounce {
    animation: dice-bounce 1.2s ease-out forwards;
}

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

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

.slide-in-right {
    animation: slideInRight 0.4s ease-out forwards;
}

.glow-text {
    animation: glow-text 2s ease-in-out infinite;
}

.parchment-bg {
    background: linear-gradient(135deg, #f5e6c8 0%, #e0d0a8 50%, #f5e6c8 100%);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

.stone-bg {
    background: linear-gradient(180deg, #222240 0%, #1a1a2e 50%, #161630 100%);
}

.ornate-border {
    border: 2px solid #6b0f1a;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 0 10px rgba(107, 15, 26, 0.3);
    position: relative;
}

.ornate-border::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    border: 1px solid rgba(212, 168, 71, 0.2);
    pointer-events: none;
}

.hp-bar {
    background: linear-gradient(90deg, #8b0000, #cc0000, #8b0000);
    transition: width 0.8s ease-out;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
}

.hp-bar-bg {
    background: linear-gradient(90deg, #2a0a0a, #1a0505);
}

.chat-bubble {
    background: rgba(34, 34, 64, 0.8);
    border-left: 3px solid #6b0f1a;
}

.dm-chat-bubble {
    background: rgba(107, 15, 26, 0.2);
    border-left: 3px solid #d4a847;
}

.active-player-glow {
    box-shadow: 0 0 15px rgba(212, 168, 71, 0.6), 0 0 30px rgba(212, 168, 71, 0.3);
    border-color: #d4a847 !important;
}

.stat-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #d4a847, #b8923a);
    border-radius: 50%;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(212, 168, 71, 0.5);
}

.stat-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(90deg, #2d6a4f, #d4a847);
    border-radius: 4px;
}

.stat-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: transparent;
    outline: none;
}

.initiative-alert {
    animation: rollInitiative 0.8s ease-out;
}

@media (max-width: 768px) {
    .game-layout {
        flex-direction: column !important;
    }
    .narrative-panel {
        width: 100% !important;
        max-height: 50vh;
    }
    .sidebar-panel {
        width: 100% !important;
    }
}