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

body {
    background: #0a0a2e;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #dde;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

#gameCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

/* --- Overlays --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 25, 0.92);
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.overlay-content {
    text-align: center;
    max-width: 460px;
    padding: 40px 30px;
}

/* --- Title Screen --- */
.title-raccoon {
    font-size: 64px;
    margin-bottom: 10px;
    animation: bobble 2s ease-in-out infinite;
}

.title-content h1 {
    font-size: 3rem;
    letter-spacing: 0.3em;
    color: #8899cc;
    text-shadow: 0 0 20px rgba(136, 153, 204, 0.5);
    margin-bottom: 6px;
}

.subtitle {
    font-size: 1rem;
    color: #667;
    margin-bottom: 30px;
    font-style: italic;
}

.title-instructions {
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 0.95rem;
    color: #aab;
}

.controls-info {
    margin-bottom: 30px;
    font-size: 0.8rem;
    color: #778;
    line-height: 1.8;
}

/* --- Buttons --- */
.game-button {
    display: inline-block;
    padding: 14px 48px;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    color: #0a0a2e;
    background: #8899cc;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.game-button:hover {
    background: #aabbee;
    transform: scale(1.04);
}

.game-button:active {
    transform: scale(0.97);
}

/* --- Scorecard --- */
.scorecard {
    background: rgba(10, 10, 46, 0.95);
    border: 2px solid #334;
    border-radius: 12px;
    padding: 36px 40px;
    min-width: 320px;
}

.scorecard h2 {
    font-size: 1.6rem;
    color: #8899cc;
    margin-bottom: 24px;
    letter-spacing: 0.1em;
}

.score-details {
    margin-bottom: 20px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 1rem;
    border-bottom: 1px solid #1a1a3e;
}

.score-row span:first-child {
    color: #778;
}

.score-row span:last-child {
    color: #dde;
    font-weight: bold;
}

.rank {
    font-size: 1.4rem;
    color: #ffdd88;
    margin: 16px 0;
    text-shadow: 0 0 10px rgba(255, 221, 136, 0.4);
}

.result-message {
    font-size: 0.9rem;
    color: #889;
    margin-bottom: 24px;
    font-style: italic;
}

.victory-msg {
    color: #8c8;
}

/* --- Mobile Controls --- */
#mobileControls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
}

#joystickArea {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50%;
    height: 55%;
    pointer-events: auto;
}

#mobileButtons {
    position: absolute;
    bottom: 30px;
    right: 20px;
    display: flex;
    gap: 14px;
    pointer-events: auto;
}

.mobile-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(136, 153, 204, 0.5);
    background: rgba(10, 10, 46, 0.6);
    color: #8899cc;
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.mobile-btn:active,
.mobile-btn.active {
    background: rgba(136, 153, 204, 0.35);
    border-color: #8899cc;
}

.sneak-btn {
    border-color: rgba(100, 180, 100, 0.5);
    color: #6b6;
}

.sneak-btn:active,
.sneak-btn.active {
    background: rgba(100, 180, 100, 0.3);
    border-color: #6b6;
}

.dash-btn {
    border-color: rgba(200, 160, 80, 0.5);
    color: #ca8;
}

.dash-btn:active,
.dash-btn.active {
    background: rgba(200, 160, 80, 0.3);
    border-color: #ca8;
}

/* --- Dawn Warning --- */
#dawnWarning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.2rem;
    font-weight: bold;
    color: #f84;
    text-shadow: 0 0 30px rgba(255, 136, 68, 0.7);
    z-index: 60;
    animation: warnPulse 0.6s ease-in-out infinite;
    pointer-events: none;
    letter-spacing: 0.15em;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bobble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes warnPulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.5; transform: translate(-50%, -50%) scale(1.08); }
}
