@import url('../styles.css');

/* Mobile score */
.mobile-score {
    display: none;
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 1002;
    background: rgba(36,36,36,0.85);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-weight: bold;
}

/* Layout */
.responsive-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}
.game-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
.info-side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 280px;
    max-width: 400px;
    background: rgba(36,36,36,0.85);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    padding: 2rem;
}
.info-side h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.info-side p { font-size: 1.1rem; margin-bottom: 1.5rem; color: var(--text-muted); }
.buttons-panel { display: flex; gap: 1rem; margin-top: 1.5rem; }
.score-panel { display: flex; gap: 1.5rem; font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--text-muted); flex-wrap: wrap; }

@media (max-width: 900px) {
    .responsive-layout { flex-direction: column; align-items: center; gap: 1.5rem; padding: 1rem 0.5rem; }
    .info-side { max-width: 100vw; width: 100%; align-items: center; text-align: center; }
    .info-side h1 { font-size: 1.7rem; }
    .game-side { width: 100%; justify-content: center; }
}

body { background: var(--grad-bg); color: #fff; min-height: 100vh; margin: 0; }

/* ---- Score animated ---- */
.score-animated {
    display: inline-block;
    transition: transform 0.15s ease;
}
.score-animated.bump {
    transform: scale(1.35);
}

/* ---- Time bar ---- */
.time-bar-wrap {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    height: 10px;
    margin-bottom: 1.2rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}
.time-bar {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #8fd3f4 0%, #ff512f 100%);
    transition: width 0.9s linear;
    width: 100%;
}

/* ---- Whack-a-Mole grid ---- */
.mole-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 14px;
    padding: 18px;
    background: linear-gradient(160deg, #4caf2a 0%, #2e7d1e 100%);
    border-radius: 22px;
    width: 370px;
    height: 370px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 2px 8px rgba(255,255,255,0.08);
}

/* ---- Hole ---- */
.hole {
    position: relative;
    background: radial-gradient(ellipse at 50% 80%, #0a1f03 60%, #1c4a0a 100%);
    border-radius: 50%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    box-shadow:
        inset 0 6px 18px rgba(0,0,0,0.7),
        inset 0 2px 6px rgba(0,0,0,0.5),
        0 2px 4px rgba(0,0,0,0.3);
    transition: box-shadow 0.15s;
}

.hole.active {
    box-shadow:
        inset 0 4px 12px rgba(0,0,0,0.5),
        inset 0 1px 3px rgba(0,0,0,0.4),
        0 2px 4px rgba(0,0,0,0.3);
}

.hole.whacked {
    box-shadow:
        inset 0 6px 18px rgba(0,0,0,0.7),
        inset 0 2px 6px rgba(0,0,0,0.5),
        0 0 18px rgba(255,81,47,0.6);
}

/* ---- Mole body (CSS only, no emoji) ---- */
.mole {
    position: relative;
    width: 72%;
    height: 78%;
    transform: translateY(110%);
    transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    flex-shrink: 0;
}

.hole.active .mole {
    transform: translateY(0%);
}

/* Mole body */
.mole-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 88%;
    background: radial-gradient(ellipse at 40% 30%, #b5793a 0%, #7a4a18 60%, #5a3310 100%);
    border-radius: 50% 50% 40% 40% / 55% 55% 45% 45%;
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.3), inset 2px 2px 6px rgba(255,200,120,0.2);
}

/* Highlight on mole head */
.mole-body::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 20%;
    width: 30%;
    height: 18%;
    background: radial-gradient(ellipse, rgba(255,220,160,0.55) 0%, transparent 80%);
    border-radius: 50%;
}

/* Mole snout */
.mole-body::after {
    content: '';
    position: absolute;
    bottom: 28%;
    left: 50%;
    transform: translateX(-50%);
    width: 44%;
    height: 26%;
    background: radial-gradient(ellipse at 50% 40%, #e8a0a0 0%, #c06060 70%);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

/* Mole eyes */
.mole-eye-left,
.mole-eye-right {
    position: absolute;
    top: 28%;
    width: 18%;
    height: 18%;
    background: radial-gradient(circle at 35% 35%, #555 0%, #111 70%);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}
.mole-eye-left { left: 20%; }
.mole-eye-right { right: 20%; }

/* Eye shine */
.mole-eye-left::after,
.mole-eye-right::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 35%;
    height: 35%;
    background: rgba(255,255,255,0.75);
    border-radius: 50%;
}

/* ---- Golden mole ---- */
.mole.golden .mole-body {
    background: radial-gradient(ellipse at 40% 30%, #ffe066 0%, #e8a000 60%, #b87800 100%);
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.2), inset 2px 2px 6px rgba(255,255,180,0.4), 0 0 16px rgba(255,200,0,0.6);
}

/* ---- Evil mole ---- */
.mole.evil .mole-body {
    background: radial-gradient(ellipse at 40% 30%, #e85050 0%, #9b1c1c 60%, #6b0f0f 100%);
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.3), inset 2px 2px 6px rgba(255,150,150,0.2), 0 0 14px rgba(220,30,30,0.5);
}

/* Evil horns */
.mole.evil .mole-body::before {
    background: radial-gradient(ellipse, rgba(255,180,180,0.4) 0%, transparent 80%);
}

/* ---- Hit effect: floating +1 ---- */
@keyframes fadeUpOut {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    60%  { opacity: 1; transform: translateY(-22px) scale(1.1); }
    100% { opacity: 0; transform: translateY(-40px) scale(0.9); }
}

.hit-effect {
    position: absolute;
    pointer-events: none;
    font-size: 1.3rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 200;
    animation: fadeUpOut 0.65s ease forwards;
    white-space: nowrap;
}

/* ---- Buttons ---- */
#startBtn, #restartBtn {
    background: var(--grad-primary);
    color: #222; border: none; border-radius: 8px;
    padding: 0.9rem 2rem; font-size: 1.1rem; font-weight: bold;
    cursor: pointer; margin: 0 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.2s, transform 0.2s;
}
#startBtn:hover, #restartBtn:hover { opacity: 0.9; transform: scale(1.05); }
#playAgainBtn {
    background: #8fd3f4; color: #222; border: none; border-radius: 8px;
    padding: 1rem 2.2rem; font-size: 1.2rem; font-weight: bold;
    cursor: pointer; transition: background 0.2s; margin-top: 1rem;
}
#playAgainBtn:hover { background: #5ec2e6; }

.popup {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(24,24,24,0.95); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.popup-content {
    background: #242424; padding: 2.5rem 3rem; border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4); text-align: center;
    min-width: 280px; max-width: 90vw;
}
.popup-content h2 { margin-top: 0; color: #8fd3f4; font-size: 2rem; }
.popup-content p { font-size: 1.5rem; margin: 1.5rem 0; }

/* Speed indicator */
.speed-label {
    font-size: 0.85rem;
    color: #8fd3f4;
    margin-bottom: 1rem;
    font-style: italic;
    min-height: 1.2em;
}
