/* =========================================================
   CONFIGURAÇÕES GERAIS
========================================================= */

:root {
    --bg: #020e18;
    --bg-secondary: #041725;

    --panel: rgba(2, 24, 39, 0.82);

    --cyan: #3bd8ff;
    --cyan-soft: #1596bd;
    --cyan-dark: #0c5570;

    --white: #d8f6ff;

    --red: #ff3b42;
    --orange: #ff9f43;

    --grid: rgba(52, 179, 218, 0.22);

    --border: rgba(50, 195, 235, 0.65);

    --glow:
        0 0 8px rgba(40, 208, 255, 0.16);

    --cell-size: 22px;
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    min-height: 100%;

    background:
        radial-gradient(
            circle at 50% 20%,
            #08273c 0%,
            #031521 38%,
            #010a11 100%
        );

    color: var(--white);

    font-family: "Chakra Petch", sans-serif;

    overflow-x: auto;
}


body::before {

    content: "";

    position: fixed;
    inset: 0;

    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(45, 187, 225, 0.025) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(45, 187, 225, 0.025) 1px,
            transparent 1px
        );

    background-size: 32px 32px;

    z-index: 0;
}



.app {

    position: relative;

    z-index: 1;

    min-width: 1500px;

    padding: 15px;
}



/* =========================================================
   PAINÉIS
========================================================= */

.hud-panel {

    position: relative;

    border: 1px solid var(--border);

    background:
        linear-gradient(
            180deg,
            rgba(3, 28, 44, 0.95),
            rgba(2, 16, 28, 0.94)
        );

    box-shadow:
        inset 0 0 25px rgba(44, 190, 230, 0.03),
        var(--glow);

    clip-path: polygon(
        10px 0,
        calc(100% - 10px) 0,
        100% 10px,
        100% calc(100% - 10px),
        calc(100% - 10px) 100%,
        10px 100%,
        0 calc(100% - 10px),
        0 10px
    );
}


.hud-panel::before {

    content: "";

    position: absolute;

    top: 7px;
    left: 7px;

    width: 7px;
    height: 7px;

    border-top: 1px solid var(--cyan);
    border-left: 1px solid var(--cyan);

    opacity: 0.7;
}


.hud-panel::after {

    content: "";

    position: absolute;

    right: 7px;
    bottom: 7px;

    width: 7px;
    height: 7px;

    border-right: 1px solid var(--cyan);
    border-bottom: 1px solid var(--cyan);

    opacity: 0.7;
}


.panel-title,
.board-title {

    font-size: 17px;

    letter-spacing: 1.6px;

    color: var(--white);

    margin-bottom: 13px;

    text-shadow:
        0 0 8px rgba(70, 215, 255, 0.35);
}



/* =========================================================
   TOPO
========================================================= */

.topbar {

    display: grid;

    grid-template-columns:
        1fr 1.55fr 1fr;

    gap: 15px;

    margin-bottom: 15px;
}


.player-card {

    min-height: 120px;

    display: grid;

    grid-template-columns:
        78px 1fr 145px;

    align-items: center;

    gap: 15px;

    padding: 15px;
}


.avatar {

    width: 76px;
    height: 76px;

    border: 1px solid var(--cyan-soft);

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 33px;

    background:
        radial-gradient(
            circle,
            rgba(38, 167, 207, 0.15),
            rgba(5, 21, 33, 0.3)
        );

    box-shadow:
        inset 0 0 18px rgba(45, 187, 225, 0.08);
}


.enemy-avatar {
    color: #b4cad2;
}


.player-name {

    font-size: 25px;

    font-weight: 600;

    letter-spacing: 1.5px;
}


.player-rank {

    margin-top: 5px;

    font-size: 13px;

    color: #b8dbe6;

    letter-spacing: 0.8px;
}


.xp-bar {

    height: 10px;

    border: 1px solid var(--cyan-soft);

    margin-top: 12px;

    padding: 1px;
}


