:root {
	--bg: #14161f;
	--bg-glow: #232a44;
	--body: #efe6d2;
	--body-edge: #c9bc9f;
	--key: #fffaf0;
	--key-edge: #d9cdb2;
	--key-lit: #ffb703;
	--ink: #2b2a33;
	--ink-soft: #6d6a75;
	--accent: #e63946;
	--screen: #16231c;
	--screen-ink: #7dffb0;
	--page-ink: #f4efe3;
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: 1.5rem 16px 2rem;
	background: radial-gradient(ellipse at 50% 0%, var(--bg-glow), var(--bg) 65%);
	background-color: var(--bg);
	color: var(--page-ink);
	font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

.title {
	text-align: center;
}

.title h1 {
	margin: 0;
	font-size: clamp(2.2rem, 9vw, 3.4rem);
	letter-spacing: 0.12em;
	font-weight: 800;
	line-height: 1;
}

.spell {
	display: flex;
	justify-content: center;
	gap: 0.35em;
	margin: 0.6rem 0 0;
	padding: 0;
	list-style: none;
	font-size: clamp(1.1rem, 5vw, 1.5rem);
	font-weight: 700;
	letter-spacing: 0.08em;
}

.spell li {
	opacity: 0.28;
	transform: translateY(0);
	transition: opacity 0.2s, transform 0.2s, color 0.2s;
}

.spell li.on {
	opacity: 1;
	color: var(--key-lit);
	transform: translateY(-3px);
}

.tagline {
	margin: 0.5rem 0 0;
	color: #a9a6b8;
	font-size: 0.95rem;
}

/* The phone */

.phone {
	width: min(92vw, 360px);
	padding: 18px 18px 22px;
	border-radius: 28px;
	background: linear-gradient(160deg, var(--body), var(--body-edge));
	box-shadow:
		0 2px 0 #fff8 inset,
		0 -6px 0 #0002 inset,
		0 24px 50px #0008;
	color: var(--ink);
}

.phone.ringing {
	animation: ring 0.12s linear 14;
}

@keyframes ring {
	0% { transform: translateX(0) rotate(0); }
	25% { transform: translateX(-3px) rotate(-0.8deg); }
	75% { transform: translateX(3px) rotate(0.8deg); }
	100% { transform: translateX(0) rotate(0); }
}

.screen {
	min-height: 78px;
	margin-bottom: 16px;
	padding: 10px 14px;
	border-radius: 12px;
	background: var(--screen);
	box-shadow: 0 3px 8px #0008 inset;
	color: var(--screen-ink);
	font-family: "Courier New", ui-monospace, monospace;
	text-shadow: 0 0 8px #7dffb066;
}

.screen .digits {
	min-height: 1.7rem;
	font-size: 1.6rem;
	letter-spacing: 0.3em;
	white-space: nowrap;
	overflow: hidden;
}

.screen .status {
	margin-top: 4px;
	min-height: 1.2rem;
	font-size: 0.85rem;
	opacity: 0.85;
}

.keys {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.key {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 0.88;
	border: 0;
	border-radius: 16px;
	background: linear-gradient(180deg, #fff, var(--key));
	box-shadow:
		0 5px 0 var(--key-edge),
		0 8px 10px #0003;
	color: var(--ink);
	font: inherit;
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: transform 0.06s, box-shadow 0.06s, background 0.15s;
}

.key .num {
	font-size: 1.9rem;
	font-weight: 800;
	line-height: 1;
}

.key .abc {
	margin-top: 3px;
	font-size: 0.68rem;
	letter-spacing: 0.18em;
	color: var(--ink-soft);
	font-weight: 700;
	height: 0.8rem;
}

.key.linked::after {
	content: "";
	position: absolute;
	top: 8px;
	right: 8px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	opacity: 0.85;
}

.dial-mode .key.linked::after {
	opacity: 0;
}

.key:hover {
	background: linear-gradient(180deg, #fff, #fff1cf);
}

.key:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 3px;
}

.key.down,
.key:active {
	transform: translateY(4px);
	box-shadow:
		0 1px 0 var(--key-edge),
		0 3px 5px #0003;
	background: linear-gradient(180deg, var(--key-lit), #ffd36b);
}

.key.nope {
	animation: nope 0.25s;
}

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

.mode {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 18px;
	font-size: 0.85rem;
	color: var(--ink-soft);
}

.mode button {
	padding: 6px 14px;
	border: 2px solid var(--ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.mode button:hover {
	background: var(--ink);
	color: var(--key);
}

.mode button:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

.foot {
	text-align: center;
	color: #8f8ca0;
	font-size: 0.85rem;
	line-height: 1.6;
}

.foot a {
	color: #cfcbe0;
}

.foot kbd {
	padding: 1px 6px;
	border-radius: 4px;
	background: #ffffff18;
	font: inherit;
	font-size: 0.8rem;
}

/* Subpages */

.stub {
	text-align: center;
	max-width: 30rem;
}

.stub .big {
	font-size: clamp(7rem, 38vw, 12rem);
	font-weight: 900;
	line-height: 1;
	color: var(--key-lit);
	text-shadow: 0 8px 0 #0005;
}

.stub .letters {
	margin: 0.5rem 0 1rem;
	font-size: 1.4rem;
	letter-spacing: 0.35em;
	color: #a9a6b8;
}

.stub .letters b {
	color: var(--page-ink);
}

.stub h1 {
	margin: 0 0 0.5rem;
	font-size: 1.6rem;
}

.stub p {
	margin: 0.4rem 0;
	color: #c7c3d6;
	line-height: 1.6;
}

.stub nav {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px 22px;
	margin-top: 1.8rem;
}

.stub nav a {
	color: var(--page-ink);
	font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
	.phone.ringing,
	.key.nope {
		animation: none;
	}
	.key,
	.spell li {
		transition: none;
	}
}
