/* ============================================
   Gardien des Reliques - Feuille de styles
   Design responsive - Thème temple/néon
   ============================================ */

#game-main {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    touch-action: none;
}

#gameWrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* --- HUD --- */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    font-size: clamp(0.75rem, 2.2vw, 1rem);
    font-weight: 700;
    text-shadow: 0 0 6px rgba(0,0,0,0.8), 0 1px 3px #000;
}

#livesDisplay {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
}

#scoreDisplay, #levelDisplay {
    background: rgba(0,0,0,0.45);
    border-radius: 8px;
    padding: 3px 10px;
}

#relicMsg, #alertMsg {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 18px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

#relicMsg {
    color: #ffe066;
    background: rgba(180,140,20,0.35);
    text-shadow: 0 0 12px #ffd700;
}

#alertMsg {
    color: #ff4444;
    background: rgba(180,20,20,0.35);
    text-shadow: 0 0 12px #ff0000;
}

#relicMsg.show, #alertMsg.show {
    opacity: 1;
}

/* --- Screens (title, death, win, rules) --- */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    z-index: 50;
    background: radial-gradient(ellipse at 50% 40%, rgba(30,20,50,0.92) 0%, rgba(10,8,20,0.97) 100%);
    animation: fadeIn 0.4s ease;
}

.screen.hidden {
    display: none !important;
}

.screen-title {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7, #ff6fd8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
}

.screen-sub {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: #b0b0ff;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 4px;
}

.divider {
    width: 60%;
    max-width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7b2ff7, transparent);
    margin: 14px 0;
}

.instr {
    font-size: clamp(0.72rem, 2vw, 0.9rem);
    color: #c9c0da;
    line-height: 1.8;
    text-align: center;
    max-width: 340px;
}

.rules-text {
    text-align: left;
    max-height: 50vh;
    overflow-y: auto;
    padding: 0 8px;
}

.rules-text p {
    margin-bottom: 8px;
}

/* --- Buttons --- */
.gr-btn {
    margin-top: 16px;
    padding: 14px 44px;
    font-size: clamp(0.85rem, 2.5vw, 1.05rem);
    font-weight: 700;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #00d2ff, #7b2ff7);
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,210,255,0.3);
    transition: transform 0.15s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Cinzel', 'Georgia', serif;
}

.gr-btn:active {
    transform: scale(0.95);
}

.gr-btn:hover {
    box-shadow: 0 6px 24px rgba(0,210,255,0.5);
}

.gr-btn-rules {
    background: linear-gradient(135deg, #ff6fd8, #7b2ff7);
    box-shadow: 0 4px 15px rgba(123,47,247,0.3);
    padding: 10px 30px;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
}

.gr-btn-stop {
    background: linear-gradient(135deg, #ff5252, #d50000);
    box-shadow: 0 4px 15px rgba(255,82,82,0.3);
    padding: 10px 30px;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
}

/* --- Death Flash --- */
#deathFlash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    transition: opacity 0.1s;
}

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

@keyframes pulseGlow {
    0%   { box-shadow: 0 0 8px rgba(255,215,0,0.4); }
    100% { box-shadow: 0 0 20px rgba(255,215,0,0.8); }
}

/* --- Responsive petits écrans --- */
@media (max-height: 550px) {
    #hud { padding: 4px 8px; font-size: 0.72rem; gap: 4px; }
    .screen { padding: 12px 10px; }
    .screen-title { font-size: clamp(1.4rem, 5vw, 2.2rem); }
    .gr-btn { padding: 10px 28px; font-size: 0.82rem; margin-top: 10px; }
    .instr { font-size: 0.7rem; }
}

/* --- Landscape mobile --- */
@media (orientation: landscape) and (max-height: 500px) {
    #gameWrapper { max-width: 100%; }
    .screen { padding: 8px; }
    .screen-title { font-size: clamp(1.2rem, 4vw, 1.8rem); }
    .instr { font-size: 0.68rem; line-height: 1.5; }
    .gr-btn { padding: 8px 22px; font-size: 0.78rem; margin-top: 8px; }
}

/* --- Tablettes / grands écrans --- */
@media (min-width: 768px) {
    .screen-title { font-size: 3.5rem; }
    .gr-btn { padding: 16px 52px; font-size: 1.1rem; }
}
