:root {
    --sky-top:    #1b1440;
    --sky-mid:    #4a3878;
    --sky-horizon:#f2b6d4;
    --sand:       #f6d3e8;
    --sand-dark:  #e6a8c9;
    --ink:        #241b3a;
    --paper:      #fff8fb;
    --heart:      #ec5c8d;
    --heart-dim:  rgba(255,255,255,0.25);
    --accent:     #b98cf2;
    --font:       'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #140f30, #2b1f52 60%, #4a3878);
    color: var(--paper);
    font-family: var(--font);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
}

.back-link {
    position: fixed;
    top: 16px;
    left: 16px;
    color: var(--paper);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.75;
    background: rgba(0,0,0,0.25);
    padding: 6px 12px;
    border-radius: 999px;
    z-index: 20;
}
.back-link:hover { opacity: 1; }

#game-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    aspect-ratio: 900 / 450;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

#hearts { display: flex; gap: 4px; font-size: 1.3rem; letter-spacing: 2px; }

#levelLabel { font-weight: 700; font-size: 0.95rem; }

#progressBarWrap {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
    overflow: hidden;
}
#progressBar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.15s linear;
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    background: rgba(20, 14, 40, 0.72);
    padding: 24px;
}
.overlay.hidden { display: none; }

.overlay h1 {
    margin: 0;
    font-size: 2.2rem;
    letter-spacing: 3px;
}

.overlay p { margin: 0; max-width: 380px; opacity: 0.9; }
.overlay .hint { font-size: 0.85rem; opacity: 0.65; }

.overlay button {
    margin-top: 10px;
    padding: 10px 28px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    color: var(--ink);
    background: var(--paper);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.overlay button:hover { background: var(--accent); color: var(--paper); }
.overlay button + button { margin-left: 8px; }
.overlay button:disabled {
    opacity: 0.5;
    cursor: default;
    background: var(--paper);
    color: var(--ink);
}

#mobileJumpBtn {
    position: absolute;
    bottom: 18px;
    right: 18px;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.18);
    color: var(--paper);
    font-family: inherit;
    font-weight: 700;
    letter-spacing: 1px;
    backdrop-filter: blur(2px);
    display: none;
    z-index: 15;
}

@media (hover: none) and (pointer: coarse) {
    #mobileJumpBtn { display: block; }
}
