/* Game Hub kit: the chrome every upgraded game shares. Built by GH.shell and
   GH.over in public/js/hub/kit.js; colours come from the hub's own variables. */
.ghx { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(980px, 100vw - 24px); margin: 0 auto; padding: 18px 14px 40px; }
.ghx-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ghx-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ghx-icon { font-size: 28px; line-height: 1; }
.ghx-title { margin: 0; font-size: clamp(20px, 3.2vw, 28px); font-weight: 800; letter-spacing: -0.5px; }
.ghx-tools { display: flex; gap: 6px; }
.ghx-tool {
    width: 38px; height: 38px; display: grid; place-items: center;
    border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.05);
    color: var(--text); font-size: 16px; font-family: inherit; cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.ghx-tool:hover { background: rgba(255, 255, 255, 0.12); }
.ghx-tool:active { transform: scale(0.94); }
.ghx-tool:focus-visible, .ghx-btn:focus-visible, .ghx-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ghx-stats, .ghx-options, .ghx-controls { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; }
.ghx-stats { gap: 8px; }
.ghx-stats:empty, .ghx-options:empty, .ghx-controls:empty, .ghx-status:empty { display: none; }
.ghx-stat {
    font-size: 12px; font-weight: 600; color: var(--text2);
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border);
    padding: 6px 13px; border-radius: 999px;
}
.ghx-stat b { display: inline-block; margin-left: 3px; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.ghx-bump { animation: ghxBump 0.28s ease-out; }
@keyframes ghxBump { 40% { transform: scale(1.35); color: #ffd166; } }

.ghx-options { gap: 10px 16px; }
.ghx-option { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-border); }
.ghx-option-label { padding: 0 8px 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text2); }
.ghx-choice { border: 0; background: transparent; color: var(--text2); font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.ghx-choice:hover { color: var(--text); }
.ghx-choice[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #fff; }

.ghx-stage-wrap { position: relative; width: 100%; display: flex; justify-content: center; }
.ghx-stage {
    position: relative; width: 100%; min-height: 240px; padding: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    border-radius: 20px; border: 1px solid var(--glass-border); overflow: hidden;
    background: radial-gradient(120% 90% at 50% 0%, rgba(83, 52, 131, 0.28), rgba(22, 33, 62, 0.35) 55%, rgba(13, 13, 26, 0.5));
    box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.ghx-stage canvas { display: block; max-width: 100%; border-radius: 14px; touch-action: none; }
.ghx-status { min-height: 20px; font-size: 14px; font-weight: 600; color: var(--text2); text-align: center; }
.ghx-controls { gap: 10px; }
.ghx-btn {
    border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.06); color: var(--text);
    font-family: inherit; font-size: 14px; font-weight: 700; padding: 10px 18px; border-radius: 12px; cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.ghx-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ghx-btn:active { transform: translateY(1px) scale(0.98); }
.ghx-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ghx-btn-primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent2), var(--accent)); box-shadow: 0 6px 20px rgba(233, 69, 96, 0.3); }
.ghx-btn-primary:hover { background: linear-gradient(135deg, #6a43a8, #f25a74); }

/* "How to play" and the end-of-game panel cover the stage */
.ghx-help, .ghx-over {
    position: absolute; inset: 0; z-index: 8; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(13, 13, 26, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
}
.ghx-help[hidden] { display: none; }
.ghx-help-card, .ghx-over-card {
    width: min(420px, 100%); max-height: 100%; overflow: auto; padding: 22px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
    background: rgba(22, 33, 62, 0.92); border: 1px solid var(--glass-border); border-radius: 18px;
    box-shadow: var(--glass-shadow); animation: ghxPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Scale only: a panel that fades in from nothing stays invisible if the animation never runs. */
@keyframes ghxPop { from { transform: scale(0.86); } }
.ghx-help-card h3, .ghx-over-card h3 { margin: 0; font-size: 22px; font-weight: 800; }
.ghx-help-body { text-align: left; color: var(--text2); font-size: 14px; line-height: 1.55; }
.ghx-help-body p, .ghx-help-body ul { margin: 0 0 8px; }
.ghx-help-body ul { padding-left: 18px; }
.ghx-help-body b, .ghx-help-body kbd { color: var(--text); }
.ghx-help-body kbd { padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); font: 600 12px ui-monospace, monospace; }
.ghx-over-icon { font-size: 52px; line-height: 1; }
.ghx-over-card p { margin: 0; color: var(--text2); font-size: 14px; }
.ghx-over-best { padding: 4px 12px; border-radius: 999px; background: #ffd166; color: #1a1a2e; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.ghx-over-rows { display: grid; grid-template-columns: auto auto; gap: 4px 18px; margin: 4px 0; font-size: 14px; }
.ghx-over-rows dt { color: var(--text2); text-align: right; }
.ghx-over-rows dd { margin: 0; font-weight: 700; text-align: left; font-variant-numeric: tabular-nums; }
.ghx-over-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* effects */
.ghx-fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; }
.ghx-shake { animation: ghxShake 0.32s; }
@keyframes ghxShake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* a game in full screen fills the display */
.game-view:fullscreen { display: block; overflow: auto; background: var(--bg); }
.game-view:-webkit-full-screen { display: block; overflow: auto; background: var(--bg); }

/* the page's Back button sits in the top-left corner */
@media (max-width: 1240px) { .ghx { padding-top: 62px; } }
@media (max-width: 560px) {
    .ghx { padding: 62px 10px 28px; gap: 10px; } /* still clear of the Back button */
    .ghx-stage { padding: 10px; border-radius: 16px; }
    .ghx-tool { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    .ghx-bump, .ghx-shake, .ghx-help-card, .ghx-over-card { animation: none; }
}
