/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #0a0a0f;
    font-family: 'Bungee', cursive;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

canvas#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
}

.hidden {
    display: none !important;
}

/* ===== MENU SCREEN ===== */
#menu-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at top, #0a2a4a 0%, #061420 50%, #020a10 100%);
    overflow-y: auto;
}

#menu-content {
    text-align: center;
    max-width: 520px;
    padding: 1.5rem 1.5rem 2rem;
}

/* Ape Image */
#ape-image-wrap {
    width: 180px;
    height: 180px;
    margin: 0 auto 0.8rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(59, 170, 255, 0.5);
    box-shadow: 0 0 30px rgba(59, 170, 255, 0.3), 0 0 60px rgba(59, 170, 255, 0.1);
    animation: apeFloat 3s ease-in-out infinite;
}

#ape-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

#game-title {
    font-family: 'Bungee Shade', cursive;
    font-size: 2.8rem;
    background: linear-gradient(180deg, #3baaff, #14F195, #FFD700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 2px 15px rgba(59, 170, 255, 0.4));
    margin: 0.2rem 0;
    letter-spacing: 1px;
    line-height: 1.1;
}

#game-subtitle {
    font-family: 'Bungee', cursive;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 5px;
    margin-bottom: 0.6rem;
}

#solana-badge {
    display: inline-block;
    background: linear-gradient(135deg, #9945FF, #14F195);
    padding: 0.25rem 1rem;
    border-radius: 50px;
    font-size: 0.55rem;
    letter-spacing: 3px;
    margin-bottom: 1.2rem;
    font-family: 'Bungee', cursive;
    color: #fff;
}

/* ===== SCATTERED HYPE TAGS ===== */
#hype-tags {
    position: absolute;
    inset: 0;
    z-index: 101;
    pointer-events: none;
    overflow: hidden;
}

/* --- Base for every tag --- */
.hype {
    position: absolute;
    pointer-events: auto;
    cursor: default;
    backdrop-filter: blur(10px);
    border: 1px solid;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}
.hype:hover {
    z-index: 110;
    box-shadow: 0 8px 30px rgba(255,255,255,0.14) !important;
}

/* --- HERO: big card with emoji + label + sub --- */
.hype-hero {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.1rem;
    border-radius: 16px;
}
.hype-hero .hype-emoji { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.hype-hero .hype-body  { text-align: left; }
.hype-hero .hype-label {
    font-family: 'Bungee', cursive;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    line-height: 1.4;
    display: block;
}
.hype-hero .hype-sub {
    font-family: 'Bungee', cursive;
    font-size: 0.42rem;
    letter-spacing: 2px;
    opacity: 0.55;
    display: block;
    margin-top: 0.15rem;
}
.hype-hero:hover { transform: scale(1.07) !important; }

/* --- PILL: compact horizontal chip --- */
.hype-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 50px;
    white-space: nowrap;
}
.hype-pill .hype-emoji { font-size: 1.15rem; line-height: 1; }
.hype-pill .hype-label {
    font-family: 'Bungee', cursive;
    font-size: 0.48rem;
    letter-spacing: 1.5px;
}
.hype-pill:hover { transform: scale(1.1) !important; }

/* --- BADGE: square-ish tilted card --- */
.hype-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    transform: rotate(-3deg);
}
.hype-badge .hype-emoji { font-size: 1.5rem; line-height: 1; }
.hype-badge .hype-label {
    font-family: 'Bungee', cursive;
    font-size: 0.45rem;
    letter-spacing: 1.5px;
    line-height: 1.5;
}
.hype-badge:hover { transform: rotate(0deg) scale(1.1) !important; }

/* right-side badges tilt the other way */
.hype-badge[style*="right"] { transform: rotate(3deg); }
.hype-badge[style*="right"]:hover { transform: rotate(0deg) scale(1.1) !important; }

/* --- DOT: tiny emoji floater for depth --- */
.hype-dot {
    font-size: 1.8rem;
    line-height: 1;
    padding: 0.4rem;
    border-radius: 50%;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none;
    opacity: 0.35;
}
.hype-dot:hover { opacity: 0.7; transform: scale(1.3) !important; }

