/* Admin page of the Aura Shield licence server. The look follows the game's start banner (aura_splash.cpp) and
   the crest (aura-shield-logo.svg): dark blue banner, the crest standing out of it, the crest's blues, and the
   gold of its stone for the one thing that matters most. Fonts are the system's own on purpose: this page must
   work offline and must not ask any outside server for anything. */
:root {
	/* the crest */
	--brand-blue-light: #3a7de0;
	--brand-blue: #1a5fb4;
	--brand-blue-deep: #123f7a;
	--brand-aura: #7fb2ff;
	--brand-gold: #ffd76a;
	--brand-gold-deep: #b8860b;
	/* the banner */
	--banner-top: #16305f;
	--banner-bottom: #0a1a3a;
	--banner-line: rgb(127 178 255 / 55%);
	--banner-text: #ffffff;
	--banner-text-soft: #a9c8f5;

	--color-page-top: #e3e8f2;
	--color-page-bottom: #eef2f8;
	--color-surface: #ffffff;
	--color-ink: #0c1b3a;
	--color-ink-soft: #46557a;
	--color-line: #d0daec;
	--color-line-strong: #a9b9d6;
	--color-primary: var(--brand-blue);
	--color-primary-deep: var(--brand-blue-deep);
	--color-on-primary: #ffffff;
	--color-good: #0f6b3c;
	--color-good-soft: #e2f4ea;
	--color-warn: #7d4700;
	--color-warn-soft: #fff3d6;
	--color-bad: #b01c1c;
	--color-bad-soft: #fde8e8;
	--color-plain-soft: #e6ecf6;
	--font-text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-code: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
	--radius-small: 6px;
	--radius-large: 12px;
	--shadow-card: 0 1px 2px rgb(12 27 58 / 7%), 0 10px 26px -14px rgb(12 27 58 / 28%);
	--shadow-banner: 0 12px 30px -16px rgb(10 26 58 / 75%);
	--control-height: 44px;
	--bar-height: 68px;
	--crest-size: 84px;
	--page-width: 1240px;
	--gutter: clamp(16px, 4vw, 32px);
	--duration: 160ms;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	min-height: 100dvh;
	background: linear-gradient(180deg, var(--color-page-top), var(--color-page-bottom) 420px) no-repeat var(--color-page-bottom);
	color: var(--color-ink);
	font: 16px/1.5 var(--font-text);
}

h1, h2, p, ul, dl, dd { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-primary-deep); margin-bottom: var(--space-3); }
a { color: var(--color-primary); }
code, .num, .id { font-family: var(--font-code); font-variant-numeric: tabular-nums; }
code { background: var(--color-plain-soft); padding: 1px 6px; border-radius: 4px; font-size: 0.875em; }
.hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

:focus-visible { outline: 3px solid var(--brand-blue-light); outline-offset: 2px; border-radius: var(--radius-small); }

.skip { position: absolute; left: var(--space-4); top: -60px; background: var(--color-surface); padding: var(--space-2) var(--space-4); z-index: 10; }
.skip:focus { top: var(--space-2); }

/* ---- the banner on top of every page: the crest is larger than the bar and stands out of it ---- */
.top {
	position: relative;
	z-index: 2;
	background: linear-gradient(180deg, var(--banner-top), var(--banner-bottom));
	border-bottom: 1px solid var(--banner-line);
	box-shadow: var(--shadow-banner);
	color: var(--banner-text);
}
.top-inner {
	display: flex;
	align-items: center;
	gap: var(--space-5);
	max-width: var(--page-width);
	min-height: var(--bar-height);
	margin: 0 auto;
	padding: 0 var(--gutter);
}
.brand { position: relative; display: flex; align-items: center; gap: var(--space-3); color: inherit; text-decoration: none; }
.brand::before {
	content: "";
	position: absolute;
	left: calc(var(--crest-size) / 2 - 90px);
	top: 50%;
	width: 180px;
	height: 180px;
	margin-top: -78px;
	background: radial-gradient(closest-side, rgb(127 178 255 / 34%), rgb(127 178 255 / 0%));
	pointer-events: none;
}
.brand-crest { position: relative; width: var(--crest-size); height: var(--crest-size); margin: -2px 0 -26px; filter: drop-shadow(0 6px 10px rgb(4 12 30 / 55%)); }
.brand-text { position: relative; display: grid; line-height: 1.15; }
.brand-name { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.01em; }
.brand-part { font-size: 0.8125rem; color: var(--banner-text-soft); }
.top nav { display: flex; gap: var(--space-1); margin-left: var(--space-4); margin-right: auto; align-self: stretch; }
.top nav a {
	display: flex;
	align-items: center;
	padding: 0 var(--space-4);
	min-height: var(--control-height);
	color: var(--banner-text-soft);
	text-decoration: none;
	font-weight: 600;
	border-bottom: 3px solid transparent;
	border-top: 3px solid transparent;
	transition: color var(--duration) ease-out, border-color var(--duration) ease-out;
}
.top nav a { white-space: nowrap; }
.top nav a:hover { color: var(--banner-text); border-bottom-color: var(--banner-line); }
.top nav a[aria-current="page"] { color: var(--banner-text); border-bottom-color: var(--brand-gold); }
.top form { margin-left: auto; }
.top :focus-visible { outline-color: var(--brand-gold); }

