/* Styles pour le jeu */

@font-face {
    font-family: 'Unown';
    src: url('../fonts/Unown.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Overlay pour les animations (écran noir/rouge) - Par défaut couvre le canvas */
.overlay {
    background-color: black;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.newCharacterDialogue {
    font-family: 'Unown';
    user-select: none;
}

/* Boîte de dialogue des personnages - responsive */
.dialogue-box {
    background-color: white;
    height: 100px;
    position: absolute;
    bottom: 0px;
    left: 0px;
    right: 0px;
    border-top: 4px black solid;
    display: none;
    padding: 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    cursor: pointer;
    box-sizing: border-box;
    z-index: 15;
    line-height: 1.4;
}

/* Choix de dialogue - au-dessus de la boîte de dialogue */
.dialogue-choices {
    background-color: white;
    position: absolute;
    bottom: 110px;
    right: 50px;
    border: 4px black solid;
    padding: 12px;
    display: none;
    min-width: 120px;
    font-family: 'Press Start 2P', cursive;
    z-index: 16;
}

.choice-option {
    padding: 8px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.choice-option.selected {
    background-color: #f0f0f0;
}

.choice-arrow {
    margin-right: 10px;
    color: black;
}

.choice-text {
    user-select: none;
}

/* Controls hint - indicateur des touches */
.controls-hint {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    z-index: 14;
    pointer-events: none;
    opacity: 0.7;
}

/* Combat UI Styles */
.ui-container {
    display: none;
}

.status-box {
    background-color: white;
    width: 300px;
    position: absolute;
    border: 4px black solid;
    padding: 12px;
    box-sizing: border-box;
}

.status-box.enemy {
    top: 50px;
    left: 55px;
}

.status-box.player {
    top: 300px;
    right: 45px;
}

.status-title {
    font-size: 16px;
    color: black;
}

.health-bar-container {
    position: relative;
}

.health-bar-background {
    height: 10px;
    background-color: #ccc;
    margin-top: 10px;
}

.health-bar {
    height: 10px;
    background-color: green;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.xp-bar {
    height: 10px;
    background-color: #4CAF50;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transition: width 0.3s ease;
}

.xp-bar-container {
    margin-top: 8px;
}

.xp-bar-container .health-bar-background {
    position: relative;
}

.battle-options {
    background-color: white;
    height: 100px;
    position: absolute;
    bottom: 0px;
    left: 0px;
    right: 0px;
    border-top: 4px black solid;
    display: flex;
}

.dialogue {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: white;
    padding: 12px;
    display: none;
    cursor: pointer;
}

.attacks-box {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.attack-type-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-left: 4px black solid;
}

.attack-type-title {
    font-size: 16px;
}

/* Styles pour les boutons d'attaque */
#attacksBox button,
#attacksBoxTrainer button {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    padding: 12px;
    margin: 2px;
    border: 3px solid black;
    background-color: white;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

#attacksBox button:hover,
#attacksBoxTrainer button:hover {
    background-color: #f0f0f0;
}

#attacksBox button.selected,
#attacksBoxTrainer button.selected {
    background-color: #4CAF50;
    color: white;
}

body {
    margin: 0;
    padding: 0;
    background: #000;
}

.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Game Boy Styles */
.gameboy {
    display: inline-block;
    position: relative;
}

.screen-area {
    position: relative;
}

.display {
    display: block;
}

/* Masquer la Game Boy par défaut sur desktop */
@media (min-width: 801px) {
    .gameboy {
        display: block;
        position: relative;
        width: auto;
        max-width: 1024px;
        margin: 0 auto;
    }

    .screen-area {
        position: relative;
        padding: 0;
        background: transparent;
    }

    .display {
        background-color: #000;
        width: 1024px;
        height: 576px;
        border-radius: 0;
        margin: 0 auto;
    }

    .nintendo {
        display: none;
    }

    .speaker {
        display: none;
    }
}

/* Media queries pour afficher la Game Boy uniquement sur les petits écrans */
@media (max-width: 800px) {
    .gameboy {
        display: block;
        position: relative;
        width: 100vw;
        height: 100vh;
        border-radius: 20px;
        padding: 15px;
        background-color: #4f50db;
        font-family: sans-serif;
        -webkit-user-select: none;
        cursor: default;
        box-sizing: border-box;
        overflow: hidden;
    }

    .screen-area {
        position: relative;
        padding: 12% 3% 1% 3%;
        border-radius: 15px;
        background-color: #23252d;
        color: #67879a;
        box-shadow: 0px 2px 0px black, 0px -2px 0px black, -2px 0px 0px black, 2px 0px 0px black;
        box-sizing: border-box;
    }

    .screen-area::after {
        content: "";
        display: block;
        position: absolute;
        top: 98%;
        left: 2%;
        width: 96%;
        height: 3%;
        border-radius: 50%;
        background-color: #23252d;
        box-shadow: 0px 2px 0px black;
    }

    .display {
        background-color: #929d97;
        height: 30vh;
        width: 100%;
        border-radius: 0.5vh;
        margin-bottom: 2vh;
        box-shadow: inset 0px 4px 5px rgba(0, 0, 0, 0.5), inset 0px -2px 0px rgba(255, 255, 255, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .display canvas {
        max-width: 100%;
        max-height: 100%;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .label {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1vw;
        margin-top: 5vw;
    }

    .label .title {
        font-size: 2vw;
        font-weight: 900;
        color: #3a3e98;
        text-shadow: 0px -2px 1px #6b67ed;
    }

    .label .subtitle {
        font-size: 1.5vw;
        font-weight: 900;
        text-shadow: 0px -2px 1px #6b67ed;
        line-height: 1;
        text-align: center;
    }

    .label .subtitle .c {
        color: #c44a3d;
    }

    .label .subtitle .o1 {
        color: #5171c4;
    }

    .label .subtitle .l {
        color: #62ac3e;
    }

    .label .subtitle .o2 {
        color: #ddb731;
    }

    .label .subtitle .r {
        color: #317aaf;
    }

    .nintendo {
        padding: 5px 10px;
        width: 180px;
        color: #3436bf;
        font-weight: bold;
        text-align: center;
        margin: 0 auto;
        border: 2px solid #3436bf;
        border-radius: 11px;
        margin-top: 30px;
        text-shadow: 0px -2px 1px #6b67ed;
        box-shadow: 0px -2px 1px #6b67ed;
    }

    .nintendo input[type="text"] {
        width: calc(100% - 10px);
        padding: 8px 5px;
        margin-bottom: 8px;
        border: 1px solid #3436bf;
        border-radius: 5px;
        box-shadow: inset 0px -2px 1px #6b67ed;
        font-family: 'Press Start 2P', sans-serif;
        text-align: center;
        color: #8686be;
        font-size: 12px;
    }

    .formSolana {
        background-color: #4f50db;
        border-radius: 20px;
    }

    .nintendo button {
        width: 100%;
        padding: 8px 5px;
        background: transparent;
        border: none;
        color: #3436bf;
        font-weight: bold;
        text-shadow: 0px -2px 1px #6b67ed;
        cursor: pointer;
        font-family: inherit;
        font-size: 14px;
        line-height: 1.2;
    }

    .nintendo button:hover {
        background-color: #3436bf;
        color: #6b67ed;
    }

    .controls {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0 10px;
        box-sizing: border-box;
        max-width: 100%;
        gap: 10px;
    }

    .controls .dpad {
        position: relative;
        display: inline-block;
        margin-top: 5vw;
        margin-left: 2vw;
        width: 28vw;
        height: 28vw;
        z-index: 5;
        flex-shrink: 0;
    }

    .controls .dpad>* {
        width: 33%;
        height: 33%;
        position: absolute;
        background-color: #565e6a;
        cursor: pointer;
    }

    .controls .dpad>*:active {
        box-shadow: inset 0px 1px 3px black;
        background-color: #434951;
    }

    .controls .dpad .up {
        top: 0;
        left: 33%;
        border-radius: 0.4vh 0.4vh 0 0;
    }

    .controls .dpad .right {
        top: 33%;
        right: 0;
        border-radius: 0 0.4vh 0.4vh 0;
    }

    .controls .dpad .down {
        bottom: 0;
        left: 33%;
        border-radius: 0 0 0.4vh 0.4vh;
    }

    .controls .dpad .left {
        top: 33%;
        left: 0;
        border-radius: 0.4vh 0 0 0.4vh;
    }

    .controls .dpad .middle {
        top: 33%;
        left: 33%;
        background-color: #434951;
        border-radius: 0;
        cursor: default;
    }

    .controls .dpad i {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
        font-size: 5vw;
        color: #23252d;
    }

    .controls .a-b {
        position: relative;
        display: inline-block;
        margin-top: 12vw;
        margin-right: 5vw;
        width: 28vw;
        height: 14vw;
        flex-shrink: 0;
    }

    .controls .a-b>* {
        position: absolute;
        width: 14vw;
        height: 14vw;
        border-radius: 50%;
        background-color: #c85679;
        box-shadow: 0px 3px 0px #862041, inset 0px 1px 4px rgba(255, 255, 255, 0.5);
        cursor: pointer;
        font-size: 3vw;
        font-weight: 700;
        color: #565e6a;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .controls .a-b>*:active {
        box-shadow: 0px 0px 0px #862041, inset 0px 1px 4px rgba(0, 0, 0, 0.5);
        margin-top: 0.5vh;
    }

    .controls .a-b .b {
        bottom: 0;
        left: 0;
    }

    .controls .a-b .a {
        top: 0;
        right: 0;
    }

    /* Responsive UI pour combat sur mobile */
    .ui-container {
        transform: scale(0.32);
        transform-origin: top left;
        width: 312.5%;
        height: 312.5%;
    }

    .status-box {
        width: 280px;
        padding: 8px;
        border: 3px black solid;
    }

    .status-box.enemy {
        top: -780px;
        left: 15px;
    }

    .status-box.player {
        top: auto;
        bottom: 135px;
        right: 15px;
    }

    .status-title {
        font-size: 14px;
        margin: 0;
    }

    .health-bar-background {
        height: 8px;
        margin-top: 6px;
    }

    .health-bar {
        height: 8px;
    }

    .xp-bar {
        height: 8px;
    }

    .xp-bar-container {
        margin-top: 6px;
    }

    .xp-bar-container>div {
        font-size: 9px !important;
        margin-bottom: 3px !important;
    }

    .battle-options {
        height: 100px;
    }

    .dialogue {
        padding: 10px;
        font-size: 12px;
    }

    #attacksBox button,
    #attacksBoxTrainer button {
        font-size: 11px;
        padding: 8px 6px;
        margin: 2px;
        border: 2px solid black;
    }

    .attack-type-container {
        border-left: 3px black solid;
    }

    .attack-type-title {
        font-size: 12px;
    }

    /* Dialogue box des personnages en mobile - 50px alignée avec .battle-options */
    .dialogue-box {
        height: 50px;
        padding: 8px;
        font-size: 10px;
        bottom: 50px;
        left: 0;
        right: 0;
        border-top: 3px black solid;
        line-height: 1.2;
    }

    /* Choices dialog - juste au-dessus de la dialogue box */
    .dialogue-choices {
        bottom: 110px;
        right: 20px;
        padding: 8px;
        border: 3px black solid;
        min-width: 100px;
    }

    .choice-option {
        padding: 6px;
        font-size: 10px;
    }

    .choice-arrow {
        margin-right: 6px;
        font-size: 10px;
    }

    /* Controls hint - en bas du canvas */
    .controls-hint {
        font-size: 8px;
        padding: 5px 8px;
        bottom: 3px;
        transform: translateX(-50%);
    }

    /* Bag system responsive mobile */
    .bag-interface {
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        transform: none !important;
    }

    .bag-header h2 {
        font-size: 22px !important;
    }

    .bag-instruction {
        font-size: 13px !important;
    }

    .bag-items {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
        gap: 12px !important;
        padding: 15px !important;
    }

    .bag-item {
        padding: 12px !important;
        border: 2px solid #666 !important;
    }

    .bag-item-icon {
        font-size: 28px !important;
        margin-bottom: 8px !important;
    }

    .bag-item-name {
        font-size: 11px !important;
    }

    .empty-bag-message {
        font-size: 14px !important;
    }

    /* Item detail view responsive */
    .item-detail-view {
        width: 100% !important;
        height: 100% !important;
        left: 0 !important;
        top: 0 !important;
        transform: none !important;
    }

    .paper-container {
        max-width: 90% !important;
        padding: 20px !important;
    }

    .paper-title {
        font-size: 18px !important;
    }

    .paper-text {
        font-size: 13px !important;
    }

    .password-display {
        font-size: 20px !important;
        padding: 12px !important;
    }

    .password-hint-text {
        font-size: 11px !important;
    }

    .unown-legend p {
        font-size: 14px !important;
        letter-spacing: 1px !important;
    }

    .close-paper-btn {
        font-size: 12px !important;
        padding: 10px 20px !important;
    }

    /* Boutons flottants sur mobile */
    .floating-code-btn,
    .floating-bag-btn,
    .floating-mute-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
        top: 10px !important;
    }

    .floating-code-btn {
        right: 10px !important;
    }

    .floating-bag-btn {
        right: 70px !important;
    }

    .floating-mute-btn {
        right: 130px !important;
    }

    /* Notification d'item */
    .item-notification {
        transform: scale(0.8);
        transform-origin: top center;
    }
}