/* Game module: HUD, arcade, quests, profile, shop, boss. All classes are prefixed gm- / hud-. */

/* ───────── HUD (top bar) ───────── */
.hud { display: flex; align-items: center; gap: var(--s3); min-width: 0; max-width: 100%; }
.hud-level { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-weight: 900; font-size: 1.05rem; color: #1b1300; background: radial-gradient(circle at 30% 25%, #fff3b0, var(--xp) 55%, #d98a00); box-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 14px color-mix(in srgb, var(--xp) 45%, transparent); }
.hud-main { display: flex; flex-direction: column; gap: 3px; min-width: 70px; flex: 0 1 220px; cursor: pointer; }
.hud-title { font-size: var(--fs-xs); font-weight: 800; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; }
.hud-xp { position: relative; display: block; height: 16px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.hud-xp-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #f59e0b, var(--xp)); border-radius: inherit; transition: width .7s var(--ease-bounce); }
.hud-xp-txt { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 900; line-height: 14px; color: var(--text); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); font-variant-numeric: tabular-nums; }
.hud-chip { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 900; text-decoration: none; font-variant-numeric: tabular-nums; }
.hud-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.hud-streak.is-cold span:first-child { filter: grayscale(1); opacity: .55; }
.hud-pulse .hud-level { animation: hud-bump .6s var(--ease-bounce); }
@keyframes hud-bump { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-6deg); } 100% { transform: scale(1); } }
@media (max-width: 700px) {
  .hud { gap: var(--s2); }
  .hud-main { min-width: 56px; flex-basis: 110px; }
  .hud-title { display: none; }
  .hud-level { width: 34px; height: 34px; font-size: .95rem; }
  .hud-chip { height: 32px; padding: 0 8px; gap: 3px; font-size: var(--fs-sm); }
}
@media (max-width: 560px) { .hud-main { display: none; } }
.hud-modal { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.hud-modal-big { font-size: 3.2rem; font-weight: 900; color: var(--xp); text-shadow: 0 0 24px color-mix(in srgb, var(--xp) 60%, transparent); }
.hud-modal-badge { font-size: 3.4rem; width: 108px; height: 108px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 4px solid var(--rc, var(--primary)); box-shadow: 0 0 30px color-mix(in srgb, var(--rc, var(--primary)) 55%, transparent); }
.r-common { --rc: #94a3b8; } .r-rare { --rc: #38bdf8; } .r-epic { --rc: #c084fc; } .r-legendary { --rc: #fbbf24; }
.anim-pop { animation: pop-in .5s var(--ease-bounce); }

/* ───────── avatar ───────── */
.gm-avatar { position: relative; width: var(--sz); height: var(--sz); flex: none; }
.gm-avatar-ring { position: absolute; inset: 0; border-radius: 50%; background: var(--ring); box-shadow: 0 0 calc(var(--sz) * .2) color-mix(in srgb, var(--ring, #7c6cff) 50%, transparent); }
.gm-avatar-bg { position: absolute; inset: calc(var(--sz) * .045); border-radius: 50%; background: var(--abg, var(--bg)); display: grid; place-items: center; overflow: hidden; }
.gm-avatar-base { font-size: calc(var(--sz) * .55); line-height: 1; }
.gm-avatar-hat { position: absolute; top: calc(var(--sz) * .02); left: 50%; transform: translateX(-50%) rotate(-6deg); font-size: calc(var(--sz) * .3); line-height: 1; }
.gm-avatar-pet { position: absolute; right: calc(var(--sz) * -.08); bottom: calc(var(--sz) * -.04); font-size: calc(var(--sz) * .34); line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); animation: float 3s ease-in-out infinite; }

/* ───────── arcade hub ───────── */
.gm-arcade-card { --accent: var(--game); display: flex; gap: var(--s4); align-items: flex-start; text-decoration: none; color: var(--text); position: relative; overflow: hidden; }
.gm-arcade-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(260px 120px at 0% 0%, color-mix(in srgb, var(--game) 22%, transparent), transparent 70%); pointer-events: none; }
.gm-arcade-icon { font-size: 2.6rem; width: 64px; height: 64px; flex: none; display: grid; place-items: center; border-radius: var(--radius); background: color-mix(in srgb, var(--game) 20%, var(--surface-2)); box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.gm-arcade-card:hover .gm-arcade-icon { transform: rotate(-6deg) scale(1.08); transition: transform .2s var(--ease-bounce); }
.gm-xpnote { margin-top: var(--s4); text-align: center; }

/* ───────── game shell ───────── */
.gm-shell { display: flex; flex-direction: column; gap: var(--s4); max-width: 760px; margin: 0 auto; width: 100%; }
.gm-head { margin-bottom: 0; }
.gm-start { display: flex; gap: var(--s5); align-items: flex-start; }
.gm-start-icon { font-size: 4rem; flex: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .4)); animation: float 3s ease-in-out infinite; }
.gm-rules { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; color: var(--text-muted); }
.gm-countcard { min-height: 280px; display: grid; place-content: center; text-align: center; }
.gm-count { font-size: 7rem; font-weight: 900; color: var(--xp); line-height: 1; animation: pop-in .5s var(--ease-bounce); text-shadow: 0 0 40px color-mix(in srgb, var(--xp) 50%, transparent); }
.gm-play { padding: var(--s4); gap: var(--s3); display: flex; flex-direction: column; }
.gm-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.gm-bar-left, .gm-bar-right { display: flex; align-items: center; gap: var(--s3); }
.gm-score { font-weight: 900; font-size: var(--fs-lg); color: var(--xp); font-variant-numeric: tabular-nums; }
.gm-score-val.gm-pop { display: inline-block; animation: hud-bump .35s var(--ease-bounce); }
.gm-combo { font-weight: 900; color: #fb923c; min-width: 3.2em; }
.gm-time { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 2.4em; text-align: right; }
.gm-timebar { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.gm-timefill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--game), color-mix(in srgb, var(--game) 60%, #fff)); transition: width .1s linear; border-radius: inherit; }
.gm-timebar.is-low .gm-timefill { background: linear-gradient(90deg, #ef4444, #f97316); }
.gm-area { display: flex; flex-direction: column; align-items: center; gap: var(--s3); min-height: 320px; padding-top: var(--s2); }

/* quick-fire */
.gm-q { font-size: clamp(2rem, 9vw, 3.6rem); font-weight: 900; text-align: center; letter-spacing: .01em; padding: var(--s3) var(--s5); border-radius: var(--radius); background: var(--surface-2); min-width: min(100%, 360px); font-variant-numeric: tabular-nums; transition: background .15s, transform .15s; }
.gm-q.gm-flash-ok { background: var(--success-soft); transform: scale(1.04); color: var(--success); }
.gm-q.gm-flash-bad { background: var(--danger-soft); animation: gm-shake .4s; color: var(--danger); }
@keyframes gm-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.gm-ans { font-size: 2.2rem; font-weight: 900; min-width: 220px; text-align: center; padding: 6px 16px; border-bottom: 4px solid var(--game); font-variant-numeric: tabular-nums; min-height: 3.2rem; }
.gm-ans.is-empty { opacity: .5; }
.gm-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 300px); }
.gm-key { min-height: 52px; border-radius: var(--radius-sm); border: 0; background: var(--surface-3); color: var(--text); font-size: 1.4rem; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); touch-action: manipulation; }
.gm-key:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.gm-key-alt { background: var(--surface-2); color: var(--text-muted); }
.gm-key-go { background: var(--success); color: #04230f; }
.gm-yn { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; width: 100%; }
.gm-yn .btn { min-width: 150px; min-height: 56px; }
.gm-under { min-height: 32px; justify-content: center; }
.gm-last { font-size: var(--fs-sm); color: var(--text-muted); text-align: center; min-height: 1.4em; }

/* end screen */
.gm-end { display: flex; flex-direction: column; gap: var(--s4); align-items: center; text-align: center; }
.gm-end-title { font-size: var(--fs-xl); font-weight: 900; }
.gm-end-score { font-size: clamp(3.5rem, 16vw, 6rem); font-weight: 900; line-height: 1; color: var(--xp); text-shadow: 0 0 40px color-mix(in srgb, var(--xp) 45%, transparent); }
.gm-end-stats { width: 100%; }
.gm-kpi { align-items: center; text-align: center; }
.gm-end-actions { justify-content: center; }
.gm-review { width: 100%; text-align: left; display: flex; flex-direction: column; gap: var(--s2); }
.gm-review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gm-review-list li { display: flex; justify-content: space-between; gap: var(--s3); padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); align-items: baseline; }
.gm-review-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }

/* countdown */
.gm-cd { width: 100%; display: flex; flex-direction: column; gap: var(--s4); align-items: center; }
.gm-cd-top { text-align: center; }
.gm-target { font-size: clamp(3rem, 14vw, 5rem); font-weight: 900; color: var(--game); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 30px color-mix(in srgb, var(--game) 45%, transparent); }
.gm-tiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.gm-tile { position: relative; min-width: 64px; height: 64px; padding: 0 14px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 1.5rem; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; touch-action: manipulation; }
.gm-tile.is-result { background: color-mix(in srgb, var(--game) 25%, var(--surface-2)); border-color: var(--game); }
.gm-tile.is-sel { outline: 3px solid var(--xp); transform: translateY(-3px); }
.gm-tile:disabled { opacity: .55; cursor: default; }
.gm-tile-i { position: absolute; top: 2px; left: 6px; font-size: 10px; color: var(--text-faint); font-weight: 800; }
.gm-ops { display: flex; gap: 10px; }
.gm-op { width: 60px; height: 52px; border-radius: var(--radius-sm); border: 0; background: var(--surface-3); color: var(--text); font-size: 1.7rem; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); touch-action: manipulation; }
.gm-op.is-sel { background: var(--xp); color: #1b1300; }
.gm-op:disabled { opacity: .4; }
.gm-cd-steps { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 28px; align-items: center; }
.gm-cd-result { width: 100%; display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }

/* match board */
.gm-match { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.4fr); gap: var(--s3); width: 100%; }
.gm-col { display: flex; flex-direction: column; gap: 8px; }
.gm-card, .gm-opt { position: relative; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 10px; text-align: left; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: var(--fs-sm); touch-action: manipulation; transition: transform .12s, border-color .12s, background .12s; }
.gm-card:hover, .gm-opt:hover { border-color: var(--border-strong); background: var(--surface-3); }
.gm-card.is-sel { border-color: var(--xp); background: color-mix(in srgb, var(--xp) 14%, var(--surface-2)); transform: scale(1.02); }
.gm-card.is-good { border-color: var(--success); background: var(--success-soft); transform: scale(.97); opacity: .7; }
.gm-card.is-bad { border-color: var(--danger); background: var(--danger-soft); animation: gm-shake .4s; }
.gm-card-key { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-3); font-size: 11px; font-weight: 900; color: var(--text-muted); }
.gm-card-word { font-weight: 900; font-size: var(--fs-md); overflow-wrap: break-word; }
@media (max-width: 480px) { .gm-match .gm-card-key { display: none; } .gm-card-word { font-size: .95rem; } .gm-card { padding: 8px; } }
.gm-card-text { min-width: 0; overflow-wrap: break-word; }
.gm-hint { margin: 0; }

