:root {
    --bg-top: #75c7ff;
    --bg-bottom: #fef5b8;
    --tree-bark: #714322;
    --tree-shadow: #4d2d14;
    --leaf-main: #4ea74c;
    --leaf-dark: #2b7032;
    --ui-red: #ff4f7b;
    --ui-pink: #ffbfd8;
    --ui-cream: #fff8e6;
    --ui-blue: #0e3d70;
    --ui-yellow: #ffd54f;
    --danger: #ff6f61;
    --shadow: 0 10px 0 rgba(14, 61, 112, 0.35);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
}

body {
    font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
    color: var(--ui-blue);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.55), transparent 28%),
        linear-gradient(180deg, #86d7ff 0%, #d7f9ff 28%, #ffe59d 100%);
}

button {
    font: inherit;
    appearance: none;
}

.app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hud-top {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
}

.logo-wrap h1,
.logo-wrap p {
    margin: 0;
}

.logo-wrap h1 {
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 0.95;
    color: #fff;
    text-shadow: 3px 3px 0 var(--ui-red), 6px 6px 0 var(--ui-blue);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: #fffaf0;
}

.hud-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hearts {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    border: 3px solid var(--ui-blue);
    border-radius: 999px;
    background: rgba(255, 248, 230, 0.9);
    box-shadow: 0 4px 0 rgba(14, 61, 112, 0.25);
    font-size: 1.3rem;
}

.hearts span.is-lost {
    opacity: 0.28;
    transform: scale(0.9);
}

.pixel-button {
    padding: 10px 16px;
    border: 3px solid var(--ui-blue);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffec77, #ffb703);
    color: var(--ui-blue);
    font-weight: 700;
    box-shadow: 0 6px 0 rgba(14, 61, 112, 0.28);
    cursor: pointer;
}

.pixel-button.secondary {
    background: linear-gradient(180deg, #fff8e6, #ffc8dd);
}

.marquee-border {
    border: 4px solid var(--ui-blue);
    box-shadow: var(--shadow);
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.panel-menu.active {
    display: grid;
}

.panel-game.active {
    display: block;
}

.game-root {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.overlay {
    position: absolute;
    inset: 0;
    display: none;
    padding: 16px;
    background: rgba(20, 52, 88, 0.35);
    place-items: center;
    z-index: 10;
}

.overlay.active {
    display: grid;
}

.overlay-card {
    width: min(92vw, 520px);
    padding: 24px;
    border-radius: 28px;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 248, 230, 0.96), rgba(255, 203, 221, 0.98));
}

.overlay-lead,
.overlay-title,
.overlay-text {
    margin: 0;
}

.overlay-lead {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ui-red);
    margin-bottom: 8px;
}

.overlay-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin-bottom: 10px;
}

.overlay-text {
    line-height: 1.4;
}

.overlay-actions {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.face-details {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.face-eyes {
    position: absolute;
    top: 46%;
    left: 50%;
    width: 7px;
    height: 9px;
    border-radius: 50%;
    background: #13253e;
    transform: translateX(-18px);
    box-shadow: 34px 0 0 #13253e;
}

.face-mouth {
    position: absolute;
    left: 50%;
    bottom: 18%;
    width: 20px;
    height: 10px;
    border-bottom: 3px solid #9b2c5f;
    border-radius: 0 0 24px 24px;
    transform: translateX(-50%);
}

@media (max-width: 720px) {
    .hud-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .hud-right {
        width: 100%;
        justify-content: space-between;
    }

    .overlay-card {
        padding: 20px;
    }
}