@font-face {
    font-family: 'CP-Font';
    src: url('assets/fonts/CP-Font.woff2') format('woff2'),
        url('assets/fonts/CP-Font.woff') format('woff');
    font-weight: 1000;
    font-style: normal;
}

:root {
    --primary-color: #ffc107;
    --dark-bg: #1a1a1a;
    --light-text: #f0f0f0;
    --dark-text: #333;
}

body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'CP-Font', 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background-color: var(--dark-bg);
    color: var(--light-text);
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.overlay .content {
    background: rgba(20, 20, 20, 0.85);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    width: 450px;
}

h1 {
    font-size: 5rem;
    color: var(--primary-color);
    margin: 0;
}

h1 .title-emphasis {
    color: white;
}

.subtitle {
    font-size: 1.5rem;
    margin-top: -10px;
    color: var(--light-text);
    letter-spacing: 5px;
}

.description,
.controls-info {
    margin: 20px 0;
    line-height: 1.6;
}

button {
    font-family: 'CP-Font', sans-serif;
    background-color: var(--primary-color);
    color: var(--dark-text);
    border: none;
    padding: 12px 25px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0px 0px rgba(255, 193, 7, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 0 rgba(255, 193, 7, 0.5);
}

button:active {
    transform: translateY(0);
}

#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px; 
}

#loading-progress {
    margin-top: 15px;
    font-size: 1.2em;
}

.loading-animation-container {
    width: 100%;
    height: 100px; 
    overflow: hidden; 
    position: relative; 
    margin-bottom: 20px; 
    display: flex; 
    justify-content: center;
    align-items: center;
}

.loading-image-runner {
    height: 10%; 
    background-image: url('assets/images/kickboard.svg'); 
    background-repeat: no-repeat; 
    background-size: contain; 
    background-position: center; 

    position: absolute;
    top: 70%; 
    left: 0; 
    
    animation: moveLeftToRight 2s linear infinite; 
}

@keyframes moveLeftToRight {
    0% {
        transform: translate(-100%, -50%); 
        opacity: 1; 
    }
    80% { 
        transform: translate(100vw, -50%); 
        opacity: 1;
    }
    100% {
        transform: translate(100vw, -50%); 
        opacity: 0; 
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.battery-icon {
    font-size: 2rem;
    margin-right: 10px;
}

#battery-bar-wrapper {
    width: 200px;
    height: 25px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 5px;
    padding: 2px;
}

#battery-bar {
    width: 100%;
    height: 100%;
    background-color: #4caf50;
    border-radius: 3px;
    transition: width 0.2s ease, background-color 0.5s ease;
}

#battery-percent {
    margin-left: 10px;
    font-weight: bold;
    width: 60px;
}

#game-over-screen .content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

h2 {
    font-size: 3rem;
    margin: 0;
    color: #dc3545;
    text-shadow: 0 0 0px #dc3545;
}

.score-label {
    margin: -10px 0 0 0;
    font-size: 1.2rem;
}

#final-score {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
}

#ranking-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

#ranking-list {
    list-style-type: decimal;
    padding-left: 30px;
    margin: 0;
    font-size: 1.1rem;
}

#ranking-list li {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

#ranking-list li span:last-child {
    font-weight: bold;
    color: var(--primary-color);
}


#new-highscore-input input {
    width: 70%;
    padding: 10px;
    font-size: 1rem;
    background: #333;
    border: 1px solid #555;
    color: white;
    border-radius: 5px;
    margin-right: 10px;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

#bottom-hud {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 15px 30px;
    border-radius: 20px;
    backdrop-filter: blur(3px);
    width: auto;
}

#bottom-hud #score {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 0 var(--primary-color);
    line-height: 1;
}

#bottom-hud #battery-container {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
}

#bottom-hud .battery-icon {
    font-size: 2rem;
    margin-right: 10px;
}

#bottom-hud #battery-bar-wrapper {
    width: 200px;
    height: 25px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 5px;
    padding: 2px;
}

#bottom-hud #battery-bar {
    width: 100%;
    height: 100%;
    background-color: #4caf50;
    border-radius: 3px;
    transition: width 0.2s ease, background-color 0.5s ease;
}

