/* Prevent text selection when holding mouse button */
body, .game-container, .advanced-inventory-container, .inventory-header, .inventory-grid, .equipment-section, .equipment-grid, .item-detail-modal, .modal-content, .modal-header {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
/* === Custom Scrollbar Styles (Global) === */
* {
  scrollbar-width: thin;
  scrollbar-color: #4a4a6a #23233a;
}

*::-webkit-scrollbar {
  width: 10px;
  background: #23233a;
}
*::-webkit-scrollbar-track {
  background: #23233a;
  border-radius: 6px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4a4a6a 60%, #6a8dff 100%);
  border-radius: 6px;
  border: 2px solid #23233a;
  min-height: 40px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #6a8dff 60%, #8a8ac2 100%);
}

/* === Custom Checkbox Styles (Global) === */
input[type="checkbox"] {
-webkit-appearance: none;
appearance: none;
  appearance: none;
  width: 1.2em;
  height: 1.2em;
  border: 2px solid #4a4a6a;
  border-radius: 0.25em;
  background: #23233a;
  transition: box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 0 0 1px #23233a;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}
input[type="checkbox"]:checked {
  border-color: #6a8dff;
  background: linear-gradient(135deg, #23233a 60%, #6a8dff 100%);
}
input[type="checkbox"]:focus {
  outline: 2px solid #8a8ac2;
  outline-offset: 1px;
}
input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 0.32em;
  top: 0.08em;
  width: 0.35em;
  height: 0.7em;
  border: solid #8a8ac2;
  border-width: 0 0.18em 0.18em 0;
  transform: rotate(45deg);
}
/* Edoria: The Triune Convergence - Main Stylesheet */

body {
    font-family: "Faculty Glyphic", sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
}

.font-cinzel {
    font-family: 'Cinzel', serif;
}

.faculty-glyphic-regular {
    font-family: "Faculty Glyphic", sans-serif;
    font-weight: 400;
    font-style: normal;
}

.game-container {
    max-width: 100%;
    margin: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: url('https://www.transparenttextures.com/patterns/dark-matter.png');
}

/* Header Styles */
.header {
    background: rgba(23, 23, 39, 0.8);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #4a4a6a;
}

/* Moon Styles */
.moon {
    transition: all 0.3s ease;
    box-shadow: 0 0 15px 0px rgba(255, 255, 255, 0.2);
}

.moon-edyria { 
    background-color: #6a8dff; 
    box-shadow: 0 0 15px 3px #6a8dff; 
}

.moon-kapra { 
    background-color: #ff6a6a; 
    box-shadow: 0 0 15px 3px #ff6a6a; 
}

.moon-enia {
    background-color: #fffb8a;
    box-shadow: 0 0 15px 3px #fffb8a;
}

.full-moon {
    box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.8);
}

/* Text Styles */
.story-text {
    line-height: 1.8;
    font-size: 1.2rem;
}

/* Button Styles */
.choice-button, .action-button {
    background-color: #2e2e4d;
    border: 1px solid #4a4a6a;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    cursor: pointer;
}

.choice-button:hover, .action-button:hover {
    background-color: #4a4a6a;
    border-color: #8a8ac2;
}

.start-button {
    background: linear-gradient(45deg, #8a8ac2, #6a8dff);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.start-button:hover {
    transform: scale(1.05);
}

/* UI Panel Styles */
.ui-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(8px);
    z-index: 50;
    padding: 1.5rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-direction: column;
    align-items: center;
}

.ui-panel.open {
    display: flex;
    opacity: 1;
}

/* Close panel button positioning */
.close-panel-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 60;
}

/* Inventory and Crafting specific styles */
#inventory-panel, #crafting-panel {
    max-width: none;
    width: 100%;
    padding: 1rem;
}

#inventory-content, #crafting-content {
    max-width: 1400px;
    margin: 0 auto;
    max-height: 50%;
}

/* Drag and drop styles */
.inventory-slot, .equipped-item {
    transition: all 0.2s ease;
    position: relative;
    min-height: 60px;
}

.inventory-slot:hover, .equipped-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.inventory-slot.drag-over {
    border-color: #60a5fa !important;
    background-color: rgba(96, 165, 250, 0.2);
    transform: scale(1.05);
}

.empty-slot {
    opacity: 0.6;
}

.empty-slot:hover {
    opacity: 0.8;
}

.occupied {
    opacity: 1;
}