main { max-width: var(--page-width); margin: 0 auto; padding: 44px var(--gutter) 64px; display: grid; gap: var(--space-5); }

.title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.title-row h1 .id { color: var(--color-primary); font-size: 0.7em; font-weight: 600; display: block; letter-spacing: 0.02em; }
.crumb { color: var(--color-ink-soft); font-size: 0.875rem; margin-bottom: calc(var(--space-3) * -1); }

/* ---- buttons and fields ---- */
.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--control-height);
	padding: 0 var(--space-4);
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-small);
	background: var(--color-surface);
	color: var(--color-ink);
	font: 600 0.9375rem/1 var(--font-text);
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	transition: background var(--duration) ease-out, border-color var(--duration) ease-out, box-shadow var(--duration) ease-out;
}
.button:hover { border-color: var(--color-primary); box-shadow: 0 2px 0 var(--color-line); }
.button:active { box-shadow: none; background: var(--color-plain-soft); }
.button-main { background: linear-gradient(180deg, #2a6fd0, var(--brand-blue)); border-color: var(--brand-blue-deep); color: var(--color-on-primary); box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%); }
.button-main:hover { background: linear-gradient(180deg, var(--brand-blue), var(--brand-blue-deep)); border-color: var(--brand-blue-deep); box-shadow: 0 2px 0 rgb(18 63 122 / 35%); }
.button-main:active { background: var(--brand-blue-deep); box-shadow: none; }
.button-danger { background: var(--color-bad); border-color: var(--color-bad); color: #ffffff; }
.button-danger:hover { background: #8c1414; border-color: #8c1414; }
.button-quiet { background: transparent; border-color: transparent; }
.button-ghost { background: rgb(255 255 255 / 6%); border-color: var(--banner-line); color: var(--banner-text); }
.button-ghost:hover { background: rgb(127 178 255 / 20%); border-color: var(--brand-aura); box-shadow: none; }
.button-ghost:active { background: rgb(127 178 255 / 30%); }

label { font-weight: 600; font-size: 0.9375rem; }
.req { color: var(--color-bad); }
input:not([type="hidden"]) {
	width: 100%;
	min-height: var(--control-height);
	padding: 0 var(--space-3);
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-small);
	background: var(--color-surface);
	color: var(--color-ink);
	font: inherit;
}
input.num { font-family: var(--font-code); letter-spacing: 0.04em; }
input[type="checkbox"]:not([type="hidden"]) { width: 22px; min-height: 22px; height: 22px; flex: none; padding: 0; margin: 0; accent-color: var(--brand-blue); cursor: pointer; }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-height); font-weight: 400; cursor: pointer; }
.group { border: 1px solid var(--color-line); border-radius: var(--radius-small); padding: var(--space-4); margin: 0; display: grid; gap: var(--space-3); min-width: 0; }
.group legend { padding: 0 var(--space-2); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-primary-deep); font-weight: 700; }
input:hover, select:hover, textarea:hover { border-color: var(--color-primary); }
select, textarea {
	width: 100%;
	min-height: var(--control-height);
	padding: 0 var(--space-3);
	border: 1px solid var(--color-line-strong);
	border-radius: var(--radius-small);
	background: var(--color-surface);
	color: var(--color-ink);
	font: inherit;
}
textarea { padding: var(--space-2) var(--space-3); resize: vertical; line-height: 1.5; }
input:disabled { background: var(--color-plain-soft); color: var(--color-ink-soft); }
.row select { flex: 1 1 180px; width: auto; }
.secret { font-family: var(--font-code); font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; overflow-wrap: anywhere; user-select: all; }
.stack { display: grid; gap: var(--space-2); }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row input { flex: 1 1 180px; width: auto; }
.field { display: grid; gap: var(--space-1); align-content: start; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.hint { color: var(--color-ink-soft); font-size: 0.875rem; }
.hint-warn { color: var(--color-warn); background: var(--color-warn-soft); padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); }

