/* MAZE-TEMPLE Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cell-size: 32px;
    --primary: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --gold: #f59e0b;
    --purple-dark: #1a1a2e;
    --purple-light: #764ba2;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: white;
}

.game-container {
    max-width: 1200px;
    width: 100%;
}

.game-title {
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-title h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
}

.game-title p {
    font-size: 1.1em;
    opacity: 0.9;
}

.game-header {
    background: rgba(26, 26, 46, 0.8);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.score, .timer, .level-info {
    font-size: 1.2em;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.score span, .timer span, .level-info span {
    color: var(--gold);
}

.mode {
    display: flex;
    gap: 10px;
}

.mode button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--primary), var(--purple-light));
    color: white;
}

.mode button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.5);
}

.mode button.active {
    background: var(--secondary);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.game-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.maze-container {
    background: rgba(26, 26, 46, 0.8);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.maze-grid {
    display: grid;
    grid-template-columns: repeat(var(--maze-size, 15), var(--cell-size));
    gap: 1px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2px;
    border-radius: 8px;
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    transition: all 0.2s ease;
    font-size: 20px;
    position: relative;
}

.cell.wall {
    background: #2d2d44;
}

.cell.player {
    background: radial-gradient(circle, var(--primary), transparent);
    animation: pulse 0.8s infinite;
}

.cell.gem {
    animation: sparkle 1s infinite;
}

.cell.bonus {
    animation: rotate-sparkle 2s infinite;
}

.cell.trap {
    animation: danger-pulse 1s infinite;
}

.cell.exit {
    animation: glow 1.5s infinite;
    background: radial-gradient(circle, var(--secondary), transparent);
}

.cell.shield-active, .cell.speed-active {
    animation: power-glow 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.8; filter: brightness(1.5); }
}

@keyframes rotate-sparkle {
    0%, 100% { transform: rotate(0deg) scale(1); filter: brightness(1); }
    50% { transform: rotate(180deg) scale(1.2); filter: brightness(1.8); }
}

@keyframes danger-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5) saturate(1.5); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px var(--secondary); }
    50% { box-shadow: 0 0 20px var(--secondary), 0 0 30px var(--secondary); }
}

@keyframes power-glow {
    0%, 100% { box-shadow: 0 0 10px var(--gold); }
    50% { box-shadow: 0 0 20px var(--gold); }
}

.side-panel {
    background: rgba(26, 26, 46, 0.8);
    padding: 20px;
    border-radius: 12px;
    min-width: 250px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stats {
    margin-bottom: 20px;
}

.stats > div {
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.stats .active {
    border-left-color: var(--gold);
    background: rgba(245, 158, 11, 0.2);
    animation: pulse 0.5s infinite;
}

.leaderboard h3 {
    margin-bottom: 10px;
    color: var(--gold);
}

.leaderboard ol {
    list-style-position: inside;
    font-size: 0.9em;
}

.leaderboard li {
    padding: 8px;
    margin-bottom: 5px;
    background: rgba(79, 70, 229, 0.2);
    border-radius: 6px;
}

.controls {
    margin-top: 20px;
    text-align: center;
    padding: 15px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.game-over-modal.show {
    display: flex !important;
}

.modal-content {
    background: linear-gradient(135deg, var(--primary), var(--purple-light));
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 400px;
}

.modal-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.modal-content .stats-summary {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.modal-content .stats-summary div {
    margin: 10px 0;
    font-size: 1.2em;
}

.modal-content button {
    padding: 12px 30px;
    margin: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: var(--primary);
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.stars-display {
    font-size: 2em;
    margin: 10px 0;
    letter-spacing: 5px;
}

.stars-display .star {
    display: inline-block;
    transition: all 0.3s ease;
}

.stars-display .star.earned {
    animation: star-pop 0.5s ease;
}

@keyframes star-pop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(15deg); }
}

.challenge-badge {
    display: inline-block;
    padding: 5px 12px;
    background: var(--danger);
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    animation: pulse 1s infinite;
}

.timer-warning {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.settings-modal.show {
    display: flex !important;
}

.settings-content {
    background: linear-gradient(135deg, var(--primary), var(--purple-light));
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

.settings-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
}

.setting-group {
    margin: 20px 0;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.setting-group input, .setting-group select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
}

.skin-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.skin-option {
    font-size: 2.5em;
    padding: 10px;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.skin-option:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.skin-option.selected {
    border-color: var(--gold);
    background: rgba(245, 158, 11, 0.3);
}

.skin-option.locked {
    opacity: 0.3;
    cursor: not-allowed;
}

.skin-option.locked:hover {
    transform: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: bold;
}

/* Maze Analysis Styles */
.maze-analysis {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.maze-analysis h4 {
    margin-bottom: 12px;
    font-size: 1.1em;
    color: var(--gold);
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.analysis-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9em;
}

.analysis-item .label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
}

.analysis-item .value {
    color: white;
    font-weight: bold;
    font-size: 1em;
}

.difficulty-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.diff-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.diff-bar span {
    width: 70px;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
}

.diff-bar .bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.diff-bar .bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--gold));
    transition: width 0.5s ease;
}

/* Performance Info Styles */
.performance-info {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    max-height: 400px;
    overflow-y: auto;
}

.perf-section {
    margin-bottom: 20px;
}

.perf-section h4 {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 1em;
}

.perf-section p {
    margin: 5px 0;
    font-size: 0.9em;
    line-height: 1.6;
}

.perf-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.perf-bar {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.perf-bar span {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.9);
}

.perf-bar .bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.perf-bar .bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
}

.improvement-high {
    color: #fca5a5;
}

.improvement-medium {
    color: #fcd34d;
}

.improvement-low {
    color: #86efac;
}

@media (max-width: 768px) {
    :root {
        --cell-size: 24px;
    }

    .game-title h1 {
        font-size: 1.8em;
    }

    .game-header {
        flex-direction: column;
        text-align: center;
    }

    .game-area {
        flex-direction: column;
    }

    .maze-analysis {
        margin-bottom: 10px;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* Level Select Modal Styles */
.level-select-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.level-select-modal.show {
    display: flex !important;
}

.level-select-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 15px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid var(--gold);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
    margin: 20px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.level-select-content h2 {
    color: var(--gold);
    margin-bottom: 20px;
}

.progress-summary {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.progress-summary div {
    font-size: 1.1em;
    color: white;
}

.worlds-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.world-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.world-section.locked {
    opacity: 0.5;
    filter: grayscale(50%);
}

.world-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.world-header h3 {
    color: var(--gold);
    margin: 0;
}

.world-stars {
    color: var(--gold);
    font-weight: bold;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.level-card {
    background: linear-gradient(135deg, rgba(0, 100, 255, 0.2), rgba(0, 150, 255, 0.1));
    padding: 15px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.level-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
    box-shadow: 0 5px 20px rgba(255, 200, 0, 0.3);
}

.level-card.locked {
    background: rgba(100, 100, 100, 0.2);
    cursor: not-allowed;
    opacity: 0.6;
}

.level-card.locked:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.level-card.completed {
    border-color: var(--secondary);
}

.level-number {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--gold);
    margin-bottom: 5px;
}

.level-name {
    font-size: 0.9em;
    color: white;
    margin-bottom: 8px;
}

.level-stars {
    font-size: 1.2em;
    color: var(--gold);
}

.level-card.locked .level-stars {
    color: rgba(255, 255, 255, 0.3);
}

/* Level Intro Modal Styles */
.level-intro-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.level-intro-modal.show {
    display: flex !important;
}

.level-intro-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    border: 2px solid var(--gold);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
    margin: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.level-intro-content h2 {
    color: var(--gold);
    margin-bottom: 10px;
}

.level-description {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    margin-bottom: 20px;
}

.objectives-section,
.star-requirements {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.objectives-section h3,
.star-requirements h3 {
    color: var(--secondary);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.objective-item,
.star-requirement-item {
    padding: 8px;
    margin-bottom: 5px;
    border-left: 3px solid var(--gold);
    padding-left: 12px;
}

.level-stats {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.level-stats div {
    color: white;
}

.level-stats span {
    color: var(--gold);
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .levels-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .level-card {
        padding: 10px;
    }

    .progress-summary {
        flex-direction: column;
        gap: 10px;
    }
}
