/* ============================================================
   game-hud.css — the one in-game top bar (ShoppingList / FindTheShape look)
   Loaded by _GameLayout for every game.

   [שלבים >] [⭐ points] [🪙 coins]   רמה X · שלב Y   [⏱ timer]

   Markup (RTL — the first .gh-side sits on the right):
   <div class="gh">
     <div class="gh-side">
       <button type="button" class="gh-back"> <svg…/> <span class="gh-back-txt">שלבים</span></button>
       <div class="gh-stat" title="נקודות"><span aria-hidden="true">⭐</span><bdi id="…">0</bdi></div>
       <div class="gh-stat gold" id="coinStatBox"><span aria-hidden="true">🪙</span><bdi id="valCoins">0</bdi><span id="valCoinProgress" hidden></span></div>
     </div>
     <div class="gh-title" id="…">רמה 1 · שלב 1</div>
     <div class="gh-side gh-end">
       <div class="gh-timer idle"> <svg…/> <bdi>—</bdi></div>   (only in games with a timer)
     </div>
   </div>

   Keep each game's existing ids on the inner elements — game code and the
   co-op files write to them directly. Add .bump to a stat to pulse it.
   Extra game stats (pairs left, lives…) go in .gh-end as more .gh-stat pills,
   before the timer. Games on a dark background add .gh-dark to .gh.
   ============================================================ */

.gh {
    --gh-ink: #1C1B22;
    --gh-line: #E6E3DC;
    --gh-muted: #F1EFEA;
    --gh-accent: #4F46E5;
    --gh-accent-l: #EEF0FF;
    --gh-gold-bg: #FFF3D6;
    --gh-gold-ink: #9A5B00;

    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
    width: 100%; box-sizing: border-box;
    margin-bottom: 10px;
    direction: rtl;
    font-family: 'Heebo', system-ui, sans-serif;
    color: var(--gh-ink);
}
.gh-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.gh-end { justify-content: flex-end; }

.gh .gh-back {
    display: inline-flex; align-items: center; gap: 4px;
    height: 36px; padding: 0 12px 0 10px; margin: 0;
    border-radius: 999px; border: 1px solid var(--gh-line);
    background: #fff; color: var(--gh-ink); box-shadow: none;
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
    text-decoration: none; transition: border-color .15s, color .15s;
}
.gh .gh-back svg { width: 18px; height: 18px; flex: none; }
.gh .gh-back:hover { border-color: var(--gh-accent); color: var(--gh-accent); }
.gh .gh-back:active { transform: scale(.97); }

.gh .gh-stat {
    display: inline-flex; gap: 4px; align-items: center; height: 34px; box-sizing: border-box;
    margin: 0; padding: 0 11px; border: 0; border-radius: 999px;
    background: var(--gh-muted); color: var(--gh-ink); box-shadow: none;
    font-weight: 800; font-size: 15px; line-height: 1; font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.gh .gh-stat.gold { background: var(--gh-gold-bg); color: var(--gh-gold-ink); }
.gh .gh-stat.bump { animation: ghBump .45s ease; }
.gh .gh-stat.warn { background: #FFF1D6; color: #B45309; }
.gh .gh-stat.danger { background: #FDE0DC; color: #C0392B; }
@keyframes ghBump { 50% { transform: scale(1.12); } }

.gh .gh-title {
    font-weight: 800; font-size: 17px; white-space: nowrap; text-align: center;
    color: var(--gh-ink); margin: 0;
}

.gh .gh-timer {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; min-width: 74px; box-sizing: border-box; padding: 0 12px;
    border-radius: 999px; background: var(--gh-accent-l); color: var(--gh-accent);
    font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
    transition: background .3s, color .3s;
}
.gh .gh-timer svg { width: 18px; height: 18px; flex: none; }
.gh .gh-timer.idle { background: var(--gh-muted); color: #9A97A0; }
.gh .gh-timer.warn { background: #FFF1D6; color: #B45309; }
.gh .gh-timer.danger { background: #FDE0DC; color: #C0392B; }

/* games on a dark background: add .gh-dark — the pills stay light, the title turns white */
.gh.gh-dark .gh-title { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }

/* phones: title on its own row, back + stats + timer on the second */
@media (max-width: 560px) {
    .gh { grid-template-columns: 1fr auto; grid-template-areas: "title title" "side end"; row-gap: 6px; margin-bottom: 8px; }
    .gh > .gh-title { grid-area: title; font-size: 16px; }
    .gh > .gh-side:first-child { grid-area: side; flex-wrap: nowrap; gap: 6px; }
    .gh > .gh-end { grid-area: end; }
    .gh .gh-back { padding: 0 8px; }
    .gh .gh-back-txt { display: none; }
    .gh .gh-stat { padding: 0 9px; font-size: 14px; height: 32px; }
    .gh .gh-timer { height: 32px; min-width: 64px; padding: 0 10px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .gh .gh-stat.bump { animation: none; }
}
