/* ===== Games hub ===== */
.games-hub, .game-play { max-width: 1100px; margin: 2.5rem auto; padding: 0 1.5rem; }
.games-head { text-align: center; margin-bottom: 2rem; }
.games-head h1 { font-size: 2.4rem; margin: 0 0 .5rem; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.2rem; margin: 1.5rem 0 2.5rem; }
/* Each column contains a game card + its leaderboard widget */
.game-col { display: flex; flex-direction: column; gap: .6rem; }
.game-card { background: #fff; border: 1px solid #e6e9e7; border-radius: 16px; padding: 1.5rem; text-align: center; transition: .15s; }
.game-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(20,30,25,.12); border-color: #18a957; }

/* ===== Leaderboard widget ===== */
.lb-widget { background: #fff; border: 1px solid #e6e9e7; border-radius: 14px; padding: .8rem; }
.lb-tabs { display: flex; gap: .3rem; margin-bottom: .6rem; flex-wrap: wrap; }
.lb-tab { flex: 1; padding: .3rem 0; border: 1px solid #e6e9e7; border-radius: 999px;
          background: #fff; font-weight: 700; font-size: .72rem; cursor: pointer; line-height: 1.4; }
.lb-tab:hover { border-color: #18a957; color: #128043; }
.lb-tab.active { background: #18a957; color: #fff; border-color: #18a957; }
.lb-list { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; }
.lb-list li { display: flex; gap: .4rem; padding: .3rem 0; border-bottom: 1px solid #e6e9e7;
              align-items: center; font-size: .8rem; }
.lb-list li:last-child { border: 0; }
.lb-rank { font-weight: 800; color: #128043; min-width: 1.6rem; flex-shrink: 0; }
.lb-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: #6b7280; font-size: .74rem; flex-shrink: 0; }
.lb-empty { color: #6b7280; text-align: center; padding: .6rem 0; font-size: .82rem; list-style: none; }
/* Gold / silver / bronze for top 3 */
.lb-list li:nth-child(1) .lb-rank { color: #b8860b; }
.lb-list li:nth-child(2) .lb-rank { color: #7a7a7a; }
.lb-list li:nth-child(3) .lb-rank { color: #9a5c2e; }
.game-emoji { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.game-card h3 { margin: .3rem 0; }
.game-card p { color: #6b7280; font-size: .9rem; margin: .3rem 0 .8rem; }
.play-tag { font-weight: 700; color: #128043; font-size: .9rem; }
.game-card-ext { background: #f5f8f6; }
.ext-arrow { color: #6b7280; }

/* ===== Playful KIDS button (used on home + games hub) ===== */
.kids-pill {
    display: inline-block; margin-top: 1rem; padding: .9rem 1.8rem; border-radius: 999px;
    font-weight: 800; font-size: 1.1rem; color: #fff; text-decoration: none;
    background: linear-gradient(90deg, #ff6b6b, #ffa94d, #ffd43b, #69db7c, #4dabf7, #b197fc);
    background-size: 300% 100%; box-shadow: 0 6px 18px rgba(0,0,0,.15);
    animation: kidsShimmer 6s linear infinite;
}
.kids-pill:hover { animation: kidsShimmer 6s linear infinite, kidsBounce .5s ease infinite; }
@keyframes kidsShimmer { to { background-position: 300% 0; } }
@keyframes kidsBounce { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.04); } }

.kids-band { text-align: center; padding: 2.5rem 1.5rem; background: linear-gradient(180deg, #fff, #fff7e6); }
.kids-band h2 { font-size: 1.8rem; margin: 0 0 .3rem; }
.kids-band p { color: #6b7280; margin: 0 0 1rem; }

/* ===== Kids zone ===== */
.kids-zone { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }
.kids-hero { text-align: center; background: linear-gradient(135deg, #fff0f6, #e7f5ff, #fff9db); border-radius: 24px; padding: 2.5rem 1.5rem; margin-bottom: 2rem; }
.kids-hero h1 { font-size: 2.6rem; margin: 0 0 .5rem; }
.kids-hero p { font-size: 1.15rem; color: #495057; }
.kids-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.2rem; }
.kids-card {
    display: flex; flex-direction: column; align-items: center; gap: .6rem;
    background: #fff; border: 3px solid #ffe066; border-radius: 20px; padding: 1.8rem 1rem;
    text-decoration: none; color: #1c2024; font-weight: 800; transition: .15s;
}
.kids-card:nth-child(3n+1) { border-color: #ff8787; }
.kids-card:nth-child(3n+2) { border-color: #74c0fc; }
.kids-card:nth-child(3n+3) { border-color: #8ce99a; }
.kids-card:hover { transform: scale(1.06) rotate(-1deg); }
.kids-emoji { font-size: 3rem; }
.kids-name { font-size: 1.1rem; }
.kids-note { text-align: center; margin-top: 2rem; color: #6b7280; font-weight: 600; }
.kids-note a { color: #128043; }

/* ===== In-game UI (hangman / anagram / wordmatch) ===== */
.game-root { margin-top: 1.5rem; }
.hm, .ana, .wm { background: #fff; border: 1px solid #e6e9e7; border-radius: 16px; padding: 1.5rem; }
.hm-status, .ana-score, .wm-status { color: #6b7280; font-weight: 700; margin-bottom: 1rem; }
.hm-word { font-size: 2.4rem; letter-spacing: .4rem; text-align: center; font-weight: 800; margin: 1rem 0; }
.hm-hint { text-align: center; color: #6b7280; margin-bottom: 1rem; }
.hm-keys { display: grid; grid-template-columns: repeat(9, 1fr); gap: .4rem; }
.hm-key { padding: .5rem 0; border: 1px solid #e6e9e7; border-radius: 8px; background: #fff; font-weight: 700; cursor: pointer; }
.hm-key:hover:not(:disabled) { background: #f5f8f6; border-color: #18a957; }
.hm-key.good { background: #e6f7ee; border-color: #18a957; color: #128043; }
.hm-key.bad { background: #fdecec; border-color: #b4231f; color: #b4231f; }
.hm-result { text-align: center; font-size: 1.2rem; margin: 1.2rem 0; font-weight: 700; }
.hm-result.win, .win { color: #128043; }
.hm-result.lose, .lose { color: #b4231f; }
.hm .btn, .ana .btn, .wm .btn { margin-top: 1rem; }

.ana-letters { display: flex; justify-content: center; gap: .5rem; margin: 1rem 0; }
.ana-tile { width: 44px; height: 44px; display: grid; place-items: center; background: #f5f8f6; border: 2px solid #18a957; border-radius: 10px; font-size: 1.4rem; font-weight: 800; }
.ana-form { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }
.ana-input { padding: .6rem 1rem; border: 1px solid #e6e9e7; border-radius: 10px; font-size: 1.1rem; text-transform: uppercase; }
.ana-msg { text-align: center; font-weight: 700; min-height: 1.5rem; }

.wm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.wm-item { display: block; width: 100%; text-align: left; padding: .8rem 1rem; margin-bottom: .5rem; border: 2px solid #e6e9e7; border-radius: 10px; background: #fff; cursor: pointer; font-size: .95rem; }
.wm-item:hover:not(.matched) { border-color: #18a957; }
.wm-item.selected { border-color: #18a957; background: #e6f7ee; }
.wm-item.matched { opacity: .45; cursor: default; border-style: dashed; }

/* ===== Embedded game player ===== */
.embed-player {
    background: #1c2024; border-radius: 16px; margin: 0 auto 2rem;
    max-width: 1100px; overflow: hidden;
}
.embed-player-bar {
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
    padding: .7rem 1rem; background: #111;
}
.embed-player-title { font-weight: 800; color: #fff; font-size: 1rem; flex: 1; }
.embed-credit { color: #8a9090; font-size: .78rem; }
.embed-credit a { color: #4dabf7; }
.embed-close {
    background: #363d45; color: #fff; border: none; border-radius: 8px;
    padding: .35rem .8rem; font-weight: 700; cursor: pointer; font-size: .82rem;
}
.embed-close:hover { background: #b4231f; }
.embed-frame-wrap { background: #000; }

/* ===== Embedded game grid (43 games) ===== */
.embed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .8rem; margin: 1.2rem 0 2.5rem;
}
.embed-card {
    background: #fff; border: 2px solid #e6e9e7; border-radius: 14px;
    padding: .9rem .7rem; text-align: center; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    transition: .15s; font-family: inherit;
}
.embed-card:hover { border-color: #18a957; transform: translateY(-3px); box-shadow: 0 8px 20px rgba(20,30,25,.1); }
.embed-card.active { border-color: #18a957; background: #e6f7ee; }
.embed-emoji { font-size: 1.9rem; line-height: 1.2; }
.embed-name { font-size: .85rem; font-weight: 800; color: #1c2024; }
.embed-desc { font-size: .72rem; color: #6b7280; line-height: 1.3; }
.embed-play-tag { font-size: .72rem; font-weight: 700; color: #128043; margin-top: .15rem; }

/* ===== Adaptive difficulty: level badge + toast ===== */
.hm-bar, .ana-bar, .wm-bar, .eq-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: .8rem; margin-bottom: 1rem;
}
.game-level {
    display: inline-block; font-weight: 800; font-size: .8rem; color: #fff;
    background: linear-gradient(90deg, #4dabf7, #b197fc); padding: .25rem .7rem;
    border-radius: 999px; white-space: nowrap;
}
.game-root { position: relative; }
.game-toast {
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: #18a957; color: #fff; font-weight: 800; padding: .6rem 1.2rem;
    border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 5;
    animation: toastPop 1.8s ease forwards;
}
@keyframes toastPop {
    0% { opacity: 0; transform: translate(-50%, -8px) scale(.9); }
    15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -8px) scale(.95); }
}

/* ===== Countdown timer ===== */
#game-timer-slot { margin-bottom: .6rem; }
#game-timer {
    display: flex; align-items: center; gap: .6rem;
    font-size: .82rem; font-weight: 700; color: #6b7280;
}
#game-timer-bar-wrap {
    flex: 1; height: 7px; background: #e6e9e7; border-radius: 4px; overflow: hidden;
}
#game-timer-bar {
    height: 100%; background: #18a957; border-radius: 4px;
    transition: width .1s linear, background .3s;
}
#game-timer-bar.urgent { background: #b4231f; }

/* ===== Emoji Quiz ===== */
.eq { background: #fff; border: 1px solid #e6e9e7; border-radius: 16px; padding: 1.5rem; text-align: center; }
.eq-score { color: #6b7280; font-weight: 700; }
.eq-emoji { font-size: 5rem; line-height: 1.2; margin: .5rem 0; }
.eq-prompt { font-weight: 700; margin-bottom: 1rem; }
.eq-options { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; max-width: 26rem; margin: 0 auto; }
.eq-opt { background: #fff; border: 2px solid #e6e9e7; color: #1c2024; font-weight: 700; padding: .8rem; }
.eq-opt:hover:not(:disabled) { border-color: #18a957; background: #f5f8f6; }
.eq-opt.eq-correct { border-color: #18a957; background: #e6f7ee; color: #128043; }
.eq-opt.eq-wrong { border-color: #b4231f; background: #fdecec; color: #b4231f; }
.eq-msg { min-height: 1.5rem; margin-top: 1rem; font-weight: 700; }

@media (max-width: 600px) {
    .hm-keys { grid-template-columns: repeat(7, 1fr); }
}
