@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap");

:root {
    --bg-deep: #04163e;
    --bg-mid: #0f4aa0;
    --bg-light: #66bcff;
    --panel: rgba(7, 35, 86, 0.9);
    --panel-border: #9be1ff;
    --text-main: #eaf4ff;
    --text-soft: #cfe4ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    font-family: "VT323", monospace;
    color: var(--text-main);
    background: radial-gradient(circle at 22% 9%, var(--bg-light) 0%, var(--bg-mid) 42%, var(--bg-deep) 100%);
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.1;
    background-image:
        linear-gradient(rgba(166, 229, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(166, 229, 255, 0.1) 1px, transparent 1px);
    background-size: 24px 24px;
}

.game-shell {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: block;
}

.topbar {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    line-height: 1.1;
    z-index: 3;
    pointer-events: none;
}

.topbar h1 {
    margin: 0;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(1.05rem, 2.25vw, 1.55rem);
    letter-spacing: 0.16em;
    color: #ffffff;
    text-shadow: 0 0 14px rgba(154, 212, 255, 0.7);
}

.topbar p {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: clamp(1rem, 1.9vw, 1.35rem);
    letter-spacing: 0.08em;
}

.canvas-wrap {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
    background: #0f4695;
    overflow: hidden;
    position: absolute;
    inset: 0;
    box-shadow:
        inset 0 0 0 2px rgba(144, 213, 255, 0.24),
        inset 0 0 46px rgba(84, 177, 255, 0.24),
        0 0 34px rgba(36, 110, 200, 0.4);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.round-banner {
    position: absolute;
    inset: auto 0 16px 0;
    margin: 0 auto;
    width: fit-content;
    max-width: calc(100% - 16px);
    padding: 9px 14px;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(0.6rem, 1vw, 0.82rem);
    line-height: 1.35;
    text-transform: uppercase;
    text-align: center;
    color: #fff7dc;
    background: rgba(173, 43, 60, 0.92);
    border: 2px solid #ffc2cc;
    box-shadow: 0 0 16px rgba(255, 107, 126, 0.5);
}

.hidden {
    display: none !important;
}

.legend {
    width: min(96vw, 1200px);
    display: grid;
    gap: 6px;
    padding: 10px 14px;
    font-size: clamp(0.95rem, 1.8vw, 1.25rem);
    border: 1px solid #6dbdff;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(8, 45, 102, 0.92) 0%, rgba(6, 32, 74, 0.92) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    z-index: 3;
}

.legend strong {
    color: #9de0ff;
    letter-spacing: 0.05em;
}

.guide-buttons {
    position: absolute;
    left: 50%;
    bottom: 120px;
    transform: translateX(-50%);
    z-index: 4;
    width: min(96vw, 1200px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.guide-btn {
    border: 1px solid #88d8ff;
    background: linear-gradient(180deg, #1d5fb0 0%, #153f84 100%);
    color: #eff8ff;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(0.52rem, 0.8vw, 0.68rem);
    padding: 8px 6px;
    cursor: pointer;
    text-shadow: 0 0 5px rgba(108, 203, 255, 0.35);
    box-shadow: 0 0 10px rgba(44, 136, 221, 0.24);
}

.guide-btn:hover,
.guide-btn:focus-visible {
    outline: none;
    border-color: #bdf0ff;
    background: linear-gradient(180deg, #2676d8 0%, #1b56b2 100%);
    box-shadow: 0 0 14px rgba(101, 207, 255, 0.45);
}

.guide-modal {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(2, 8, 22, 0.7);
    display: grid;
    place-items: center;
    padding: 16px;
}

.guide-panel {
    position: relative;
    width: min(1000px, 96vw);
    max-height: min(88vh, 820px);
    overflow: auto;
    border: 2px solid #8fddff;
    background: linear-gradient(180deg, #0f3875 0%, #082a59 100%);
    box-shadow: 0 0 28px rgba(61, 171, 255, 0.35);
    padding: 14px 14px 12px;
}

.guide-panel.theme-kael {
    border-color: #ffb471;
    background: linear-gradient(180deg, #5d2f22 0%, #2b2040 100%);
}

.guide-panel.theme-vex {
    border-color: #ff88ac;
    background: linear-gradient(180deg, #3d1430 0%, #1e0c2d 100%);
}

.guide-panel.theme-rox8 {
    border-color: #ffd39a;
    background: linear-gradient(180deg, #4a3624 0%, #24190f 100%);
}

.guide-panel.theme-nyx {
    border-color: #90f7ff;
    background: linear-gradient(180deg, #12384f 0%, #0a2136 100%);
}

.guide-close {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid #9ae5ff;
    background: #143f7a;
    color: #f3fbff;
    font-family: "Press Start 2P", monospace;
    font-size: 0.6rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.guide-close:hover,
.guide-close:focus-visible {
    outline: none;
    background: #205cb0;
}

.guide-panel h2 {
    margin: 0 0 10px;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(0.9rem, 1.7vw, 1.3rem);
    color: #ffffff;
    text-shadow: 0 0 10px rgba(138, 217, 255, 0.6);
}

.guide-panel.theme-kael h2,
.guide-panel.theme-kael h3 {
    color: #ffd2a0;
    text-shadow: 0 0 10px rgba(255, 162, 95, 0.4);
}

.guide-panel.theme-vex h2,
.guide-panel.theme-vex h3 {
    color: #ffc1d4;
    text-shadow: 0 0 10px rgba(255, 115, 156, 0.4);
}

.guide-panel.theme-rox8 h2,
.guide-panel.theme-rox8 h3 {
    color: #ffe1b8;
    text-shadow: 0 0 10px rgba(238, 186, 120, 0.38);
}

.guide-panel.theme-nyx h2,
.guide-panel.theme-nyx h3 {
    color: #c9fcff;
    text-shadow: 0 0 10px rgba(103, 227, 255, 0.4);
}

.guide-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 280px) 1fr;
}

.guide-model h3,
.guide-abilities h3,
.guide-lore h3 {
    margin: 0 0 8px;
    font-family: "Press Start 2P", monospace;
    font-size: clamp(0.62rem, 1vw, 0.8rem);
    color: #bfeeff;
}

#guideModelCanvas {
    width: min(260px, 100%);
    height: auto;
    border: 1px solid #86d8ff;
    background: #0c2e61;
    image-rendering: pixelated;
}

.guide-panel.theme-kael #guideModelCanvas {
    border-color: #ffb471;
    background: #4a2d23;
}

.guide-panel.theme-vex #guideModelCanvas {
    border-color: #ff88ac;
    background: #35152d;
}

.guide-panel.theme-rox8 #guideModelCanvas {
    border-color: #ffd39a;
    background: #3e2d20;
}

.guide-panel.theme-nyx #guideModelCanvas {
    border-color: #90f7ff;
    background: #17384d;
}

.guide-abilities ul {
    margin: 0;
    padding-left: 18px;
    color: #e5f5ff;
    font-size: clamp(1.1rem, 1.7vw, 1.35rem);
    line-height: 1.25;
}

.guide-lore {
    margin-top: 12px;
    border: 1px solid rgba(137, 211, 255, 0.35);
    background: rgba(5, 22, 49, 0.42);
    padding: 8px 10px;
}

.guide-lore p {
    margin: 0;
    color: #e2f2ff;
    font-size: clamp(1.12rem, 1.65vw, 1.4rem);
    line-height: 1.22;
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .legend {
        font-size: 1rem;
        padding: 8px 10px;
    }

    .guide-buttons {
        bottom: 150px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .topbar p {
        margin-top: 4px;
    }
}
