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

body {
    background-color: #e0f7fa; /* Light sky blue */
    color: #333;
    font-family: 'Noto Sans SC', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding-top: 40px;
    overflow-x: hidden;
}

.back-link {
    align-self: flex-start;
    margin-left: max(20px, calc(50vw - 400px));
    margin-bottom: 20px;
    color: #0277bd;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    background: #ffffff;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, background 0.2s;
}

.back-link:hover {
    transform: translateY(-2px);
    background: #e1f5fe;
}

#game-container {
    position: relative;
    width: 800px;
    height: 680px;
    box-sizing: content-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    background: #ffffff;
    border: 4px solid #b2ebf2;
    overflow: hidden;
}

/* Dashboard UI */
#dashboard {
    height: 80px;
    background: #e1f5fe;
    border-bottom: 4px solid #b2ebf2;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-radius: 10px 10px 0 0;
    padding: 0 20px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-box .label {
    font-size: 14px;
    color: #555;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-box .value {
    font-size: 24px;
    font-weight: 900;
    color: #4a148c;
}

.stat-box .value.highlight {
    color: #ff6b6b;
    font-size: 28px;
}

.lives {
    display: flex;
    gap: 5px;
}

.heart {
    color: #ff5252;
    font-size: 24px;
}
.heart.lost {
    color: #e0e0e0;
}

/* Canvas */
#gameCanvas {
    display: block;
    border-radius: 0 0 10px 10px;
    background-color: #fffde7; /* Warm white/yellow */
}

/* Overlays */
.overlay {
    position: absolute;
    top: 80px; /* Below dashboard */
    left: 0;
    width: 100%;
    height: 600px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 0 0 10px 10px;
    text-align: center;
    padding: 40px;
}

.overlay.hidden {
    display: none;
}

.overlay h1 {
    font-size: 48px;
    color: #ff9800;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0px #ffe0b2;
}

.overlay h1.red-glow {
    color: #f44336;
    text-shadow: 2px 2px 0px #ffcdd2;
}

.overlay p {
    font-size: 18px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
    font-weight: bold;
}

.overlay .controls {
    color: #fff;
    background: #4caf50;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 0 #388e3c;
}

button {
    background: #ffca28;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 24px;
    font-weight: 900;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: 'Noto Sans SC', sans-serif;
    box-shadow: 0 6px 0 #ff8f00;
    margin-top: 20px;
}

button:hover {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #ff8f00;
}

button:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #ff8f00;
}

.overlay-toast {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #8bc34a;
    border: 4px solid #689f38;
    color: #fff;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 20;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.3s ease;
}

.overlay-toast.level-up {
    background: #ff9800;
    border-color: #f57c00;
    transform: translateX(-50%) scale(1.1);
}

.overlay-toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
}
