/*
 * Hala Player — public activation pages.
 *
 * Written by hand and served as one file. No Tailwind, no build step, no CDN,
 * no webfont. Three reasons, in order of how much they matter:
 *
 *   1. The audience is on a phone, often on mobile data, standing in front of a
 *      television they want to fix NOW. One 8 KB stylesheet and no blocking
 *      font request is the difference between instant and "is it broken?".
 *   2. This is a payment page. Every external request is a third party that can
 *      see who is buying, and one more thing that can be down when they are.
 *   3. The host is shared cPanel with a finite inode budget. node_modules is
 *      not a reasonable cost for four screens.
 *
 * The palette is the television app's own — #0B0F14 and the teal accent — so
 * that someone moving from the TV screen to their phone recognises where they
 * landed.
 */

:root {
	color-scheme: light dark;

	--bg: #f6f8fb;
	--bg-glow: rgba(13, 148, 136, 0.08);
	--surface: #ffffff;
	--surface-2: #f0f4f8;
	--line: #dfe7ee;
	--line-strong: #c7d4df;
	--text: #0b0f14;
	--muted: #5a6b7a;
	/* teal-700, not teal-600. 16px white on #0d9488 measured 3.70:1 — below the
	 * 4.5:1 WCAG threshold for normal text, and the Continue button is the single
	 * most important control on the site. #0f766e measures 5.40:1. */
	--accent: #0f766e;
	--accent-ink: #ffffff;
	--accent-soft: rgba(13, 148, 136, 0.1);
	--success: #047857;
	--success-soft: rgba(4, 120, 87, 0.12);
	--warn: #b45309;
	--warn-soft: rgba(180, 83, 9, 0.12);
	--danger: #b91c1c;
	--danger-soft: rgba(185, 28, 28, 0.1);

	--radius: 14px;
	--radius-lg: 20px;
	--shadow: 0 1px 2px rgba(11, 15, 20, 0.06), 0 8px 24px rgba(11, 15, 20, 0.06);
	--max: 540px;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0b0f14;
		--bg-glow: rgba(45, 212, 191, 0.07);
		--surface: #131a22;
		--surface-2: #1b242e;
		--line: #253039;
		--line-strong: #33414d;
		--text: #e8eef4;
		--muted: #93a4b3;
		--accent: #2dd4bf;
		--accent-ink: #04221f;
		--accent-soft: rgba(45, 212, 191, 0.12);
		--success: #34d399;
		--success-soft: rgba(52, 211, 153, 0.13);
		--warn: #fbbf24;
		--warn-soft: rgba(251, 191, 36, 0.13);
		--danger: #f87171;
		--danger-soft: rgba(248, 113, 113, 0.13);
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.3);
	}
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	/* A single soft wash behind the card, so the page has depth without
	   costing an image request. */
	background-image: radial-gradient(120% 60% at 50% 0%, var(--bg-glow) 0%, transparent 70%);
	background-repeat: no-repeat;
	color: var(--text);
	font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	padding: 0 18px;
	display: flex;
	flex-direction: column;
}

html[dir="rtl"] body {
	font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif;
}

.shell {
	width: 100%;
	max-width: var(--max);
	margin: 0 auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	padding-block: 22px 40px;
}

/* ── Header ───────────────────────────────────────────────────────────── */

.masthead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 26px;
}

.logo {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--text);
	text-decoration: none;
}

.logo .mark {
	width: 32px;
	height: 32px;
	flex: none;
	border-radius: 9px;
	background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
	color: var(--accent-ink);
	display: grid;
	place-items: center;
	font-weight: 800;
	font-size: 16px;
}

/* color-mix is not everywhere yet; the flat accent is a fine fallback. */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.logo .mark { background: var(--accent); }
}

.lang {
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: var(--muted);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 7px 15px;
	text-decoration: none;
	white-space: nowrap;
	transition: color .15s, border-color .15s;
}

.lang:hover { color: var(--text); border-color: var(--line-strong); }

/* ── Card ─────────────────────────────────────────────────────────────── */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	padding: 26px 22px;
}

.card + .card { margin-top: 16px; }

h1 {
	font-size: clamp(23px, 6vw, 28px);
	line-height: 1.25;
	letter-spacing: -0.02em;
	margin: 0 0 10px;
}

h2 {
	font-size: 17px;
	letter-spacing: -0.01em;
	margin: 0 0 14px;
}

