/* ==========================================================================
   EUREKAKIDS - In-Game Stylesheet
   Styles for: Memory Game, Bunny Jump, Bubble Pop, Whack-a-Mole, Draw Pad
   ========================================================================== */

/* Universal Game Wrapper & HUD */
.game-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.game-hud {
    width: 100%;
    max-width: 540px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #FFFFFF;
    border: 2px solid #FFEAA7;
    border-radius: 16px;
    padding: 8px 14px;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.hud-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #FF7675;
}

.hud-select {
    padding: 4px 8px;
    border-radius: 10px;
    border: 2px solid #F0ECE1;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    outline: none;
    background: #FFFDF9;
}

.btn-game-action {
    padding: 6px 12px;
    background: #F8F9FA;
    border: 2px solid #E2DED5;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 0 #D0CBC0;
    transition: all 0.15s ease;
}

.btn-game-action:hover {
    background: #FFFFFF;
}

.btn-game-action:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-primary-fun {
    padding: 10px 20px;
    background: #FF7675;
    border: 2px solid #E84393;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 4px 0 #D63031;
    transition: all 0.15s ease;
}

.btn-primary-fun:hover {
    background: #E84393;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #D63031;
}

.btn-primary-fun:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #D63031;
}

/* Win Overlay */
.memory-win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 52, 54, 0.75);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

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

.win-card {
    background: #FFFFFF;
    border: 4px solid #FFEAA7;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3), 0 8px 0 #FDCB6E;
    padding: 24px 28px;
    text-align: center;
    max-width: 360px;
    animation: bounceZoom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceZoom {
    0% { transform: scale(0.7); }
    100% { transform: scale(1); }
}

.win-stars {
    font-size: 2.4rem;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.win-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #2D3436;
    margin-bottom: 8px;
}

.win-stats {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 18px;
}

/* ==========================================================================
   1. Starry Memory Flip Game Styles
   ========================================================================== */
.memory-grid-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    justify-content: center;
}

.memory-grid {
    display: grid;
    gap: 10px;
    width: 100%;
    perspective: 1000px;
}

.grid-easy {
    grid-template-columns: repeat(4, 1fr);
}

.grid-medium {
    grid-template-columns: repeat(4, 1fr);
}

.grid-hard {
    grid-template-columns: repeat(5, 1fr);
}

.mem-card {
    aspect-ratio: 1 / 1.15;
    cursor: pointer;
    perspective: 800px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    border-radius: 14px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.mem-card.flipped .card-inner,
.mem-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid #F0ECE1;
}

.card-front {
    background: linear-gradient(135deg, #74B9FF 0%, #A29BFE 100%);
    color: #FFFFFF;
    font-size: 1.8rem;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.4);
}

.card-front:hover {
    filter: brightness(1.06);
}

.card-back {
    background: #FFFFFF;
    transform: rotateY(180deg);
    padding: 4px;
}

.card-emoji {
    font-size: 2.2rem;
    line-height: 1;
}

.card-name {
    font-size: 0.72rem;
    font-weight: 800;
    color: #2D3436;
    margin-top: 4px;
}

.mem-card.matched .card-inner {
    animation: matchPulse 0.4s ease;
    border-color: #55EFC4;
}

@keyframes matchPulse {
    0%, 100% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.1); }
}

/* ==========================================================================
   2. Canvas Games Container (Bunny Jump & Bubble Pop)
   ========================================================================== */
.canvas-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 4px solid #FFEAA7;
    background: #FFFDF9;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
}

canvas#bunny-canvas, canvas#bubble-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

.bunny-touch-controls {
    display: flex;
    width: 100%;
    background: #FFFDF9;
    padding: 8px 12px;
    gap: 12px;
    justify-content: space-between;
}

.touch-btn {
    flex: 1;
    padding: 12px;
    background: #74B9FF;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    border: none;
    border-radius: 14px;
    box-shadow: 0 4px 0 #0984E3;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.touch-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #0984E3;
    background: #0984E3;
}

/* ==========================================================================
   3. Whack-a-Mole Game Styles
   ========================================================================== */
.whack-garden {
    background: #A8E6CF;
    border: 4px solid #55EFC4;
    border-radius: 24px;
    padding: 18px;
    max-width: 440px;
    width: 100%;
    box-shadow: inset 0 0 20px rgba(0, 184, 148, 0.2);
}

.whack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.whack-hole {
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    border-radius: 50% 50% 45% 45%;
    background: #6D4C41;
    border: 4px solid #5D4037;
    box-shadow: inset 0 10px 10px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.hole-front {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 38%;
    background: #8D6E63;
    border-radius: 50% 50% 0 0;
    z-index: 10;
    border-top: 3px solid #A1887F;
    pointer-events: none;
}

.mole {
    position: absolute;
    bottom: -80%;
    left: 15%;
    width: 70%;
    height: 85%;
    background: #BCAAA4;
    border-radius: 40px 40px 10px 10px;
    border: 3px solid #8D6E63;
    transition: bottom 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.mole.up {
    bottom: 12%;
}

.mole.hit {
    filter: brightness(1.2);
    transform: scale(0.92);
}

.mole.bee {
    background: #FFEAA7;
    border-color: #FDCB6E;
}

.mole-head {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mole-eyes {
    position: relative;
    width: 32px;
    height: 10px;
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
}

.mole-eyes::before, .mole-eyes::after {
    content: '';
    width: 7px;
    height: 7px;
    background: #2D3436;
    border-radius: 50%;
}

.mole-snout {
    width: 22px;
    height: 14px;
    background: #FFAB91;
    border-radius: 50%;
    margin-top: 4px;
}

.mole-hat {
    position: absolute;
    top: -12px;
    font-size: 1.2rem;
}

.whack-popup {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 1.2rem;
    font-weight: 800;
    z-index: 20;
    animation: floatUpFade 0.7s forwards;
    pointer-events: none;
}

@keyframes floatUpFade {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, -35px); opacity: 0; }
}

/* ==========================================================================
   4. Magic Doodle / Paint Pad Styles
   ========================================================================== */
.draw-wrapper {
    width: 100%;
    max-width: 740px;
}

.draw-toolbar {
    width: 100%;
    background: #FFFFFF;
    border: 2px solid #FFEAA7;
    border-radius: 18px;
    padding: 10px 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 60px;
}

.color-palette {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid #FFFFFF;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.color-btn:hover, .color-btn.active {
    transform: scale(1.22);
    box-shadow: 0 0 0 2px #FF7675;
}

.tool-pill {
    padding: 4px 10px;
    border-radius: 12px;
    border: 2px solid #F0ECE1;
    background: #F8F9FA;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.rainbow-pill {
    background: linear-gradient(135deg, #FF7675, #FFEAA7, #55EFC4, #74B9FF);
    color: #2D3436;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.rainbow-pill.active {
    box-shadow: 0 0 0 3px #6C5CE7;
    font-weight: 800;
}

.size-group, .stamp-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.size-btn, .stamp-btn {
    padding: 4px 10px;
    border-radius: 10px;
    border: 2px solid #F0ECE1;
    background: #FFFDF9;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.size-btn.active, .stamp-btn.active {
    border-color: #FF7675;
    background: #FFEAA7;
    font-weight: 800;
}

.draw-canvas-box {
    width: 100%;
    overflow: hidden;
}

canvas#draw-canvas {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
    background: #FFFFFF;
    cursor: crosshair;
    touch-action: none;
}
