/* Mr Francis Ball - retro neon arcade styling */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Share+Tech+Mono&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%;
    background: #000;
    color: #b6f9ff;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #000;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #000;
}

.screen.active { display: flex; }

.bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.screen-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 24px;
    max-width: 720px;
    width: 100%;
}

/* Loading */
.loading-inner { text-align: center; }
.loading-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(28px, 6vw, 56px);
    color: #fff;
    text-shadow: 0 0 12px #00ffaa, 0 0 24px #00ffaa;
    letter-spacing: 0.12em;
}
.loading-bar {
    width: min(360px, 70vw);
    height: 6px;
    border: 1px solid #00ffaa;
    margin: 24px auto 12px;
    overflow: hidden;
}
.loading-fill {
    width: 0%;
    height: 100%;
    background: #00ffaa;
    box-shadow: 0 0 14px #00ffaa;
    transition: width 0.4s ease;
}
.loading-text {
    color: #6ad6c2;
    letter-spacing: 0.2em;
    font-size: 14px;
}

/* Title */
.game-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(34px, 8vw, 84px);
    color: #fff;
    letter-spacing: 0.14em;
    text-shadow:
        0 0 8px #00ffaa,
        0 0 22px #00ffaa,
        0 0 42px #00cc88;
    margin-bottom: 8px;
}

.game-subtitle {
    color: #5fd1bd;
    letter-spacing: 0.4em;
    font-size: clamp(11px, 1.6vw, 14px);
    margin-bottom: 28px;
    text-transform: uppercase;
}

.menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
}

