*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Disable text/image selection, drag, zoom highlight globally */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
img { pointer-events: none; }

:root {
    --green-dark: #2d6a2d;
    --green-mid: #4caf50;
    --green-light: #a8e063;
    --green-bg: #c8f59a;
    --sky-top: #b8f0ff;
    --sky-bot: #e0ffd5;
    --pond: #7dd4fc;
    --brown: #8B5E3C;
    --brown-light: #c9914d;
    --accent: #ff7043;
    --accent2: #ffd54f;
    --white: #fff;
    --shadow: rgba(0,0,0,0.18);
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--sky-top);
    font-family: 'Nunito', sans-serif;
}

#bgDecor {
    position: fixed;
    inset: 0;
    background: linear-gradient(175deg, #b8f0ff 0%, #d4f7a0 55%, #a8e063 100%);
    z-index: 0;
    overflow: hidden;
}
#bgDecor::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 120px;
    background: linear-gradient(to top, #5aab3a 0%, transparent 100%);
    border-radius: 60% 60% 0 0 / 40px 40px 0 0;
}

/* Screens */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 14px;
}
.screen.hidden { display: none; }

/* Start Screen */
.frog-logo {
    font-size: 88px;
    filter: drop-shadow(0 8px 0 var(--green-dark));
    animation: floatFrog 2s ease-in-out infinite;
}
@keyframes floatFrog {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-12px) rotate(4deg); }
}

.title {
    font-family: 'Fredoka One', cursive;
    font-size: 58px;
    line-height: 1;
    color: var(--green-dark);
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 4px 4px 0 var(--green-light), 6px 6px 0 rgba(0,0,0,0.1);
}
.title span {
    color: var(--accent);
    text-shadow: 4px 4px 0 #ff4a00a0, 6px 6px 0 rgba(0,0,0,0.1);
}

.subtitle {
    font-size: 20px;
    font-weight: 800;
    color: var(--green-dark);
    opacity: 0.7;
    letter-spacing: 1px;
}

.controls-hint {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    background: rgba(255,255,255,0.55);
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 14px;
    padding: 10px 22px;
    backdrop-filter: blur(6px);
}
.hint-item { font-size: 14px; color: var(--green-dark); font-weight: 700; }

.btn-start {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    letter-spacing: 2px;
    background: linear-gradient(145deg, var(--accent) 0%, #ff4a00 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 14px 52px;
    cursor: pointer;
    box-shadow: 0 6px 0 #b33000, 0 10px 24px rgba(255,112,67,0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 4px;
}
.btn-start:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b33000, 0 4px 12px rgba(255,112,67,0.3);
}

.btn-home {
    font-family: 'Fredoka One', cursive;
    font-size: 16px;
    background: transparent;
    color: rgba(45,106,45,0.6);
    border: 2px solid rgba(45,106,45,0.25);
    border-radius: 50px;
    padding: 9px 30px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 1px;
}

.btn-home:active { transform: scale(0.95); }

.best-score-display {
    font-size: 16px;
    font-weight: 800;
    color: var(--green-dark);
    opacity: 0.65;
    letter-spacing: 1px;
}

/* Game Screen */
#gameScreen {
    background: transparent;
    padding: 0;
    gap: 0;
    justify-content: flex-start;
}

.hud {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px 6px;
    z-index: 20;
    pointer-events: none;
}
.hud-score {
    font-family: 'Fredoka One', cursive;
    font-size: 36px;
    color: var(--green-dark);
    text-shadow: 2px 2px 0 var(--green-light);
    letter-spacing: 1px;
}
.hud-best {
    font-size: 15px;
    font-weight: 800;
    color: var(--green-dark);
    opacity: 0.6;
}

#gameCanvas {
    display: block;
    width: 100%;
    max-width: 420px;
    flex: 1;
    touch-action: none;
    /* actual dimensions set by JS */
}

/* On-screen movement buttons */
.move-btns {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-between;
    padding: 10px 16px 14px;
    gap: 12px;
    z-index: 20;
}

.move-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 26px;
    color: var(--green-dark);
    background: rgba(255,255,255,0.65);
    border: 3px solid rgba(255,255,255,0.9);
    border-radius: 18px;
    width: 80px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.15);
    backdrop-filter: blur(6px);
    transition: transform 0.08s, box-shadow 0.08s;
    flex: 1;
}

.move-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.12);
}

/* Game Over */
.frog-dead {
    font-size: 80px;
    animation: wobble 0.5s ease-in-out;
}
@keyframes wobble {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-15deg) scale(1.15); }
    75% { transform: rotate(15deg) scale(1.15); }
    100% { transform: rotate(0deg) scale(1); }
}

.go-title {
    font-family: 'Fredoka One', cursive;
    font-size: 56px;
    color: var(--accent);
    text-shadow: 4px 4px 0 rgba(0,0,0,0.15);
}

.go-score-wrap {
    text-align: center;
    background: rgba(255,255,255,0.55);
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 16px;
    padding: 8px 36px;
    backdrop-filter: blur(6px);
    min-width: 160px;
}
.go-label { font-size: 13px; font-weight: 800; color: var(--green-dark); opacity: 0.6; letter-spacing: 2px; text-transform: uppercase; }
.go-score, .go-best { font-family: 'Fredoka One', cursive; font-size: 42px; color: var(--green-dark); }
.go-best { color: var(--accent); }