.gm-root { max-width: 900px; margin: 0 auto; }
.gm-wrap {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	background: #14122b; color: #fff; border-radius: 16px; padding: 10px;
	display: flex; flex-direction: column; align-items: center; gap: 8px;
	user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
	box-sizing: border-box; line-height: 1.25;
}
.gm-wrap * { box-sizing: border-box; }
.gm-wrap.gm-full {
	position: fixed; inset: 0; z-index: 999999; border-radius: 0; margin: 0;
	width: 100vw; height: 100vh; height: 100dvh; justify-content: center;
}
.gm-wrap button {
	font: inherit; color: #fff; border: 0; margin: 0; cursor: pointer; line-height: 1.1;
	text-transform: none; letter-spacing: normal; box-shadow: none; text-shadow: none;
	min-height: 0; min-width: 0; width: auto; touch-action: manipulation;
}
.gm-wrap button:disabled { cursor: default; }

/* HUD */
.gm-hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; width: 100%; }
.gm-stats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.gm-pill { background: #2a2752; border-radius: 999px; padding: 5px 11px; font-weight: 800; font-size: clamp(14px, 3.6vw, 19px); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.gm-pill b { color: #ffd54f; }
.gm-wicon { font-size: 1.25em; }
.gm-wbar { display: inline-block; width: 70px; height: 10px; background: #0d0b1f; border-radius: 6px; overflow: hidden; }
.gm-wbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4fa3, #ffd54f); }
.gm-weapon.gm-blink { animation: gm-blink .35s steps(2) infinite; }
@keyframes gm-blink { 50% { opacity: .35; } }
.gm-tools { display: flex; gap: 6px; }
.gm-wrap .gm-iconbtn { background: #2a2752; border-radius: 10px; width: 38px; height: 38px; font-size: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.gm-wrap .gm-iconbtn:hover { background: #3b3675; }

/* Board */
.gm-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.gm-stage { position: relative; width: 100%; max-width: 100%; }
.gm-stage canvas { display: block; width: 100%; height: auto; touch-action: none; border-radius: 10px; background: #0d0b1f; }

/* Overlay screens (sized relative to the board so they always fit) */
.gm-stage { container-type: inline-size; }
.gm-overlay {
	position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
	text-align: center; gap: 1.8cqw; padding: 3cqw; overflow: auto; border-radius: 10px; background: rgba(13, 11, 31, .9);
}
.gm-overlay.gm-show { display: flex; }
.gm-overlay h2 { margin: 0; font-size: clamp(22px, 8cqw, 46px); color: #ffd54f; font-weight: 900; line-height: 1.1; }
.gm-overlay p { margin: 0; font-size: clamp(13px, 3.6cqw, 20px); max-width: 92%; }
.gm-label { font-weight: 800; color: #b9b4ff; font-size: clamp(11px, 3cqw, 16px); text-transform: uppercase; letter-spacing: .06em; }
.gm-small { font-size: clamp(11px, 2.6cqw, 14px); color: #9a96c8; }
@media (pointer: coarse) { .gm-small { display: none; } }
.gm-row { display: flex; flex-wrap: wrap; gap: 2.5cqw; justify-content: center; }
.gm-wrap .gm-big { background: #ff4fa3; font-size: clamp(16px, 5.2cqw, 26px); font-weight: 900; padding: 2.2cqw 5cqw; border-radius: 14px; }
.gm-wrap .gm-big:hover { filter: brightness(1.1); }
.gm-wrap .gm-alt { background: #4f5bd5; }
.gm-heroes { display: flex; gap: 2cqw; width: 65%; justify-content: center; }
.gm-wrap .gm-herobtn { flex: 1; background: #2a2752; padding: 1.6cqw 1cqw; border-radius: 12px; font-size: clamp(13px, 4cqw, 20px); font-weight: 800; border: 3px solid transparent; }
.gm-wrap .gm-herobtn.gm-on { border-color: #ff4fa3; background: #3b3675; }
.gm-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8cqw; width: 88%; }
.gm-wrap .gm-mode { background: #2a2752; padding: 1.8cqw 1cqw; border-radius: 12px; font-size: clamp(13px, 4cqw, 20px); font-weight: 800; border: 3px solid transparent; }
.gm-wrap .gm-mode.gm-on { border-color: #ffd54f; background: #3b3675; }
.gm-stage .gm-overlay canvas.gm-cast { width: 48cqw; height: auto; background: transparent; border-radius: 0; }
.gm-stage .gm-overlay canvas.gm-gob { width: 24cqw; height: auto; background: transparent; border-radius: 0; }
.gm-say { font-weight: 700; font-size: clamp(13px, 4cqw, 22px); max-width: 92%; min-height: 2.5em; }
.gm-q { font-size: clamp(36px, 13cqw, 80px); font-weight: 900; letter-spacing: .02em; line-height: 1.1; }
.gm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 3cqw; width: 78%; }
.gm-wrap .gm-choice { background: #4f5bd5; font-size: clamp(26px, 9cqw, 52px); font-weight: 900; padding: 2cqw 0; border-radius: 16px; }
.gm-wrap .gm-choice:hover:not(:disabled) { background: #6672ef; }
.gm-wrap .gm-choice.gm-ok { background: #2e9e44; }
.gm-wrap .gm-choice.gm-bad { background: #d23a3a; }
.gm-overlay p.gm-final { font-size: clamp(26px, 9cqw, 44px); font-weight: 900; color: #ffd54f; }
.gm-effects { font-size: clamp(26px, 9cqw, 44px); letter-spacing: 6px; }

/* Toast */
.gm-toast {
	position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
	background: rgba(255, 255, 255, .96); color: #222; padding: 8px 14px; border-radius: 12px;
	font-weight: 800; font-size: clamp(14px, 3.6vw, 19px); text-align: center; max-width: 92%;
	pointer-events: none; opacity: 0; transition: opacity .25s;
}
.gm-toast.gm-show { opacity: 1; }

/* D-pad (touch devices) */
.gm-dpad { display: none; grid-template-columns: repeat(3, 62px); grid-template-rows: repeat(3, 62px); gap: 6px; }
@media (pointer: coarse) { .gm-dpad { display: grid; } }
.gm-wrap .gm-dpad button { background: #2a2752; border-radius: 16px; font-size: 28px; padding: 0; }
.gm-wrap .gm-dpad button:active { background: #4f5bd5; }
.gm-d-up { grid-column: 2; grid-row: 1; }
.gm-d-left { grid-column: 1; grid-row: 2; }
.gm-d-right { grid-column: 3; grid-row: 2; }
.gm-d-down { grid-column: 2; grid-row: 3; }
@media (orientation: landscape) and (pointer: coarse) {
	.gm-wrap.gm-full .gm-body { flex-direction: row; }
}

/* Players, high scores, power-ups (1.3.0) */
.gm-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 2cqw; width: 88%; max-height: 40cqw; overflow: auto; }
.gm-pwrap { position: relative; display: flex; }
.gm-wrap .gm-player { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: #2a2752; border: 3px solid transparent; border-radius: 14px; padding: 1.6cqw 1cqw; }
.gm-wrap .gm-player:hover { border-color: #ffd54f; background: #3b3675; }
.gm-pavatar { font-size: clamp(22px, 7cqw, 40px); line-height: 1; }
.gm-pname { font-weight: 900; font-size: clamp(14px, 4.2cqw, 22px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-pstat { font-size: clamp(10px, 2.8cqw, 14px); color: #b9b4ff; }
.gm-wrap .gm-pdel { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 50%; background: #d23a3a; font-size: 14px; font-weight: 900; padding: 0; }
.gm-wrap .gm-danger { background: #d23a3a; }
.gm-wrap .gm-link { background: none; color: #b9b4ff; text-decoration: underline; font-size: clamp(12px, 3.2cqw, 16px); padding: 4px; }
.gm-wrap .gm-name { font: inherit; font-size: clamp(18px, 6cqw, 30px); font-weight: 800; text-align: center; width: 70%; padding: 1.6cqw 2cqw; border-radius: 14px; border: 3px solid #4f5bd5; background: #0d0b1f; color: #fff; outline: none; }
.gm-wrap .gm-name:focus { border-color: #ffd54f; }
.gm-wrap .gm-name.gm-err { border-color: #d23a3a; }
.gm-scores { border-collapse: collapse; width: 94%; font-size: clamp(12px, 3.4cqw, 18px); }
.gm-scores th { color: #b9b4ff; font-weight: 800; font-size: .8em; text-transform: uppercase; padding: 4px; }
.gm-scores td { padding: 1.2cqw 1cqw; border-top: 1px solid #2a2752; white-space: nowrap; }
.gm-scores td.gm-tn { font-weight: 900; text-align: left; max-width: 30cqw; overflow: hidden; text-overflow: ellipsis; }
.gm-fx { color: #ffd54f; }
