/* Le Secret de Clamart - Phaser Edition - Styles */
/* Ambiance "Manoir de Mortevielle" — sombre, oppressante, mystérieuse */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'VT323', monospace;
}

/* ============================================ */
/* Container principal                          */
/* ============================================ */
#game-container {
    position: relative;
    width: 960px;
    height: 640px;
    background: #0a0a12;
    overflow: hidden;
    border: 2px solid #222;
}

/* ============================================ */
/* Écran de chargement                          */
/* ============================================ */
#loading-screen {
    position: absolute;
    inset: 0;
    background: #050510;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    color: #8a8a6a;
}

.loading-content h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #3a3a2a;
    color: #a09070;
}

.loading-content .subtitle {
    font-size: 20px;
    color: #555;
    margin-bottom: 30px;
}

.loading-bar-container {
    width: 300px;
    height: 20px;
    background: #111;
    border: 2px solid #333;
    margin: 0 auto 15px;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #5a5a4a, #8a8a6a);
    transition: width 0.3s;
}

.loading-text {
    color: #444;
    font-size: 18px;
}

/* ============================================ */
/* Écran titre                                  */
/* ============================================ */
#title-screen {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #050510 0%, #0a0a1e 50%, #0d0810 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 90;
}

.title-content {
    text-align: center;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 32px;
    color: #a09070;
    text-shadow: 3px 3px 0 #3a3020, -1px -1px 0 #706050;
    margin-bottom: 15px;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 3px 3px 0 #3a3020, 0 0 8px rgba(160,144,112,0.2); }
    to { text-shadow: 3px 3px 0 #3a3020, 0 0 16px rgba(160,144,112,0.4); }
}

.game-subtitle {
    font-size: 22px;
    color: #666;
    margin-bottom: 40px;
}

.menu-btn {
    display: block;
    margin: 10px auto;
    padding: 12px 40px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #a09070;
    background: transparent;
    border: 2px solid #5a5040;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: #5a5040;
    color: #0a0a12;
    transform: scale(1.05);
}

.credits {
    margin-top: 40px;
    color: #333;
    font-size: 16px;
}

/* ============================================ */
/* Écran de jeu                                 */
/* ============================================ */
#game-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#phaser-game {
    width: 960px;
    height: 540px;
    flex-shrink: 0;
}

#phaser-game canvas {
    display: block;
}

/* Texte de scène (nom du lieu) */
.scene-text {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #8a8a7a;
    font-size: 22px;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    text-shadow: 2px 2px 4px #000, -1px -1px 2px #000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 10;
}

.scene-text.visible {
    opacity: 1;
}

/* Texte d'action (hover feedback) */
#action-text {
    width: 960px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    color: #8a8a7a;
    font-size: 18px;
    background: rgba(0,0,0,0.95);
    pointer-events: none;
    z-index: 15;
    flex-shrink: 0;
}

/* Barre d'actions */
#action-bar {
    width: 960px;
    height: 36px;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 2px 10px;
    background: #080810;
    border-top: 2px solid #1a1a28;
    z-index: 20;
    flex-shrink: 0;
}

.action-btn {
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 4px 16px;
    background: #0d0d1a;
    color: #777;
    border: 1px solid #222;
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn:hover {
    background: #151528;
    color: #aaa;
}

.action-btn.active {
    background: #1a1528;
    color: #a09070;
    border-color: #5a5040;
}

/* Inventaire */
#inventory-bar {
    width: 960px;
    height: 40px;
    background: #050510;
    border-top: 2px solid #1a1a28;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 20;
    flex-shrink: 0;
}

#inventory-label {
    color: #444;
    font-size: 12px;
    margin-right: 8px;
    white-space: nowrap;
}

#inventory-items {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    padding: 2px;
    height: 36px;
    align-items: center;
}

.inventory-item {
    width: 32px;
    height: 32px;
    background: #0d0d1a;
    border: 2px solid #222;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
    flex-shrink: 0;
    position: relative;
}

.inventory-item:hover {
    border-color: #5a5040;
    transform: scale(1.15);
}

.inventory-item.selected {
    border-color: #a09070;
    background: #1a1528;
    box-shadow: 0 0 8px rgba(160,144,112,0.3);
}

.inventory-item .item-name {
    display: none;
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 12px;
    color: #8a8a6a;
    background: rgba(0,0,0,0.9);
    padding: 2px 6px;
    border-radius: 2px;
    z-index: 30;
}

.inventory-item:hover .item-name {
    display: block;
}
.inventory-item.selected .item-name {
    display: block;
}

@media (max-width: 970px) {
    .inventory-item .item-name {
        display: block !important;
        position: static;
        transform: none;
        font-size: 9px;
        padding: 0;
        background: none;
        margin-top: 1px;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40px;
    }
    .inventory-item {
        flex-direction: column;
        height: auto !important;
        padding: 2px;
        width: auto !important;
        min-width: 36px;
    }
}

/* ============================================ */
/* Boîte de dialogue                            */
/* ============================================ */
#dialog-box {
    position: absolute;
    bottom: 106px;
    left: 20px;
    right: 20px;
    background: rgba(5, 5, 15, 0.96);
    border: 2px solid #5a5040;
    border-radius: 4px;
    padding: 15px;
    z-index: 50;
    max-height: 350px;
    overflow-y: auto;
}

