@font-face {
	font-family: 'IRANSansXV';
	src: url('/fonts/IRANSansXV.woff2') format('woff2');
	font-weight: 100 900;
	font-display: swap;
}

:root {
	--bg: #0c0a10;
	--panel: #17131d;
	--line: #2a2333;
	--text: #ece6f1;
	--muted: #9a90a6;
	--rose: #f9a8d4;
	--gold: #fcd34d;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'IRANSansXV', sans-serif;
	-webkit-tap-highlight-color: transparent;
}

[hidden] {
	display: none !important;
}

.screen {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	text-align: center;
}

h1 {
	margin: 18px 0 4px;
	font-size: 2.4rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

h2 {
	margin: 18px 0 6px;
	font-weight: 500;
}

.fa {
	font-family: 'IRANSansXV', sans-serif;
	font-weight: 300;
	color: var(--gold);
	margin-inline-start: 6px;
}

.lead {
	margin: 0 0 18px;
	color: var(--gold);
}

.story {
	max-width: 30rem;
	margin: 0 0 28px;
	color: var(--muted);
}

.small {
	color: var(--muted);
	font-size: 0.85rem;
}

.error {
	min-height: 1.4em;
	color: #fca5a5;
	font-size: 0.9rem;
}

button {
	font: inherit;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 18px;
	cursor: pointer;
	touch-action: manipulation;
}

button:hover {
	border-color: #4a3f57;
}

button.primary {
	background: linear-gradient(180deg, #fde68a, #f59e0b);
	color: #2a1a05;
	border: none;
	font-weight: 600;
	padding: 12px 26px;
	box-shadow: 0 0 30px rgba(252, 211, 77, 0.25);
}

input {
	font: inherit;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px 14px;
	outline: none;
}

input:focus {
	border-color: var(--gold);
}

.join {
	display: flex;
	gap: 8px;
	margin-top: 14px;
}

.join input {
	width: 7.5rem;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 0.3em;
}

.share {
	display: flex;
	gap: 8px;
	width: 100%;
	max-width: 26rem;
}

.share input {
	flex: 1;
	min-width: 0;
	font-size: 0.9rem;
}

.code {
	font-family: ui-monospace, Menlo, monospace;
	letter-spacing: 0.15em;
	color: var(--gold);
}

/* The lamp drawing on the home and waiting screens */
.lamp-mark {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: radial-gradient(circle, #fff7d6 0 12%, #fcd34d 22%, rgba(252, 211, 77, 0.25) 45%, transparent 70%);
	animation: flicker 3.2s ease-in-out infinite;
}

@keyframes flicker {
	0%,
	100% {
		transform: scale(1);
		opacity: 1;
	}
	45% {
		transform: scale(1.06);
		opacity: 0.9;
	}
	60% {
		transform: scale(0.97);
		opacity: 1;
	}
}

/* Game */
#game {
	justify-content: flex-start;
	padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
	gap: 8px;
	height: 100%;
	min-height: 0;
}

.hud {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	max-width: 640px;
	text-align: start;
}

.hud-level {
	display: flex;
	flex-direction: column;
	font-size: 0.9rem;
	line-height: 1.3;
}

.hud-level .code {
	font-size: 0.75rem;
}

.lamps {
	flex: 1;
	display: grid;
	gap: 4px;
}

.lamp-bar {
	display: grid;
	grid-template-columns: 5.6rem 1fr;
	align-items: center;
	font-size: 0.72rem;
	color: var(--muted);
}

.lamp-bar i {
	height: 6px;
	border-radius: 3px;
	background: var(--line);
	overflow: hidden;
}

.lamp-bar b {
	display: block;
	height: 100%;
	width: 100%;
	border-radius: 3px;
	transition: width 0.6s;
}

.heart {
	color: var(--rose);
	font-size: 1.2rem;
	padding: 6px 12px;
}

.hint {
	margin: 0;
	min-height: 1.4em;
	max-width: 640px;
	color: var(--muted);
	font-size: 0.85rem;
}

.stage {
	position: relative;
	flex: 1;
	min-height: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

canvas {
	display: block;
	touch-action: none;
	cursor: crosshair;
	border-radius: 10px;
}

canvas.shake {
	animation: shake 0.22s;
}

@keyframes shake {
	25% {
		transform: translateX(-4px);
	}
	75% {
		transform: translateX(4px);
	}
}

.paused {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(12, 10, 16, 0.75);
	color: var(--muted);
	border-radius: 10px;
}

.pad {
	display: grid;
	grid-template-columns: repeat(3, 58px);
	grid-template-rows: repeat(2, 50px);
	gap: 6px;
}

.pad button {
	padding: 0;
	font-size: 1.1rem;
	color: var(--muted);
}

.pad [data-d='u'] {
	grid-column: 2;
}
.pad [data-d='l'] {
	grid-column: 1;
	grid-row: 2;
}
.pad [data-d='d'] {
	grid-column: 2;
	grid-row: 2;
}
.pad [data-d='r'] {
	grid-column: 3;
	grid-row: 2;
}

/* Mouse and keyboard players don't need the pad */
@media (hover: hover) and (pointer: fine) {
	.pad {
		display: none;
	}
}

/* Level finished */
.overlay {
	position: fixed;
	inset: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(12, 10, 16, 0.8);
	backdrop-filter: blur(3px);
	animation: fade 0.6s;
}

@keyframes fade {
	from {
		opacity: 0;
	}
}

.card {
	max-width: 28rem;
	padding: 28px 24px;
	text-align: center;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 18px;
	box-shadow: 0 0 60px rgba(252, 211, 77, 0.12);
}

.eyebrow {
	margin: 0;
	color: var(--gold);
	font-size: 0.8rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

blockquote {
	margin: 16px 0 10px;
	font-size: 1.3rem;
	line-height: 1.5;
	font-style: italic;
}