/* --- Color themes (applied to .hype) --- */
.hype.hype-gold {
    background: linear-gradient(135deg, rgba(255,215,0,0.13), rgba(255,170,0,0.07));
    border-color: rgba(255,215,0,0.28);
    box-shadow: 0 4px 20px rgba(255,215,0,0.08);
}
.hype.hype-gold .hype-label, .hype.hype-gold .hype-sub { color: #FFD700; }

.hype.hype-green {
    background: linear-gradient(135deg, rgba(20,241,149,0.13), rgba(20,200,120,0.07));
    border-color: rgba(20,241,149,0.28);
    box-shadow: 0 4px 20px rgba(20,241,149,0.08);
}
.hype.hype-green .hype-label, .hype.hype-green .hype-sub { color: #14F195; }

.hype.hype-blue {
    background: linear-gradient(135deg, rgba(59,170,255,0.13), rgba(33,150,243,0.07));
    border-color: rgba(59,170,255,0.28);
    box-shadow: 0 4px 20px rgba(59,170,255,0.08);
}
.hype.hype-blue .hype-label, .hype.hype-blue .hype-sub { color: #3baaff; }

.hype.hype-purple {
    background: linear-gradient(135deg, rgba(153,69,255,0.13), rgba(120,50,220,0.07));
    border-color: rgba(153,69,255,0.28);
    box-shadow: 0 4px 20px rgba(153,69,255,0.08);
}
.hype.hype-purple .hype-label, .hype.hype-purple .hype-sub { color: #c084fc; }

.hype.hype-orange {
    background: linear-gradient(135deg, rgba(255,152,0,0.13), rgba(255,120,0,0.07));
    border-color: rgba(255,152,0,0.28);
    box-shadow: 0 4px 20px rgba(255,152,0,0.08);
}
.hype.hype-orange .hype-label, .hype.hype-orange .hype-sub { color: #FF9800; }

/* --- Float / drift animations (each tag gets one via data-float) --- */
[data-float="drift-y"]     { animation: driftY    5s ease-in-out infinite; }
[data-float="drift-y-alt"] { animation: driftYAlt 6s ease-in-out infinite; }
[data-float="drift-x"]     { animation: driftX    7s ease-in-out infinite; }
[data-float="drift-x-alt"] { animation: driftXAlt 5.5s ease-in-out infinite; }
[data-float="drift-diag"]     { animation: driftDiag    8s ease-in-out infinite; }
[data-float="drift-diag-alt"] { animation: driftDiagAlt 7s ease-in-out infinite; }

@keyframes driftY {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-14px); }
}
@keyframes driftYAlt {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(12px); }
}
@keyframes driftX {
    0%,100% { transform: translateX(0); }
    50%     { transform: translateX(10px); }
}
@keyframes driftXAlt {
    0%,100% { transform: translateX(0); }
    50%     { transform: translateX(-10px); }
}
@keyframes driftDiag {
    0%,100% { transform: rotate(-3deg) translate(0,0); }
    50%     { transform: rotate(-1deg) translate(8px,-10px); }
}
@keyframes driftDiagAlt {
    0%,100% { transform: rotate(3deg) translate(0,0); }
    50%     { transform: rotate(1deg) translate(-8px, 10px); }
}

/* Social Links — BIGGER */
#social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-family: 'Bungee', cursive;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1.5px solid;
}

.social-btn svg { flex-shrink: 0; }

.social-x {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.25);
}
.social-x:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 4px 18px rgba(255,255,255,0.12);
}

.social-dex {
    color: #14F195;
    background: rgba(20, 241, 149, 0.08);
    border-color: rgba(20, 241, 149, 0.3);
}
.social-dex:hover {
    background: rgba(20, 241, 149, 0.2);
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 4px 18px rgba(20,241,149,0.15);
}

.social-pump {
    color: #9945FF;
    background: rgba(153, 69, 255, 0.08);
    border-color: rgba(153, 69, 255, 0.3);
}
.social-pump:hover {
    background: rgba(153, 69, 255, 0.2);
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 4px 18px rgba(153,69,255,0.15);
}

/* Contract Address Row */
#ca-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
}

#ca-display {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.5px;
}

#copy-ca {
    font-family: 'Bungee', cursive;
    font-size: 0.5rem;
    padding: 0.25rem 0.6rem;
    background: rgba(59, 170, 255, 0.15);
    border: 1px solid rgba(59, 170, 255, 0.3);
    border-radius: 6px;
    color: #3baaff;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
    white-space: nowrap;
}