.xp-fill {

    height: 100%;

    background:
        linear-gradient(
            90deg,
            #b8f1ff,
            #4fd7ff
        );

    box-shadow:
        0 0 8px rgba(56, 211, 255, 0.5);
}


.enemy-xp {
    opacity: 0.85;
}


.stats {

    height: 82px;

    padding: 7px 10px;

    border-left: 1px solid rgba(49, 188, 230, 0.4);
}


.stats div {

    height: 23px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    font-family: "Share Tech Mono", monospace;

    font-size: 13px;

    color: #a6d7e6;
}


.stats strong {

    color: var(--white);

    font-weight: 400;
}



/* =========================================================
   TÍTULO CENTRAL
========================================================= */

.game-title {

    display: grid;

    grid-template-columns:
        120px 1fr 120px;

    align-items: center;

    text-align: center;
}


.game-title h1 {

    margin: 0;

    font-size: 27px;

    letter-spacing: 3px;

    font-weight: 600;
}


.game-title h2 {

    margin: 0;

    color: var(--cyan);

    font-size: 18px;

    letter-spacing: 7px;

    font-weight: 500;
}


.subtitle {

    color: var(--cyan-soft);

    margin-top: 9px;

    letter-spacing: 2px;

    font-size: 12px;
}


.ship-title-icon {

    color: var(--white);

    transform: scaleX(3.5);

    font-size: 16px;

    margin-bottom: 7px;
}



/* =========================================================
   MINI RADAR
========================================================= */

.mini-radar {

    display: flex;

    justify-content: center;
}


.mini-radar-circle {

    position: relative;

    width: 90px;
    height: 90px;

    border-radius: 50%;

    border: 1px solid rgba(47, 192, 235, 0.35);

    background:

        radial-gradient(
            circle,
            transparent 0 19%,
            rgba(33, 166, 206, 0.15) 20% 21%,
            transparent 22% 39%,
            rgba(33, 166, 206, 0.15) 40% 41%,
            transparent 42% 60%,
            rgba(33, 166, 206, 0.15) 61% 62%,
            transparent 63%
        );
}


.mini-radar-line {

    position: absolute;

    left: 50%;
    top: 50%;

    width: 1px;
    height: 43%;

    transform-origin:
        center bottom;

    background: var(--cyan);

    animation:
        radarRotate 4s linear infinite;
}



.compass {

    position: relative;

    width: 90px;
    height: 90px;

    margin: auto;
}


.compass-ring {

    position: absolute;

    inset: 5px;

    border: 1px solid rgba(45, 197, 238, 0.5);

    border-radius: 50%;
}


.compass-line {

    position: absolute;

    background: rgba(65, 202, 238, 0.4);
}


.compass-line.vertical {

    top: 8px;

    left: 50%;

    width: 1px;
    height: 74px;
}


.compass-line.horizontal {

    top: 50%;

    left: 8px;

    width: 74px;
    height: 1px;
}


.compass-needle {

    position: absolute;

    width: 0;
    height: 0;

    top: 15px;
    left: 38px;

    border-left:
        7px solid transparent;

    border-right:
        7px solid transparent;

    border-bottom:
        30px solid var(--cyan);

    opacity: 0.75;
}



/* =========================================================
   ÁREA DA BATALHA
========================================================= */

.battle-area {

    display: grid;

    grid-template-columns:
        200px
        minmax(520px, 1fr)
        minmax(520px, 1fr)
        205px;

    gap: 12px;

    align-items: stretch;
}



/* =========================================================
   FROTA
========================================================= */

.fleet-panel {

    padding: 15px;
}


.fleet-list {

    display: flex;

    flex-direction: column;

    gap: 8px;
}


.fleet-item {

    position: relative;

    min-height: 78px;

    padding:
        7px 5px 7px 5px;

    border-bottom:
        1px solid rgba(45, 184, 223, 0.14);
}


.fleet-item.destroyed {
    opacity: 0.35;
}


