/* =========================================
   BASE
========================================= */
@font-face {
    font-family: 'LibrasFont';
    src: url('./Libras2020-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --pad-top-color: #00f3ff;
    --pad-right-color: #ff00ff;
    --pad-bottom-color: #00ff00;
    --pad-left-color: #ffaa00;
    --bg-color: #050510;
    --panel-bg: rgba(10, 10, 20, 0.8);
    --panel-border: rgba(0, 243, 255, 0.3);
    --panel-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
    --pad-size: clamp(8.6rem, 31vmin, 16.5rem);
    --board-gap: clamp(1.1rem, 3.2vmin, 2rem);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 50% -10%, rgba(78, 152, 255, 0.18), transparent 34%),
        radial-gradient(circle at 90% 10%, rgba(0, 255, 225, 0.1), transparent 28%),
        radial-gradient(circle at 10% 80%, rgba(195, 0, 255, 0.1), transparent 30%),
        var(--bg-color);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    touch-action: none;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: -15%;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: screen;
}

body::before {
    background:
        radial-gradient(circle at 20% 35%, rgba(88, 150, 255, 0.2), transparent 34%),
        radial-gradient(circle at 76% 24%, rgba(0, 230, 255, 0.16), transparent 30%),
        radial-gradient(circle at 58% 78%, rgba(145, 70, 255, 0.16), transparent 35%);
    animation: nebulaDriftA 28s linear infinite;
}

body::after {
    background:
        radial-gradient(circle at 85% 58%, rgba(255, 52, 170, 0.15), transparent 32%),
        radial-gradient(circle at 32% 70%, rgba(0, 220, 255, 0.14), transparent 30%),
        radial-gradient(circle at 55% 18%, rgba(90, 120, 255, 0.15), transparent 32%);
    animation: nebulaDriftB 34s linear infinite;
    opacity: 0.9;
}

[hidden] {
    display: none !important;
}

.intro-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.8rem, 2.5vmin, 1.4rem);
    background: rgba(2, 6, 14, 0.78);
    backdrop-filter: blur(8px);
}