/* flash race */
.gm-flash { width: 100%; display: flex; flex-direction: column; gap: var(--s3); align-items: stretch; }
.gm-flash-front { font-size: clamp(1.2rem, 4.5vw, 1.8rem); font-weight: 900; text-align: center; padding: var(--s4); border-radius: var(--radius); background: var(--surface-2); border: 2px solid var(--border); transition: background .15s, border-color .15s; }
.gm-flash-front.gm-flash-ok { background: var(--success-soft); border-color: var(--success); }
.gm-flash-front.gm-flash-bad { background: var(--danger-soft); border-color: var(--danger); animation: gm-shake .4s; }
.gm-flash-claim { text-align: center; font-size: var(--fs-lg); padding: var(--s3); color: var(--text); background: var(--surface); border-radius: var(--radius-sm); margin-bottom: var(--s3); }
.gm-flash-topic { text-align: center; min-height: 1.2em; }
.gm-opts { display: grid; gap: 8px; }
.gm-opt { min-height: 52px; font-size: var(--fs-md); }

/* ───────── quests ───────── */
.gm-streakcard .card-body, .gm-streakcard { overflow: hidden; }
.gm-flame { font-size: 3rem; line-height: 1; animation: float 2.4s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(251, 146, 60, .6)); }
.gm-streak-n { font-size: var(--fs-xl); font-weight: 900; }
.gm-freezes { display: flex; gap: 6px; }
.gm-freeze { font-size: 1.6rem; opacity: .25; filter: grayscale(1); }
.gm-freeze.is-full { opacity: 1; filter: none; }
.gm-freeze-box { align-items: flex-end; text-align: right; }
.gm-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.gm-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; background: var(--surface-2); border: 2px solid transparent; font-weight: 800; }
.gm-day-dow { font-size: 10px; color: var(--text-faint); }
.gm-day-icon { font-size: 1.05rem; min-height: 1.3em; line-height: 1.3; }
.gm-day-num { color: var(--text-muted); font-size: 10px; }
.gm-day.is-done { background: var(--success-soft); }
.gm-day.is-frozen { background: var(--info-soft); }
.gm-day.is-free { background: color-mix(in srgb, var(--cyan) 10%, var(--surface-2)); }
.gm-day.is-missed { opacity: .5; }
.gm-day.is-today { border-color: var(--xp); }
@media (max-width: 520px) { .gm-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.gm-quest { display: flex; gap: var(--s3); align-items: center; }
.gm-quest.is-ready { border-color: var(--success); box-shadow: 0 0 0 1px var(--success), 0 0 24px var(--success-soft); }
.gm-quest.is-claimed { opacity: .65; }
.gm-quest-icon { width: 52px; height: 52px; flex: none; display: grid; place-items: center; font-size: 1.7rem; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ───────── profile ───────── */
.gm-profile-hero { display: flex; gap: var(--s5); align-items: center; flex-wrap: wrap; }
.gm-rank { font-size: var(--fs-lg); font-weight: 900; color: var(--xp); }
.gm-xpline { max-width: 560px; display: flex; flex-direction: column; gap: 4px; }
.gm-best-n { font-size: var(--fs-xl); font-weight: 900; }
.gm-badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--s3); text-align: center; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--rc, var(--border)); color: var(--text); font: inherit; cursor: pointer; min-height: 132px; }
.gm-badge:hover { transform: translateY(-2px); transition: transform .15s; }
.gm-badge-icon { font-size: 2.2rem; line-height: 1.2; }
.gm-badge-name { font-weight: 900; font-size: var(--fs-sm); }
.gm-badge-sub { color: var(--text-muted); }
.gm-badge.is-locked { border-style: dashed; border-color: var(--border); background: transparent; }
.gm-badge.is-locked .gm-badge-icon { filter: grayscale(1); opacity: .5; }
.gm-badge.is-locked .gm-badge-name { color: var(--text-muted); }
.gm-badge:not(.is-locked) { box-shadow: 0 0 18px color-mix(in srgb, var(--rc, transparent) 25%, transparent); }

