/* Games: the Games tab (#/games) and the full-screen game frame (#/game/<id>).
   Same hand as the rest: flat colour, solid bottom edges, ink outlines, Bud. Loaded last. */

/* ---------- Five tabs: Home, Path, Songs, Games, You (Progress and Profile) ---------- */

@media (max-width: 959px) {
  .tab-list { grid-template-columns: repeat(5, 1fr); max-width: 600px; }
}
@media (max-width: 359px) {
  .tab .ic { padding: 3px 6px; }
  .tab { font-size: 0.66rem; }
}

/* ---------- Shared bits ---------- */

.gm-stars { display: inline-flex; gap: 2px; }
.gm-stars .ic { width: 20px; height: 20px; color: var(--ink); }
.gm-stars i:not(.is-on) .ic { color: #B9C7CB; }
.gm-stars i:not(.is-on) .ic .ic-fill { fill: #E6EEF0; }
.gm-stars i.is-on .ic .ic-fill { fill: #F6CF57; }
.gm-note-ic { width: 0.95em; height: 1.2em; fill: #F4B63F; stroke: var(--ink); stroke-width: 12; flex: none; overflow: visible; }

/* ---------- Games tab ---------- */

.gh-top { display: grid; gap: 0 16px; }
.gh-wallet { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; }
.gh-wallet-bud { width: 92px; }
.gh-wallet-bud .bud { width: 100%; height: auto; }
.gh-notes { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 1.5rem; line-height: 1.1; }
.gh-wallet .card-note { margin: 6px 0 10px; }

.gh-daily {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: var(--sun); box-shadow: var(--sh-card);
}
.gh-daily-ic { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--white); box-shadow: inset 0 0 0 2.5px var(--ink); }
.gh-daily-ic .ic .ic-fill { fill: #F6CF57; }
.gh-daily.is-done .gh-daily-ic { background: var(--teal); }
.gh-daily-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.gh-daily-text small { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--coral-text); }
.gh-daily-text b { font-family: var(--font-head); font-size: 1.15rem; margin: 2px 0; }
.gh-daily-text span { color: var(--ink-soft); font-weight: 600; font-size: 0.95rem; }

.gh-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 16px; }
.gh-card { border-radius: 26px; background: var(--white); box-shadow: var(--sh-card); overflow: hidden; display: flex; flex-direction: column; }
.gh-main { display: flex; flex-direction: column; text-decoration: none; flex: 1; }
.gh-main:active { transform: scale(0.985); }
.gh-art { position: relative; display: block; height: 128px; overflow: hidden; border-bottom: 2.5px solid var(--ink); }
.gh-text { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px 4px; flex: 1; }
.gh-name { font-family: var(--font-head); font-size: 1.35rem; line-height: 1.1; }
.gh-line { color: var(--ink-soft); line-height: 1.4; }
.gh-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.gh-meta small { font-weight: 700; color: var(--ink-soft); }
.gh-play { align-self: flex-start; justify-self: start; margin: 10px 18px 18px; }
.gh-little { display: block; padding: 12px 18px; border-top: 2px dashed var(--track); text-decoration: none; color: var(--ink-soft); font-size: 0.95rem; }
.gh-little b { color: var(--ink); }
.gh-little:hover b { text-decoration: underline; text-decoration-color: var(--coral); text-underline-offset: 4px; }

/* The little scenes on each card */
.gh-art-bud { position: absolute; width: 104px; left: 22%; top: 16px; animation: gh-hover 2.4s ease-in-out infinite; }
.gh-art-bud .bud { width: 100%; height: auto; }
@keyframes gh-hover { 50% { transform: translateY(-7px); } }

.gh-flight .gh-art { background: linear-gradient(#BFEFF1, #F1FCFC); }
.gh-cloud { position: absolute; width: 74px; border: 2.5px solid var(--ink); background: var(--white); border-radius: 0 0 30px 30px; }
.gh-cloud.c1 { right: 16%; top: -3px; height: 38px; }
.gh-cloud.c2 { right: 3%; top: -3px; height: 56px; width: 60px; }
.gh-bush { position: absolute; right: 13%; bottom: -3px; width: 74px; height: 44px; border: 2.5px solid var(--ink); background: #BCE5B2; border-radius: 30px 30px 0 0; }
.gh-art-note { position: absolute; right: 30%; top: 46px; font-size: 26px; display: flex; animation: gh-hover 1.8s ease-in-out infinite reverse; }
.gh-art-note .gm-note-ic { fill: var(--coral); }

.gh-bubbles .gh-art { background: linear-gradient(#DDF4FF, #F4FBF6); }
.gh-bubbles .gh-art-bud { left: 8%; }
.gh-bub { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.7); border: 4px solid var(--c); animation: gh-hover 2.8s ease-in-out infinite; }
.gh-bub::after { content: ''; position: absolute; width: 30%; height: 18%; left: 20%; top: 18%; border-radius: 50%; background: #fff; transform: rotate(-30deg); }
.gh-bub.b1 { --c: #F27165; width: 46px; height: 46px; right: 40%; top: 18px; }
.gh-bub.b2 { --c: #8FD18A; width: 34px; height: 34px; right: 24%; top: 70px; animation-delay: -0.8s; }
.gh-bub.b3 { --c: #9C8BE0; width: 58px; height: 58px; right: 6%; top: 24px; animation-delay: -1.6s; }
.gh-bub.b4 { --c: #F6CF57; width: 26px; height: 26px; right: 52%; top: 84px; animation-delay: -2.1s; }

.gh-copy .gh-art { background: linear-gradient(#FFF3E2, #EDFBFC); }
.gh-copy .gh-art-bud { left: 6%; width: 96px; top: 22px; }
.gh-bar { position: absolute; left: 44%; right: 8%; height: 18px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--c); }
.gh-bar.r1 { --c: #F27165; top: 14px; }
.gh-bar.r2 { --c: #F6CF57; top: 42px; animation: gh-ring 2.4s ease-in-out infinite; }
.gh-bar.r3 { --c: #8FD18A; top: 70px; }
.gh-bar.r4 { --c: #74C7C8; top: 98px; animation: gh-ring 2.4s ease-in-out infinite 1.2s; }
@keyframes gh-ring { 0%, 70%, 100% { filter: none; transform: none; } 80% { filter: brightness(1.12); transform: scale(1.04); } }

/* Wardrobe */
.gh-wardrobe { margin-top: 22px; scroll-margin-top: 16px; }
.gh-wardrobe .card-note { margin-top: 4px; }
.gh-hats { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.gh-hat {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px 10px; border: 2.5px solid transparent; border-radius: 20px; background: var(--mint); cursor: pointer;
  font: inherit; color: var(--ink); line-height: 1.25;
}
.gh-hat-bud { width: 72px; height: 72px; display: block; }
.gh-hat-bud .bud { width: 100%; height: 100%; }
.gh-hat b { font-size: 0.92rem; }
.gh-hat small { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink-soft); font-size: 0.85rem; }
.gh-hat.is-on { border-color: var(--coral); background: var(--blush); }
.gh-hat.is-on small { color: var(--coral-text); }
.gh-hat.is-afford { border-color: #F6CF57; background: #FFF9E3; }
.gh-hat.is-locked .gh-hat-bud { opacity: 0.45; filter: grayscale(0.6); }
.gh-hat.is-locked { cursor: default; }
.gh-hat:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

@media (min-width: 640px) {
  .gh-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gh-main { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .gh-art { grid-row: 1 / 3; height: auto; min-height: 160px; border-bottom: 0; border-right: 2.5px solid var(--ink); }
  .gh-text { padding-top: 18px; }
}
@media (min-width: 1240px) {
  .gh-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gh-main { display: flex; }
  .gh-art { height: 140px; min-height: 0; border-right: 0; border-bottom: 2.5px solid var(--ink); }
}

/* ---------- The game frame ---------- */

.gm-shell { position: fixed; inset: 0; overflow: hidden; background: var(--mint); touch-action: none; user-select: none; -webkit-user-select: none; }
.gm-stage { position: absolute; inset: 0; }
.gm-canvas { width: 100%; height: 100%; max-width: none; }

.gm-hud {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  pointer-events: none;
}
.gm-hud > * { pointer-events: auto; }
.gm-btn {
  flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--white); color: var(--ink);
  box-shadow: var(--sh-card);
}
.gm-btn:active { transform: translateY(2px); box-shadow: var(--sh-card); }
.gm-btn .ic .ic-fill { fill: var(--ink); }
.gm-btn[data-pause] { margin-left: auto; }
.gm-stat, .gm-time {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 64px; height: 46px; padding: 0 14px; border-radius: 16px;
  background: var(--white); box-shadow: var(--sh-card); line-height: 1;
}
.gm-stat small, .gm-time small { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.gm-stat b, .gm-time b { font-family: var(--font-head); font-size: 1.45rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.gm-time.is-low b { color: var(--coral-text); animation: gm-pulse 0.5s ease-in-out infinite alternate; }
@keyframes gm-pulse { to { transform: scale(1.18); } }
.gm-mid { display: flex; align-items: center; gap: 8px; }
.gm-hearts { display: inline-flex; gap: 3px; padding: 8px 10px; border-radius: 16px; background: var(--white); box-shadow: var(--sh-card); }
.gm-hearts svg { width: 24px; height: 24px; fill: #E3ECEE; stroke: #B9C7CB; stroke-width: 2; stroke-linejoin: round; transition: fill 200ms ease; }
.gm-hearts .is-on svg { fill: var(--coral); stroke: var(--ink); }
.gm-round { white-space: nowrap; font-weight: 700; font-size: 0.9rem; background: var(--white); padding: 6px 12px; border-radius: 999px; box-shadow: var(--sh-card); }
.gm-combo {
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: var(--white);
  background: var(--coral); padding: 6px 14px; border-radius: 999px; box-shadow: var(--sh-card);
  animation: gm-pop 300ms var(--ease-spring);
}
@keyframes gm-pop { from { transform: scale(0.6); } }

.gm-count {
  position: absolute; z-index: 3; left: 50%; top: 46%; transform: translate(-50%, -50%);
  pointer-events: none; text-align: center; white-space: nowrap;
}
.gm-count:not(:empty) {
  font-family: var(--font-head); font-weight: 700; font-size: clamp(4.5rem, 14vmin, 8rem); line-height: 1; color: var(--coral);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 rgba(46, 61, 68, 0.15);
}
.gm-count.is-go { color: #F6CF57; }

.gm-layer {
  position: absolute; z-index: 4; inset: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: rgba(46, 61, 68, 0.22);
}
.gm-card {
  width: min(430px, 100%); padding: 20px 22px 18px; border-radius: 28px; text-align: center;
  background: var(--white); box-shadow: var(--sh-card);
}
.gm-bud { width: 112px; margin: -4px auto 0; }
.gm-bud .bud { width: 100%; height: auto; }
.gm-card .eyebrow { margin-top: 2px; }
.gm-title { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.2rem); margin-top: 4px; }
.gm-title:focus { outline: none; }
.gm-how { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; text-align: left; }
.gm-how li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.35; }
.gm-how li span { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blush); color: var(--coral-text); font-weight: 700; font-size: 0.9rem; }
.gm-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.gm-mode {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-radius: 16px; cursor: pointer;
  border: 2.5px solid var(--track); background: var(--white); font: inherit; color: var(--ink); line-height: 1.25;
}
.gm-mode b { font-size: 0.98rem; }
.gm-mode small { color: var(--ink-soft); font-weight: 600; font-size: 0.82rem; }
.gm-mode[aria-checked="true"] { border-color: var(--coral); background: var(--blush); }
.gm-best { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 700; color: var(--ink-soft); }
.gm-play { width: 100%; margin-top: 14px; }
.gm-status { margin: 8px 0 0; min-height: 0; font-weight: 600; font-size: 0.95rem; }
.gm-status:empty { display: none; }
.gm-status.is-error { color: var(--coral-text); }
.gm-private { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.gm-private .ic { width: 16px; height: 16px; }

.gm-pause .btn { width: 100%; margin-top: 14px; }
.gm-pause .btn + .btn { margin-top: 10px; }

.gm-big { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 4.2rem; line-height: 1; letter-spacing: -0.03em; }
.gm-best-over { margin-top: 6px; }
.gm-stats { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.gm-stats li { display: flex; flex-direction: column; padding: 8px 4px; border-radius: 14px; background: var(--mint); line-height: 1.2; }
.gm-stats b { font-family: var(--font-head); font-size: 1.3rem; }
.gm-stats small { color: var(--ink-soft); font-weight: 600; font-size: 0.8rem; }
.gm-earned { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 12px 0 0; font-weight: 700; }
.gm-earned > span:first-of-type { margin-left: -4px; }
.gm-bonus { padding: 3px 10px; border-radius: 999px; background: var(--sun); font-size: 0.9rem; }
.gm-canbuy { display: block; margin-top: 10px; padding: 8px 12px; border-radius: 14px; background: #FFF9E3; text-decoration: none; font-size: 0.95rem; }
.gm-canbuy b { text-decoration: underline; text-decoration-color: var(--coral); text-underline-offset: 4px; }
.gm-actions { display: grid; gap: 10px; margin-top: 16px; }

/* Short windows (a phone on its side, a small laptop): keep the card on screen */
@media (max-height: 640px) {
  .gm-bud { width: 76px; }
  .gm-how { gap: 4px; margin-top: 10px; font-size: 0.95rem; }
  .gm-big { font-size: 3.2rem; }
  .gm-card { padding: 14px 18px 14px; }
  .gm-play, .gm-actions { margin-top: 10px; }
  .gm-best, .gm-modes { margin-top: 10px; }
}
@media (max-height: 480px) {
  .gm-bud, .gm-private, .gm-card > .eyebrow { display: none; }
  .gm-layer { place-items: start center; }
  .gm-card { width: min(560px, 100%); }
  .gm-stats { margin-top: 8px; }
  .gm-actions { grid-template-columns: 1fr 1fr; }
  .gm-actions .btn-lg { min-height: 50px; font-size: 1.05rem; }
  .gm-hud { padding-top: calc(6px + var(--safe-t)); }
  .gm-btn { width: 40px; height: 40px; }
  .gm-stat, .gm-time { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .gh-art-bud, .gh-art-note, .gh-bub, .gh-bar, .gm-time.is-low b, .gm-combo { animation: none !important; }
}

/* ---------- The free plan: locked games and hats ---------- */

.gh-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  padding: 3px 10px; border-radius: 999px; background: var(--belly); font-weight: 700; font-size: 0.78rem; color: #2F5F5E;
}
.gh-tag.is-locked { background: var(--ink); color: var(--cream); padding-left: 7px; }
.gh-tag .ic { width: 13px; height: 13px; }
.gh-tag .ic .ic-fill { fill: #F6CF57; }
.gh-card.is-locked .gh-art { filter: saturate(0.55); }
.gh-freeplan { display: flex; gap: 8px; align-items: flex-start; margin: 16px 2px 0; color: var(--ink-soft); font-size: 0.95rem; line-height: 1.45; }
.gh-freeplan .ic { width: 18px; height: 18px; margin-top: 2px; }
.gh-freeplan a { color: var(--ink); font-weight: 700; text-decoration-color: var(--coral); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.gh-hat { position: relative; }
.gh-hat.is-pro { cursor: pointer; }
.gh-pro {
  position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 5px; border-radius: 999px; background: var(--ink); color: var(--cream); font-size: 0.68rem; font-weight: 700;
}
.gh-pro .ic { width: 12px; height: 12px; }
.gh-pro .ic .ic-fill { fill: #F6CF57; }
.gm-more { background: var(--mint); }

/* Phones: today's challenge first, then a slim notes-and-wardrobe row, so the games start sooner */
@media (max-width: 759px) {
  .gh-top { display: flex; flex-direction: column; }
  .gh-daily { order: -1; }
  .gh-wallet { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 12px; padding: 12px 14px; }
  .gh-wallet-bud { width: 56px; margin: 0; }
  .gh-wallet .card-note { display: none; }
  .gh-wallet-text { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; text-align: left; }
  .gh-wallet .gh-notes { margin: 0; font-size: 1.1rem; }
  .gh-wallet .btn { margin: 0; }
}

/* Game intro: clear of the score bar, no repeated "Pitch games" label, "Play" centred */
.gm-intro > .eyebrow { display: none; }
.gm-layer { padding-top: calc(76px + var(--safe-t)); }
.gm-card .btn-lg > .ic:first-child + span:last-child { margin-right: 30px; }