.fleet-name {

    margin-top: 4px;

    font-size: 12px;

    color: #c9effb;
}


.fleet-slots {

    color: var(--cyan);

    font-size: 11px;
}


.fleet-ship-icon {

    width: 125px;

    height: 35px;

    margin: auto;

    display: block;
}


.ship-outline {

    fill:
        rgba(30, 107, 130, 0.08);

    stroke: #caf5ff;

    stroke-width: 1.5;

    vector-effect:
        non-scaling-stroke;

    filter:
        drop-shadow(
            0 0 2px
            rgba(57, 214, 255, 0.22)
        );
}


.ship-inner {

    fill: none;

    stroke:
        rgba(198, 239, 250, 0.55);

    stroke-width: 1;

    vector-effect:
        non-scaling-stroke;
}



/* =========================================================
   TABULEIRO
========================================================= */

.board-panel {

    padding: 14px;

    min-height: 610px;
}


.board-title {

    text-align: center;

    margin-bottom: 7px;
}


.board-container {

    position: relative;

    width: 100%;
}


.coordinate-x {

    display: grid;

    grid-template-columns:
        repeat(20, 1fr);

    margin-left: 29px;

    height: 24px;
}


.coordinate-x span {

    display: flex;

    align-items: center;
    justify-content: center;

    font-family:
        "Share Tech Mono",
        monospace;

    color: #b9e6f3;

    font-size: 12px;
}


.board-line {

    display: flex;
}


.coordinate-y {

    width: 29px;

    display: grid;

    grid-template-rows:
        repeat(20, 1fr);
}


.coordinate-y span {

    display: flex;

    align-items: center;
    justify-content: center;

    font-family:
        "Share Tech Mono",
        monospace;

    color: #b9e6f3;

    font-size: 12px;
}


.board-grid {

    position: relative;

    width: calc(100% - 29px);

    aspect-ratio: 1 / 1;

    display: grid;

    grid-template-columns:
        repeat(20, 1fr);

    grid-template-rows:
        repeat(20, 1fr);

    border:
        1px solid rgba(57, 203, 244, 0.5);

    background:

        linear-gradient(
            rgba(15, 75, 96, 0.13),
            rgba(2, 19, 31, 0.16)
        );
}


.cell {

    position: relative;

    border-right:
        1px solid rgba(72, 186, 221, 0.26);

    border-bottom:
        1px solid rgba(72, 186, 221, 0.26);

    cursor: crosshair;

    transition:
        background 0.12s ease,
        box-shadow 0.12s ease;
}


.enemy-board .cell:hover {

    background:
        rgba(40, 202, 255, 0.14);

    box-shadow:
        inset 0 0 10px
        rgba(46, 215, 255, 0.18);
}


.cell.selected {

    background:
        rgba(62, 217, 255, 0.22);

    box-shadow:

        inset 0 0 10px
        rgba(62, 217, 255, 0.4),

        0 0 8px
        rgba(62, 217, 255, 0.45);
}


.cell.selected::before,
.cell.selected::after {

    content: "";

    position: absolute;

    background: var(--cyan);

    opacity: 0.85;
}


.cell.selected::before {

    top: 50%;
    left: -30%;

    width: 160%;
    height: 1px;
}


.cell.selected::after {

    top: -30%;
    left: 50%;

    width: 1px;
    height: 160%;
}



/* =========================================================
   TIROS
========================================================= */

.cell.miss::after {

    content: "";

    position: absolute;

    width: 35%;
    height: 35%;

    border: 1px solid #c6f4ff;

    border-radius: 50%;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%);

    box-shadow:
        0 0 5px
        rgba(203, 247, 255, 0.35);
}


.cell.hit {

    background:
        radial-gradient(
            circle,
            rgba(255, 42, 50, 0.38),
            rgba(255, 42, 50, 0.02)
        );
}


.cell.hit::before,
.cell.hit::after {

    content: "";

    position: absolute;

    width: 70%;
    height: 2px;

    top: 50%;
    left: 15%;

    background: var(--red);

    box-shadow:
        0 0 5px
        rgba(255, 40, 50, 0.8);
}


