/* AiGeleia (/play/aigeleia/ e aigeleia.gamestoplay.net): o palco com o canvas (a cena se ajusta à tela), os botões
   do canto, as telas de título, balão de abertura, pausa e fim, e o controle de toque — embaixo do jogo no celular em
   pé e por cima dos cantos no celular deitado. As cores e os botões base vêm do kit (../kit/kit.css). */
:root { --ag-sun: #ffb84d; --ag-ink: #1b1a24; --ag-cream: #fff7e8; }
html, body { background: var(--ag-ink); }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }

.ag-app {
	height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.ag-stage { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.ag-stage canvas { display: block; touch-action: none; background: #f4c890; }

/* botões do canto */
.ag-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 3; }
.ag-tools .gk-icon { background: rgba(15, 14, 19, .55); border-color: rgba(255, 255, 255, .18); color: #fff; backdrop-filter: blur(4px); }
.ag-only-play { display: none !important; }
.ag-playing .ag-only-play { display: grid !important; }

/* telas por cima do jogo */
.ag-overlay {
	position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 56px 16px 16px;
	background: radial-gradient(ellipse at center, rgba(15, 14, 19, .55), rgba(15, 14, 19, .82)); overflow: auto;
}
.ag-card {
	width: min(560px, 100%); text-align: center; padding: 22px 22px 18px; border-radius: 16px;
	background: rgba(24, 23, 29, .92); border: 1px solid #3a3842; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.ag-card.ag-small { width: min(380px, 100%); }
.ag-card h2 { margin: 0 0 12px; font: 900 26px/1.1 Rubik, sans-serif; text-transform: uppercase; letter-spacing: .02em; }
.ag-kicker { margin: 0 0 6px; color: var(--ag-sun); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.ag-logo { margin: 0; font: 900 clamp(38px, 9vw, 64px)/.95 Rubik, sans-serif; text-transform: uppercase; letter-spacing: -.01em; }
.ag-logo b { color: var(--magenta); }
.ag-lead { margin: 12px auto 16px; max-width: 42ch; color: #d8d6e0; }
.ag-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; align-items: center; }
.ag-go { font-size: 18px; padding: 12px 30px; min-height: 48px; }
.ag-best { margin: 12px 0 0; color: var(--ag-sun); font-weight: 700; min-height: 1.4em; }
.ag-keys { margin: 8px auto 0; max-width: 46ch; color: var(--muted); font-size: 13px; }
.ag-credit { margin: 12px 0 0; font-size: 11px; }
.ag-credit a { color: #77748a; text-decoration: none; }
.ag-credit a:hover { color: var(--text); text-decoration: underline; }
.ag-touch { display: none; }
@media (pointer: coarse) { .ag-touch { display: block; } .ag-desktop { display: none; } }
.ag-progress { height: 8px; border-radius: 99px; background: #2a2931; overflow: hidden; margin-top: 10px; }
.ag-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--magenta)); transition: width .2s; }
.ag-results { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 12px; padding: 0; }
.ag-results li { background: #121117; border: 1px solid #2a2931; border-radius: 10px; padding: 10px 6px; display: grid; gap: 2px; }
.ag-results b { font: 900 24px/1 Rubik, sans-serif; color: #fff; }
.ag-results span { color: var(--muted); font-size: 12px; }
.ag-record { margin: 0 0 12px; color: var(--ag-sun); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }

/* balão de abertura: fala do personagem, ancorado em cima dele (left/bottom postos pelo jogo) */
.ag-intro { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.ag-balloon {
	pointer-events: auto; position: absolute; left: 12px; bottom: 50%;
	width: min(440px, calc(100% - 24px)); max-height: calc(100% - 64px); overflow: auto; padding: 16px 18px 14px; border-radius: 22px;
	background: var(--ag-cream); color: var(--ag-ink); border: 3px solid var(--ag-ink); box-shadow: 0 10px 0 rgba(0, 0, 0, .18);
	transform-origin: var(--tail, 12%) 100%; animation: ag-pop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.ag-balloon::after {
	content: ''; position: absolute; left: var(--tail, 12%); bottom: -17px; width: 26px; height: 26px; background: var(--ag-cream);
	border: 3px solid var(--ag-ink); border-top: 0; border-left: 0; transform: rotate(45deg) skew(12deg, 12deg); border-radius: 0 0 6px 0;
}
.ag-balloon h2 { margin: 0 0 6px; font: 900 18px/1.1 Rubik, sans-serif; text-transform: uppercase; color: #c3123a; }
.ag-balloon p { margin: 0 0 12px; font-size: 15px; line-height: 1.42; font-weight: 500; }
.ag-balloon .ag-go { font-size: 16px; padding: 9px 24px; min-height: 44px; }
@keyframes ag-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ag-balloon { animation: none; } }

/* controle de toque */
.ag-pad { display: none; }
.ag-touch-on .ag-pad {
	display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px 12px;
	background: #15141b; border-top: 1px solid #2a2931;
}
.ag-pad-left { display: flex; gap: 12px; }
.ag-key {
	width: 76px; height: 76px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .28); background: rgba(40, 38, 50, .78);
	color: #fff; display: grid; place-content: center; justify-items: center; gap: 0; cursor: pointer; touch-action: none;
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 0;
}
.ag-key svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ag-key.ag-jump { width: 104px; height: 104px; background: rgba(255, 38, 98, .85); border-color: rgba(255, 255, 255, .5); }
.ag-key.ag-jump svg { width: 40px; height: 40px; }
.ag-key[data-down='true'] { transform: scale(.94); filter: brightness(1.25); }

/* celular deitado: os botões ficam por cima dos cantos de baixo do jogo */
@media (orientation: landscape) {
	.ag-touch-on .ag-app { grid-template-rows: minmax(0, 1fr); }
	.ag-touch-on .ag-pad {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; background: none; border: 0; pointer-events: none;
		padding: 0 max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
	}
	.ag-touch-on .ag-key { pointer-events: auto; width: 64px; height: 64px; background: rgba(30, 28, 38, .5); }
	.ag-touch-on .ag-key.ag-jump { width: 88px; height: 88px; background: rgba(255, 38, 98, .6); }
}
