* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
    color: white;
    overflow: hidden;
}


/* ================================================= */
/* PÁGINA INICIAL */
/* ================================================= */

body:not(.play-page) {

    display: flex;
    justify-content: center;
    align-items: center;

    background: #080808;
}


.background {

    position: fixed;
    inset: 0;

    background:
        radial-gradient(
            circle at center,
            #303030 0%,
            #111 45%,
            #050505 100%
        );

    z-index: -5;
}

/* ========================================= */
/* MODO LOCAL */
/* ========================================= */

.local-menu {

    width: 650px;

    max-width: 90vw;

    text-align: center;

    animation: menuAppear 0.7s ease;

}


.local-menu h1 {

    font-size: 42px;

    letter-spacing: 5px;

    text-shadow:
        0 5px 25px black;

}


.local-box {

    margin-top: 30px;

    padding: 30px;

    background:
        rgba(255,255,255,0.055);

    border:
        1px solid rgba(255,255,255,0.13);

    border-radius: 15px;

    box-shadow:
        0 20px 60px rgba(0,0,0,0.4);

    backdrop-filter:
        blur(10px);

}


.local-box h2 {

    margin: 0 0 20px;

    font-size: 14px;

    letter-spacing: 3px;

    opacity: 0.55;

}


/* ========================================= */
/* ESCOLHA DE JOGADORES */
/* ========================================= */

.player-options {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 12px;

}


.player-option {

    min-height: 130px;

    padding: 15px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 4px;

    color: white;

    background:
        rgba(255,255,255,0.035);

    border:
        1px solid rgba(255,255,255,0.1);

    border-radius: 10px;

    cursor: pointer;

    transition: 0.25s;

}


.player-option:hover {

    transform:
        translateY(-4px);

    background:
        rgba(255,255,255,0.08);

    border-color:
        rgba(255,255,255,0.3);

}


.player-option span {

    font-size: 25px;

    opacity: 0.6;

}


.player-option strong {

    font-size: 30px;

}


.player-option small {

    font-size: 11px;

    opacity: 0.45;

}


.player-option.selected-player {

    background:
        rgba(255,255,255,0.13);

    border:
        1px solid rgba(255,255,255,0.7);

    box-shadow:
        0 0 25px rgba(255,255,255,0.08);

    transform:
        translateY(-3px);

}


/* ========================================= */
/* INFORMAÇÃO */
/* ========================================= */

.local-info {

    margin-top: 22px;

    padding: 13px;

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 10px;

    background:
        rgba(0,0,0,0.25);

    border-radius: 8px;

    font-size: 13px;

    opacity: 0.65;

}


.local-info strong {

    color: white;

    opacity: 1;

}


/* ========================================= */
/* COMEÇAR */
/* ========================================= */

.start-local-button {

    width: 100%;

    margin-top: 22px;

    padding: 17px;

    border:
        1px solid white;

    border-radius: 8px;

    background:
        rgba(255,255,255,0.08);

    color: white;

    font-size: 18px;

    font-weight: bold;

    letter-spacing: 1px;

    cursor: pointer;

    transition: 0.25s;

}


.start-local-button:hover {

    background: white;

    color: #111;

    transform:
        translateY(-3px);

    box-shadow:
        0 10px 35px
        rgba(255,255,255,0.15);

}


/* ========================================= */
/* CELULAR */
/* ========================================= */

