@import url('https://fonts.googleapis.com/css2?family=Tektur:wght@400..900&display=swap');

html, body {
    margin: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #0a0a12;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameContainer {
    position: relative;
    overflow: hidden;
}

canvas {
    display: block;
    image-rendering: pixelated;
}

/* ── UI Root (overlay layer above canvas) ── */

#ui-root {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#ui-root > * {
    pointer-events: auto;
}

/* ── HUD ── */

#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#hud.hidden { display: none; }

#ui {
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    color: #5dbdca;
    font-family: "Tektur", sans-serif;
    font-size: 32px;
    pointer-events: none;
}

.overlay-helper {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #5dbdca;
    font-family: "Tektur", sans-serif;
    pointer-events: none;
    opacity: .5;
}

.overlay-helper p {
    margin: 2px 0;
    font-size: 14px;
}

/* ── Overlay screens ── */

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 18, 0.85);
    color: #5dbdca;
    font-family: "Tektur", sans-serif;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.25s ease;
}

.overlay.hidden {
    display: none;
}

.overlay h1 { font-size: 48px; margin-bottom: 0; }
.overlay p  { font-size: 20px; margin-bottom: 0; }

.overlay button {
    padding: 10px 32px;
    margin: 12px 0;
    width: 320px;
    font-size: 32px;
    font-family: "Tektur", sans-serif;
    background: transparent;
    border: 2px solid #5dbdca;
    color: #5dbdca;
    cursor: pointer;
    transition: background 0.2s ease;
}

.overlay button:hover { background: rgba(93, 202, 165, 0.12); }

.hidden { display: none; }

/* ── Main Menu (left-aligned, transparent gradient) ── */

.overlay.menu-bg {
    background: linear-gradient(
        90deg,
        rgba(10, 10, 18, 0.92) 0%,
        rgba(10, 10, 18, 0.65) 38%,
        rgba(10, 10, 18, 0.12) 100%
    );
    align-items: flex-start;
    justify-content: center;
}

.menu-left {
    padding-left: 8%;
    display: flex;
    flex-direction: column;
}

.menu-left h1 {
    font-size: 72px;
    line-height: 0.95;
    margin: 0 0 8px;
    text-shadow: 0 0 40px rgba(93, 189, 202, 0.25);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-buttons button {
    text-align: left;
    width: 300px;
    font-size: 26px;
    padding: 10px 28px;
}

.menu-btn-info {
    border-color: #5dbdca44 !important;
    color: #5dbdca88 !important;
    font-size: 18px !important;
    width: 180px !important;
    margin-top: 16px !important;
}

.menu-btn-info:hover {
    border-color: #5dbdca !important;
    color: #5dbdca !important;
}

/* ── Engine logo (bottom-right) ── */

.menu-logo {
    position: absolute;
    bottom: 18px;
    right: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.35;
    transition: opacity 0.3s;
}

.menu-logo:hover { opacity: 0.7; }

.menu-logo img {
    width: 196px;
    height: 196px;
}

.menu-logo span {
    font-size: 13px;
    color: #ae6cf6;
    letter-spacing: 1.5px;
    font-family: "Tektur", sans-serif;
}

/* ── Info modal ── */

.info-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 18, 0.75);
    z-index: 10;
}

.info-modal.hidden { display: none; }

.info-content {
    max-width: 480px;
    padding: 32px 40px;
    border: 1px solid #5dbdca33;
    background: rgba(10, 10, 18, 0.95);
    font-family: "Tektur", sans-serif;
    color: #5dbdca;
}

.info-content h2 {
    font-size: 28px;
    margin: 0 0 16px;
}

.info-content p {
    font-size: 15px !important;
    color: #5dbdca99;
    margin: 0 0 12px !important;
    line-height: 1.6;
}

.info-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.info-content li {
    font-size: 14px;
    color: #5dbdca88;
    padding: 3px 0;
}

.info-content li::before {
    content: '› ';
    color: #5dbdca;
}

.info-content button {
    width: auto;
    padding: 8px 24px;
    font-size: 18px;
}

/* ── Menu subtitle ── */

.menu-subtitle {
    font-size: 16px !important;
    color: #5dbdca88;
    margin-bottom: 32px !important;
    letter-spacing: 2px;
}

/* ── Settings groups ── */

.settings-group {
    margin: 16px 0;
    text-align: center;
}

.settings-group label {
    display: block;
    font-size: 18px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.option-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.option-buttons button {
    padding: 8px 20px;
    margin: 0;
    width: auto;
    min-width: 100px;
    font-size: 18px;
    background: transparent;
    border: 1px solid #5dbdca55;
    color: #5dbdca88;
    transition: all 0.2s ease;
}

.option-buttons button:hover {
    border-color: #5dbdca;
    color: #5dbdca;
}

.option-buttons button.selected {
    background: rgba(93, 189, 202, 0.2);
    border-color: #5dbdca;
    color: #5dbdca;
    box-shadow: 0 0 12px rgba(93, 189, 202, 0.3);
}

.option-desc {
    font-size: 14px;
    color: #666;
    margin: 8px 0 0 0;
    min-height: 20px;
}

/* ── Start / action buttons ── */

.start-button {
    width: 360px !important;
    margin-top: 32px !important;
    font-size: 36px !important;
    padding: 16px 48px !important;
    background: rgba(93, 189, 202, 0.15) !important;
    animation: pulse 2s ease-in-out infinite;
}

.start-button:hover {
    background: rgba(93, 189, 202, 0.3) !important;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(93, 189, 202, 0.3); }
    50% { box-shadow: 0 0 20px rgba(93, 189, 202, 0.5); }
}