#bottom-hud #battery-percent {
    margin-left: 10px;
    font-weight: bold;
    width: 60px;
}

#hud #battery-container {
    display: none;
}

.comment {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffc107;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: bold;
    font-size: 1.1rem;
    min-height: 1.5em;
}

.feedback-text {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: #4caf50;
    text-shadow: 0 0 0 white, 0 0 10px #4caf50;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
    animation: float-up 1.5s ease-out forwards;
}

@keyframes float-up {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 1;
    }

    80% {
        transform: translateY(-80px) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) scale(1.2);
        opacity: 0;
    }
}

#transition-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}

#transition-overlay.fade {
    animation: fade-in-out 1.0s ease-in-out;
}

@keyframes fade-in-out {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 3.5rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .overlay .content {
        padding: 20px;
        width: 90%;
    }

    h2 {
        font-size: 2.5rem;
    }

    #final-score {
        font-size: 3rem;
    }

    #ranking-list {
        font-size: 1rem;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    #bottom-hud {
        bottom: 20px;
        padding: 10px 20px;
        border-radius: 15px;
    }

    #bottom-hud #score {
        font-size: 2rem;
    }

    #bottom-hud #battery-container {
        font-size: 1.2rem;
    }

    #bottom-hud #battery-bar-wrapper {
        width: 150px;
    }
}

.overlay .content {
    background: rgba(20, 20, 20, 0.85);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    width: 450px;
    max-height: 85vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .overlay .content {
        padding: 20px;
        width: 90%;
    }

    #game-over-screen .content {
        gap: 10px;
    }

    h2 {
        font-size: 2.2rem;
    }

    #final-score {
        font-size: 2.5rem;
    }
}

.ranking-title {
    font-size: 1.2rem; 
    color: var(--primary-color); 
    margin: 0;
    margin-bottom: 15px; 
    line-height: 1.2;
    font-weight: 1000; 
    text-align: center; 
}

.ranking-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    margin: 20px auto;
    width: 80%;
    max-width: 350px;
}

.ranking-preview ol {
    list-style-type: decimal;
    padding-left: 25px;
    margin: 0;
    font-size: 1rem;
}

.ranking-preview li {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    color: #ddd;
}

.ranking-preview li span:last-child {
    font-weight: bold;
    color: #fff;
}

#stage-transition-overlay {
    background-color: rgba(0, 0, 0, 0.0);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
}

#stage-transition-overlay .content {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
    width: auto;
    padding: 20px 40px;
    border-radius: 15px;
    pointer-events: auto;
}

#stage-transition-overlay h2 {
    font-size: 3rem;
    color: var(--primary-color);
    margin: 0;
    text-shadow: 0 0 0 var(--primary-color);
}

#stage-transition-overlay.show {
    opacity: 1;
}

#stage-transition-overlay #stage-subtitle {
    font-size: 1.2rem;
    color: #ccc;
    margin-top: 5px;
    margin-bottom: 0;
}

footer {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: #ccc;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9rem;
    position: absolute;
    bottom: 0;
    z-index: 10;
}

.footer-hidden {
    display: none !important;
}

.footer-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer-content a {
    color: #ffc107;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: #fff;
}

.content .title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.content .title-text-wrapper {
    display: flex; 
    justify-content: center; 
    flex-grow: 1; 
    margin-right: 15px;
    position: relative; 
}

.content .title-main {
    font-size: 5rem;
    color: var(--primary-color);
    margin: 0;
    display: block; 
    text-align: center; 
    width: auto; 
}

.content .title-image {
    width: 80px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .content .title-container {
        flex-direction: column;
        gap: 10px;
    }
    .content .title-main {
        margin-right: 0;
        margin-bottom: 5px;
        display: block;
        text-align: center;
        flex-grow: 0;
    }
    .content .title-image {
        width: 60px;
    }

    .content .title-text-wrapper {
        margin-right: 0;
        margin-bottom: 5px;
        display: block; 
        text-align: center; 
        flex-grow: 0;
        max-width: 100%;
        width: auto;
    }
}