/* ───────── shop ───────── */
.gm-coins { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-lg); align-self: flex-start; }
.gm-shop-top { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.gm-shop-preview { align-items: center; display: flex; flex-direction: column; gap: var(--s3); position: sticky; top: calc(var(--topbar-h) + 12px); }
@media (max-width: 760px) { .gm-shop-top { grid-template-columns: 1fr; } .gm-shop-preview { position: static; flex-direction: row; justify-content: center; } }
.gm-items { margin-top: var(--s3); }
.gm-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.gm-item.is-equipped { border-color: var(--success); }
.gm-item.is-locked { opacity: .6; }
.gm-item-emoji { font-size: 2.6rem; height: 64px; display: grid; place-items: center; }
.gm-swatch { width: 64px; height: 64px; border-radius: var(--radius-sm); border: 2px solid var(--border-strong); }
.gm-swatch-ring { border-radius: 50%; background: var(--c); }
.gm-item-action { margin-top: auto; padding-top: 6px; }

/* ───────── boss ───────── */
.gm-boss { --accent: var(--boss); border-color: color-mix(in srgb, var(--boss) 50%, var(--border)); background: radial-gradient(500px 220px at 15% 0%, color-mix(in srgb, var(--boss) 22%, transparent), transparent 70%), var(--surface); }
.gm-boss-top { display: flex; gap: var(--s5); align-items: center; flex-wrap: wrap; }
.gm-boss-stage { position: relative; width: 150px; height: 150px; flex: none; display: grid; place-items: center; }
.gm-boss-face { font-size: 6rem; line-height: 1; animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .5)); }
.gm-boss-face.is-hit { animation: gm-hit .5s; }
.gm-boss-face.is-laugh { animation: gm-laugh .6s; }
.gm-boss-face.is-dead { animation: gm-dead 1.2s forwards; }
.gm-boss-face.is-won { animation: float 3s ease-in-out infinite; transform: scale(1.1); }
@keyframes gm-hit { 0% { transform: translateX(0); filter: brightness(2) drop-shadow(0 0 20px #fff); } 20%, 60% { transform: translateX(-14px) rotate(-8deg); } 40%, 80% { transform: translateX(14px) rotate(8deg); } 100% { transform: none; } }
@keyframes gm-laugh { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.15) rotate(-5deg); } 50% { transform: scale(1.1) rotate(5deg); } 75% { transform: scale(1.15) rotate(-3deg); } }
@keyframes gm-dead { to { transform: rotate(80deg) translateY(30px) scale(.8); opacity: .35; filter: grayscale(1); } }
.gm-dmg { position: absolute; top: 0; right: 0; font-size: 1.7rem; font-weight: 900; color: #ff5470; opacity: 0; text-shadow: 0 2px 0 #000; }
.gm-dmg.is-show { animation: gm-dmg 1s ease-out; }
@keyframes gm-dmg { 0% { opacity: 1; transform: translateY(20px) scale(.6); } 30% { transform: translateY(-6px) scale(1.2); } 100% { opacity: 0; transform: translateY(-40px); } }
.gm-boss-say { padding: 8px 14px; border-radius: var(--radius); background: var(--surface-2); font-style: italic; position: relative; }
.gm-hearts { display: flex; gap: 6px; font-size: 1.7rem; }
.gm-heart.is-lost { filter: grayscale(.6); opacity: .6; }
.gm-bq { display: flex; flex-direction: column; gap: var(--s3); }
.gm-bq-head { align-items: center; }
@media (max-width: 520px) { .gm-boss-stage { width: 100px; height: 100px; } .gm-boss-face { font-size: 4.2rem; } .gm-start { flex-direction: column; } .gm-start-icon { font-size: 3rem; } }

@media (prefers-reduced-motion: reduce) {
  .gm-flame, .gm-start-icon, .gm-boss-face, .gm-avatar-pet, .gm-count { animation: none !important; }
  .gm-q.gm-flash-bad, .gm-card.is-bad, .gm-flash-front.gm-flash-bad { animation: none !important; }
  .gm-boss-face.is-hit, .gm-boss-face.is-laugh, .gm-dmg.is-show { animation: none !important; }
}
