/* ============================================
   신나는 게임월드 - 메인 스타일시트
   Mobile-First Design
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pink: #FF6B8A;
    --pink-light: #FFE0E8;
    --coral: #FF8A65;
    --yellow: #FFD54F;
    --yellow-light: #FFF8E1;
    --mint: #4DD0B7;
    --mint-light: #E0F7F4;
    --sky: #64B5F6;
    --sky-light: #E3F2FD;
    --purple: #BA68C8;
    --purple-light: #F3E5F5;
    --orange: #FFB74D;
    --green: #81C784;
    --text: #3E3E3E;
    --text-light: #757575;
    --white: #FFFFFF;
    --bg: #FFF5F7;
    --card-shadow: 0 4px 16px rgba(255, 107, 138, 0.15);
    --card-shadow-hover: 0 8px 30px rgba(255, 107, 138, 0.25);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --font-main: 'Noto Sans KR', sans-serif;
    --font-fun: 'Gamja Flower', cursive;
    --max-width: 480px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.5;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* --- Background Decorations --- */
.bg-decorations {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-star {
    position: absolute;
    font-size: 1.5rem;
    animation: floatUpDown 3s ease-in-out infinite;
    opacity: 0.4;
}
.floating-star:nth-child(1) { top: 10%; left: 8%; animation-delay: 0s; font-size: 1.8rem; }
.floating-star:nth-child(2) { top: 20%; right: 10%; animation-delay: 0.5s; font-size: 1.4rem; }
.floating-star:nth-child(3) { top: 60%; left: 5%; animation-delay: 1s; font-size: 1.6rem; }
.floating-star:nth-child(4) { top: 75%; right: 8%; animation-delay: 1.5s; font-size: 1.3rem; }
.floating-star:nth-child(5) { top: 40%; left: 15%; animation-delay: 2s; font-size: 1.2rem; }
.floating-star:nth-child(6) { top: 85%; left: 70%; animation-delay: 2.5s; font-size: 1.7rem; }

@keyframes floatUpDown {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* --- App Container --- */
.app-container {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--white);
    box-shadow: 0 0 60px rgba(0,0,0,0.06);
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, var(--pink), var(--coral));
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 20px rgba(255, 107, 138, 0.3);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-text {
    color: var(--white);
}

.site-title {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.site-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

/* --- Main Content --- */
.main-content {
    padding: 16px 16px calc(24px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content.hidden {
    display: none;
}

/* --- Hero Section --- */
.hero-section {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-card {
    background: linear-gradient(135deg, var(--yellow-light), #FFF0F5);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px dashed var(--yellow);
}

.hero-mascot {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
}

.hero-emoji {
    font-size: 2.5rem;
}

.hero-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.hero-message h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--pink);
    margin-bottom: 4px;
}

.hero-message p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* --- Section Title --- */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Games Grid --- */
.games-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.game-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    animation: fadeInCard 0.4s ease-out backwards;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.10s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.20s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.30s; }
.game-card:nth-child(7) { animation-delay: 0.35s; }
.game-card:nth-child(8) { animation-delay: 0.40s; }

@keyframes fadeInCard {
    from { opacity: 0; transform: scale(0.85) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.game-card:active {
    transform: scale(0.95);
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.game-card:nth-child(1) { border-color: #FFE0E8; }
.game-card:nth-child(2) { border-color: #E0F7F4; }
.game-card:nth-child(3) { border-color: #E3F2FD; }
.game-card:nth-child(4) { border-color: #F3E5F5; }
.game-card:nth-child(5) { border-color: #FFF3E0; }
.game-card:nth-child(6) { border-color: #FFF8E1; }
.game-card:nth-child(7) { border-color: #E8F5E9; }
.game-card:nth-child(8) { border-color: #FCE4EC; }

.game-card-emoji {
    font-size: 2.8rem;
    display: block;
    margin-bottom: 8px;
    transition: transform 0.2s;
}

.game-card:active .game-card-emoji {
    transform: scale(1.15);
}

.game-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.game-card-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.3;
}

.game-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--pink);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.game-card:nth-child(3) .game-card-badge,
.game-card:nth-child(7) .game-card-badge {
    background: var(--mint);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-light);
}

.footer p {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.footer-small {
    font-size: 0.7rem !important;
    opacity: 0.6;
}

/* ============================================
   Game Screen
   ============================================ */

.game-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    flex-direction: column;
}

.game-screen.active {
    display: flex;
}

.game-header {
    background: linear-gradient(135deg, var(--pink), var(--coral));
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    min-height: 52px;
    flex-shrink: 0;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    flex-shrink: 0;
}

.btn-back:active {
    background: rgba(255,255,255,0.35);
}

.back-icon {
    font-size: 0.7rem;
}

.game-title-display {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-score-display {
    color: var(--yellow);
    font-weight: 900;
    font-size: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.game-score-display:empty {
    display: none;
}

.game-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

/* ============================================
   Modal (Game Over / Result)
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.modal-emoji {
    font-size: 3.5rem;
    margin-bottom: 8px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--pink);
    margin-bottom: 4px;
}

.modal-message {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.modal-score {
    font-size: 2rem;
    font-weight: 900;
    color: var(--coral);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
    transition: transform 0.15s;
}

.btn:active {
    transform: scale(0.95);
}

.btn-retry {
    background: var(--pink);
    color: white;
}

.btn-menu {
    background: var(--sky-light);
    color: var(--sky);
    border: 2px solid var(--sky);
}

/* ============================================
   Shared Game Styles
   ============================================ */

/* --- Game Intro Screen --- */
.game-intro {
    text-align: center;
    padding: 20px;
}

.game-intro-emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 16px;
    animation: bounceEmoji 0.6s ease-out;
}

@keyframes bounceEmoji {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.game-intro h3 {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 8px;
}

.game-intro p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-start {
    background: linear-gradient(135deg, var(--pink), var(--coral));
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 138, 0.35);
    touch-action: manipulation;
}

.btn-start:active {
    transform: scale(0.95);
}

/* --- Whack-a-Mole --- */
.whack-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 360px;
    width: 100%;
    padding: 10px;
}

.whack-hole {
    aspect-ratio: 1;
    background: linear-gradient(180deg, #8B5E3C 0%, #6B3F2A 50%, #4A2512 100%);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    box-shadow: inset 0 6px 12px rgba(0,0,0,0.4);
    touch-action: manipulation;
}

.whack-mole {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    font-size: 2.4rem;
    transition: transform 0.1s ease-out;
    pointer-events: none;
}

.whack-mole.show {
    transform: translate(-50%, 10%);
}

.whack-mole:active {
    transform: translate(-50%, 10%) scale(0.8);
}

.whack-hole.hit .whack-mole {
    font-size: 1.5rem;
    transition: transform 0.15s ease-in;
    transform: translate(-50%, 30%);
}

.whack-info {
    text-align: center;
    margin-bottom: 8px;
}

.whack-timer {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--pink);
}

.whack-score-text {
    font-size: 0.95rem;
    color: var(--text-light);
}

/* --- Memory Card Game --- */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 360px;
    width: 100%;
}

.memory-card {
    aspect-ratio: 1;
    perspective: 600px;
    cursor: pointer;
    touch-action: manipulation;
}

.memory-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.4s ease;
    transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-face {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.memory-card-back {
    background: linear-gradient(135deg, var(--pink), var(--coral));
    box-shadow: 0 3px 8px rgba(255, 107, 138, 0.3);
}

.memory-card-back::after {
    content: '?';
    color: white;
    font-size: 1.8rem;
    font-weight: 900;
}

.memory-card-front {
    background: var(--white);
    transform: rotateY(180deg);
    border: 2px solid var(--mint);
    box-shadow: 0 3px 8px rgba(77, 208, 183, 0.2);
}

.memory-card.matched .memory-card-front {
    border-color: var(--green);
    background: #E8F5E9;
    animation: matchPop 0.4s ease-out;
}

@keyframes matchPop {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.15); }
    100% { transform: rotateY(180deg) scale(1); }
}

.memory-info {
    text-align: center;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    max-width: 360px;
    width: 100%;
    padding: 0 4px;
}

/* --- Catch Stars --- */
.catch-game-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 420px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

.catch-basket {
    position: absolute;
    bottom: 12px;
    font-size: 2.5rem;
    transform: translateX(-50%);
    transition: left 0.05s linear;
    pointer-events: none;
    z-index: 10;
}

.catch-star {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: none;
    animation: fallStar linear forwards;
    z-index: 5;
}

@keyframes fallStar {
    from { transform: translateY(0); }
    to { transform: translateY(450px); }
}

.catch-hud {
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    width: 100%;
    margin-bottom: 6px;
    color: white;
    font-weight: 700;
}

.catch-miss {
    color: #FF5252;
}

/* --- Rock Paper Scissors --- */
.rps-game {
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.rps-choices {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
    flex-wrap: wrap;
}

.rps-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 2.4rem;
    cursor: pointer;
    border: 3px solid #eee;
    background: white;
    box-shadow: var(--card-shadow);
    touch-action: manipulation;
    transition: all 0.15s;
}

.rps-btn:active {
    transform: scale(0.9);
    border-color: var(--pink);
}

.rps-btn.selected {
    border-color: var(--pink);
    background: var(--pink-light);
    transform: scale(1.1);
}

.rps-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.rps-player, .rps-computer {
    font-size: 3rem;
}

.rps-vs {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-light);
}

.rps-outcome {
    font-size: 1.2rem;
    font-weight: 900;
    margin: 8px 0;
    min-height: 32px;
}

.rps-score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 12px;
    font-weight: 700;
}

/* --- Snake --- */
.snake-canvas-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.snake-canvas-wrap canvas {
    display: block;
    background: #1a1a2e;
}

.snake-controls {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 4px;
    margin-top: 12px;
    justify-content: center;
}

.snake-dpad {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xs);
    border: 2px solid #ddd;
    background: white;
    font-size: 1.3rem;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.snake-dpad:active {
    background: var(--pink-light);
    border-color: var(--pink);
}

.snake-dpad-empty {
    border: none;
    background: transparent;
}

/* --- Math Quiz --- */
.math-game {
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.math-question {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text);
    margin: 20px 0;
    background: var(--yellow-light);
    border-radius: var(--radius);
    padding: 20px;
    border: 2px dashed var(--yellow);
}

.math-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.math-ans-btn {
    padding: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 3px solid #eee;
    background: white;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s;
    box-shadow: var(--card-shadow);
}

.math-ans-btn:active {
    transform: scale(0.95);
}

.math-ans-btn.correct {
    border-color: var(--green);
    background: #E8F5E9;
    animation: popIn 0.3s;
}

.math-ans-btn.wrong {
    border-color: var(--pink);
    background: #FFEBEE;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.math-hud {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 8px;
}

/* --- 2048 --- */
.game2048-wrap {
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.board2048 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #BBADA0;
    padding: 10px;
    border-radius: var(--radius-xs);
    box-shadow: var(--card-shadow);
}

.tile2048 {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.3rem;
    background: #CDC1B4;
    color: #776E65;
    transition: all 0.1s ease;
}

.tile2048[data-value="2"] { background: #EEE4DA; }
.tile2048[data-value="4"] { background: #EDE0C8; }
.tile2048[data-value="8"] { background: #F2B179; color: white; }
.tile2048[data-value="16"] { background: #F59563; color: white; }
.tile2048[data-value="32"] { background: #F67C5F; color: white; }
.tile2048[data-value="64"] { background: #F65E3B; color: white; }
.tile2048[data-value="128"] { background: #EDCF72; color: white; font-size: 1.1rem; }
.tile2048[data-value="256"] { background: #EDCC61; color: white; font-size: 1.1rem; }
.tile2048[data-value="512"] { background: #EDC850; color: white; font-size: 1.1rem; }
.tile2048[data-value="1024"] { background: #EDC53F; color: white; font-size: 0.95rem; }
.tile2048[data-value="2048"] { background: #EDC22E; color: white; font-size: 0.95rem; }

.tile2048.new-tile {
    animation: popIn 0.2s ease-out;
}

.game2048-score-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.game2048-score-box {
    background: #BBADA0;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-xs);
    font-weight: 700;
}

/* --- Bug Catch --- */
.bug-area {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 400px;
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    border: 3px solid var(--mint);
}

.bug {
    position: absolute;
    font-size: 1.8rem;
    transition: left 0.3s, top 0.3s;
    animation: bugWiggle 0.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes bugWiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.bug.caught {
    animation: bugSplat 0.3s ease-out forwards;
}

@keyframes bugSplat {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.bug-hud {
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    width: 100%;
    font-weight: 700;
    margin-bottom: 6px;
}

/* ============================================
   Responsive - Tablet & Desktop
   ============================================ */

@media (min-width: 481px) {
    .app-container {
        border-radius: var(--radius);
        margin: 16px auto;
        min-height: calc(100vh - 32px);
        min-height: calc(100dvh - 32px);
    }

    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero-mascot {
        width: 80px;
        height: 80px;
    }

    .hero-emoji {
        font-size: 3rem;
    }
}

@media (min-width: 769px) {
    :root {
        --max-width: 720px;
    }

    .games-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    .game-card {
        padding: 20px 16px;
    }

    .game-card-emoji {
        font-size: 3.2rem;
    }
}

/* --- Tic-Tac-Toe --- */
.ttt-cell:active {
    background: var(--pink-light);
    transform: scale(0.9);
}

/* --- Reaction Time --- */
#rxArea {
    -webkit-tap-highlight-color: transparent;
}

/* --- Number Baseball --- */
#nbD1, #nbD2, #nbD3 {
    -moz-appearance: textfield;
}
#nbD1::-webkit-outer-spin-button,
#nbD1::-webkit-inner-spin-button,
#nbD2::-webkit-outer-spin-button,
#nbD2::-webkit-inner-spin-button,
#nbD3::-webkit-outer-spin-button,
#nbD3::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Color Word --- */
.cw-cho-btn:active {
    transform: scale(0.9) !important;
}

/* --- Bubble Pop --- */
#bpArea {
    -webkit-tap-highlight-color: transparent;
}

/* --- Slide Puzzle --- */
#spBoard > div:active {
    transform: scale(0.9);
}

/* --- Speed Tap --- */
#stArea {
    -webkit-tap-highlight-color: transparent;
}

/* --- Simon Says --- */
.ss-btn {
    opacity: 0.75;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.ss-btn:active {
    transform: scale(0.9);
}

/* ============================================
   Utility
   ============================================ */

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }
