/* =============================================
   TOMB OF THE MONSTER — style.css
   Contient : variables, menu, HUD, canvas, mobile
   ============================================= */

:root {
    --purple:      #8e44ad;
    --purple-glow: #a855f7;
    --cyan:        #00fff7;
    --red:         #e74c3c;
    --yellow:      #f1c40f;
    --green:       #2ecc71;
    --dark:        #0a0a0f;
    --dark2:       #0f0f1a;
}

/* ---- RESET & BASE ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--dark);
    font-family: 'Share Tech Mono', monospace;
    overflow: hidden;
    height: 100vh;
    cursor: none;
}

/* ---- CUSTOM CURSOR ---- */
#cursor {
    position: fixed;
    width: 20px; height: 20px;
    border: 2px solid var(--cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--cyan);
    transition: transform 0.05s;
}
#cursor::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 4px; height: 4px;
    background: var(--cyan);
    border-radius: 50%;
}

/* ---- BACKGROUND CANVAS ---- */
#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.35;
}

/* ---- SCANLINES ---- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent, transparent 3px,
        rgba(0,0,0,0.12) 3px, rgba(0,0,0,0.12) 4px
    );
    pointer-events: none;
    z-index: 100;
}

/* ---- TRANSITION OVERLAY ---- */
#transition {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}
#transition.active {
    opacity: 1;
    pointer-events: all;
}
.transition-text {
    font-family: 'Black Ops One', cursive;
    font-size: 48px;
    color: var(--purple-glow);
    text-shadow: 0 0 30px var(--purple), 0 0 60px var(--purple);
    letter-spacing: 0.1em;
}

/* =============================================
   MENU SCREEN
   ============================================= */
#menu-screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.menu-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.particle {
    position: absolute;
    width: 3px; height: 3px;
    border-radius: 50%;
    animation: float-up linear infinite;
    opacity: 0;
}
@keyframes float-up {
    0%   { transform: translateY(100vh) scale(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* Logo */
.logo-wrap {
    text-align: center;
    margin-bottom: 10px;
    animation: logo-in 0.8s cubic-bezier(0.23, 1, 0.32, 1) both;
}
@keyframes logo-in {
    from { transform: translateY(-40px) scale(0.8); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.logo-subtitle {
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    letter-spacing: 0.5em;
    color: var(--purple-glow);
    text-transform: uppercase;
    margin-bottom: 8px;
    animation: pulse-text 2s ease-in-out infinite;
}
@keyframes pulse-text {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1; }
}
.logo-title {
    font-family: 'Black Ops One', cursive;
    font-size: clamp(36px, 7vw, 72px);
    color: #fff;
    text-shadow:
        0 0 20px var(--purple-glow),
        0 0 40px var(--purple-glow),
        0 0 80px var(--purple),
        4px 4px 0 #2d0a45;
    line-height: 0.9;
    letter-spacing: 0.03em;
}
.logo-title span {
    color: var(--purple-glow);
    text-shadow:
        0 0 20px var(--cyan),
        0 0 40px var(--cyan),
        0 0 80px var(--cyan),
        4px 4px 0 #003333;
    animation: neon-flicker 4s ease-in-out infinite;
}
@keyframes neon-flicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.4; }
    97% { opacity: 1; }
    98% { opacity: 0.2; }
    99% { opacity: 1; }
}
.logo-edition {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 0.6em;
    color: var(--yellow);
    margin-top: 6px;
    text-shadow: 0 0 10px var(--yellow);
}

/* Score bar */
.score-bar {
    display: flex;
    gap: 30px;
    margin-bottom: 28px;
    animation: fade-in 0.8s 0.3s both;
}
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.score-item {
    text-align: center;
    padding: 8px 20px;
    border: 1px solid rgba(142, 68, 173, 0.3);
    border-radius: 8px;
    background: rgba(142, 68, 173, 0.06);
}
.score-label {
    font-size: 8px;
    letter-spacing: 0.25em;
    color: #555;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.score-value {
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    font-weight: 900;
    color: var(--yellow);
    text-shadow: 0 0 10px var(--yellow);
}
.score-purple {
    color: var(--purple-glow) !important;
    text-shadow: 0 0 10px var(--purple-glow) !important;
}

/* Big Play Button */
.play-btn {
    position: relative;
    width: 200px; height: 200px;
    cursor: none;
    animation: btn-in 0.8s 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
    margin-bottom: 28px;
}
@keyframes btn-in {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.play-btn-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--purple-glow);
    box-shadow: 0 0 20px var(--purple), 0 0 40px var(--purple), inset 0 0 20px rgba(142,68,173,0.1);
    animation: spin-ring 8s linear infinite;
}
.play-btn-ring2 {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,255,247,0.3);
    animation: spin-ring 5s linear infinite reverse;
}
@keyframes spin-ring {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.play-btn-inner {
    position: absolute;
    inset: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #1a0a2e, #0a0a0f);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 2px solid rgba(142,68,173,0.4);
    transition: all 0.2s;
}
.play-btn:hover .play-btn-inner {
    background: radial-gradient(circle at 40% 35%, #2d1050, #0f0f20);
    box-shadow: inset 0 0 30px rgba(168, 85, 247, 0.3);
}
.play-btn:hover .play-btn-ring {
    box-shadow: 0 0 30px var(--purple), 0 0 60px var(--purple), inset 0 0 30px rgba(142,68,173,0.2);
    border-color: var(--cyan);
}
.play-btn:active .play-btn-inner {
    transform: scale(0.95);
}
.play-triangle {
    width: 0; height: 0;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-left: 38px solid #fff;
    margin-left: 8px;
    filter: drop-shadow(0 0 8px var(--cyan));
    transition: all 0.2s;
}
.play-btn:hover .play-triangle {
    border-left-color: var(--cyan);
}
.play-label {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 0.3em;
    color: #aaa;
    margin-top: 8px;
}

/* Level grid */
.level-section {
    animation: fade-in 0.8s 0.7s both;
    text-align: center;
    width: 100%;
    max-width: 500px;
}
.section-title {
    font-size: 9px;
    letter-spacing: 0.35em;
    color: #444;
    margin-bottom: 10px;
    text-transform: uppercase;
}
.level-grid {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.level-btn {
    width: 52px; height: 52px;
    border-radius: 10px;
    border: 1px solid #222;
    background: #0f0f1a;
    cursor: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}
.level-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(142,68,173,0.15), transparent);
    opacity: 0;
    transition: opacity 0.15s;
}
.level-btn:hover::before { opacity: 1; }
.level-btn:hover {
    border-color: var(--purple-glow);
    box-shadow: 0 0 12px var(--purple);
    transform: translateY(-2px);
}
.level-btn.selected {
    border-color: var(--cyan);
    box-shadow: 0 0 15px var(--cyan);
    background: rgba(0,255,247,0.05);
}
.level-num {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 900;
    color: #666;
    transition: color 0.15s;
}
.level-btn:hover .level-num,
.level-btn.selected .level-num {
    color: #fff;
    text-shadow: 0 0 8px var(--purple-glow);
}
.level-diff { display: flex; gap: 2px; }
.diff-dot { width: 4px; height: 4px; border-radius: 50%; }

/* Instructions */
.instructions {
    margin-top: 18px;
    font-size: 10px;
    color: #333;
    letter-spacing: 0.15em;
    animation: fade-in 0.8s 0.9s both;
}
.instructions kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid #333;
    border-radius: 3px;
    color: #555;
    font-size: 10px;
}
.coin-dot { color: #2ecc71; }
.trap-dot { color: #e74c3c; }

/* =============================================
   GAME SCREEN
   ============================================= */
#game-screen {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--dark);
}
#game-screen.active { display: flex; }

/* HUD */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: calc(100vw - 40px);
    padding: 8px 16px;
    background: rgba(0,0,0,0.5);
    border: 1px solid #1a1a2e;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}
.hud-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.hud-level {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    color: var(--purple-glow);
    letter-spacing: 0.1em;
}
.hud-sep { color: #333; font-size: 10px; }
.hud-score-wrap {
    font-size: 10px;
    color: #555;
}
#currentScore {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--yellow);
    text-shadow: 0 0 8px var(--yellow);
}
.hud-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.hud-best {
    font-size: 9px;
    color: #333;
    letter-spacing: 0.1em;
}
#hud-best { color: #555; }
.btn-menu {
    padding: 5px 14px;
    border: 1px solid #333;
    border-radius: 6px;
    background: transparent;
    color: #555;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-menu:hover {
    border-color: var(--purple-glow);
    color: var(--purple-glow);
}

/* Canvas — dimensions gérées par game.js via style.width/height */
#gameCanvas {
    display: block;
    border: 2px solid var(--purple);
    border-top: none;
    box-shadow: 0 0 30px rgba(142,68,173,0.3), 0 0 60px rgba(142,68,173,0.1);
    border-radius: 0 0 8px 8px;
}

/* =============================================
   MOBILE CONTROLS
   ============================================= */
.mobile-controls {
    display: none;
    gap: 4px;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}
.mobile-row { display: flex; gap: 4px; }
.dpad-btn {
    width: 52px; height: 52px;
    border: 1px solid #333;
    border-radius: 8px;
    background: rgba(142,68,173,0.1);
    color: #888;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.dpad-btn:active {
    background: rgba(142,68,173,0.4);
    color: #fff;
    border-color: var(--purple-glow);
}
.dpad-spacer { width: 52px; height: 52px; }

@media (max-width: 600px) {
    .mobile-controls { display: flex; }
    .instructions { display: none; }
    .game-hud { width: 95vw; }
}