:root {
	font-family: ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
	font-synthesis: none;
	--ink: #302e2a;
	--muted: #8a8981;
	--soft: #eeeae4;
	--paper: #fff;
	--accent: #c2532e;
	--goal: #3f9a55;
	--miss: #c8463c;
	--empty: #dcd8d0;
	color: var(--ink);
	background: var(--paper);
}
/* the page follows the stadium's light */
body[data-page="night"] { --ink: #e6e4f0; --muted: #8d8ca6; --soft: #2a2c3c; --paper: #12131c; --accent: #f0a13c; --empty: #3a3c50; }
body[data-page="sunset"] { --paper: #fff6ec; --soft: #f3e2d0; --accent: #d4583a; }
body[data-page="snow"] { --paper: #f6f9fc; --soft: #e2e8f0; --accent: #b8443e; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; height: 100svh; min-height: 600px; overflow: hidden; background: var(--paper); color: var(--ink); transition: background 0.4s; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.header { position: absolute; top: 28px; left: 40px; right: 40px; display: flex; align-items: center; justify-content: space-between; z-index: 2; }
.wordmark { display: flex; gap: 11px; align-items: center; font-size: 9px; letter-spacing: 1.5px; line-height: 1.7; }
.wordmark b { font-size: 17px; letter-spacing: 3.2px; font-weight: 600; }
.ball-icon { color: var(--accent); font-size: 30px; line-height: 1; }
.text-button { border: 0; background: none; padding: 6px 0; color: var(--muted); font-size: 11px; }
.text-button:hover, .footer a:hover { color: var(--accent); }
#help-open span { margin-left: 12px; }

.scoreboard { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px 22px; padding: 6px 16px; }
.side { display: grid; gap: 6px; justify-items: center; }
.side-name { font-size: 8px; letter-spacing: 1.7px; color: var(--muted); }
.tracker { display: flex; gap: 5px; }
.tracker i { width: 9px; height: 9px; border-radius: 50%; background: var(--empty); }
.tracker i.goal { background: var(--goal); }
.tracker i.miss { background: var(--miss); }
.tracker i.now { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--accent); }
.score { display: flex; gap: 10px; align-items: baseline; font-size: 26px; font-variant-numeric: tabular-nums; }
.score strong { font-weight: 400; }
.score span { color: var(--muted); font-size: 18px; }
.score strong.pop { animation: score-pop 0.5s ease-out; }
.kick-info { grid-column: 1 / -1; margin: 2px 0 0; text-align: center; font-size: 9px; letter-spacing: 1.2px; color: var(--muted); }

#stage { position: absolute; inset: 0 0 70px; display: grid; place-items: center; overflow: hidden; }
canvas { display: block; image-rendering: pixelated; cursor: crosshair; touch-action: none; outline: none; transition: transform 0.7s cubic-bezier(.2, .7, .2, 1); }
canvas.zoomed { transform: scale(1.14); }

#callout, #paused { position: absolute; z-index: 3; transform: translate(-50%, -100%); padding: 10px 16px; border: 1px solid var(--accent); background: var(--paper); color: var(--accent); text-align: center; pointer-events: none; box-shadow: 3px 3px 0 #00000018; }
#callout[hidden], #paused[hidden] { display: none; }
#callout strong, #paused strong { display: block; font-size: 18px; letter-spacing: 2px; }
#callout span, #paused span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: 1px; }
#callout.miss { border-color: var(--muted); color: var(--ink); }
#callout.show { animation: callout-pop 1.7s both; }
#paused { left: 50%; top: 45%; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; }
@keyframes callout-pop {
	0% { opacity: 0; transform: translate(-50%, calc(-100% + 10px)) scale(0.8); }
	10% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); }
	18%, 82% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
	100% { opacity: 0; transform: translate(-50%, calc(-100% - 8px)); }
}
@keyframes score-pop { 35% { transform: scale(1.4); } }
@media (prefers-reduced-motion: reduce) {
	#callout.show, .score strong.pop { animation: none; }
	canvas, canvas.zoomed { transition: none; transform: none; }
	body { transition: none; }
}

.shoot-panel { position: absolute; width: 292px; left: 50%; bottom: 69px; transform: translateX(-50%); z-index: 2; }
#feedback { margin: 0 0 22px; min-height: 14px; text-align: center; color: var(--muted); font-size: 11px; }
.power-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; letter-spacing: 1.4px; }
#power-value { font-variant-numeric: tabular-nums; color: var(--ink); }
#power-meter { position: relative; margin-top: 8px; height: 7px; background: var(--soft); overflow: hidden; }
#power-fill { position: relative; height: 100%; width: 0; background: var(--accent); opacity: 0.85; }
#sweet-spot { position: absolute; top: 0; bottom: 0; background: var(--goal); opacity: 0.55; }
body.defending #power-meter { opacity: 0.35; }
#shoot { border: 0; background: transparent; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 0 0; width: 100%; color: var(--muted); font-size: 9px; touch-action: none; user-select: none; -webkit-user-select: none; }
kbd { font: inherit; font-size: 9px; color: var(--ink); border: 1px solid var(--soft); padding: 3px 5px; border-radius: 3px; background: var(--paper); white-space: nowrap; }
#shoot:active kbd, body.charging #shoot kbd { border-color: var(--accent); color: var(--accent); }