.intro-card {
    width: min(100%, 34rem);
    background:
        linear-gradient(145deg, rgba(0, 243, 255, 0.12), rgba(255, 0, 255, 0.1)),
        rgba(10, 14, 28, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-left: 4px solid rgba(0, 243, 255, 0.85);
    box-shadow:
        0 0 30px rgba(0, 243, 255, 0.14),
        0 16px 40px rgba(0, 0, 0, 0.52);
    border-radius: 1rem;
    padding: clamp(1rem, 2.8vmin, 1.5rem);
    text-align: center;
}

.intro-title {
    margin: 0;
    font-size: clamp(1.3rem, 3.4vmin, 1.9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.intro-text {
    margin: 0.7rem 0 0;
    font-size: clamp(1.25rem, 3.1vmin, 1.7rem);
    line-height: 1.6;
    color: rgba(245, 250, 255, 0.95);
}

.intro-keyboard {
    display: block;
    width: min(100%, 17rem);
    height: auto;
    margin: 0.9rem auto 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.intro-tip {
    margin: 0.75rem 0 0;
    font-size: clamp(0.95rem, 2.1vmin, 1.15rem);
    color: rgba(220, 242, 255, 0.9);
}

.intro-btn {
    margin-top: 1rem;
    min-width: clamp(12rem, 30vmin, 16rem);
    padding: 1.25rem 1.9rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.9rem;
    background:
        linear-gradient(135deg, rgba(0, 255, 221, 0.45), rgba(110, 145, 255, 0.35), rgba(160, 90, 255, 0.38), rgba(255, 66, 143, 0.42)),
        rgba(18, 20, 36, 0.9);
    color: rgba(255, 255, 255, 0.98);
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: clamp(1rem, 2.3vmin, 1.25rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        0 0 26px rgba(0, 255, 225, 0.34),
        0 0 42px rgba(188, 96, 255, 0.28),
        inset 0 0 18px rgba(255, 255, 255, 0.12);
}

.intro-btn:hover {
    transform: scale(1.06);
    box-shadow:
        0 0 34px rgba(0, 255, 225, 0.42),
        0 0 50px rgba(255, 72, 186, 0.36);
}

.app-shell {
    position: relative;
    z-index: 2;
    width: min(100%, 70rem);
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    padding: clamp(0.75rem, 2.3vmin, 1.5rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: clamp(0.5rem, 1.8vmin, 1rem);
    overflow: hidden;
}

/* =========================================
   FUNDO
========================================= */
.stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.95;
    filter: contrast(112%) saturate(110%);
}

.ship-visual {
    position: fixed;
    left: 16vw;
    top: 68%;
    height: 66.66vh;
    height: 66.66dvh;
    width: auto;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    user-select: none;
    opacity: 0.92;
    filter: drop-shadow(0 0 26px rgba(110, 180, 255, 0.3));
}

.app-logo {
    position: fixed;
    top: clamp(0.35rem, 1.6vmin, 0.7rem);
    left: 50%;
    transform: translateX(-50%);
    height: clamp(2.2rem, 6.8vmin, 4.2rem);
    width: auto;
    z-index: 5;
    pointer-events: none;
    user-select: none;
    opacity: 0.96;
    filter: drop-shadow(0 0 14px rgba(0, 0, 0, 0.45));
}

.app-copyright {
    position: fixed;
    right: clamp(0.35rem, 1.4vmin, 0.7rem);
    bottom: clamp(0.35rem, 1.4vmin, 0.7rem);
    margin: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: clamp(0.6rem, 1.05vmin, 0.72rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(220, 235, 255, 0.62);
    opacity: 0.92;
    z-index: 6;
    pointer-events: none;
    user-select: none;
}

.scanlines {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 4;
    pointer-events: none;
    opacity: 0.32;
}

.grid-bg {
    display: none;
}

@keyframes nebulaDriftA {
    0% {
        transform: translate3d(0, 0, 0) scale(1.03) rotate(0deg);
    }
    50% {
        transform: translate3d(-2.5%, -2%, 0) scale(1.08) rotate(2deg);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1.03) rotate(0deg);
    }
}

@keyframes nebulaDriftB {
    0% {
        transform: translate3d(0, 0, 0) scale(1.02) rotate(0deg);
    }
    50% {
        transform: translate3d(2.2%, 1.8%, 0) scale(1.07) rotate(-2deg);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1.02) rotate(0deg);
    }
}

/* =========================================
   HUD
========================================= */
.top-hud {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(0.75rem, 2vw, 1rem);
    min-width: 0;
}

.brand-panel {
    position: fixed;
    top: clamp(0.55rem, 2.2vmin, 1rem);
    left: clamp(0.55rem, 2.2vmin, 1rem);
    z-index: 6;
    min-width: 0;
    max-width: min(32rem, calc(100vw - 1.2rem));
}

.eyebrow {
    margin: 0;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(0, 243, 255, 0.85);
}

.game-title {
    margin: 0.35rem 0 0;
    font-size: clamp(1.35rem, 3vw, 2.45rem);
    font-weight: 900;
    letter-spacing: 0.08em;
}

.system-mode {
    margin: 0.45rem 0 0;
    font-size: clamp(0.75rem, 1.4vw, 0.9rem);
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.72);
}

.hud-metrics {
    position: fixed;
    top: clamp(0.55rem, 2.2vmin, 1rem);
    right: clamp(0.55rem, 2.2vmin, 1rem);
    left: auto;
    transform: none;
    z-index: 6;
    display: flex;
    gap: clamp(0.55rem, 1.8vw, 0.9rem);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.hud-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-left: 4px solid var(--pad-top-color);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(7px);
}

.metric-card {
    min-width: clamp(8rem, 20vw, 10.5rem);
    padding: 1rem 1.2rem;
    text-align: right;
}

.metric-label {
    margin: 0;
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.48);
}

.metric-value {
    margin: 0.2rem 0 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1;
}

.sector-value {
    color: #ff4ec9;
}

.record-value {
    color: #ffd65a;
}

.glitch-text {
    text-shadow: 2px 0 red, -2px 0 cyan;
}

/* =========================================
   AREA CENTRAL
========================================= */
.play-area {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: clamp(0.5rem, 1.8vmin, 1rem);
}

.status-shell {
    width: min(100%, 42rem);
    justify-self: center;
    text-align: center;
    margin-top: clamp(2.5rem, 9vmin, 6rem);
    padding: 1rem 1.3rem;
    border-radius: 1rem;
    background:
        linear-gradient(135deg, rgba(0, 243, 255, 0.09), rgba(255, 0, 255, 0.08)),
        rgba(5, 8, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.status-shell[data-tone="idle"] {
    border-color: rgba(255, 255, 255, 0.08);
}

.status-shell[data-tone="cyan"] {
    border-color: rgba(0, 243, 255, 0.32);
    box-shadow: 0 0 18px rgba(0, 243, 255, 0.12);
}

.status-shell[data-tone="green"] {
    border-color: rgba(0, 255, 140, 0.34);
    box-shadow: 0 0 18px rgba(0, 255, 140, 0.12);
}

.status-shell[data-tone="pink"] {
    border-color: rgba(255, 78, 201, 0.34);
    box-shadow: 0 0 18px rgba(255, 78, 201, 0.12);
}

.status-shell[data-tone="orange"] {
    border-color: rgba(255, 170, 0, 0.35);
    box-shadow: 0 0 18px rgba(255, 170, 0, 0.14);
}

.status-shell[data-tone="red"] {
    border-color: rgba(255, 90, 90, 0.42);
    box-shadow: 0 0 22px rgba(255, 80, 80, 0.16);
}

.status-message {
    margin: 0;
    font-size: clamp(1.1rem, 2.8vw, 1.45rem);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.status-detail {
    margin: 0.35rem 0 0;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.68);
}

.game-console {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    transform-style: preserve-3d;
}

.board-stage {
    position: relative;
    width: 100%;
    min-height: 0;
    gap: clamp(1rem, 2.8vmin, 2.2rem);
}

.start-panel {
    position: absolute;
    right: clamp(0rem, 1vw, 0.6rem);
    top: 50%;
    transform: translateY(-50%);
    min-width: clamp(10rem, 18vw, 14rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-3d {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, var(--pad-size));
    gap: var(--board-gap);
    transform: rotateX(25deg);
    transition: transform 0.3s ease;
    padding: 0.5rem;
}

.board-3d.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.pad {
    width: var(--pad-size);
    height: var(--pad-size);
    border-radius: clamp(1rem, 2.3vmin, 1.4rem);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'LibrasFont', sans-serif;
    font-size: clamp(4.8rem, 11.5vmin, 8.8rem);
    cursor: pointer;
    position: relative;
    background: rgba(20, 20, 30, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.8);
    transition: transform 0.12s ease, color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
    transform: translateZ(0);
}

.pad::after {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.pad-top {
    color: rgba(0, 243, 255, 0.44);
    border-color: rgba(0, 243, 255, 0.3);
}

.pad-right {
    color: rgba(255, 0, 255, 0.44);
    border-color: rgba(255, 0, 255, 0.3);
}

.pad-bottom {
    color: rgba(0, 255, 0, 0.44);
    border-color: rgba(0, 255, 0, 0.3);
}

.pad-left {
    color: rgba(255, 170, 0, 0.44);
    border-color: rgba(255, 170, 0, 0.3);
}

.pad.active {
    transform: translateZ(-10px) scale(0.95);
    color: #fff;
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
}

.pad-top.active {
    background: var(--pad-top-color);
    box-shadow: 0 0 42px var(--pad-top-color), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.pad-right.active {
    background: var(--pad-right-color);
    box-shadow: 0 0 42px var(--pad-right-color), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.pad-bottom.active {
    background: var(--pad-bottom-color);
    box-shadow: 0 0 42px var(--pad-bottom-color), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.pad-left.active {
    background: var(--pad-left-color);
    box-shadow: 0 0 42px var(--pad-left-color), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

.center-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(5.8rem, 16vmin, 8.4rem);
    height: clamp(5.8rem, 16vmin, 8.4rem);
    transform: translate(-50%, -50%) translateZ(20px);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.12), transparent 35%),
        #10121a;
    border: 4px solid #2b2f40;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.center-hub::before {
    content: "";
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.start-btn {
    position: relative;
    background:
        linear-gradient(135deg, rgba(0, 243, 255, 0.12), rgba(255, 0, 255, 0.1)),
        rgba(20, 20, 30, 0.8);
    color: rgba(255, 255, 255, 0.88);
    border: 2px solid rgba(0, 243, 255, 0.34);
    min-width: clamp(10rem, 18vw, 14rem);
    padding: 1.25rem 1.7rem;
    border-radius: 1rem;
    text-transform: uppercase;
    font-weight: 900;
    font-size: clamp(1rem, 2.5vmin, 1.35rem);
    letter-spacing: 0.18em;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow:
        0 0 18px rgba(0, 243, 255, 0.24),
        0 10px 26px rgba(0, 0, 0, 0.42),
        inset 0 0 20px rgba(0, 0, 0, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
    overflow: hidden;
}

.start-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 18%, rgba(0, 243, 255, 0.2) 50%, transparent 82%);
    transform: translateX(-120%);
    transition: transform 0.5s ease;
}

.start-btn::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.start-btn:hover {
    transform: scale(1.08);
    box-shadow:
        0 0 28px rgba(0, 243, 255, 0.45),
        0 12px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 22px rgba(0, 243, 255, 0.18);
}

.start-btn:hover::before {
    transform: translateX(120%);
}

.start-btn:active {
    transform: scale(0.95);
    box-shadow:
        0 0 24px rgba(0, 243, 255, 0.32),
        0 8px 22px rgba(0, 0, 0, 0.42),
        inset 0 0 16px rgba(0, 243, 255, 0.22);
}

.core-label {
    font-size: clamp(0.7rem, 2vmin, 0.95rem);
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
}

.footer-hint {
    justify-self: center;
    text-align: center;
    font-size: clamp(0.65rem, 1.3vw, 0.78rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(180, 240, 255, 0.62);
}

.footer-hint p {
    margin: 0;
}

@keyframes shake {
    10%, 90% {
        transform: rotateX(25deg) translate3d(-2px, 0, 0);
    }
    20%, 80% {
        transform: rotateX(25deg) translate3d(4px, 0, 0);
    }
    30%, 50%, 70% {
        transform: rotateX(25deg) translate3d(-8px, 0, 0);
    }
    40%, 60% {
        transform: rotateX(25deg) translate3d(8px, 0, 0);
    }
}

/* =========================================
   RESPONSIVO
========================================= */
@media (max-width: 780px) {
    .top-hud {
        align-items: stretch;
        flex-direction: column;
    }

    .hud-metrics {
        width: auto;
        justify-content: flex-end;
    }

    .metric-card {
        flex: 1;
    }

    .board-stage {
        flex-direction: column;
        gap: 1rem;
    }

    .start-panel {
        position: static;
        transform: none;
        min-width: 0;
    }

    .start-btn {
        min-width: clamp(9rem, 52vw, 14rem);
    }
}

@media (max-height: 760px) {
    :root {
        --pad-size: clamp(7.1rem, 25vmin, 13.2rem);
        --board-gap: clamp(1rem, 2.6vmin, 1.5rem);
    }

    .app-shell {
        padding-block: 0.65rem;
        gap: 0.55rem;
    }

    .status-shell {
        padding-block: 0.65rem;
    }

    .system-mode {
        margin-top: 0.3rem;
    }
}

@media (max-height: 650px) {
    .footer-hint {
        display: none;
    }

    .status-detail {
        font-size: 0.72rem;
    }
}
