:root {
	--bg: #0f1115;
	--bg-2: #171a21;
	--fg: #e9edf3;
	--muted: #8a93a3;
	--accent: #ef4444;
	--pill: #232833;
	--pill-hi: #2c3240;
	--auth: #a855f7;
	--commerce: #22c55e;
	--content: #f97316;
	--nav: #3b82f6;
	--ads: #eab308;
	--injoke: #ec4899;
	--brick: #ef4444;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	background: radial-gradient(
		1200px 700px at 40% -10%,
		#1b2030 0%,
		var(--bg) 60%
	);
	color: var(--fg);
	font:
		14px / 1.4 -apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Helvetica,
		Arial,
		sans-serif;
	min-height: 100vh;
	overflow: hidden;
}

#app {
	display: flex;
	flex-direction: column;
	height: 100vh;
}

#hud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	background: rgba(15, 17, 21, 0.7);
	border-bottom: 1px solid #1f232d;
	gap: 12px;
	flex-wrap: wrap;
}
.hud-left,
.hud-center,
.hud-right {
	display: flex;
	align-items: center;
	gap: 8px;
}
.brand {
	font-weight: 700;
	letter-spacing: 0.2px;
	margin-right: 8px;
}

.pill {
	background: var(--pill);
	padding: 6px 10px;
	border-radius: 999px;
	color: var(--muted);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.pill b {
	color: var(--fg);
	font-weight: 600;
}
.pill.big b {
	font-size: 18px;
}
.pill.combo {
	background: #7c2d12;
	color: #fed7aa;
}
.pill.combo b {
	color: #fff;
}
.hidden {
	display: none !important;
}

button {
	background: var(--pill-hi);
	color: var(--fg);
	border: 0;
	border-radius: 8px;
	padding: 6px 10px;
	cursor: pointer;
	font: inherit;
}
button:hover {
	background: #384154;
}

#stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
}
#game {
	background: linear-gradient(#0b0d13, #12151d);
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	max-width: 100%;
	max-height: 100%;
	/* Preserve aspect ratio when scaling down */
	aspect-ratio: 1280 / 720;
	width: auto;
	height: 100%;
	touch-action: none;
}

#hint {
	position: absolute;
	left: 50%;
	bottom: 18px;
	transform: translateX(-50%);
	color: var(--muted);
	background: rgba(0, 0, 0, 0.4);
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	pointer-events: none;
}
#hint kbd {
	background: #333;
	color: #fff;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 11px;
}

/* Modals */
.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	backdrop-filter: blur(4px);
}
.modal-card {
	background: var(--bg-2);
	border: 1px solid #262b37;
	border-radius: 14px;
	padding: 24px 28px;
	min-width: 340px;
	max-width: min(480px, 92vw);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
	max-height: 92vh;
	overflow-y: auto;
}
.modal-card.wide {
	min-width: min(480px, 92vw);
	max-width: min(560px, 92vw);
}
.modal-card .game-title {
	margin: 0 0 4px;
	font-size: 28px;
	letter-spacing: 0.3px;
}
.modal-card .tagline {
	margin: 0 0 18px;
	color: var(--muted);
}
.tutorial {
	background: #0d1017;
	border: 1px solid #232838;
	border-radius: 10px;
	padding: 14px 16px;
	margin: 0 0 18px;
}
.tutorial h3 {
	margin: 0 0 10px;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: var(--muted);
}
.tutorial-list {
	list-style: none;
	margin: 0 0 10px;
	padding: 0;
	display: grid;
	gap: 6px;
}
.tutorial-list li {
	color: var(--fg);
	font-size: 13.5px;
	line-height: 1.45;
}
.tutorial-list b {
	color: #fff;
	font-weight: 600;
}
.tutorial kbd {
	background: #333;
	color: #fff;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 11px;
}
.small {
	font-size: 12px;
}
.field-label {
	display: block;
	font-size: 12px;
	color: var(--muted);
	margin: 0 0 6px;
}
.modal-card h2 {
	margin: 0 0 8px;
}
.modal-card p {
	color: var(--muted);
	margin: 0 0 16px;
}
.modal-card input {
	width: 100%;
	background: #0d1017;
	border: 1px solid #2b3040;
	border-radius: 8px;
	color: var(--fg);
	padding: 10px 12px;
	font: inherit;
	margin-bottom: 14px;
}
.modal-card input:focus {
	outline: none;
	border-color: var(--accent);
}
.modal-card button {
	background: var(--accent);
	color: #fff;
	padding: 10px 14px;
	font-weight: 600;
	border-radius: 8px;
}
.modal-card button:hover {
	background: #dc2626;
}
.row {
	display: flex;
	justify-content: flex-end;
}

.scoreboard {
	margin: 8px 0 16px;
}
.scoreboard h3 {
	margin: 0 0 8px;
	font-size: 14px;
	color: var(--muted);
	font-weight: 600;
}
.scoreboard ol {
	margin: 0;
	padding-left: 22px;
	max-height: 240px;
	overflow: auto;
}
.scoreboard li {
	padding: 3px 0;
	display: flex;
	justify-content: space-between;
	gap: 12px;
}
.scoreboard li .n {
	color: var(--fg);
}
.scoreboard li .s {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.scoreboard li.me {
	color: #fca5a5;
	font-weight: 700;
	background: rgba(239, 68, 68, 0.12);
	border-radius: 6px;
	padding-left: 6px;
	padding-right: 6px;
	margin: 0 -6px;
}
.scoreboard li.me .s {
	color: #fecaca;
}
.muted {
	color: var(--muted);
}

/* Floating +score text */
.floater {
	position: absolute;
	pointer-events: none;
	font-weight: 700;
	color: #fbbf24;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
	animation: rise 900ms ease-out forwards;
}
@keyframes rise {
	0% {
		transform: translateY(0) scale(0.9);
		opacity: 0;
	}
	20% {
		opacity: 1;
	}
	100% {
		transform: translateY(-60px) scale(1.15);
		opacity: 0;
	}
}