.footer { position: absolute; left: 40px; right: 40px; bottom: 25px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; color: var(--muted); font-size: 9px; align-items: center; z-index: 2; }
#controls { display: flex; align-items: center; gap: 22px; }
#controls > span { display: flex; align-items: center; gap: 6px; }
.mouse-icon { display: inline-block; width: 9px; height: 13px; border: 1px solid var(--muted); border-radius: 5px; margin-right: 1px; }
.footer-right { display: flex; gap: 24px; align-items: center; }
.author-credit { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; color: var(--ink); }
.author-credit:hover { color: var(--accent); }
.footer-right button, .footer-right a { font-size: 9px; }
.footer-menu { position: relative; }
.menu-button { white-space: nowrap; }
.menu-button[aria-expanded="true"] { color: var(--accent); }
.menu-options { position: absolute; bottom: calc(100% + 10px); left: -12px; width: 190px; margin: 0; padding: 0 0 6px; border: 1px solid var(--soft); background: var(--paper); box-shadow: 0 12px 40px #28231520; }
.menu-options[hidden] { display: none; }
.menu-options legend { float: left; width: 100%; padding: 12px 12px 6px; font-size: 8px; letter-spacing: 1.4px; color: var(--accent); }
.menu-options label { clear: left; display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 10px; color: var(--ink); cursor: pointer; }
.menu-options label:hover { background: var(--soft); }
.menu-options input { margin: 0; accent-color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100svh - 40px); padding: 30px; border: 1px solid var(--soft); color: var(--ink); background: var(--paper); box-shadow: 0 25px 100px #28231520; }
dialog::backdrop { background: #ffffff55; backdrop-filter: blur(5px); }
.dialog-top { display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: 1px; color: var(--accent); }
dialog h1 { font: 400 34px/1.2 Georgia, serif; margin: 25px 0 15px; }
dialog p { font-size: 11px; line-height: 1.8; color: var(--muted); }
dialog dl { margin: 25px 0; }
dialog dl div { border-top: 1px solid var(--soft); padding: 15px 0; }
dialog dt { font-size: 9px; letter-spacing: 1.3px; color: var(--accent); }
dialog dd { margin: 8px 0 0; font-size: 11px; line-height: 1.8; }
dialog .dialog-note { font-size: 10px; }
.play-button { display: flex; justify-content: space-between; width: 100%; border: 0; padding: 14px 16px; margin-top: 22px; background: var(--accent); color: white; font-size: 11px; }
.result-score { display: flex; gap: 12px; align-items: baseline; justify-content: center; font-size: 10px; letter-spacing: 1.5px; }
.result-score strong { font: 400 40px Georgia, serif; color: var(--ink); }
.history { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 9px; }
.history th, .history td { padding: 7px 2px; border-top: 1px solid var(--soft); text-align: center; font-weight: 400; }
.history th { color: var(--muted); }
.history th:first-child, .history td:first-child { text-align: left; color: var(--muted); letter-spacing: 1.2px; }
.history td.goal { color: var(--goal); }
.history td.saved, .history td.missed, .history td.post { color: var(--miss); }

@media (min-height: 850px) { .shoot-panel { bottom: 90px; } }
@media (max-width: 1250px) and (min-width: 901px) { .author-credit { position: static; transform: none; } }
@media (max-width: 900px) {
	.header { top: 18px; left: 22px; right: 22px; display: grid; grid-template-columns: 1fr auto; row-gap: 12px; }
	.scoreboard { position: static; grid-column: 1 / -1; justify-self: center; transform: none; gap: 4px 14px; padding: 4px 8px; }
	#stage { inset: 120px 0 230px; }
	.shoot-panel { bottom: 96px; width: 270px; }
	#feedback { margin-bottom: 14px; }
	.footer { left: 16px; right: 16px; bottom: 16px; font-size: 8px; justify-content: center; }
	#controls { display: none; }
	.footer-right { flex-wrap: wrap; justify-content: center; gap: 10px 18px; }
	.author-credit { position: static; transform: none; flex-basis: 100%; text-align: center; }
}
@media (max-height: 620px) and (min-width: 901px) {
	body { min-height: 400px; }
	.header { top: 14px; }
	#stage { inset: 60px 0 110px; }
	.shoot-panel { bottom: 62px; }
	#feedback { margin-bottom: 10px; }
	.footer { bottom: 12px; }
}
