/* The Godot build painted a fresh background colour behind every name; the page
   does the same through --ground, set from script. */

@font-face {
	font-family: "Special Elite";
	src: url("fonts/SpecialElite-Regular.ttf") format("truetype");
	font-display: swap;
}

@font-face {
	font-family: "Scheherazade New";
	src: url("fonts/ScheherazadeNew-SemiBold.ttf") format("truetype");
	font-display: swap;
}

:root {
	--ground: #3d3480;
	--ink: #ffffff;
	/* The visible area, which the on-screen keyboard shrinks. */
	--app-top: 0px;
	--app-height: 100%;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
}

body {
	background: var(--ground);
	color: var(--ink);
	font-family: "Special Elite", "Courier New", monospace;
	transition: background-color 600ms ease;
	overflow: hidden;
}

.screen {
	position: fixed;
	top: var(--app-top);
	left: 0;
	right: 0;
	height: var(--app-height);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2rem;
	padding: max(1rem, env(safe-area-inset-top)) 1.5rem
		max(1rem, env(safe-area-inset-bottom));
}

[hidden] { display: none !important; }

/* menu ---------------------------------------------------------------- */

.title {
	margin: 0;
	font-size: clamp(2.5rem, 9vw, 4.5rem);
	font-weight: normal;
	line-height: 1.3;
	text-align: center;
}

.arabic {
	font-family: "Scheherazade New", serif;
}

.translation {
	display: block;
	margin-top: 0.6rem;
	font-size: clamp(0.9rem, 2.6vw, 1.15rem);
	opacity: 0.65;
}

.title-small {
	margin: 0;
	font-size: clamp(1.5rem, 5vw, 2.2rem);
	font-weight: normal;
	text-align: center;
}

.action {
	font: inherit;
	font-size: clamp(1rem, 3vw, 1.4rem);
	padding: 0.7em 1.6em;
	color: var(--ink);
	background: transparent;
	border: 1px solid currentColor;
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.action:hover:not(:disabled),
.action:focus-visible:not(:disabled) {
	background: var(--ink);
	color: var(--ground);
}

.action:disabled {
	opacity: 0.5;
	cursor: default;
}

.error {
	margin: 0;
	max-width: 32rem;
	text-align: center;
	line-height: 1.5;
}

/* game ---------------------------------------------------------------- */

#game {
	justify-content: space-between;
}

.hud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	width: 100%;
	max-width: 60rem;
	font-size: clamp(0.8rem, 2.2vw, 1rem);
}

.time {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex: 1;
	max-width: 24rem;
}

.time-label { white-space: nowrap; }

.bar {
	flex: 1;
	height: 0.9rem;
	border: 1px solid var(--ink);
	background: transparent;
}

#bar-fill {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--ink);
}

.centre {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	flex: 1;
	width: 100%;
	min-height: 0;
}

.name {
	margin: 0;
	text-align: center;
	line-height: 1.15;
	white-space: nowrap;      /* sized to fit by script, never wrapped */
}

.info {
	margin: 0;
	font-size: clamp(1rem, 3.5vw, 1.6rem);
	text-align: center;
	min-height: 1.4em;        /* holds its line so the name does not jump */
}

/* Where the bar stands, read as a date since October 7th 2023. */
.equivalence {
	margin: 0;
	max-width: 36rem;
	padding: 0 1rem;
	font-size: clamp(0.85rem, 2.6vw, 1.1rem);
	line-height: 1.5;
	text-align: center;
	opacity: 0.85;
	min-height: 3em;          /* two lines held, so nothing jumps when it fills */
}

#entry-form {
	width: 100%;
	max-width: 60rem;
}

#entry {
	font: inherit;
	font-size: clamp(1rem, 3.5vw, 1.5rem);
	width: 100%;
	padding: 0.6em 0.8em;
	color: #0a0a0a;
	background: #fff;
	border: 2px solid #000;
	border-radius: 0;
	-webkit-appearance: none;
}

#entry::placeholder { color: #626262; }

#entry:disabled { background: #efefef; }

/* ended --------------------------------------------------------------- */

#ended, #sources {
	justify-content: center;
	overflow-y: auto;
}

.reveal {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.75rem;
	width: 100%;
	max-width: 52rem;
}

/* Each part fades in where it stands; nothing counts up. */
.entered-list, .line, .counts, .actions {
	transition: opacity 1200ms ease;
}

[data-veiled="true"] { opacity: 0; }

/* The names, in the order they were entered. */
.entered-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.35rem 1.5rem;
	max-height: 42vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	font-size: clamp(0.9rem, 2.4vw, 1.1rem);
	line-height: 1.6;
}

.entered-list li { white-space: nowrap; }

.line {
	margin: 0;
	font-size: clamp(0.95rem, 2.8vw, 1.25rem);
	line-height: 1.7;
	text-align: center;
	white-space: pre-line;
}

.counts {
	max-width: 40rem;
	margin: 0;
	font-size: clamp(0.85rem, 2.4vw, 1.05rem);
	line-height: 1.7;
	text-align: center;
}

/* The numbers keep their thousands together on one line. */
.counts span { white-space: nowrap; }

.share-note {
	margin: 0;
	font-size: clamp(0.75rem, 2.1vw, 0.9rem);
	opacity: 0.65;
	text-align: center;
}

.actions {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	align-items: center;
}

.call {
	margin: 0;
	font-size: clamp(0.95rem, 2.8vw, 1.15rem);
}

.share-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1rem;
	align-items: baseline;
	justify-content: center;
	font-size: clamp(0.85rem, 2.4vw, 1rem);
}

/* Quiet text, not a row of brand buttons. */
.share {
	font: inherit;
	padding: 0;
	color: inherit;
	background: none;
	border: 0;
	border-bottom: 1px solid currentColor;
	cursor: pointer;
	opacity: 0.85;
}

.share:hover, .share:focus-visible { opacity: 1; }

/* sources ------------------------------------------------------------- */

.source-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	max-width: 40rem;
	width: 100%;
	font-size: clamp(0.85rem, 2.4vw, 1rem);
}

.source-list li {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.source-what { opacity: 0.7; }

.source-list a {
	color: inherit;
	text-underline-offset: 0.25em;
	word-break: break-word;
}

/* The game screen stays underneath while the last name is still showing. */
.hud.faded,
#entry-form.faded,
.name.faded,
.equivalence.faded,
.info.faded {
	opacity: 0;
	transition: opacity 900ms ease;
	pointer-events: none;
}