.menu-btn {
    appearance: none;
    background: #fff;
    color: #000;
    border: 2px solid #00ffaa;
    padding: 12px 30px;
    min-width: 220px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.18em;
    font-size: 15px;
    cursor: pointer;
    border-radius: 30px;
    box-shadow: 0 0 12px rgba(0, 255, 170, 0.45);
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.menu-btn:hover {
    background: #00ffaa;
    color: #000;
    box-shadow: 0 0 22px rgba(0, 255, 170, 0.85);
    transform: translateY(-1px);
}
.menu-btn:active { transform: translateY(1px); }
.menu-btn.small {
    min-width: 140px;
    padding: 8px 20px;
    font-size: 12px;
}

.footer-note {
    margin-top: 20px;
    color: #3a8a7c;
    letter-spacing: 0.2em;
    font-size: 11px;
}

/* Panels */
.panel-title {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 10px #00ffaa;
    letter-spacing: 0.18em;
    margin-bottom: 18px;
    font-size: clamp(20px, 3vw, 32px);
}

.how-list {
    list-style: none;
    text-align: left;
    margin: 0 auto 22px;
    max-width: 540px;
    color: #b6f9ff;
    line-height: 1.9;
    font-size: 15px;
}
.how-list li::before {
    content: "▸ ";
    color: #00ffaa;
    margin-right: 6px;
}
.how-list b { color: #fff; }

#scoresTableWrap {
    margin: 0 auto 20px;
    max-width: 600px;
    max-height: min(70vh, 704px);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-color: #00ffaa rgba(0, 255, 170, 0.10);
    scrollbar-width: thin;
}
#scoresTableWrap::-webkit-scrollbar {
    width: 8px;
}
#scoresTableWrap::-webkit-scrollbar-track {
    background: rgba(0, 255, 170, 0.10);
}
#scoresTableWrap::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 170, 0.55);
    border-radius: 6px;
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    color: #b6f9ff;
    font-size: 14px;
}
.scores-table th, .scores-table td {
    border-bottom: 1px solid rgba(0, 255, 170, 0.25);
    padding: 8px 6px;
    text-align: left;
}
.scores-table th {
    color: #00ffaa;
    letter-spacing: 0.15em;
    font-size: 11px;
    text-transform: uppercase;
    border-bottom: 2px solid #00ffaa;
    position: sticky;
    top: 0;
    background: #000;
    z-index: 1;
}
.scores-table tr.me { background: rgba(0, 255, 170, 0.08); }
.scores-table .rank { width: 36px; color: #5fd1bd; }
.scores-table .nm { color: #fff; }
.scores-table .sc { text-align: right; color: #fff; font-weight: 700; }
.scores-table .lv, .scores-table .ra, .scores-table .dt { color: #5fd1bd; }
.scores-empty {
    text-align: center;
    color: #5fd1bd;
    padding: 30px 0;
    letter-spacing: 0.15em;
}

/* Game */
#gameScreen { background: #000; }
#gameCanvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: none;
    background: #000;
}

#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    color: #00ffaa;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    text-shadow: 0 0 8px #00ffaa;
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 22px 0;
    letter-spacing: 0.16em;
}
.hud-row.top { font-size: clamp(14px, 2.2vw, 22px); }
.hud-row.sub {
    padding-top: 4px;
    font-size: clamp(10px, 1.4vw, 13px);
    color: #5fd1bd;
    text-shadow: 0 0 6px #00ffaa;
}
.hud-cell.center { text-align: center; }

.lives-dots {
    display: inline-flex;
    gap: 5px;
    vertical-align: middle;
    margin-left: 8px;
}
.lives-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #ff4d6a;
    box-shadow: 0 0 8px #ff4d6a;
}
.lives-dots .dot.lost {
    background: transparent;
    box-shadow: none;
    border: 1px solid #553340;
}
.lives-label { font-size: 0.7em; color: #5fd1bd; }

.curve-flash {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(20px, 4vw, 36px);
    letter-spacing: 0.2em;
    text-shadow: 0 0 14px #00ffaa, 0 0 28px #00ffaa;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.curve-flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.serve-hint {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(11px, 1.6vw, 15px);
    letter-spacing: 0.22em;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid #00ffaa;
    padding: 8px 18px;
    border-radius: 22px;
    box-shadow: 0 0 14px rgba(0, 255, 170, 0.45);
    opacity: 0;
    pointer-events: none;
    text-transform: uppercase;
    text-align: center;
    max-width: min(92vw, 520px);
    white-space: normal;
    transition: opacity 0.18s ease;
}
.serve-hint.show {
    opacity: 1;
    animation: servePulse 1.4s ease-in-out infinite;
}
.control-hint {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(10px, 1.4vw, 13px);
    letter-spacing: 0.18em;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid #3a8aff;
    padding: 7px 15px;
    border-radius: 20px;
    box-shadow: 0 0 12px rgba(58, 138, 255, 0.42);
    opacity: 0;
    pointer-events: none;
    text-transform: uppercase;
    text-align: center;
    max-width: min(90vw, 420px);
    transition: opacity 0.16s ease;
}
.control-hint.show { opacity: 1; }
@keyframes servePulse {
    0%, 100% { box-shadow: 0 0 14px rgba(0, 255, 170, 0.4); }
    50%      { box-shadow: 0 0 28px rgba(0, 255, 170, 0.95); }
}

.pause-btn {
    position: absolute;
    top: 12px;
    right: 50%;
    transform: translateX(50%);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #00ffaa;
    color: #00ffaa;
    width: 36px;
    height: 30px;
    border-radius: 6px;
    text-align: center;
    line-height: 28px;
    font-size: 14px;
    letter-spacing: 0.2em;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.4);
}
.pause-btn:hover { background: rgba(0, 255, 170, 0.2); }

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    z-index: 20;
}
.overlay.active { display: flex; }
.overlay-inner {
    background: #000;
    border: 2px solid #00ffaa;
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.6);
    border-radius: 14px;
    padding: 30px 40px;
    text-align: center;
    max-width: 92vw;
}
.overlay-inner h2 {
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 12px #00ffaa;
    letter-spacing: 0.2em;
    margin-bottom: 16px;
}
.overlay-inner p {
    color: #b6f9ff;
    margin: 8px 0;
    letter-spacing: 0.1em;
}
.overlay-inner .menu-btn { margin: 6px 4px; }

#goName {
    display: block;
    margin: 12px auto;
    background: #000;
    color: #fff;
    border: 2px solid #00ffaa;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    letter-spacing: 0.18em;
    text-align: center;
    width: min(320px, 80vw);
    outline: none;
}
#goName:focus { box-shadow: 0 0 14px rgba(0, 255, 170, 0.7); }

.go-stats {
    color: #b6f9ff;
    margin: 16px 0;
    line-height: 1.8;
    letter-spacing: 0.14em;
}
.go-stats span { color: #00ffaa; font-weight: 700; }

.hidden { display: none !important; }

@media (max-width: 600px) {
    .menu-btn { min-width: 180px; padding: 11px 22px; font-size: 13px; }
    .hud-row { padding: 8px 12px 0; }
}
