/* D&D Game Styles */

.dnd-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a0a2e 0%, #0d0d0d 50%, #1a0a2e 100%);
}

.dnd-screen.hidden {
    display: none;
}

/* Title */
.dnd-title {
    text-align: center;
    margin-bottom: 40px;
}

.dnd-title h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8c00;
    margin-bottom: 10px;
}

.dnd-title .subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    color: #888;
}

/* Buttons */
.dnd-btn {
    font-family: 'Rajdhani', sans-serif;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border: 2px solid #ffd700;
    color: #fff;
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 250px;
}

.dnd-btn:hover {
    background: linear-gradient(180deg, #4a3500 0%, #2a1a00 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.dnd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dnd-btn.primary {
    border-color: #ffd700;
    background: linear-gradient(180deg, #4a3500 0%, #2a1a00 100%);
}

.dnd-btn.secondary {
    border-color: #00ccff;
}

.dnd-btn.secondary:hover {
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.5);
}

.dnd-btn.small {
    padding: 8px 15px;
    min-width: auto;
    font-size: 0.9rem;
}

.dnd-btn.large {
    padding: 20px 40px;
    font-size: 1.3rem;
}

.dnd-btn .icon {
    font-size: 2rem;
}

.dnd-btn .label {
    font-weight: bold;
    font-size: 1.1rem;
}

.dnd-btn .desc {
    font-size: 0.8rem;
    color: #888;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Character Creation */
.character-creation {
    max-width: 800px;
    width: 100%;
}

.creation-section {
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border: 1px solid #333;
    border-radius: 5px;
}

.creation-section h3 {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.selection-item {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid #444;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.selection-item:hover {
    border-color: #ffd700;
    background: rgba(50, 40, 0, 0.5);
}

.selection-item.selected {
    border-color: #ffd700;
    background: rgba(100, 80, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.selection-item .item-icon {
    font-size: 2rem;
}

.selection-item .item-name {
    font-weight: bold;
    color: #fff;
}

.selection-item .item-bonus {
    font-size: 0.75rem;
    color: #0f0;
}

/* Stats Display */
.stats-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    min-width: 60px;
}

.stat-item .stat-name {
    display: block;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 5px;
}

.stat-item .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

/* Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 200px 1fr 250px;
    gap: 10px;
    width: 100%;
    max-width: 1200px;
    height: calc(100vh - 40px);
}

.panel {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
    padding: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Left Panel - Character */
.left-panel {
    gap: 10px;
}

.character-portrait {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #2a1a00 0%, #1a1a1a 100%);
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.character-info {
    text-align: center;
}

.character-info h3 {
    color: #ffd700;
    margin: 0;
    font-size: 1rem;
}

.character-info p {
    color: #888;
    margin: 5px 0 0;
    font-size: 0.8rem;
}

/* Health/Mana/XP Bars */
.health-bar,
.mana-bar,
.xp-bar {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bar-label {
    font-size: 0.7rem;
    color: #888;
    width: 25px;
}

.bar-container {
    flex: 1;
    height: 20px;
    background: #222;
    border: 1px solid #444;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.bar-fill.hp {
    background: linear-gradient(90deg, #8b0000, #ff0000);
}

.bar-fill.mp {
    background: linear-gradient(90deg, #00008b, #0066ff);
}

.bar-fill.xp {
    background: linear-gradient(90deg, #006400, #00ff00);
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
}

.mini-stats {
    display: flex;
    justify-content: space-around;
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.mini-stat {
    display: flex;
    gap: 3px;
    font-size: 0.9rem;
}

/* Center Panel - Map */
.center-panel {
    gap: 10px;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 5px;
    border-bottom: 1px solid #333;
}

.map-header h3 {
    margin: 0;
    color: #ffd700;
    font-size: 1rem;
}

#turn-indicator {
    color: #888;
    font-size: 0.9rem;
}

#game-canvas {
    flex: 1;
    background: #111;
    border: 1px solid #333;
    width: 100%;
}

.action-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
}

.action-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border: 2px solid #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Right Panel - Tabs */
.panel-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: #222;
    border: 1px solid #444;
    color: #888;
    cursor: pointer;
    font-size: 0.8rem;
}

.tab-btn.active {
    background: #333;
    color: #ffd700;
    border-color: #ffd700;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
}

.tab-content.hidden {
    display: none;
}

/* Combat Log */
.combat-log {
    height: 100%;
    overflow-y: auto;
    font-size: 0.85rem;
}

.log-entry {
    padding: 5px;
    border-bottom: 1px solid #222;
}

.log-entry.damage {
    color: #ff4444;
}

.log-entry.heal {
    color: #44ff44;
}

.log-entry.info {
    color: #888;
}

.log-entry.critical {
    color: #ffd700;
    font-weight: bold;
}

.log-entry.spell {
    color: #aa44ff;
}

/* Inventory */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: #222;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
}

.inventory-slot:hover {
    border-color: #ffd700;
}

.inventory-slot.empty {
    opacity: 0.3;
}

/* DM Layout */
.dm-layout {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 15px;
    width: 100%;
    height: calc(100vh - 40px);
    padding: 10px;
    box-sizing: border-box;
}

.dm-panel {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ff4444;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
}

.dm-panel h3 {
    color: #ff4444;
    font-size: 1.1rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #ff4444;
    padding-bottom: 8px;
    text-transform: uppercase;
}

.dm-tool-section {
    margin-bottom: 20px;
}

.dm-tool-section h4 {
    color: #ffd700;
    font-size: 0.95rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.terrain-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.terrain-btn {
    padding: 15px;
    font-size: 1.5rem;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border: 2px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terrain-btn:hover {
    border-color: #ffd700;
    transform: scale(1.1);
}

.terrain-btn.selected {
    border-color: #ff4444;
    background: linear-gradient(180deg, #4a1a1a 0%, #2a0a0a 100%);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
}

#dm-canvas {
    width: 100%;
    min-height: 600px;
    background: #0a0a0a;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: crosshair;
}

/* DM Action Buttons */
.dm-action-btn {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    font-size: 1rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border: 2px solid #ff4444;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dm-action-btn:hover {
    background: linear-gradient(180deg, #4a2020 0%, #2a1010 100%);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

/* Lobby */
.player-list {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    min-width: 300px;
    min-height: 200px;
    border: 1px solid #333;
    margin: 20px 0;
}

.player-entry {
    padding: 10px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-entry .player-name {
    color: #fff;
}

.player-entry .player-class {
    color: #888;
    font-size: 0.9rem;
}

.player-entry.dm {
    background: rgba(255, 0, 0, 0.1);
    border-left: 3px solid #ff4444;
}

#room-code {
    color: #ffd700;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
}

.empty-text {
    color: #555;
    text-align: center;
    padding: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .left-panel {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .character-portrait {
        width: 80px;
        height: 80px;
    }
}

/* Player Count Selector */
.player-count-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.count-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
    border: 2px solid #555;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.count-btn:hover {
    border-color: #ffd700;
    color: #fff;
    transform: scale(1.1);
}

.count-btn.selected {
    border-color: #ffd700;
    background: linear-gradient(180deg, #4a3500 0%, #2a1a00 100%);
    color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.count-info {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

.count-info span {
    color: #ffd700;
    font-weight: bold;
}

/* Click Effect - Ripple Animation */
.clickable {
    position: relative;
    overflow: hidden;
}

.clickable::after {
    content: '';
    position: absolute;
    top: var(--ripple-y, 50%);
    left: var(--ripple-x, 50%);
    width: 0;
    height: 0;
    background: rgba(255, 215, 0, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: width 0.5s ease, height 0.5s ease, opacity 0.5s ease;
    pointer-events: none;
}

.clickable.clicked::after {
    width: 400px;
    height: 400px;
    opacity: 0;
}

/* Active state for all interactive elements */
.dnd-btn:active,
.selection-item:active,
.action-btn:active,
.tab-btn:active,
.terrain-btn:active,
.count-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.7);
}

/* Selection feedback animation */
@keyframes selectPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 20px 5px rgba(255, 215, 0, 0.3);
    }

    100% {
        box-shadow: 0 0 15px 0 rgba(255, 215, 0, 0.3);
    }
}

.selection-item.selected {
    animation: selectPulse 0.3s ease-out;
}

/* DM Setup Screen */
.dm-setup {
    max-width: 800px;
    width: 100%;
}