/* ── Back link ── */

.back-link {
    width: auto !important;
    border: none !important;
    font-size: 18px !important;
    color: #5dbdca88 !important;
    margin-top: 24px !important;
    padding: 8px 16px !important;
}

.back-link:hover {
    color: #5dbdca !important;
    background: transparent !important;
}

/* ── Controls info (settings screen) ── */

.controls-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 6px 16px;
    min-width: 280px;
    font-size: 16px;
    color: #5dbdca99;
}

.control-key {
    color: #5dbdca;
    font-weight: 600;
    min-width: 80px;
}

/* ── Leaderboard ── */

.leaderboard-wrap {
    margin: 24px 0;
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-table {
    border-collapse: collapse;
    min-width: 500px;
    font-family: "Tektur", sans-serif;
    font-size: 16px;
}

.leaderboard-table th {
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: #5dbdca88;
    padding: 8px 16px;
    border-bottom: 1px solid #5dbdca33;
    text-align: left;
}

.leaderboard-table td {
    padding: 8px 16px;
    color: #5dbdca99;
    border-bottom: 1px solid #5dbdca11;
}

.leaderboard-table .player-row td {
    color: #5dbdca;
    font-weight: 600;
}

.lb-empty {
    text-align: center;
    opacity: .5;
}

/* ── Final score (game over) ── */

.final-score {
    font-size: 28px !important;
    margin: 16px 0 8px !important;
}

/* ── Power-up HUD ── */

#powerupsHUD {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: none;
    font-family: "Tektur", sans-serif;
}

.pu-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 14px 6px;
    min-width: 72px;
    border: 1px solid #5dbdca33;
    background: rgba(10, 10, 18, 0.72);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.pu-slot.active {
    border-color: #5dbdca;
    background: rgba(93, 189, 202, 0.14);
    box-shadow: 0 0 14px rgba(93, 189, 202, 0.35), inset 0 0 8px rgba(93, 189, 202, 0.08);
}

.pu-slot.empty {
    opacity: 0.3;
}

.pu-icon {
    font-size: 26px;
    color: #5dbdca;
    line-height: 1;
}

.pu-slot.active .pu-icon {
    color: #fff;
    text-shadow: 0 0 10px #5dbdcacc;
}

.pu-name {
    font-size: 11px;
    color: #5dbdca99;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    line-height: 1;
}

.pu-dots {
    display: flex;
    gap: 5px;
}

.pu-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5dbdca;
    box-shadow: 0 0 4px #5dbdca88;
}

.pu-dot.used {
    background: transparent;
    border: 1px solid #5dbdca33;
    box-shadow: none;
}

.pu-key {
    font-size: 11px;
    color: #5dbdca55;
    border: 1px solid #5dbdca33;
    padding: 1px 6px;
    line-height: 1.5;
}

/* ── Lobby screen ── */

.lobby-label {
    font-size: 16px !important;
    color: #5dbdca88;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px !important;
}

.lobby-code {
    font-size: 64px !important;
    letter-spacing: 12px;
    color: #5dbdca;
    margin: 4px 0 16px !important;
    text-shadow: 0 0 30px rgba(93, 189, 202, 0.35);
    user-select: all;
}

.lobby-status {
    font-size: 16px !important;
    color: #5dbdca77;
    min-height: 24px;
}

.lobby-ok {
    color: #6ce6a0 !important;
}

.lobby-hint {
    font-size: 14px !important;
    color: #5dbdca55;
    margin-top: 8px !important;
}

.lobby-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.lobby-input-row input {
    width: 180px;
    padding: 10px 16px;
    font-size: 32px;
    font-family: "Tektur", sans-serif;
    text-align: center;
    letter-spacing: 6px;
    background: rgba(93, 189, 202, 0.06);
    border: 2px solid #5dbdca55;
    color: #5dbdca;
    outline: none;
    transition: border-color 0.2s;
}

.lobby-input-row input:focus {
    border-color: #5dbdca;
    box-shadow: 0 0 12px rgba(93, 189, 202, 0.2);
}

.lobby-input-row input::placeholder {
    color: #5dbdca33;
    letter-spacing: 8px;
}

.lobby-input-row button {
    width: auto !important;
    min-width: 56px;
    padding: 10px 16px !important;
    font-size: 28px !important;
}

/* ── Lobby roster ── */

.lobby-count {
    font-size: 18px !important;
    color: #5dbdca88;
    margin: 4px 0 12px !important;
    letter-spacing: 2px;
}

.lobby-roster {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    min-width: 220px;
}

.lobby-roster li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    border: 1px solid #5dbdca22;
    font-family: "Tektur", sans-serif;
    font-size: 16px;
    color: #5dbdca99;
}

.lobby-player-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}
