:root {
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-green: #00ff00;
    --bg-color: #050510;
    --glass-bg: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    color: white;
    font-family: 'Zen Kaku Gothic New', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

/* UI Overlay */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center vertically */
    align-items: center;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed */
}

.hidden {
    display: none !important;
}

/* HUD Elements */
#score-display,
#combo-display,
#timer-display {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--neon-blue);
}

#score-display {
    top: 20px;
    left: 20px;
    color: var(--neon-blue);
}

#combo-display {
    top: 60px;
    left: 20px;
    color: var(--neon-green);
}

#timer-display {
    top: 20px;
    right: 20px;
    color: var(--neon-pink);
    font-size: 2rem;
}

/* Word Display Area */
#word-container {
    text-align: center;
    margin-top: -50px;
    /* Slight offset upwards */
}

#word-display {
    font-size: 4rem;
    font-weight: bold;
    text-shadow: 0 0 20px var(--neon-blue);
    margin-bottom: 10px;
    letter-spacing: 5px;
    transition: transform 0.1s;
    min-height: 1.2em;
}

.word-complete {
    animation: wordComplete 0.3s forwards;
}

@keyframes wordComplete {
    0% {
        transform: scale(1);
        opacity: 1;
        color: white;
    }

    50% {
        transform: scale(1.2);
        color: var(--neon-green);
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#input-display {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.8);
    min-height: 3.5rem;
    font-family: 'Orbitron', sans-serif;
    text-shadow: 0 0 5px white;
    margin-bottom: 30px;
}

/* NEXT Word Display - Moved to bottom and made smaller */
#next-word-display {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Orbitron', sans-serif;
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    display: inline-block;
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: auto;
}

.modal-content {
    background: rgba(10, 10, 30, 0.9);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 30px var(--neon-blue);
    backdrop-filter: blur(10px);
}

.neon-border {
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue), inset 0 0 15px var(--neon-blue);
}

h1,
h2 {
    font-family: 'Orbitron', sans-serif;
    color: white;
    text-shadow: 0 0 10px var(--neon-pink);
    margin-bottom: 30px;
}

/* Form Elements */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--neon-blue);
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--neon-blue);
    color: white;
    border-radius: 5px;
    font-size: 1.1rem;
    box-sizing: border-box;
    /* Fix padding issue */
}

input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 10px var(--neon-blue);
}

/* Mode Selection Buttons */
.mode-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--neon-green);
    color: white;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(0, 255, 0, 0.2);
}

.mode-btn.selected {
    background: var(--neon-green);
    color: black;
    box-shadow: 0 0 15px var(--neon-green);
    font-weight: bold;
}

/* Action Buttons */
button.start-btn,
button.retry-btn,
button.ranking-btn,
button.close-btn {
    background: linear-gradient(45deg, var(--neon-pink), var(--neon-blue));
    border: none;
    padding: 15px 40px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

button:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--neon-pink);
}

/* Ranking List */
#ranking-list {
    list-style: none;
    padding: 0;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

#ranking-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#ranking-list li:nth-child(1) {
    color: gold;
    font-weight: bold;
    font-size: 1.2em;
}

#ranking-list li:nth-child(2) {
    color: silver;
}

#ranking-list li:nth-child(3) {
    color: #cd7f32;
}

/* Animations */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: auto;
}

.modal-content {
    background: rgba(10, 10, 30, 0.9);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 30px var(--neon-blue);
    backdrop-filter: blur(10px);
}

.neon-border {
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue), inset 0 0 15px var(--neon-blue);
}

h1,
h2 {
    font-family: 'Orbitron', sans-serif;
    color: white;
    text-shadow: 0 0 10px var(--neon-pink);
    margin-bottom: 30px;
}

/* Form Elements */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--neon-blue);
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--neon-blue);
    color: white;
    border-radius: 5px;
    font-size: 1.1rem;
    box-sizing: border-box;
    /* Fix padding issue */
}

input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 10px var(--neon-blue);
}

/* Mode Selection Buttons */
.mode-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--neon-green);
    color: white;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(0, 255, 0, 0.2);
}

.mode-btn.selected {
    background: var(--neon-green);
    color: black;
    box-shadow: 0 0 15px var(--neon-green);
    font-weight: bold;
}

/* Action Buttons */
button.start-btn,
button.retry-btn,
button.ranking-btn,
button.close-btn {
    background: linear-gradient(45deg, var(--neon-pink), var(--neon-blue));
    border: none;
    padding: 15px 40px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

button:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--neon-pink);
}

/* Ranking List */
#ranking-list {
    list-style: none;
    padding: 0;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

#ranking-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#ranking-list li:nth-child(1) {
    color: gold;
    font-weight: bold;
    font-size: 1.2em;
}

#ranking-list li:nth-child(2) {
    color: silver;
}

#ranking-list li:nth-child(3) {
    color: #cd7f32;
}

/* Animations */
@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake {
    animation: shake 0.5s;
    animation-iteration-count: 1;
}

.pop {
    animation: pop 0.1s ease-out;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        color: var(--neon-pink);
    }

    100% {
        transform: scale(1);
    }
}