.cell.hit::before {

    transform: rotate(45deg);
}


.cell.hit::after {

    transform: rotate(-45deg);
}



/* =========================================================
   NAVIOS SOBRE O TABULEIRO
========================================================= */

.board-ship {

    position: absolute;

    z-index: 2;

    pointer-events: none;

    opacity: 0.9;
}


.board-ship svg {

    width: 100%;
    height: 100%;

    overflow: visible;
}


.board-ship.destroyed {

    stroke: var(--red);

    opacity: 0.4;
}



/* =========================================================
   LOG
========================================================= */

.battle-log-panel {

    display: flex;

    flex-direction: column;

    gap: 12px;
}


.log-section {

    padding: 15px;

    height: 465px;

    overflow: hidden;
}


.battle-log {

    display: flex;

    flex-direction: column;

    gap: 2px;
}


.log-entry {

    min-height: 27px;

    display: grid;

    grid-template-columns:
        42px 22px 1fr;

    align-items: center;

    border-bottom:
        1px solid rgba(50, 177, 215, 0.08);

    font-family:
        "Share Tech Mono",
        monospace;

    font-size: 12px;
}


.log-coordinate {

    color: #d5f6ff;
}


.log-icon {

    text-align: center;
}


.log-result {

    color: #b1d8e3;
}


.log-entry.hit .log-icon,
.log-entry.hit .log-result {

    color: var(--red);
}



/* =========================================================
   SONAR
========================================================= */

.sonar-panel {

    height: 170px;

    padding: 8px;

    display: flex;

    flex-direction: column;

    align-items: center;
}


.sonar {

    position: relative;

    width: 115px;
    height: 115px;

    border:
        1px solid rgba(46, 183, 224, 0.35);

    border-radius: 50%;

    overflow: hidden;
}


.sonar-circle {

    position: absolute;

    border:
        1px solid rgba(50, 194, 235, 0.2);

    border-radius: 50%;

    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);
}


.sonar-1 {

    width: 25%;
    height: 25%;
}


.sonar-2 {

    width: 52%;
    height: 52%;
}


.sonar-3 {

    width: 80%;
    height: 80%;
}


.sonar-cross {

    position: absolute;

    background:
        rgba(54, 191, 231, 0.23);
}


.sonar-cross.vertical {

    width: 1px;
    height: 100%;

    left: 50%;
}


.sonar-cross.horizontal {

    width: 100%;
    height: 1px;

    top: 50%;
}


.sonar-sweep {

    position: absolute;

    width: 50%;
    height: 50%;

    left: 50%;
    top: 0;

    transform-origin:
        left bottom;

    background:
        linear-gradient(
            35deg,
            rgba(48, 208, 249, 0.0),
            rgba(48, 208, 249, 0.22)
        );

    animation:
        radarRotate 2.7s
        linear infinite;
}


.sonar-center {

    position: absolute;

    width: 5px;
    height: 5px;

    background: var(--cyan);

    border-radius: 50%;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%);

    box-shadow:
        0 0 7px var(--cyan);
}


.sonar-status {

    display: flex;

    flex-direction: column;

    align-items: center;

    font-size: 10px;

    color: var(--cyan);

    letter-spacing: 1px;
}



/* =========================================================
   PARTE INFERIOR
========================================================= */

.bottom-area {

    display: grid;

    grid-template-columns:
        245px
        1fr
        215px;

    gap: 12px;

    margin-top: 12px;
}


.turn-panel {

    padding: 15px;
}


.turn-label {

    font-size: 15px;

    letter-spacing: 1px;
}


.timer-row {

    display: flex;

    align-items: center;

    gap: 15px;

    margin:
        9px 0 4px;
}


.hourglass {

    font-size: 28px;

    color: var(--white);
}


