@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
/* --- CSS Variables --- */
:root {
    --bg-color: #121212;
    --primary-text-color: #e0e0e0;
    --secondary-text-color: #a0a0a0;
    --accent: rebeccapurple;
    --accent-hover: rgba(102, 51, 153, 0.746);
    --danger-color: #dc3545;
    --danger-color-hover: rgb(145, 36, 47);
    --card-bg-color: #1e1e1e;
    --border-color: #333;
    --apple-color: rgb(163, 61, 61);
    --trophy-color: rgb(197, 197, 31);
    --font-family: 'Press Start 2P';
    --logo-size: 55px;
}

/* --- General Styles & Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding-top: 5rem;
    text-align: center;
    cursor: none;
}

.wrapper {
    width: 100%;
    max-width: 800px;
    padding: 20px;
}

h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.main-layout {
    display: grid;
    gap: 5px 40px;
    align-items: flex-start;
    grid-template-columns: 250px 400px;
    grid-template-rows: auto auto;
    justify-content: center;
}

/* Grid Positioning */
.score-board {
    grid-column: 2;
    grid-row: 1;
}

.leaderboard-container {
    grid-column: 1;
    grid-row: 2;
    height: 4px; 
}

.game-container {
    grid-column: 2;
    grid-row: 2;
}

/* ---Leaderboard--- */
.leaderboard-container {
    width: 250px;
    position: relative;
    text-align: left;
    background: var(--card-bg-color);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    height: 400px;
    overflow-y: auto;
}

.leaderboard-container h3 {
    margin-top: 0;
    text-align: center;
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #333;
    font-size: 0.95rem;
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

/* ---Score Board--- */
.score-board {
    display: flex;
    font-size: 1.3rem;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--primary-text-color);
    width: 100%;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.3s ease, color 0.3s ease;
}

.score-item:hover {
    transform: translateY(-3px);
    color: var(--secondary-text-color);
}

.fa-apple-whole { color: var(--apple-color); }
.fa-trophy { color: var(--trophy-color); }

/* ---Canvas--- */
canvas {
    background-color: #1e1e1e;
    border: 2px solid var(--accent);
    border-radius: 4px;
    box-shadow: 0 0 11px rgba(0, 123, 255, 0.2);
    display: block;
}

/* ---Game Board--- */
.game-board {
    width: 100%;
    height: 100%;
    background-color: #121212;
}

.game-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

/* ---Conrols--- */
.controls, .highscore-form {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    display: flex;
    width: 100%;
    justify-content: center;
    pointer-events: none;
}

.highscore-form {
    background-color: rgba(30, 30, 30, 0.95);
    padding: 25px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    width: 85%;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    pointer-events: auto;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.highscore-form h2 {
    font-size: 1.5rem;
    margin: 0rem;
    color: #fff;
}

input[type="text"] {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #222;
    color: white;
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase;
    width: 285px;
    max-width: 100%;
    outline: none;
}
input[type="text"]:focus {
    border-color: var(--accent);
}
.form-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

/* ---Pause Function--- */
#pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 25;
    letter-spacing: 5px;
}

/* ---Buttons--- */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: none;
    border: none;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.btn:hover { transform: translateY(-2px); }

#start-btn, #submit-score-btn {
    background-color: var(--accent);
    color: white;
    z-index: 10;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

#submit-score-btn {
    background-color: var(--accent);
    flex: 1;
}

#start-btn:hover, #submit-score-btn:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--primary-text-color);
}
.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-3px);
}

#cancel-btn {
    color: white;
    flex: 1;
}
#cancel-btn:hover { background-color: var(--danger-color-hover); }

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(17, 17, 17, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--accent);
    z-index: 1000;
    padding: 10px;
}

nav {
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

nav a.active {
    background-color: var(--accent);
    cursor: none;
}

.nav-logo {
    display: flex;
    align-items: center;
}

.nav-logo svg {
    height: var(--logo-size);
    fill: var(--accent);

    &:hover {
        transform: translateY(-2.5px);
        cursor: none;
    }
}

.nav-logo:active svg {
    transform: scale(0.95);
    fill: var(--accent);
    transition: 0.1s;
    background-color: none;
}

/* --- Raw Cursor --- */
.cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: var(--accent);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
}

.cursor-circle {
    display: none;
}

body.link-hovered .cursor-dot {
    width: 30px;
    height: 30px;
    cursor: none;
}

/* Mobile */
@media (max-width: 768px) {
    .cursor-dot {
        display: none;
    }

    body {
        cursor: auto;
    }

    .main-layout {
        display: flex;
        gap: 1rem;
        flex-direction: column;
        align-items: center;
    }
    
    .score-board {
        order: 1;
        max-width: 400px;
    }

    .game-container {
        order: 2;
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    canvas {
        width: 100%;
        height: 100%;
    }

    .leaderboard-container {
        order: 3;
        width: 100%;
        max-width: 400px;
        height: 300px;
        max-height: 300px;
    }
}

/* remove nav links on mobile */
@media (max-width: 540px) {
    .nav-links {
        display: none;
    }

    nav {
        justify-content: center;
    }
}