#copy-ca:hover {
    background: rgba(59, 170, 255, 0.25);
    transform: scale(1.05);
}

/* Metrics */
#metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

#metrics-updated {
    font-size: 0.4rem;
    color: rgba(255,255,255,0.2);
    letter-spacing: 1px;
    margin-bottom: 1rem;
    text-align: center;
}

.metric {
    background: rgba(59, 170, 255, 0.06);
    border: 1px solid rgba(59, 170, 255, 0.15);
    border-radius: 10px;
    padding: 0.6rem 0.4rem;
}

.metric-label {
    font-size: 0.45rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.metric-value {
    font-family: 'Bungee', cursive;
    font-size: 0.9rem;
    color: #14F195;
    letter-spacing: 0.5px;
}

/* Play Button */
#play-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 0.8rem;
    padding: 0.9rem 2rem;
    font-family: 'Bungee', cursive;
    font-size: 1.2rem;
    color: #fff;
    background: linear-gradient(135deg, #2196F3, #0D47A1);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.35), inset 0 -4px 0 rgba(0,0,0,0.2);
}

#play-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 35px rgba(33, 150, 243, 0.5), inset 0 -4px 0 rgba(0,0,0,0.2);
}

#play-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* High Score Row with Share */
#menu-hs-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

#menu-highscore {
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.7);
}

/* Share on X Buttons */
.share-x-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    font-family: 'Bungee', cursive;
    font-size: 0.5rem;
    letter-spacing: 1px;
    color: #fff;
    background: #000;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.share-x-btn:hover {
    background: #1a1a1a;
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-1px);
}

.share-x-btn svg { flex-shrink: 0; }

/* Big share button on game over */
.share-x-big {
    display: flex;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 0.5rem;
    padding: 0.7rem 1.2rem;
    font-size: 0.75rem;
    justify-content: center;
    border-radius: 10px;
    background: #000;
    border: 1px solid rgba(255,255,255,0.25);
    letter-spacing: 2px;
}

.share-x-big:hover {
    background: #111;
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 4px 15px rgba(255,255,255,0.1);
    transform: translateY(-2px) scale(1.02);
}

#controls-info {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 1rem;
}

.control-key {
    font-size: 0.5rem;
    color: rgba(255,255,255,0.25);
    margin: 0.3rem 0;
    letter-spacing: 1px;
}

.control-key span {
    display: inline-block;
    background: rgba(255,255,255,0.07);
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    color: rgba(255,255,255,0.4);
    margin: 0 0.1rem;
}

/* ===== HUD ===== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    pointer-events: none;
}

#hud-left, #hud-right {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

#score-display, #distance-display, #highscore-display {
    font-family: 'Bungee', cursive;
    font-size: 1.1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    letter-spacing: 1px;
}

#score-display { color: #FFD700; }
#distance-display { color: #ccc; font-size: 0.85rem; }
#highscore-display { color: #aaa; font-size: 0.85rem; text-align: right; }

#hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
}

#tier-display {
    font-family: 'Bungee', cursive;
    font-size: 0.65rem;
    letter-spacing: 2px;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
    transition: all 0.5s ease;
    opacity: 0;
}

#tier-display.tier-0 { color: #8BC34A; border: 1px solid rgba(139,195,74,0.3); opacity: 1; }
#tier-display.tier-1 { color: #FFC107; border: 1px solid rgba(255,193,7,0.3); opacity: 1; }
#tier-display.tier-2 { color: #FF9800; border: 1px solid rgba(255,152,0,0.4); opacity: 1; }
#tier-display.tier-3 { color: #FF5722; border: 1px solid rgba(255,87,34,0.4); opacity: 1; animation: tierPulse 1s ease-in-out infinite alternate; }
#tier-display.tier-4 { color: #FF1744; border: 1px solid rgba(255,23,68,0.5); opacity: 1; animation: tierPulse 0.5s ease-in-out infinite alternate; text-shadow: 0 0 10px rgba(255,23,68,0.6); }

@keyframes tierPulse {
    from { transform: scale(1); }
    to   { transform: scale(1.08); }
}

#multiplier {
    font-family: 'Bungee', cursive;
    font-size: 1.8rem;
    color: #FF4500;
    text-shadow: 0 0 15px rgba(255, 69, 0, 0.8);
    animation: multPulse 0.5s ease-in-out infinite alternate;
}

@keyframes multPulse {
    from { transform: scale(1); }
    to   { transform: scale(1.15); }
}

/* ===== GAME OVER ===== */
#gameover-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#gameover-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