@media (max-width: 600px) {

    .player-options {

        grid-template-columns:
            1fr;

    }

    .player-option {

        min-height: 80px;

    }

}
.chess-board {

    position: fixed;

    width: 850px;
    height: 850px;

    transform: rotate(15deg);

    opacity: 0.16;

    background:
        linear-gradient(45deg, #ffffff 25%, transparent 25%),
        linear-gradient(-45deg, #ffffff 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ffffff 75%),
        linear-gradient(-45deg, transparent 75%, #ffffff 75%);

    background-size: 100px 100px;

    background-position:
        0 0,
        0 50px,
        50px -50px,
        -50px 0;

    z-index: -2;
}


.piece {

    position: absolute;

    font-size: 75px;

    text-shadow: 0 0 25px rgba(255,255,255,0.8);

    animation: floating 4s ease-in-out infinite;
}


.p1 {
    left: 8%;
    top: 10%;
}

.p2 {
    right: 12%;
    top: 20%;
}

.p3 {
    left: 15%;
    bottom: 15%;
}

.king1 {
    right: 20%;
    bottom: 10%;
}

.p4 {
    left: 30%;
    top: 5%;
}

.p5 {
    right: 35%;
    top: 12%;
}

.king2 {
    left: 5%;
    bottom: 35%;
}

.p6 {
    right: 5%;
    bottom: 30%;
}

.p7 {
    left: 40%;
    bottom: 5%;
}

.king3 {
    left: 25%;
    top: 35%;
}

.king4 {
    right: 25%;
    top: 40%;
}


@keyframes floating {

    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}


/* MENU INICIAL */

.inicio {

    text-align: center;

    padding: 50px;

    animation: appear 1s ease;
}


@keyframes appear {

    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.crown {

    font-size: 65px;

    margin-bottom: 5px;

    animation: crownGlow 2s infinite alternate;
}


@keyframes crownGlow {

    from {
        transform: scale(1);
        text-shadow: 0 0 10px white;
    }

    to {
        transform: scale(1.08);
        text-shadow: 0 0 35px white;
    }
}


h1 {

    font-size: 72px;

    letter-spacing: 8px;

    text-shadow: 0 5px 20px black;
}


h1 span {

    font-size: 95px;
}


h2 {

    font-size: 25px;

    letter-spacing: 12px;

    margin-top: 5px;
}


.description {

    margin-top: 20px;
    margin-bottom: 35px;

    font-size: 17px;

    line-height: 1.6;

    opacity: 0.75;
}


.play-button {

    width: 310px;

    padding: 18px;

    border: 2px solid white;

    border-radius: 8px;

    background: rgba(255,255,255,0.08);

    color: white;

    font-size: 23px;

    font-weight: bold;

    cursor: pointer;

    transition: 0.25s;

    box-shadow: 0 0 25px rgba(255,255,255,0.15);
}


.play-button:hover {

    transform: scale(1.06);

    background: white;

    color: #111;

    box-shadow: 0 0 40px rgba(255,255,255,0.6);
}


.secondary-buttons {

    margin-top: 18px;

    display: flex;

    justify-content: center;

    gap: 12px;
}


.secondary-buttons button {

    padding: 10px 25px;

    border: none;

    border-radius: 5px;

    background: transparent;

    color: white;

    cursor: pointer;

    opacity: 0.65;

    transition: 0.2s;
}


.secondary-buttons button:hover {

    opacity: 1;

    background: rgba(255,255,255,0.1);
}


.version {

    position: fixed;

    bottom: 15px;
    right: 20px;

    font-size: 11px;

    opacity: 0.35;

    letter-spacing: 2px;
}


/* ================================================= */
/* NOVA PÁGINA DE JOGAR */
/* ================================================= */

.play-page {

    background: #070707;

    display: flex;

    justify-content: center;

    align-items: center;
}


/* FUNDO */

.battle-background {

    position: fixed;

    inset: 0;

    background:
        radial-gradient(
            circle at center,
            #252525 0%,
            #101010 45%,
            #030303 100%
        );

    z-index: -10;
}


/* brilho central */

.battle-background::after {

    content: "";

    position: absolute;

    width: 700px;
    height: 700px;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background: rgba(255,255,255,0.035);

    filter: blur(70px);
}


/* ================================================= */
/* REIS GIGANTES */
/* ================================================= */

.giant-king {

    position: fixed;

    font-size: 220px;

    opacity: 0.045;

    pointer-events: none;

    z-index: -2;

    animation: kingFloat 6s ease-in-out infinite;
}


.red-king {

    left: -35px;
    top: -40px;

    transform: rotate(-10deg);
}


.blue-king {

    right: -35px;
    top: -40px;

    transform: rotate(10deg);
}


.green-king {

    left: -35px;
    bottom: -50px;

    transform: rotate(10deg);
}


.yellow-king {

    right: -35px;
    bottom: -50px;

    transform: rotate(-10deg);
}


@keyframes kingFloat {

    0%, 100% {
        margin-top: 0;
    }

    50% {
        margin-top: -12px;
    }
}


/* ================================================= */
/* MENU */
/* ================================================= */

.play-menu {

    width: 700px;

    max-width: 90vw;

    text-align: center;

    animation: menuAppear 0.7s ease;
}


@keyframes menuAppear {

    from {
        opacity: 0;
        transform: translateY(25px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.play-crown {

    font-size: 48px;

    margin-bottom: 10px;

    text-shadow: 0 0 25px rgba(255,255,255,0.5);
}


.play-menu h1 {

    font-size: 42px;

    letter-spacing: 5px;

    text-shadow: 0 5px 25px black;
}


.play-subtitle {

    margin-top: 12px;

    margin-bottom: 32px;

    opacity: 0.5;

    font-size: 16px;
}


/* ================================================= */
/* OPÇÕES PRINCIPAIS */
/* ================================================= */

.main-options {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 15px;
}


.main-option {

    position: relative;

    min-height: 155px;

    padding: 25px;

    display: flex;

    align-items: center;

    text-align: left;

    gap: 18px;

    color: white;

    background: rgba(255,255,255,0.055);

    border: 1px solid rgba(255,255,255,0.13);

    border-radius: 12px;

    cursor: pointer;

    overflow: hidden;

    transition:
        transform 0.25s,
        background 0.25s,
        border 0.25s,
        box-shadow 0.25s;
}


.main-option::before {

    content: "";

    position: absolute;

    left: 0;
    top: 0;

    width: 4px;
    height: 100%;

    background: white;

    opacity: 0.7;
}


.main-option:hover {

    transform: translateY(-5px);

    background: rgba(255,255,255,0.10);

    border-color: rgba(255,255,255,0.4);

    box-shadow: 0 15px 40px rgba(0,0,0,0.35);
}


.option-symbol {

    font-size: 50px;

    width: 65px;

    text-align: center;

    text-shadow: 0 0 20px rgba(255,255,255,0.35);
}


.option-text h2 {

    font-size: 18px;

    letter-spacing: 2px;

    margin-bottom: 8px;
}


.option-text p {

    font-size: 13px;

    line-height: 1.5;

    opacity: 0.5;
}


.arrow {

    position: absolute;

    right: 18px;

    font-size: 25px;

    opacity: 0.35;

    transition: 0.25s;
}


.main-option:hover .arrow {

    right: 13px;

    opacity: 1;
}


/* ================================================= */
/* OPÇÕES PEQUENAS */
/* ================================================= */

.small-options {

    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 15px;

    margin-top: 15px;
}


.small-options button {

    padding: 17px 20px;

    display: grid;

    grid-template-columns: 40px 1fr;

    grid-template-rows: 20px 18px;

    column-gap: 12px;

    text-align: left;

    color: white;

    background: rgba(255,255,255,0.035);

    border: 1px solid rgba(255,255,255,0.09);

    border-radius: 10px;

    cursor: pointer;

    transition: 0.25s;
}


.small-options button:hover {

    background: rgba(255,255,255,0.08);

    border-color: rgba(255,255,255,0.25);
}


.small-options span {

    grid-row: 1 / 3;

    font-size: 30px;

    align-self: center;

    text-align: center;
}


.small-options strong {

    font-size: 14px;

    letter-spacing: 1px;
}


.small-options small {

    font-size: 11px;

    opacity: 0.4;

    margin-top: 4px;
}


/* ================================================= */
/* VOLTAR */
/* ================================================= */

.back-button {

    margin-top: 28px;

    padding: 9px 20px;

    border: none;

    background: transparent;

    color: white;

    opacity: 0.4;

    cursor: pointer;

    transition: 0.2s;
}


.back-button:hover {

    opacity: 1;

    transform: translateX(-4px);
}


.game-version {

    position: fixed;

    bottom: 15px;

    right: 20px;

    font-size: 10px;

    letter-spacing: 2px;

    opacity: 0.25;
}


/* ================================================= */
/* CELULAR */
/* ================================================= */

@media (max-width: 650px) {

    .play-menu h1 {

        font-size: 28px;

        letter-spacing: 3px;
    }

    .main-options,
    .small-options {

        grid-template-columns: 1fr;
    }

    .main-option {

        min-height: 125px;
    }

    .giant-king {

        font-size: 140px;
    }
}

/* ================================= */
/* CRIAR SALA */
/* ================================= */

.create-menu {

    width: 520px;

    max-width: 90vw;

    text-align: center;

    animation: menuAppear 0.7s ease;
}


.create-menu h1 {

    font-size: 45px;

    letter-spacing: 6px;

    text-shadow: 0 5px 25px black;
}


.create-box {

    margin-top: 30px;

    padding: 35px;

    background: rgba(255,255,255,0.055);

    border: 1px solid rgba(255,255,255,0.13);

    border-radius: 14px;

    box-shadow:
        0 20px 60px rgba(0,0,0,0.35);

    backdrop-filter: blur(10px);

    text-align: left;
}


.create-box label {

    display: block;

    margin-bottom: 8px;

    margin-top: 20px;

    font-size: 12px;

    letter-spacing: 2px;

    opacity: 0.55;
}


.create-box label:first-child {

    margin-top: 0;
}


.create-box input,
.create-box select {

    width: 100%;

    padding: 14px 15px;

    border-radius: 7px;

    border: 1px solid rgba(255,255,255,0.15);

    background: rgba(0,0,0,0.35);

    color: white;

    outline: none;

    font-size: 15px;

    transition: 0.2s;
}


.create-box input::placeholder {

    color: rgba(255,255,255,0.35);
}


.create-box input:focus,
.create-box select:focus {

    border-color: rgba(255,255,255,0.6);

    box-shadow: 0 0 15px rgba(255,255,255,0.08);
}


.create-box select option {

    background: #151515;

    color: white;
}


.create-button {

    width: 100%;

    margin-top: 30px;

    padding: 16px;

    border: 1px solid white;

    border-radius: 8px;

    background: rgba(255,255,255,0.08);

    color: white;

    font-size: 17px;

    font-weight: bold;

    letter-spacing: 1px;

    cursor: pointer;

    transition: 0.25s;
}


.create-button:hover {

    background: white;

    color: #111;

    transform: translateY(-3px);

    box-shadow:
        0 10px 30px rgba(0,0,0,0.4);
}

/* ================================= */
/* LINKS DOS MODOS */
/* ================================= */

.small-option-link {

    padding: 17px 20px;

    display: grid;

    grid-template-columns: 40px 1fr;

    grid-template-rows: 20px 18px;

    column-gap: 12px;

    text-align: left;

    color: white;

    text-decoration: none;

    background: rgba(255,255,255,0.035);

    border: 1px solid rgba(255,255,255,0.09);

    border-radius: 10px;

    cursor: pointer;

    transition: 0.25s;
}


.small-option-link:hover {

    background: rgba(255,255,255,0.08);

    border-color: rgba(255,255,255,0.25);

    transform: translateY(-2px);
}


.small-option-link span {

    grid-row: 1 / 3;

    font-size: 30px;

    align-self: center;

    text-align: center;
}


.small-option-link strong {

    font-size: 14px;

    letter-spacing: 1px;
}


.small-option-link small {

    font-size: 11px;

    opacity: 0.4;

    margin-top: 4px;
}

/* Cópia antiga do HTML preservada apenas como referência.
   O comentário impede que este trecho interfira no CSS original.
<!DOCTYPE html>
<html lang="pt-BR">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Xadrez 4: Guerra dos Reis</title>

    <link rel="stylesheet" href="style.css">
</head>

<body>

    <!-- Fundo -->
    <div class="background"></div>

    <!-- Tabuleiro decorativo -->
    <div class="chess-board">

        <div class="piece p1">♜</div>
        <div class="piece p2">♞</div>
        <div class="piece p3">♝</div>
        <div class="piece king1">♚</div>

        <div class="piece p4">♟</div>
        <div class="piece p5">♟</div>

        <div class="piece king2">♔</div>

        <div class="piece p6">♙</div>
        <div class="piece p7">♙</div>

        <div class="piece king3">♚</div>
        <div class="piece king4">♔</div>

    </div>


    <!-- CONTEÚDO PRINCIPAL -->

    <main class="inicio">

        <div class="crown">♛</div>

        <h1>XADREZ <span>4</span></h1>

        <h2>GUERRA DOS REIS</h2>

        <p class="description">
            Quatro reis. Quatro exércitos.<br>
            Apenas um poderá vencer.
        </p>


        <button
            class="play-button"
            onclick="window.location.href='jogar.html'">

            ♟ JOGAR

        </button>


        <div class="secondary-buttons">

            <button onclick="abrirSobre()">
                SOBRE
            </button>

            <button onclick="abrirCreditos()">
                CRÉDITOS
            </button>

        </div>

    </main>


    <!-- ================================= -->
    <!-- JANELA SOBRE -->
    <!-- ================================= -->

    <div
        id="sobreModal"
        class="info-modal"
        onclick="fecharModalFora(event)">

        <div class="info-box">

            <button
                class="close-button"
                onclick="fecharSobre()">

                ×

            </button>

            <div class="modal-icon">
                ♟
            </div>

            <h2> SOBRE O JOGO </h2>

            <p>

                <strong>Xadrez 4: Guerra dos Reis</strong>
                é uma versão diferente do xadrez tradicional.

                <br><br>

                Quatro jogadores controlam seus próprios
                exércitos e lutam em um enorme tabuleiro.

                <br><br>

                Quando restarem apenas dois reis,
                a batalha muda para um xadrez normal.

                <br><br>

                <strong>Quem será o último rei de pé?</strong>

            </p>

            <button
                class="modal-close"
                onclick="fecharSobre()">

                FECHAR

            </button>

        </div>

    </div>


    <!-- ================================= -->
    <!-- JANELA CRÉDITOS -->
    <!-- ================================= -->

    <div
        id="creditosModal"
        class="info-modal"
        onclick="fecharModalFora(event)">

        <div class="info-box credits-box">

            <button
                class="close-button"
                onclick="fecharCreditos()">

                ×

            </button>

            <div class="modal-icon">
                👑
            </div>

            <h2> CRÉDITOS </h2>

            <div class="credit-item">

                <strong>CRIADOR</strong>

                <span>
                    Daniel
                </span>

            </div>


            <div class="credit-item">

                <strong>PROJETO</strong>

                <span>
                    Xadrez 4: Guerra dos Reis
                </span>

            </div>


            <div class="credit-item">

                <strong>VERSÃO</strong>

                <span>
                    BETA
                </span>

            </div>


            <button
                class="modal-close"
                onclick="fecharCreditos()">

                FECHAR

            </button>

        </div>

    </div>


    <div class="version">
        XADREZ 4 • BETA
    </div>


    <script src="script.js"></script>

</body>
</html>
*/

[hidden] {
    display: none !important;
}

.form-message {
    margin: 4px 0 0;
    padding: 10px 12px;
    color: #ffb2ba;
    background: rgba(255, 70, 90, 0.12);
    border: 1px solid rgba(255, 90, 105, 0.35);
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.4;
}

.create-button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.offline-box p {
    margin: 0 0 22px;
    opacity: 0.65;
    line-height: 1.6;
}

.offline-link {
    display: block;
    text-decoration: none;
}

@media (max-height: 760px), (max-width: 650px) {
    body.play-page {
        overflow-y: auto;
        padding: 32px 0 55px;
    }
}