.lead {
	color: var(--muted);
	margin: 0 0 22px;
	font-size: 15px;
}

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); }

code {
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 0.92em;
	background: var(--surface-2);
	border-radius: 5px;
	padding: 1px 5px;
}

/* ── The device code ──────────────────────────────────────────────────────
 * The single most important string on the site: it is what a licence binds to,
 * and what support asks for. Monospace, always LTR even on the Arabic page
 * (it is an identifier, not prose), and allowed to wrap rather than widening
 * the card on a narrow phone. */

.device-code {
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--accent);
	direction: ltr;
	unicode-bidi: embed;
	text-align: left;
	/* `anywhere` alone, NOT word-break:break-all. break-all splits at whatever
	 * character lands at the edge, so "…-0249da / e73452" — a hex group cut in
	 * half. With only overflow-wrap the browser breaks at the hyphens first and
	 * falls back to mid-token only when a single group is itself too wide,
	 * which keeps the groups a customer is reading off a TV screen intact. */
	overflow-wrap: anywhere;
}

.device-panel {
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
	margin-bottom: 16px;
}

.device-panel .label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 7px;
}

/* ── Status ───────────────────────────────────────────────────────────── */

.status-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 14px;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	border-radius: 999px;
	padding: 5px 13px;
	background: var(--surface-2);
	color: var(--muted);
	border: 1px solid var(--line);
}

.pill::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
	flex: none;
}

.pill.is-active { background: var(--success-soft); color: var(--success); border-color: transparent; }
.pill.is-trial { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.is-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.is-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.meta {
	font-size: 13.5px;
	color: var(--muted);
}

/* "Last seen 2 minutes ago" is the one fact that tells a buyer they typed the
   right code, so it is not grey small print — it gets its own weight. */
.meta strong { color: var(--text); font-weight: 600; }

/* ── Forms ────────────────────────────────────────────────────────────── */

.field { margin-bottom: 18px; }

.field label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 8px;
}

.field .hint {
	font-size: 13px;
	color: var(--muted);
	margin-top: 9px;
	line-height: 1.55;
}

input[type="text"] {
	width: 100%;
	font: inherit;
	/* 16px minimum: anything smaller makes iOS Safari zoom the page on focus,
	   which on this form throws the layout sideways mid-typing. */
	font-size: 16px;
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	color: var(--text);
	background: var(--bg);
	border: 1.5px solid var(--line-strong);
	border-radius: var(--radius);
	padding: 14px 15px;
	direction: ltr;
	text-align: left;
	transition: border-color .15s, box-shadow .15s;
}

input[type="text"]::placeholder { color: var(--muted); opacity: .65; }

input[type="text"]:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	border-radius: var(--radius);
	padding: 15px 20px;
	border: 1.5px solid transparent;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
	transition: transform .06s, filter .15s, border-color .15s, color .15s;
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
	background: transparent;
	color: var(--text);
	border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}

.btn + .btn { margin-top: 10px; }

.price {
	font-size: 15px;
	font-weight: 700;
	opacity: .9;
}

/* ── Messages ─────────────────────────────────────────────────────────── */

.note {
	border-radius: var(--radius);
	padding: 13px 16px;
	font-size: 14.5px;
	line-height: 1.55;
	margin-bottom: 18px;
	border: 1px solid transparent;
}

.note-error { background: var(--danger-soft); color: var(--danger); }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-info { background: var(--accent-soft); color: var(--accent); }
.note-success { background: var(--success-soft); color: var(--success); }

.note strong { font-weight: 700; }

/* ── Success ──────────────────────────────────────────────────────────── */

.tick {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--success-soft);
	color: var(--success);
	display: grid;
	place-items: center;
	margin: 0 auto 18px;
}

.tick svg { width: 28px; height: 28px; }

.centered { text-align: center; }

/* ── Divider with a word in it ────────────────────────────────────────── */

.or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 22px 0;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.or::before, .or::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--line);
}

/* ── Footer ───────────────────────────────────────────────────────────── */

.site-foot {
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1px solid var(--line);
	font-size: 13px;
	color: var(--muted);
	text-align: center;
}

.site-foot nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 18px;
	margin-bottom: 10px;
}

.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--accent); text-decoration: underline; }

.explainer {
	margin-top: 22px;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--muted);
	text-align: center;
}

.explainer strong { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