.timer {

    font-family:
        "Share Tech Mono",
        monospace;

    font-size: 30px;

    color: #c9f4ff;

    letter-spacing: 2px;
}


.timer-progress {

    width: 100%;

    height: 8px;

    border:
        1px solid var(--cyan-dark);

    overflow: hidden;
}


.timer-progress-fill {

    width: 100%;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #c7f4ff,
            #4fccec
        );
}


.target-display {

    display: flex;

    justify-content: space-between;

    margin-top: 10px;

    font-family:
        "Share Tech Mono",
        monospace;

    color: #82c8db;
}


.target-display strong {

    color: var(--cyan);

    font-size: 18px;
}


.fire-button {

    width: 100%;

    height: 49px;

    margin-top: 9px;

    border:
        1px solid var(--cyan-soft);

    background:
        rgba(10, 61, 80, 0.2);

    color: var(--cyan);

    font-family:
        "Chakra Petch",
        sans-serif;

    font-size: 17px;

    letter-spacing: 3px;

    cursor: pointer;

    transition: 0.2s;
}


.fire-button:not(:disabled):hover {

    background:
        rgba(23, 157, 195, 0.18);

    box-shadow:
        inset 0 0 15px
        rgba(55, 213, 255, 0.2),
        0 0 12px
        rgba(44, 204, 249, 0.18);
}


.fire-button:disabled {

    opacity: 0.28;

    cursor: not-allowed;
}



/* =========================================================
   CARTÕES DA FROTA
========================================================= */

.unit-selector {

    min-height: 155px;
}


.unit-cards {

    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    height: 100%;
}


.unit-card {

    position: relative;

    min-height: 152px;

    border-right:
        1px solid rgba(51, 188, 228, 0.35);

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 9px;

    padding: 10px;
}


.unit-card:last-child {
    border-right: 0;
}


.unit-card svg {

    width: 100px;
    height: 35px;
}


.unit-card-name {

    font-size: 12px;

    letter-spacing: 0.7px;
}


.unit-card-size {

    color: #a2d9e9;

    font-size: 12px;
}



/* =========================================================
   FERRAMENTAS
========================================================= */

.tools-panel {

    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 8px;
}


.hud-tool {

    border:
        1px solid var(--cyan-dark);

    background:
        rgba(4, 31, 48, 0.7);

    color: #a9e5f5;

    font-size: 28px;

    cursor: pointer;

    transition: 0.2s;
}


.hud-tool:hover {

    color: white;

    border-color: var(--cyan);

    background:
        rgba(24, 123, 154, 0.2);

    box-shadow:
        inset 0 0 15px
        rgba(59, 214, 255, 0.12);
}



/* =========================================================
   RODAPÉ
========================================================= */

.footer-message {

    position: relative;

    text-align: center;

    margin-top: 10px;

    color:
        rgba(43, 174, 211, 0.75);

    letter-spacing: 1px;

    font-size: 11px;
}


.footer-message span {

    position: absolute;

    right: 2px;
}



/* =========================================================
   FLASH
========================================================= */

#screenFlash {

    position: fixed;

    inset: 0;

    pointer-events: none;

    z-index: 9999;

    opacity: 0;
}


#screenFlash.hit-flash {

    animation:
        hitFlash 0.35s ease;
}



/* =========================================================
   ANIMAÇÕES
========================================================= */

@keyframes radarRotate {

    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


@keyframes hitFlash {

    0% {
        opacity: 0;
    }

    35% {

        opacity: 0.16;

        background: var(--red);
    }

    100% {
        opacity: 0;
    }
}



/* =========================================================
   RESPONSIVIDADE
========================================================= */

@media (max-width: 1700px) {

    .app {
        min-width: 1350px;
    }

    .battle-area {

        grid-template-columns:
            180px
            minmax(470px, 1fr)
            minmax(470px, 1fr)
            190px;
    }

    .player-card {

        grid-template-columns:
            65px
            1fr
            120px;
    }

    .avatar {

        width: 62px;
        height: 62px;
    }
}