#dialog-speaker {
    color: #a09070;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

#dialog-text {
    color: #bbb;
    font-size: 20px;
    line-height: 1.4;
    margin-bottom: 10px;
}

#dialog-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dialog-choice {
    color: #7799aa;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.dialog-choice:hover {
    color: #a09070;
    background: rgba(90, 80, 64, 0.15);
    border-color: #5a5040;
}

#dialog-continue {
    text-align: center;
    color: #555;
    font-size: 16px;
    cursor: pointer;
    padding-top: 8px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ============================================ */
/* Overlays                                     */
/* ============================================ */
#transition-overlay {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.0s;
    z-index: 80;
}

#transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#cutscene-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.96);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 70;
}

#cutscene-text {
    color: #8a8a7a;
    font-size: 24px;
    text-align: center;
    max-width: 700px;
    line-height: 1.6;
    animation: fadeIn 0.5s;
}

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

/* Notification */
.notification {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 35, 25, 0.95);
    color: #bbb;
    border: 1px solid #5a5040;
    padding: 10px 24px;
    font-size: 18px;
    border-radius: 4px;
    z-index: 60;
    animation: notifIn 0.3s ease-out;
    max-width: 80%;
    text-align: center;
    pointer-events: none;
}

@keyframes notifIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================ */
/* Rotation mobile (portrait → paysage)         */
/* ============================================ */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #050510;
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #5a5040;
    font-family: 'VT323', monospace;
    text-align: center;
    padding: 40px;
}

#rotate-overlay .rotate-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotatePhone 2s ease-in-out infinite;
}

#rotate-overlay .rotate-text {
    font-size: 24px;
    color: #a09070;
}

#rotate-overlay .rotate-sub {
    font-size: 18px;
    color: #555;
    margin-top: 10px;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-90deg); }
    50% { transform: rotate(-90deg); }
    75% { transform: rotate(0deg); }
}

@media (max-width: 970px) and (orientation: portrait) {
    #rotate-overlay {
        display: flex !important;
    }
    #game-container {
        display: none;
    }
}

/* ============================================ */
/* Tutoriel                                     */
/* ============================================ */
.tutorial-help-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(5, 5, 15, 0.9);
    border: 2px solid #5a5040;
    color: #8a8a6a;
    font-family: 'Press Start 2P', cursive;
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
    transition: all 0.2s;
    display: flex;
    -webkit-tap-highlight-color: rgba(90, 80, 64, 0.3);
    touch-action: manipulation;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tutorial-help-btn:hover {
    background: #5a5040;
    color: #0a0a12;
    transform: scale(1.1);
}

#tutorial-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 75;
    animation: fadeIn 0.4s;
}

#tutorial-content {
    background: rgba(8, 8, 18, 0.97);
    border: 2px solid #5a5040;
    border-radius: 8px;
    padding: 28px 32px 20px;
    max-width: 720px;
    width: 90%;
    max-height: 85%;
    overflow-y: auto;
    position: relative;
}

#tutorial-pages .tutorial-page {
    display: none;
}

#tutorial-pages .tutorial-page.active {
    display: block;
    animation: fadeIn 0.3s;
}

.tutorial-page h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    color: #a09070;
    text-shadow: 2px 2px 0 #3a3020;
    margin-bottom: 18px;
    text-align: center;
}

.tutorial-page .tutorial-section {
    margin-bottom: 16px;
}

.tutorial-page .tutorial-section h3 {
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: #8a8a6a;
    margin-bottom: 6px;
}

.tutorial-page .tutorial-section p {
    font-family: 'VT323', monospace;
    font-size: 19px;
    color: #999;
    line-height: 1.4;
    margin-bottom: 4px;
}

.tutorial-page .tutorial-highlight {
    color: #a09070;
    font-weight: bold;
}

.tutorial-page .tutorial-example {
    background: rgba(90, 80, 64, 0.1);
    border-left: 3px solid #5a5040;
    padding: 8px 12px;
    margin: 8px 0;
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #777;
    font-style: italic;
}

#tutorial-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #222;
}

.tutorial-nav-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    padding: 8px 18px;
    background: transparent;
    color: #a09070;
    border: 2px solid #5a5040;
    cursor: pointer;
    transition: all 0.2s;
}

.tutorial-nav-btn:hover {
    background: #5a5040;
    color: #0a0a12;
}

.tutorial-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
    background: transparent;
    color: #a09070;
}

.tutorial-nav-btn.tutorial-finish {
    background: #5a5040;
    color: #0a0a12;
    font-size: 12px;
}

.tutorial-nav-btn.tutorial-finish:hover {
    background: #8a8a6a;
}

#tutorial-page-indicator {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: #555;
}

/* ============================================ */
/* Responsive — scale le conteneur entier       */
/* ============================================ */
@media (max-width: 970px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        justify-content: center;
    }
    #game-container {
        border: none;
    }
    .action-btn {
        font-size: 15px;
        padding: 4px 10px;
    }
    #dialog-box {
        bottom: 80px;
        left: 10px;
        right: 10px;
        max-height: 45vh;
    }
    .game-title {
        font-size: 22px;
    }
    .game-subtitle {
        font-size: 16px;
    }
    .menu-btn {
        font-size: 12px;
        padding: 10px 30px;
    }
}