/* ---- surfaces ---- */
.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-large); box-shadow: var(--shadow-card); padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; }
.card-form { max-width: 720px; gap: var(--space-4); border-top: 3px solid var(--brand-blue); }
.card-danger { border-color: #efc4c4; border-top: 3px solid var(--color-bad); }
.card-danger h2 { color: var(--color-bad); }
.card.empty { justify-items: start; padding: var(--space-6); }
.card.empty h2 { font-size: 1.25rem; text-transform: none; letter-spacing: 0; color: var(--color-ink); margin: 0; }
.columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: var(--space-5); align-items: start; }
.stack-cards { display: grid; gap: var(--space-4); }
/* a guide card: lists and a table between its paragraphs */
.card ul, .card ol { padding-left: var(--space-5); display: grid; gap: var(--space-1); }
.card h3 { font-size: 1rem; margin-top: var(--space-2); }
.card .table-wrap { overflow-x: auto; box-shadow: none; }

.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-small); font-weight: 600; border-left: 4px solid; }
.notice-good { background: var(--color-good-soft); color: var(--color-good); }
.notice-bad { background: var(--color-bad-soft); color: var(--color-bad); }

/* ---- the four numbers above the table: the first one is a piece of the banner ---- */
.tiles { list-style: none; padding: 0; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--space-3); }
.tile { background: var(--color-surface); border: 1px solid var(--color-line); border-left: 6px solid var(--color-line-strong); border-radius: var(--radius-small); padding: var(--space-3) var(--space-4); display: flex; align-items: baseline; gap: var(--space-3); }
.tile-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.tile-label { color: var(--color-ink-soft); font-size: 0.875rem; }
.tile-lead {
	position: relative;
	overflow: hidden;
	background: linear-gradient(180deg, var(--banner-top), var(--banner-bottom));
	border: 1px solid var(--banner-line);
	box-shadow: var(--shadow-banner);
	color: var(--banner-text);
	padding-bottom: var(--space-4);
}
.tile-lead::before { content: ""; position: absolute; left: -60px; top: -70px; width: 220px; height: 220px; background: radial-gradient(closest-side, rgb(127 178 255 / 30%), rgb(127 178 255 / 0%)); }
.tile-lead::after { content: ""; position: absolute; left: var(--space-4); right: var(--space-4); bottom: 8px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--brand-blue-light) 0 62%, rgb(255 255 255 / 18%) 62%); }
.tile-lead .tile-value { position: relative; font-size: 2.75rem; color: var(--brand-gold); }
.tile-lead .tile-label { position: relative; color: var(--banner-text-soft); }
.tile-good { border-left-color: var(--color-good); }
.tile-warn { border-left-color: var(--brand-gold-deep); background: var(--color-warn-soft); }
.tile-bad { border-left-color: var(--color-bad); background: var(--color-bad-soft); }

/* ---- states ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-good { background: var(--color-good-soft); color: var(--color-good); }
.badge-bad { background: var(--color-bad-soft); color: var(--color-bad); }
.badge-bad::before { border-radius: 1px; }
.mark { font-weight: 600; font-size: 0.9375rem; }
.mark-good { color: var(--color-good); }
.mark-warn { color: var(--color-warn); }
.mark-bad { color: var(--color-bad); }
.mark-plain { color: var(--color-ink-soft); font-weight: 400; }
.sub { display: block; color: var(--color-ink-soft); font-size: 0.8125rem; }
.sub-inline { color: var(--color-ink-soft); font-size: 0.875rem; }
.sub-warn { color: var(--color-warn); font-weight: 600; }

/* ---- chart (central log: findings per day) ---- */
.chart { width: 100%; height: auto; max-height: 220px; display: block; }
.chart-line { stroke: var(--color-line-strong); stroke-width: 1; }
.chart-bar { fill: var(--brand-blue-light); }
.chart-bar-blocked { fill: var(--color-bad); }
.chart-day { fill: var(--color-ink-soft); font-size: 11px; font-family: var(--font-code); }
.key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-left: var(--space-2); }
.key:first-child { margin-left: 0; }
.key-all { background: var(--brand-blue-light); }
.key-blocked { background: var(--color-bad); }