/* Rarity-based styling */
.border-gray-400 { border-color: #9ca3af; }
.border-green-400 { border-color: #4ade80; }
.border-blue-400 { border-color: #60a5fa; }
.border-purple-400 { border-color: #c084fc; }
.border-yellow-400 { border-color: #facc15; }

.shadow-gray-400 { box-shadow: 0 0 10px rgba(156, 163, 175, 0.3); }
.shadow-green-400 { box-shadow: 0 0 10px rgba(74, 222, 128, 0.3); }
.shadow-blue-400 { box-shadow: 0 0 10px rgba(96, 165, 250, 0.3); }
.shadow-purple-400 { box-shadow: 0 0 10px rgba(192, 132, 252, 0.3); }
.shadow-yellow-400 { box-shadow: 0 0 10px rgba(250, 204, 21, 0.3); }

/* Context menu styling */
.menu-item {
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.menu-separator {
    margin: 2px 0;
}

/* Equipment grid responsive */
.equipment-grid {
    max-width: 500px;
    margin: 0 auto;
}

/* Character Equipment Layout Styles */
.character-equipment-layout {
    max-width: 400px;
    margin: 0 auto;
}

.character-equipment-layout .slot-content {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.character-equipment-layout .slot-content i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.character-equipment-layout .equipment-slot {
    position: relative;
}

/* Advanced Inventory Container - ensure flex layout */
.advanced-inventory-container {
    max-height: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
}

/* Resizable Inventory Layout */
.resizable-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 0;
    min-height: 500px;
    width: 100%;
    align-items: stretch;
    flex: 1;
}

/* Super specific selector to override any Tailwind classes */
.advanced-inventory-container .inventory-main.resizable-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important;
    align-items: stretch !important;
    width: 100% !important;
    min-height: 500px !important;
}

.resizable-panel {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
    height: 100%;
}

.resize-separator {
    width: 4px;
    background: rgba(74, 85, 104, 0.4);
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
    touch-action: none; /* Prevent scrolling on touch */
    min-height: 100%;
    flex-shrink: 0;
    margin: 0 2px;
    border-radius: 2px;
    opacity: 0.7;
}

.resize-separator:hover {
    background: rgba(106, 141, 255, 0.7);
    width: 5px;
    opacity: 1;
    box-shadow: 0 0 8px rgba(106, 141, 255, 0.3);
    transform: scaleY(1.02);
}

.resize-separator:active {
    background: rgba(255, 107, 107, 0.8);
    width: 6px;
    opacity: 1;
    box-shadow: 0 0 12px rgba(255, 107, 107, 0.4);
    transform: scaleY(1.05);
}

/* Equipment Dropdown Styles */
.equipment-dropdown {
    position: fixed;
    background: linear-gradient(135deg, 
        rgba(30, 41, 59, 0.98) 0%, 
        rgba(15, 23, 42, 0.98) 100%);
    border: 2px solid rgba(100, 116, 139, 0.4);
    border-radius: 12px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(148, 163, 184, 0.1) inset;
    backdrop-filter: blur(16px);
    min-width: 280px;
    max-width: 320px;
    max-height: 400px;
    overflow: hidden;
    z-index: 1000;
    animation: dropdownFadeIn 0.2s ease-out;
}

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

.equipment-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, 
        rgba(100, 116, 139, 0.1) 0%, 
        rgba(148, 163, 184, 0.05) 100%);
    border-bottom: 1px solid rgba(100, 116, 139, 0.2);
}

.equipment-dropdown-header .slot-name {
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.equipment-dropdown-header .close-dropdown {
    background: none;
    border: none;
    color: rgba(148, 163, 184, 0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-dropdown-header .close-dropdown:hover {
    background: rgba(239, 68, 68, 0.1);
    color: rgba(248, 113, 113, 0.9);
}

.equipment-dropdown-content {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 0;
}

.equipment-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.equipment-option:hover {
    background: linear-gradient(90deg, 
        rgba(59, 130, 246, 0.08) 0%, 
        rgba(59, 130, 246, 0.04) 100%);
    border-left-color: rgba(59, 130, 246, 0.4);
}

.equipment-option.equipped-item {
    background: linear-gradient(90deg, 
        rgba(34, 197, 94, 0.06) 0%, 
        rgba(34, 197, 94, 0.03) 100%);
    border-left-color: rgba(34, 197, 94, 0.3);
}

.equipment-option.equipped-item:hover {
    background: linear-gradient(90deg, 
        rgba(239, 68, 68, 0.08) 0%, 
        rgba(239, 68, 68, 0.04) 100%);
    border-left-color: rgba(239, 68, 68, 0.4);
}

.equipment-option .item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.equipment-option .item-name {
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.equipment-option .item-type {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.8);
}

.equipment-option .item-quantity {
    font-size: 11px;
    color: rgba(168, 162, 158, 0.9);
    font-weight: 500;
}

.equipment-option .option-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.equipment-option .option-action.equip {
    color: rgba(34, 197, 94, 0.8);
    background: rgba(34, 197, 94, 0.1);
}

.equipment-option .option-action.unequip {
    color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.1);
}

.equipment-option:hover .option-action.equip {
    color: rgba(34, 197, 94, 1);
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

.equipment-option:hover .option-action.unequip {
    color: rgba(239, 68, 68, 1);
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.equipment-dropdown .no-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    text-align: center;
    color: rgba(148, 163, 184, 0.6);
}

.equipment-dropdown .no-items i {
    font-size: 24px;
    opacity: 0.5;
}

.equipment-dropdown .no-items span {
    font-size: 13px;
    font-style: italic;
}

.separator-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    width: 100%;
    opacity: 0.5;
    transition: all 0.2s ease;
    border-radius: 3px;
    position: relative;
    background: rgba(74, 85, 104, 0.2);
}

.resize-separator:hover .separator-handle {
    opacity: 0.8;
    background: rgba(106, 141, 255, 0.2);
    transform: scale(1.05);
}

.resize-separator:active .separator-handle {
    opacity: 1;
    background: rgba(255, 107, 107, 0.2);
    transform: scale(1.1);
}

.separator-handle i {
    font-size: 1.1rem;
    color: #cbd5e0;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.resize-separator:hover .separator-handle i {
    color: #6a8dff;
    transform: scale(1.1);
}

/* Add visual feedback when resizing */
.resize-separator:active .separator-handle i {
    color: #ff6b6b;
    transform: scale(1.2);
}

/* Mobile responsive adjustments - only for small screens */

/* Mobile responsive adjustments - only for small screens */
@media (max-width: 768px) {
    .resizable-layout {
        flex-direction: column;
        gap: 16px;
    }
    
    .resize-separator {
        display: none;
    }
    
    .resizable-panel {
        min-width: unset;
        flex: none !important;
    }
}

/* Quick tooltip styling */
#quick-tooltip {
    pointer-events: none;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

/* Inventory controls */
.inventory-controls button {
    transition: all 0.2s ease;
}

.inventory-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
    .inventory-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .equipment-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 350px;
    }
}

@media (min-width: 1200px) {
    .inventory-grid {
        grid-template-columns: repeat(14, 1fr);
    }
}

@media (min-width: 1600px) {
    .inventory-grid {
        grid-template-columns: repeat(16, 1fr);
    }
}

/* Navigation Styles */
.bottom-nav {
    border-top: 1px solid #4a4a6a;
    background: rgba(23, 23, 39, 0.9);
    backdrop-filter: blur(5px);
}

.nav-icon {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.nav-icon:hover {
    color: #fff;
    transform: scale(1.1);
}

.nav-icon i {
    font-size: 32px;
}

/* Screen Display */
#character-creation-screen, #game-screen { 
    display: none; 
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .choice-button, .action-button {
        min-height: 80px;
    }
}

/* Enhanced Character Sheet Styles */
.character-portrait {
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.character-portrait:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.stat-block {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 179, 237, 0.5), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.stat-block:hover::before {
    transform: translateX(100%);
}

.stat-bar {
    position: relative;
    overflow: hidden;
}

.stat-bar > div {
    transition: width 0.8s ease-in-out;
}

.quick-stats .stat-quick {
    position: relative;
    transition: all 0.3s ease;
}

.quick-stats .stat-quick:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.equipment-effect {
    position: relative;
    transition: all 0.3s ease;
}

.equipment-effect:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.skill-row {
    position: relative;
    transition: all 0.2s ease;
}

.skill-row:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ability-group {
    position: relative;
    transition: all 0.3s ease;
}

.ability-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.combat-stat {
    position: relative;
    transition: all 0.3s ease;
}

.combat-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.save-stat {
    transition: all 0.2s ease;
}

.save-stat:hover {
    background-color: #374151 !important;
    transform: translateX(3px);
}

/* Character Sheet Responsive Design */
@media (max-width: 1024px) {
    .character-content {
        grid-template-columns: 1fr;
    }
    
    .quick-stats {
        grid-template-columns: 2fr 2fr;
    }
    
    .stats-section .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .character-header .flex {
        flex-direction: column;
        text-align: center;
    }
    
    .character-portrait {
        width: 96px;
        height: 96px;
    }
    
    .quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stats-section .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .skills-section .grid {
        grid-template-columns: 1fr;
    }
}

/* Animation Utilities */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
    }
    100% {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
}

.proficient-skill {
    animation: pulse-glow 2s infinite;
}

/* Gradient Text Effects */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Glass Effect for Panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dice Animation Styles */
.dice-animation-transition {
    transition: all 0.25s ease-in-out;
    animation: diceValueChange 0.25s ease-in-out;
}

.dice-final-result {
    animation: finalResultPulse 0.5s ease-in-out;
    text-shadow: 0 0 10px currentColor;
}

.result-pulse {
    animation: resultPulse 1s ease-in-out infinite;
}

@keyframes diceValueChange {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    25% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.6;
    }
    75% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes finalResultPulse {
    0% {
        transform: scale(1);
        text-shadow: 0 0 10px currentColor;
    }
    50% {
        transform: scale(1.15);
        text-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 10px currentColor;
    }
}

@keyframes resultPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Dice Roll Modal Enhancements */
#dice-roll-modal .bg-gray-900 {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

#dice-display {
    transition: all 0.3s ease-in-out;
}

#dice-breakdown {
    min-height: 120px;
    transition: all 0.3s ease-in-out;
}

/* Modifier Animation */
.modifier-highlight {
    background: rgba(255, 193, 7, 0.2);
    border-radius: 4px;
    padding: 2px 4px;
    animation: highlightFade 0.75s ease-in-out;
}

.modifier-slide-in {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes highlightFade {
    0% {
        background: rgba(255, 193, 7, 0.5);
        transform: scale(1.05);
    }
    100% {
        background: rgba(255, 193, 7, 0.1);
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Combat System Styles */
.combat-container {
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
}

.combat-action-btn {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.combat-action-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.target-btn {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.target-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.initiative-item {
    transition: all 0.3s ease;
    border: 2px solid;
}

.participant-card {
    transition: all 0.3s ease;
    border: 2px solid;
}

.participant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.combat-message {
    animation: slideInLeft 0.3s ease-out;
}

/* Combat animations */
@keyframes combatPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.combat-turn-active {
    animation: combatPulse 2s ease-in-out infinite;
}

/* HP Bar animations */
.hp-bar {
    transition: width 0.8s ease-in-out;
}

/* Critical hit effects */
@keyframes criticalHit {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.1);
        filter: brightness(1.5) hue-rotate(45deg);
    }
    50% {
        transform: scale(1.2);
        filter: brightness(2) hue-rotate(90deg);
    }
    75% {
        transform: scale(1.1);
        filter: brightness(1.5) hue-rotate(45deg);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.critical-hit-effect {
    animation: criticalHit 1s ease-in-out;
}

/* Damage number pop-ups */
@keyframes damagePopup {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1);
    }
}

.damage-popup {
    animation: damagePopup 1.5s ease-out forwards;
    position: absolute;
    font-weight: bold;
    font-size: 1.5rem;
    z-index: 1000;
    pointer-events: none;
}

.damage-popup.critical {
    color: #ff4444;
    text-shadow: 0 0 10px #ff4444;
    font-size: 2rem;
}

.damage-popup.heal {
    color: #44ff44;
    text-shadow: 0 0 10px #44ff44;
}

.damage-popup.miss {
    color: #888;
    font-style: italic;
}

/* ==================== COMBAT SCREEN STYLES ==================== */

#combat-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
    background-attachment: fixed;
}

.combat-header {
    border-bottom: 2px solid #dc2626;
    background: linear-gradient(90deg, rgba(185, 28, 28, 0.8) 0%, rgba(127, 29, 29, 0.8) 100%);
    backdrop-filter: blur(10px);
}

.initiative-panel,
.combat-arena,
.combat-log {
    backdrop-filter: blur(10px);
    border: 2px solid;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.initiative-panel {
    border-color: #eab308;
    background: rgba(31, 41, 55, 0.95);
}

.combat-arena {
    border-color: #dc2626;
    background: rgba(31, 41, 55, 0.95);
}

.combat-log {
    border-color: #059669;
    background: rgba(31, 41, 55, 0.95);
}

.initiative-item {
    transition: all 0.3s ease;
    border: 1px solid;
}

.initiative-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.participant-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.participant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.participant-card:hover::before {
    left: 100%;
}

.combat-action-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.combat-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.combat-action-btn:active {
    transform: translateY(0);
}

.target-btn {
    transition: all 0.2s ease;
}

.target-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

#combat-messages {
    font-family: 'Courier New', monospace;
}

.combat-message {
    animation: fadeInUp 0.3s ease;
}

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

/* HP Bar animations */
.participant-card .bg-green-500 {
    transition: width 0.5s ease;
}

/* Critical hit effects */
@keyframes criticalFlash {
    0%, 100% { background-color: inherit; }
    50% { background-color: #fbbf24; }
}

.critical-hit {
    animation: criticalFlash 0.5s ease-in-out 2;
}

/* Turn indicator glow */
.bg-blue-600,
.bg-red-600 {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.bg-red-600 {
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.5);
}

/* Spell Menu Styles */
.spell-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 2px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.spell-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.spell-menu-header {
    background: linear-gradient(135deg, #d4af37 0%, #f4e474 50%, #d4af37 100%);
    color: #1a1a2e;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.spell-menu-close {
    background: none;
    border: none;
    color: #1a1a2e;
    font-size: 1.5rem;
    cursor: pointer;
    font-weight: bold;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.spell-menu-close:hover {
    background-color: rgba(26, 26, 46, 0.2);
}

/* Build/Version Overlay */
.version-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.version-popup {
    background: #1a1a2e;
    border: 1px solid #4a4a6a;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    color: #e0e0e0;
}

/* Version Footer */
.version-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(23, 23, 39, 0.9);
    backdrop-filter: blur(5px);
    padding: 0.5rem 1rem;
    text-align: center;
    z-index: 50;
    border-top: 1px solid rgba(74, 74, 106, 0.3);
}

.spell-menu-content {
    padding: 1rem;
    color: #e0e0e0;
}

.spell-slots-display {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #d4af37;
    border-radius: 6px;
}

.spell-slots-display h4 {
    margin: 0 0 0.5rem 0;
    color: #d4af37;
    font-size: 1rem;
}

.spell-slots-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.spell-slot {
    width: 20px;
    height: 20px;
    border: 2px solid #d4af37;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.spell-slot.available {
    background: #d4af37;
    color: #1a1a2e;
}

.spell-slot.used {
    background: transparent;
    color: #666;
}

.spell-category {
    margin-bottom: 1.5rem;
}

.spell-category h4 {
    color: #d4af37;
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    border-bottom: 1px solid #d4af37;
    padding-bottom: 0.25rem;
}

.spell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.spell-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #666;
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.spell-item:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.spell-item.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

.spell-item.unavailable:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.02);
    border-color: #666;
}

.spell-name {
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.spell-level {
    font-size: 0.8rem;
    color: #d4af37;
    margin-bottom: 0.25rem;
}

.spell-description {
    font-size: 0.8rem;
    color: #ccc;
    line-height: 1.3;
}

.class-features-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #666;
}

.feature-item {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4caf50;
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.feature-item:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: translateY(-1px);
}

.feature-item.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(76, 175, 80, 0.05);
}

.feature-item.unavailable:hover {
    transform: none;
    background: rgba(76, 175, 80, 0.05);
}

.feature-name {
    font-weight: bold;
    color: #4caf50;
    margin-bottom: 0.25rem;
}

.feature-uses {
    font-size: 0.8rem;
    color: #90caf9;
}

.feature-description {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* Advanced Inventory System Styles */
.inventory-controls {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

.inventory-list .list-header {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
    font-family: 'Cinzel', serif;
}

.inventory-list .list-item {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    transition: all 0.3s ease;
}

.inventory-list .list-item:hover {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.inventory-grid .grid-item {
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}

.inventory-grid .grid-item:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.inventory-controls select {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

.inventory-controls input[type="text"] {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
}

.inventory-controls button {
    font-family: 'Cinzel', serif;
    transition: all 0.3s ease;
}

.inventory-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.inventory-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Equipment Section Animations */
.equipment-grid {
    transition: all 0.3s ease;
}

.equipment-slot {
    transition: all 0.3s ease;
}

.equipment-slot:hover {
    transform: translateY(-2px);
}

/* Rarity Borders */
.border-gray-400 { border-color: #9ca3af; }
.border-green-400 { border-color: #4ade80; }
.border-blue-400 { border-color: #60a5fa; }
.border-purple-400 { border-color: #c084fc; }
.border-yellow-400 { border-color: #facc15; }

/* Text Colors for Rarities */
.text-gray-400 { color: #9ca3af; }
.text-green-400 { color: #4ade80; }
.text-blue-400 { color: #60a5fa; }
.text-purple-400 { color: #c084fc; }
.text-yellow-400 { color: #facc15; }

/* Selection Ring Animation */
.ring-2 {
    box-shadow: 0 0 0 2px #3b82f6;
}

.ring-blue-500 {
    box-shadow: 0 0 0 2px #3b82f6;
}

/* Loading States */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200px 100%;
    animation: shimmer 2s infinite;
}

/* Responsive Inventory */
@media (max-width: 768px) {
    .inventory-list .list-item {
        grid-template-columns: 1fr;
        gap: 2;
    }
    
    .inventory-list .list-header {
        display: none;
    }
    
    .inventory-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .equipment-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tooltip Enhancements */
.inventory-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Drag and Drop Visual Feedback */
.drag-over {
    background: rgba(59, 130, 246, 0.3) !important;
    border-color: #3b82f6 !important;
    transform: scale(1.05);
}

.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Action Button Groups */
.action-button-group {
    display: flex;
    gap: 2px;
    border-radius: 6px;
    overflow: hidden;
}

.action-button-group button {
    border-radius: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.action-button-group button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.action-button-group button:last-child {
    border-right: none;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* ========== DICE ANIMATION STYLES ========== */

.dice-animation-container {
    animation: diceSlideIn 0.3s ease-out;
}

@keyframes diceSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.dice-roll-display {
    animation: diceFloat 2s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

@keyframes diceFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.individual-die {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 4px;
}

.die-icon {
    animation: diceRoll 0.1s ease-in-out infinite;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
    100% { transform: rotate(360deg); }
}

.die-result {
    transition: all 0.3s ease-in-out;
}

.damage-total {
    transition: all 0.5s ease-in-out;
}

/* ========== COMBAT UI ENHANCEMENTS ========== */

.participant-card {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.participant-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease-in-out;
}

.participant-card:hover::before {
    left: 100%;
}

.initiative-item {
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

.initiative-item:hover {
    transform: translateX(5px);
}

.condition-tag {
    animation: conditionPulse 2s ease-in-out infinite;
}

@keyframes conditionPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.hp-display .bg-red-500,
.hp-display .bg-yellow-500,
.hp-display .bg-green-500 {
    transition: all 0.8s ease-in-out;
}

/* Turn indicator animations */
.initiative-badge {
    transition: all 0.3s ease-in-out;
}

.initiative-item.current-turn .initiative-badge {
    animation: initiativePulse 1s ease-in-out infinite;
}

@keyframes initiativePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Combat message animations */
.combat-message {
    animation: messageSlideIn 0.3s ease-out;
    transition: all 0.3s ease-in-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.combat-message:hover {
    background-color: rgba(255, 255, 255, 0.05);
    padding-left: 8px;
}

/* Settings panel enhancements */
.setting-item input[type="range"] {
    transition: all 0.3s ease-in-out;
}

.setting-item input[type="range"]:hover {
    filter: brightness(1.2);
}

.setting-item input[type="checkbox"] {
    transition: all 0.3s ease-in-out;
    transform: scale(1.2);
}

.setting-item input[type="checkbox"]:checked {
    filter: hue-rotate(90deg) brightness(1.3);
}

/* Enhanced Dice Modal Styles - Baldur's Gate 3 inspired */
.dice-modal {
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-in-out;
    transition: background-color 0.4s ease-in-out, backdrop-filter 0.4s ease-in-out;
    font-family: 'Cinzel', serif;
}

.dice-modal-content {
    animation: slideInScale 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    transition: transform 0.1s ease-out;
    font-family: 'Cinzel', serif;
}


.dice-display {
    position: relative;
    perspective: 1000px; /* Add 3D perspective for better rotation */
}

.dice-display #dice-icon {
    text-shadow: 0 0 20px rgba(106, 141, 255, 0.6);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: all 0.2s ease-out;
    font-family: 'Cinzel', serif;
    transform-style: preserve-3d; /* Enable 3D transforms */
}

.dice-display #dice-icon img {
    transition: all 0.2s ease-out;
    transform-style: preserve-3d;
}

.text-gradient {
    background: linear-gradient(135deg, #6a8dff, #8a8ac2, #6a8dff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: gradientShift 2s ease-in-out infinite;
    font-family: 'Cinzel', serif;
}

.modifier-line {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    padding: 0.5rem;
    animation: slideInLeft 0.5s ease-out;
    font-family: 'Cinzel', serif;
}

.base-roll-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.5s ease-in-out;
    font-family: 'Cinzel', serif;
}

.main-roll-section {
    font-family: 'Cinzel', serif;
}

#continue-btn {
    background: linear-gradient(135deg, #6a8dff, #8a8ac2);
    box-shadow: 0 4px 15px rgba(106, 141, 255, 0.4);
    border: none;
    position: relative;
    overflow: hidden;
    font-family: 'Cinzel', serif;
}

#continue-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

#continue-btn:hover::before {
    left: 100%;
}

#continue-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(106, 141, 255, 0.6);
}

#continue-btn:focus {
    outline: 2px solid #6a8dff;
    outline-offset: 2px;
}

/* Enhanced base roll value styling */
#base-roll-value {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    font-family: 'Cinzel', serif;
}

/* Main roll value styling */
#main-roll-value {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    font-family: 'Cinzel', serif;
}

/* Roll description styling */
#roll-description {
    font-family: 'Cinzel', serif;
}

/* Modifier display styling */
#modifier-display {
    font-family: 'Cinzel', serif;
}

/* Screen flash effect */
.screen-flash {
    mix-blend-mode: screen;
    z-index: 105;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: scale(0.7) translate(-50%, -50%);
    }
    to {
        opacity: 1;
        transform: scale(1) translate(-50%, -50%);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes modalEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translate(-50%, -50%);
        filter: blur(4px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) translate(-50%, -50%);
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translate(-50%, -50%);
        filter: blur(0px);
    }
}

@keyframes diceRollBounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(90deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    75% {
        transform: scale(1.1) rotate(270deg);
    }
}

@keyframes numberCycle {
    0% {
        opacity: 0.8;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.8;
        transform: scale(0.9);
    }
}

@keyframes resultReveal {
    0% {
        opacity: 0;
        transform: scale(0.5);
        filter: blur(4px);
    }
    60% {
        opacity: 1;
        transform: scale(1.3);
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: scale(1.2);
        filter: blur(0px);
    }
}

/* Floating Text Animation */
.floating-text {
    pointer-events: none;
    user-select: none;
    z-index: 1000;
}

/* Enhanced Dice Animation Effects */
.dice-glow {
    filter: drop-shadow(0 0 10px currentColor);
}

.critical-success {
    animation: criticalPulse 1s ease-in-out infinite alternate;
}

.critical-failure {
    animation: criticalShake 0.5s ease-in-out 3;
}

@keyframes criticalPulse {
    from {
        filter: drop-shadow(0 0 5px #10b981) brightness(1);
    }
    to {
        filter: drop-shadow(0 0 15px #10b981) brightness(1.3);
    }
}

@keyframes criticalShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Responsive Dice Modal */
@media (max-width: 640px) {
    .dice-modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: none;
    }
    
    .dice-display #dice-icon {
        font-size: 4rem;
    }
    
    #base-roll-value {
        font-size: 3rem;
    }
    
    #final-total span {
        font-size: 3rem;
    }
}

/* Floating Text Animation for DiceRoller */
@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -60%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

/* Advanced Inventory System Styles */
.advanced-inventory-container {
    max-height: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
}

.inventory-header {
    flex-shrink: 0;
}


.inventory-main {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    /* Override any grid settings for resizable layout */
    display: flex !important;
    flex-direction: row !important;
}

/* Ensure panels are side by side */
.inventory-main.resizable-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 0 !important;
    width: 100% !important;
    align-items: stretch !important;
}

/* Make sure all direct children align horizontally */
.inventory-main.resizable-layout > * {
    flex-shrink: 0;
}

.inventory-main.resizable-layout > .equipment-section {
    flex: 0 0 350px;
    min-width: 300px;
    max-width: 500px;
}

.inventory-main.resizable-layout > .resize-separator {
    flex: 0 0 8px;
    width: 8px;
}

.inventory-main.resizable-layout > .inventory-section {
    flex: 1;
    min-width: 400px;
}

.inventory-section {
    height: 100%;
}

.equipment-section {
    height: 100%;
}

/* (Removed inventory-grid specific scrollbar styles in favor of global above) */

.inventory-item {
    transition: all 0.2s ease;
    position: relative;
}

.inventory-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.item-tag {
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.5rem;
    display: inline-block;
}

.tag-consumable {
    background-color: #dc2626;
    color: #fff;
}

.tag-equippable {
    background-color: #3b82f6;
    color: #fff;
}

.quantity-badge {
    font-size: 0.75rem;
    min-width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
}

.equipment-slot .slot-content {
    min-width: 6.5rem;
    max-width: 6.5rem;
    min-height: 6.5rem;
    max-height: 6.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
}

.equipped-item-display {
    text-align: center;
    width: 100%;
    overflow: hidden;
}
.equipped-item-display .text-xs {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.item-detail-modal {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Filter and search styling */
.search-container input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.filter-controls select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Mobile filter toggle */
#filter-toggle {
    display: none;
}

@media (max-width: 768px) {
    .filter-controls.collapsed {
        display: none;
    }
    #filter-toggle {
        display: block;
    }
}

/* Stat item hover effects */
.stat-item {
    transition: background-color 0.2s ease;
}

.stat-item:hover {
    background-color: #4a5568;
}

/* Inventory item action buttons */
.inventory-item button {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inventory-item button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.inventory-item button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Rarity glow effects */
.border-green-500 {
    box-shadow: 0 0 0 1px #10b981, 0 0 8px rgba(16, 185, 129, 0.3);
}

.border-blue-500 {
    box-shadow: 0 0 0 1px #3b82f6, 0 0 8px rgba(59, 130, 246, 0.3);
}

.border-purple-500 {
    box-shadow: 0 0 0 1px #8b5cf6, 0 0 8px rgba(139, 92, 246, 0.3);
}

.border-orange-500 {
    box-shadow: 0 0 0 1px #f59e0b, 0 0 8px rgba(245, 158, 11, 0.3);
}

/* Responsive adjustments for inventory - only for mobile screens */
@media (max-width: 768px) {
    .inventory-main {
        flex-direction: column !important;
        gap: 16px;
    }
    
    .equipment-section {
        order: 1;
        flex: none !important;
    }
    
    .inventory-section {
        order: 2;
        flex: none !important;
    }
    
    .resize-separator {
        display: none;
    }
}

@media (max-width: 768px) {
    .inventory-header .flex {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .inventory-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .equipment-grid .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .equipment-slot .slot-content {
        min-height: 3rem;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .inventory-stats {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-controls select,
    .filter-controls button {
        width: 100%;
    }
}

/* ===== STAT CHANGE ANIMATIONS ===== */

/* Stat Change Modal Overlay */
.stat-change-modal-overlay {
    z-index: 9999;
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.3s ease-out;
}

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

/* Stat Change Modal */
.stat-change-modal {
    backdrop-filter: blur(8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-width: 2px;
    position: relative;
    overflow: hidden;
}

.stat-change-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Progress Bar Animation */
.progress-bar-fill {
    background: linear-gradient(90deg, #10b981, #34d399, #10b981);
    background-size: 200% 100%;
    animation: progressGlow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 1.5s ease-out;
}

@keyframes progressGlow {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 0%; }
}

@keyframes progressShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Stat Value Animation */
.stat-old-value {
    transition: all 0.5s ease-out;
}

.stat-new-value {
    transform: scale(1.1);
    transition: all 0.5s ease-out;
    text-shadow: 0 0 10px currentColor;
}

.stat-new-value.show {
    transform: scale(1);
}

/* Transition Arrow Animation */
.transition-arrow {
    transform: translateX(-10px);
    transition: all 0.5s ease-out;
}

.transition-arrow.show {
    transform: translateX(0);
}

/* Change Indicator Animation */
.change-indicator {
    transform: translateY(10px) scale(0.8);
    transition: all 0.5s ease-out;
    text-shadow: 0 0 8px currentColor;
}

.change-indicator.show {
    transform: translateY(0) scale(1);
}

/* Level Up Special Effects */
.stat-change-modal[data-type="level_up"] {
    animation: levelUpPulse 0.6s ease-out;
}

@keyframes levelUpPulse {
    0% { transform: scale(0.9); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.stat-change-modal[data-type="level_up"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    animation: goldShimmer 1s infinite;
}

@keyframes goldShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Healing Animation */
.stat-change-modal[data-type="healing"] .progress-bar-fill {
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
}

/* Mana Animation */
.stat-change-modal[data-type="mana"] .progress-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
}

/* Stat Increases Container */
.stat-increases {
    transform: translateY(20px);
    transition: all 0.7s ease-out;
}

.stat-increases.show {
    transform: translateY(0);
}

/* Icon Animation */
.stat-change-modal .ph-duotone {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Rarity Glow Effects for Stat Changes */
.stat-change-modal.legendary-glow {
    box-shadow: 
        0 0 20px rgba(255, 165, 0, 0.5),
        0 0 40px rgba(255, 165, 0, 0.3),
        0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-color: #ffa500;
}

.stat-change-modal.epic-glow {
    box-shadow: 
        0 0 20px rgba(128, 0, 128, 0.5),
        0 0 40px rgba(128, 0, 128, 0.3),
        0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-color: #800080;
}

.stat-change-modal.rare-glow {
    box-shadow: 
        0 0 15px rgba(0, 100, 255, 0.4),
        0 0 30px rgba(0, 100, 255, 0.2),
        0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-color: #0064ff;
}

/* Button Hover Effects */
.stat-change-modal button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-change-modal button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.stat-change-modal button:hover::before {
    left: 100%;
}

/* Responsive Design for Stat Modals */
@media (max-width: 640px) {
    .stat-change-modal {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .stat-change-modal .text-3xl {
        font-size: 1.5rem;
    }
    
    .stat-change-modal .text-2xl {
        font-size: 1.25rem;
    }
    
    .stat-change-modal .w-16.h-16 {
        width: 3rem;
        height: 3rem;
    }
}

/* Time Controls */
.time-controls {
    border-bottom: 1px solid #4a4a6a;
}

.time-control-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    color: #60a5fa;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-control-btn:hover {
    background: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Effects Panel */
.effect-item {
    background: rgba(55, 65, 81, 0.8);
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.effect-item.buff {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.effect-item.debuff {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.effect-item.mixed {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.effect-progress-bar {
    width: 100%;
    height: 0.5rem;
    background: rgba(75, 85, 99, 0.5);
    border-radius: 0.25rem;
    overflow: hidden;
    margin-top: 0.5rem;
}

.effect-progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 0.25rem;
}

.effect-progress-fill.buff {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.effect-progress-fill.debuff {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.effect-progress-fill.mixed {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.effect-timer {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Activatable Item Button */
.activatable-item {
    position: relative;
}

.activate-item-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(16, 185, 129, 0.8);
    border: 1px solid #10b981;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.activate-item-btn:hover {
    background: rgba(16, 185, 129, 1);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* ==================== MOBILE MODE SPECIFIC STYLES ==================== */
.mobile-toggle-btn {
    background: linear-gradient(45deg, #10b981, #34d399);
    border: 2px solid #047857;
    color: white;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.mobile-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    background: linear-gradient(45deg, #047857, #10b981);
}

.mobile-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Mobile Mode Enhancements */
body.mobile-mode {
    font-size: 14px;
    line-height: 1.4;
}

body.mobile-mode .game-container {
    padding: 0.5rem;
}

body.mobile-mode .moon {
    width: 2rem;
    height: 2rem;
}

body.mobile-mode .header {
    padding: 0.75rem;
}

body.mobile-mode .choice-button,
body.mobile-mode .action-button {
    min-height: 80px;
    font-size: 0.9rem;
    padding: 0.75rem;
}

body.mobile-mode .ui-panel {
    padding: 1rem;
}

body.mobile-mode .inventory-slot,
body.mobile-mode .equipped-item {
    min-height: 50px;
}

body.mobile-mode .inventory-grid {
    grid-template-columns: repeat(3, 1fr);
    max-height: 70vh;
}

body.mobile-mode .bottom-nav .mobile-nav-text {
    display: none;
}

body.mobile-mode .bottom-nav .nav-icon i {
    font-size: 1.75rem;
}

/* Larger touch area for bottom navigation */
body.mobile-mode .bottom-nav {
    height: 64px;
}

/* Bigger close buttons in mobile mode */
body.mobile-mode .close-panel-btn {
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
}

/* Mobile-specific touch targets */
@media (max-width: 430px) {
    /* Optimized for Google Pixel 9 (430px width) */
    .game-container {
        padding: 0.25rem;
    }
    
    .header {
        padding: 0.5rem;
    }
    
    .choice-button,
    .action-button {
        min-height: 70px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .moon {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .story-text {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Enhanced touch interactions for mobile */
body.mobile-mode button,
body.mobile-mode .choice-button,
body.mobile-mode .action-button {
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
}

body.mobile-mode input,
body.mobile-mode textarea,
body.mobile-mode select {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Journal UI Styles */
.journal-entry {
    background-color: #1f2937;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    padding: 0.75rem;
    border-left-width: 4px;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.journal-entry.quest { border-color: #d97706; }
.journal-entry.quest.completed { border-color: #16a34a; }
.journal-entry.lore { border-color: #0284c7; }
.journal-entry.rumor { border-color: #7e22ce; }
.journal-entry.location { border-color: #059669; }
.journal-entry.item { border-color: #ea580c; }
.journal-entry.npc { border-color: #0891b2; }
.journal-entry.bestiary { border-color: #dc2626; }
.journal-entry.note { border-color: #6366f1; }
.quest-progress { height: 0.25rem; background-color: #374151; border-radius: 0.25rem; margin-top: 0.5rem; }
.quest-progress-fill { background-color: #d97706; height: 100%; border-radius: 0.25rem; }
.pin-btn.active { color: #fbbf24; }

/* Journal link styling */
.journal-link {
    transition: color 0.2s ease;
}
.journal-link:hover {
    text-shadow: 0 0 4px currentColor;
}

/* Journal container styling */
.journal-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.journal-tabs {
    flex-shrink: 0;
}
.journal-section {
    flex: 1;
    overflow: hidden;
}

/* Modal styling for quick reference */
#quick-reference-modal {
    z-index: 1000;
}
#quick-reference-modal .bg-gray-900 {
    max-height: 80vh;
    overflow-y: auto;
}

/* Enhanced slider styling */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #374151;
    outline: none;
    transition: background 0.3s;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    transition: transform 0.3s;
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* === Developer Console Scrollbar === */
#console-output {
    scrollbar-width: thin;
    scrollbar-color: #6a8dff #23233a;
}

#console-output::-webkit-scrollbar {
    width: 12px;
    background: #1a1a2e;
}

#console-output::-webkit-scrollbar-track {
    background: #23233a;
    border-radius: 6px;
    border: 1px solid #4a4a6a;
}

#console-output::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6a8dff 0%, #8a8ac2 100%);
    border-radius: 6px;
    border: 2px solid #23233a;
    min-height: 30px;
}

#console-output::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8a8ac2 0%, #6a8dff 100%);
    cursor: pointer;
}

#console-output::-webkit-scrollbar-corner {
    background: #23233a;
}

/* === Developer Console Modal Window === */
#developer-menu {
    min-width: 400px;
    min-height: 300px;
    max-width: calc(100vw - 50px);
    max-height: calc(100vh - 50px);
}

#developer-menu .resize-handle {
    z-index: 10;
}

#developer-menu .resize-handle:hover {
    background-color: #6a8dff !important;
}

/* Prevent text selection during drag/resize */
#developer-menu.dragging,
#developer-menu.resizing {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* === Readable Items Modal Styles === */
#readable-item-modal .prose {
    color: #e2e8f0;
    max-width: none;
    line-height: 1.7;
}

#readable-item-modal .prose h1,
#readable-item-modal .prose h2,
#readable-item-modal .prose h3,
#readable-item-modal .prose h4,
#readable-item-modal .prose h5,
#readable-item-modal .prose h6 {
    color: #fbbf24;
    font-weight: bold;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

#readable-item-modal .prose h1 {
    font-size: 1.875rem;
    color: #f9fafb;
    border-bottom: 1px solid #374151;
    padding-bottom: 0.5rem;
}

#readable-item-modal .prose h2 {
    font-size: 1.5rem;
    color: #fde68a;
}

#readable-item-modal .prose h3 {
    font-size: 1.25rem;
    color: #fbbf24;
}

#readable-item-modal .prose p {
    margin-bottom: 1rem;
    color: #d1d5db;
    text-align: justify;
}

#readable-item-modal .prose strong {
    color: #fbbf24;
    font-weight: 600;
}

#readable-item-modal .prose em {
    color: #9ca3af;
    font-style: italic;
}

#readable-item-modal .prose ul {
    list-style-type: disc;
    list-style-position: inside;
    margin: 1rem 0;
    padding-left: 1rem;
}

#readable-item-modal .prose li {
    margin-bottom: 0.5rem;
    color: #d1d5db;
}

#readable-item-modal .prose hr {
    border: none;
    border-top: 1px solid #4b5563;
    margin: 2rem 0;
}

#readable-item-modal .prose code {
    background-color: #374151;
    color: #10b981;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
}

#readable-item-modal .prose a {
    color: #3b82f6;
    text-decoration: underline;
    transition: color 0.2s;
}

#readable-item-modal .prose a:hover {
    color: #60a5fa;
}

/* Readable content text selection enabled */
#readable-item-modal .prose,
#readable-item-modal .prose * {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Smooth modal animations */
#readable-item-modal {
    animation: fadeIn 0.2s ease-out;
}

#readable-item-modal .bg-gray-800 {
    animation: slideIn 0.3s ease-out;
    transform-origin: center;
}

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

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