#go-ape {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: goShake 0.6s ease;
}

@keyframes goShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-15px); }
    40% { transform: translateX(15px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

#go-title {
    font-family: 'Bungee Shade', cursive;
    font-size: 2.5rem;
    color: #FF4500;
    text-shadow: 0 0 20px rgba(255, 69, 0, 0.5);
    margin-bottom: 1.5rem;
}

#go-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.2rem;
}

.go-stat {
    font-size: 0.6rem;
    color: #aaa;
    letter-spacing: 2px;
    line-height: 2;
}

.go-stat span {
    font-size: 1.5rem;
    color: #FFD700;
    display: block;
}

#go-tier {
    font-family: 'Bungee', cursive;
    font-size: 0.7rem;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: #FF9800;
}

#go-highscore {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}

#new-hs-badge {
    font-size: 1rem;
    color: #FF4500;
    margin-bottom: 1rem;
    animation: hsBadge 0.6s ease-in-out infinite alternate;
}

@keyframes hsBadge {
    from { transform: scale(1); text-shadow: 0 0 10px rgba(255, 69, 0, 0.5); }
    to   { transform: scale(1.08); text-shadow: 0 0 20px rgba(255, 69, 0, 0.9); }
}

#restart-btn, #menu-btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0.5rem auto;
    padding: 0.8rem 1.5rem;
    font-family: 'Bungee', cursive;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s;
}

#restart-btn {
    color: #fff;
    background: linear-gradient(135deg, #2196F3, #0D47A1);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.35), inset 0 -3px 0 rgba(0,0,0,0.2);
}

#menu-btn {
    color: #ccc;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 0.75rem;
}

#restart-btn:hover { transform: translateY(-2px) scale(1.03); }
#menu-btn:hover { background: rgba(255,255,255,0.15); }

/* ===== PAUSE ===== */
#pause-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

#pause-content {
    text-align: center;
}

#pause-content h1 {
    font-family: 'Bungee Shade', cursive;
    font-size: 3rem;
    color: #FFD700;
    margin-bottom: 1.5rem;
}

#resume-btn {
    padding: 0.8rem 2.5rem;
    font-family: 'Bungee', cursive;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, #2196F3, #0D47A1);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.35), inset 0 -3px 0 rgba(0,0,0,0.2);
    transition: all 0.2s;
}

#resume-btn:hover {
    transform: translateY(-2px) scale(1.03);
}

/* ===== RESPONSIVE ===== */

/* Hype tags scale down then hide on smaller screens */
@media (max-width: 1100px) {
    .hype-hero  { padding: 0.55rem 0.8rem; }
    .hype-hero .hype-emoji { font-size: 1.5rem; }
    .hype-hero .hype-label { font-size: 0.48rem; }
    .hype-pill .hype-label { font-size: 0.4rem; }
    .hype-badge .hype-label { font-size: 0.38rem; }
    .hype-dot { font-size: 1.3rem; }
}

@media (max-width: 800px) {
    #hype-tags { display: none; }
}

@media (max-width: 600px) {
    #hype-tags { display: none; }
    #game-title { font-size: 2rem; }
    #game-subtitle { font-size: 0.55rem; letter-spacing: 3px; }
    #ape-image-wrap { width: 130px; height: 130px; }
    #play-btn { font-size: 1rem; padding: 0.7rem 1.5rem; }
    #go-title { font-size: 1.8rem; }
    #go-stats { gap: 1rem; }
    .go-stat span { font-size: 1.1rem; }
    #score-display { font-size: 0.9rem; }
    #hud { padding: 0.6rem 1rem; }
    #metrics { grid-template-columns: 1fr 1fr; gap: 0.3rem; }
    .metric-value { font-size: 0.7rem; }
    .metric { padding: 0.35rem 0.25rem; }
    #menu-content { padding: 1rem; }
    #ca-display { font-size: 0.4rem; }
    #ca-row { padding: 0.3rem 0.4rem; }
    #social-links { flex-direction: column; gap: 0.4rem; }
    .social-btn { padding: 0.5rem 1rem; font-size: 0.6rem; width: 100%; justify-content: center; }
    .share-x-big { font-size: 0.65rem; padding: 0.6rem 1rem; }
}