/* ---- table ---- */
.table-wrap { background: var(--color-surface); border: 1px solid var(--color-line); border-top: 3px solid var(--brand-blue); border-radius: var(--radius-large); box-shadow: var(--shadow-card); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-primary-deep); background: #f3f6fc; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); }
td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--duration) ease-out; }
tbody tr:hover { background: #f2f6fd; }
td .id, td .num:not(.sub) { white-space: nowrap; }
td .id { font-weight: 700; text-decoration: none; }
td .id:hover { text-decoration: underline; }
.cell-action { text-align: right; vertical-align: middle; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-2); }
.facts dt { color: var(--color-ink-soft); font-size: 0.875rem; padding-top: 2px; }
.facts dd { overflow-wrap: anywhere; }

/* ---- sign in: the start banner of the game, with the form under it ---- */
.gate-page main { max-width: 560px; padding-top: 12vh; }
.gate { display: grid; filter: drop-shadow(0 18px 30px rgb(10 26 58 / 28%)); }
.gate-banner {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--space-4);
	min-height: 136px;
	margin-left: 72px;
	padding: var(--space-4) var(--space-5) var(--space-4) 112px;
	background: linear-gradient(180deg, var(--banner-top), var(--banner-bottom));
	border: 1px solid var(--banner-line);
	border-radius: 0 var(--radius-large) 0 0;
	color: var(--banner-text);
}
.gate-banner::before { content: ""; position: absolute; left: -140px; top: 50%; width: 300px; height: 300px; margin-top: -150px; background: radial-gradient(closest-side, rgb(127 178 255 / 42%), rgb(127 178 255 / 0%)); pointer-events: none; }
.gate-crest { position: absolute; left: -88px; top: 50%; width: 176px; height: 176px; margin-top: -88px; filter: drop-shadow(0 8px 14px rgb(4 12 30 / 50%)); }
.gate-words { position: relative; display: grid; flex: 1; }
.gate-name { font-size: 1.875rem; font-weight: 700; line-height: 1.15; }
.gate-part { color: var(--banner-text-soft); }
.gate-line { position: relative; height: 3px; margin-top: var(--space-4); border-radius: 2px; background: linear-gradient(90deg, var(--brand-blue-light) 0 62%, rgb(255 255 255 / 18%) 62%); }
.gate-line::after { content: ""; position: absolute; left: 62%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--brand-gold); }
.gate-form { margin-left: 72px; background: var(--color-surface); border: 1px solid var(--color-line); border-top: 0; border-radius: 0 0 var(--radius-large) var(--radius-large); padding: var(--space-5); display: grid; gap: var(--space-3); }
.gate-form h1 { font-size: 1.25rem; }
.gate-form .button { width: 100%; margin-top: var(--space-2); }

@media (max-width: 900px) {
	.columns { grid-template-columns: 1fr; }
	.tiles { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
	:root { --crest-size: 64px; --bar-height: 60px; }
	.top-inner { flex-wrap: wrap; gap: 0 var(--space-3); }
	.brand-crest { margin-bottom: -6px; }
	.brand::before { width: 130px; height: 130px; left: calc(var(--crest-size) / 2 - 65px); margin-top: -62px; }
	.top nav { order: 3; width: 100%; margin: 0; padding-left: calc(var(--crest-size) + var(--space-3)); overflow-x: auto; scrollbar-width: none; }
	main { padding-top: var(--space-5); }
	.title-row h1 { font-size: 1.5rem; }
	thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
	tr { display: grid; gap: var(--space-2); padding: var(--space-4); border-bottom: 1px solid var(--color-line); }
	td { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: var(--space-3); padding: 0; border: 0; }
	td > * { grid-column: 2; justify-self: start; overflow-wrap: anywhere; }
	td .id, td .num:not(.sub) { white-space: normal; } /* a long Aura ID breaks instead of leaving the card */
	td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 3; color: var(--color-ink-soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 3px; }
	.cell-action { display: block; text-align: left; }
	.cell-action::before { content: none; }
	.cell-action .button { width: 100%; }
	.card { padding: var(--space-4); }
	.facts { grid-template-columns: 1fr; gap: 0 0; }
	.facts dd { margin-bottom: var(--space-3); }
	.gate-page main { padding-top: 56px; }
	.gate-banner { margin-left: 44px; padding-left: 76px; min-height: 112px; }
	.gate-crest { left: -56px; width: 124px; height: 124px; margin-top: -62px; }
	.gate-name { font-size: 1.5rem; }
	.gate-form { margin-left: 44px; }
}

@media (max-width: 420px) {
	.tiles { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
}
