/* === KittenKart Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a1a;
    overflow: hidden;
    font-family: 'Quicksand', sans-serif;
    cursor: default;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* === Screens === */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 10;
}
.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Game Buttons === */
.game-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    padding: 14px 40px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #ff6b9d, #c44dff);
    color: #fff;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    box-shadow: 0 4px 15px rgba(196, 77, 255, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    letter-spacing: 1px;
}
.game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(196, 77, 255, 0.6);
}
.game-btn:active {
    transform: scale(0.97);
}
.game-btn.pulse {
    animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === Title Screen === */
#title-screen {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a1a 100%);
    flex-direction: column;
}
.title-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}
.title-logo {
    margin-bottom: 30px;
}
.title-main {
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    background: linear-gradient(135deg, #ff6b9d, #ffb86b, #c44dff, #6bdfff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    text-shadow: none;
    filter: drop-shadow(0 4px 8px rgba(196, 77, 255, 0.5));
    letter-spacing: 3px;
}
.title-sub {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    color: #ff9ed2;
    margin-top: -5px;
    font-weight: 600;
    letter-spacing: 8px;
    text-transform: uppercase;
}
.title-kittens {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}
.title-heart {
    font-size: 3rem;
    color: #ff4d8d;
    animation: heartBeat 1.2s ease-in-out infinite;
}
.title-credits {
    margin-top: 25px;
    color: #8866aa;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.3); }
    30% { transform: scale(1); }
    45% { transform: scale(1.2); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Story Screen === */
#story-screen {
    background: transparent;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 10px;
    pointer-events: none;
}
/* Hide all HTML dialog elements - everything is rendered on canvas now */
.story-content {
    display: none;
}
/* Only show the "Press ENTER" hint */
.story-continue-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255,255,255,0.45);
    font-size: 0.8rem;
    animation: blink 1.5s ease-in-out infinite;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === Race Intro === */
#race-intro-screen {
    background: rgba(10, 10, 26, 0.9);
    flex-direction: column;
}
.race-intro-content {
    text-align: center;
}
.race-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #ffb86b;
    text-shadow: 0 0 20px rgba(255, 184, 107, 0.5);
    margin-bottom: 10px;
}
.race-desc {
    font-size: 1.1rem;
    color: #c8b5e0;
    margin-bottom: 40px;
}
.countdown {
    font-family: 'Fredoka One', cursive;
    font-size: 8rem;
    color: #fff;
    text-shadow: 0 0 40px rgba(255, 107, 157, 0.8);
    animation: countPop 1s ease-out;
}

@keyframes countPop {
    from { transform: scale(2); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* === HUD === */
#hud {
    pointer-events: none;
    z-index: 15;
}
#hud.active {
    display: block;
}
.hud-mash-prompt {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: #ffcc00;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
    animation: mashPulse 0.5s ease-in-out infinite;
    background: rgba(10, 10, 30, 0.7);
    padding: 8px 20px;
    border-radius: 30px;
    border: 2px solid rgba(255, 204, 0, 0.3);
    backdrop-filter: blur(5px);
}
.mash-key {
    background: linear-gradient(135deg, #ff6b9d, #c44dff);
    padding: 4px 14px;
    border-radius: 8px;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 2px 8px rgba(196, 77, 255, 0.4);
}
@keyframes mashPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}
.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 25px;
}
.hud-position, .hud-lap, .hud-speed {
    background: rgba(10, 10, 30, 0.7);
    border: 2px solid rgba(196, 77, 255, 0.3);
    border-radius: 12px;
    padding: 8px 18px;
    text-align: center;
    backdrop-filter: blur(5px);
}
.hud-position span:first-child,
.hud-lap span:first-child,
.hud-speed span:first-child {
    display: block;
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #fff;
}
.hud-label {
    font-size: 0.7rem;
    color: #8866aa;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.hud-item {
    background: rgba(10, 10, 30, 0.7);
    border: 2px solid rgba(255, 184, 107, 0.4);
    border-radius: 12px;
    padding: 4px;
    backdrop-filter: blur(5px);
}
#hud-item-canvas {
    display: block;
}
.hud-bottom {
    position: absolute;
    bottom: 15px;
    right: 25px;
}
.hud-minimap {
    background: rgba(10, 10, 30, 0.7);
    border: 2px solid rgba(196, 77, 255, 0.2);
    border-radius: 12px;
    padding: 6px;
    backdrop-filter: blur(5px);
}
#minimap {
    display: block;
    border-radius: 8px;
}

/* === Results Screen === */
#results-screen {
    background: rgba(10, 10, 26, 0.92);
    flex-direction: column;
}
.results-content {
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}
.results-heading {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    margin-bottom: 30px;
}
.results-heading.win {
    background: linear-gradient(135deg, #ffd700, #ffb86b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 8px rgba(255, 184, 107, 0.5));
}
.results-heading.lose {
    color: #ff6b9d;
}
.results-table {
    background: rgba(30, 15, 50, 0.8);
    border-radius: 15px;
    padding: 20px 40px;
    margin: 0 auto 30px;
    display: inline-block;
    min-width: 400px;
}
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(196, 77, 255, 0.15);
    color: #c8b5e0;
    font-size: 1.1rem;
}
.result-row:last-child {
    border-bottom: none;
}
.result-row.player {
    color: #ffb86b;
    font-weight: 700;
}
.result-pos {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    width: 50px;
    color: #c44dff;
}
.result-name {
    flex: 1;
    text-align: left;
}
.result-time {
    font-family: monospace;
    font-size: 1rem;
}

/* === Pause Screen === */
#pause-screen {
    background: rgba(10, 10, 26, 0.85);
    flex-direction: column;
    gap: 15px;
    z-index: 20;
}
.pause-content {
    text-align: center;
}
.pause-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: #c44dff;
    margin-bottom: 30px;
}
.pause-content .game-btn {
    display: block;
    margin: 10px auto;
    min-width: 200px;
}

/* === Loading Screen === */
#loading-screen {
    background: #0a0a1a;
    flex-direction: column;
    z-index: 50;
}
.loading-content {
    text-align: center;
}
.loading-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: #c44dff;
    margin-bottom: 30px;
}
.loading-bar {
    width: 300px;
    height: 12px;
    background: rgba(196, 77, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 15px;
}
.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff6b9d, #c44dff);
    border-radius: 10px;
    transition: width 0.3s;
}
#loading-text {
    color: #8866aa;
    font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .title-main { font-size: 3rem; }
    .story-dialog-box { flex-direction: column; align-items: center; }
    .story-portrait-right { order: -1; }
    .hud-top { padding: 8px 12px; }
    .results-table { min-width: auto; width: 90%; }
}
