/**
 * Legion Trivia Display — volunteer control panel.
 * Standalone styles; this page does not load the WordPress admin CSS.
 */

:root {
	--cp-navy: #10243a;
	--cp-navy-2: #16324f;
	--cp-gold: #c9a227;
	--cp-gold-soft: #e2c661;
	--cp-paper: #f6f4ee;
	--cp-ink: #1c2229;
	--cp-muted: #5d6874;
	--cp-line: #d8d3c6;
	--cp-ok: #2f7d4f;
	--cp-warn: #a8341f;
	--cp-radius: 8px;
	--cp-shadow: 0 1px 3px rgba(16, 36, 58, 0.1), 0 8px 24px rgba(16, 36, 58, 0.07);
}

* { box-sizing: border-box; }

body.ltd-cp {
	margin: 0;
	background: var(--cp-paper);
	color: var(--cp-ink);
	font: 15px/1.5 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.cp-star {
	display: inline-block;
	width: 26px;
	height: 26px;
	flex: 0 0 auto;
	background: var(--cp-gold);
	clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* --------------------------------------------------------------- Top bar */

.cp-topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 20px;
	background: var(--cp-navy);
	color: #f3efe3;
	border-bottom: 3px solid var(--cp-gold);
}

.cp-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.cp-brand strong { display: block; font-size: 16px; letter-spacing: 0.02em; }
.cp-brand small { display: block; font-size: 12px; opacity: 0.72; }

.cp-topbar-actions { display: flex; align-items: center; gap: 10px; }

.cp-save-state { font-size: 13px; opacity: 0.85; min-width: 110px; text-align: right; }
.cp-save-state.is-dirty { color: var(--cp-gold-soft); }
.cp-save-state.is-ok { color: #8fd6a8; }
.cp-save-state.is-error { color: #ff9d8a; }

/* --------------------------------------------------------------- Buttons */

.cp-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: #e9e5d9;
	color: var(--cp-ink);
	font: inherit;
	font-size: 14px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}

.cp-btn:hover { background: #ded9c9; }
.cp-btn:active { transform: translateY(1px); }

.cp-btn-primary { background: var(--cp-gold); color: var(--cp-navy); font-weight: 700; }
.cp-btn-primary:hover { background: var(--cp-gold-soft); }

.cp-btn-ghost {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.4);
	color: #f3efe3;
}
.cp-btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.cp-btn-danger { background: #f6dcd6; color: var(--cp-warn); }
.cp-btn-danger:hover { background: #efc9c1; }

.cp-btn-tiny { padding: 4px 9px; font-size: 12px; }
.cp-btn-wide { width: 100%; justify-content: center; padding: 11px; }

/* ------------------------------------------------------------------ Body */

.cp-body { display: flex; align-items: flex-start; gap: 0; }

.cp-tabs {
	position: sticky;
	top: 61px;
	flex: 0 0 232px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 16px 10px;
	max-height: calc(100vh - 61px);
	overflow-y: auto;
	background: #efece2;
	border-right: 1px solid var(--cp-line);
}

.cp-tab {
	padding: 9px 12px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--cp-ink);
	font: inherit;
	font-size: 14px;
	text-align: left;
	cursor: pointer;
}

.cp-tab:hover { background: #e4e0d2; }

.cp-tab.is-active {
	background: var(--cp-navy);
	color: #f7f3e6;
	font-weight: 600;
}

.cp-tab-sep {
	margin: 10px 6px 4px;
	padding-top: 10px;
	border-top: 1px solid var(--cp-line);
	color: var(--cp-muted);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.cp-content {
	flex: 1 1 auto;
	display: flex;
	align-items: flex-start;
	gap: 20px;
	padding: 22px;
	min-width: 0;
}

.cp-panels { flex: 1 1 auto; min-width: 0; }

.cp-loading { color: var(--cp-muted); }

.cp-panel { display: none; }
.cp-panel.is-active { display: block; }

.cp-panel h2 {
	margin: 0 0 4px;
	font-size: 21px;
	letter-spacing: 0.01em;
}

.cp-panel-intro { margin: 0 0 18px; color: var(--cp-muted); font-size: 14px; max-width: 62ch; }

/* ----------------------------------------------------------------- Fields */

.cp-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 14px;
}

.cp-field {
	padding: 13px 15px;
	background: #fff;
	border: 1px solid var(--cp-line);
	border-radius: var(--cp-radius);
	box-shadow: var(--cp-shadow);
}

.cp-field label.cp-label {
	display: block;
	margin-bottom: 7px;
	font-weight: 600;
	font-size: 14px;
}

.cp-help { margin: 7px 0 0; color: var(--cp-muted); font-size: 12.5px; line-height: 1.42; }

.cp-field input[type='text'],
.cp-field input[type='url'],
.cp-field input[type='number'],
.cp-field select,
.cp-field textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #c9c3b4;
	border-radius: 5px;
	background: #fdfcf9;
	color: var(--cp-ink);
	font: inherit;
	font-size: 14px;
}

.cp-field textarea { min-height: 74px; resize: vertical; }

.cp-field input:focus,
.cp-field select:focus,
.cp-field textarea:focus {
	outline: 2px solid var(--cp-gold);
	outline-offset: 1px;
	border-color: var(--cp-gold);
}

.cp-range-row { display: flex; align-items: center; gap: 10px; }
.cp-range-row input[type='range'] { flex: 1 1 auto; accent-color: var(--cp-gold); }
.cp-range-value {
	flex: 0 0 auto;
	min-width: 74px;
	padding: 4px 8px;
	background: #f0ece0;
	border-radius: 5px;
	font-variant-numeric: tabular-nums;
	font-size: 13px;
	text-align: right;
}

.cp-color-row { display: flex; align-items: center; gap: 10px; }
.cp-color-row input[type='color'] {
	flex: 0 0 auto;
	width: 46px;
	height: 34px;
	padding: 2px;
	border: 1px solid #c9c3b4;
	border-radius: 5px;
	background: #fff;
	cursor: pointer;
}
.cp-color-row input[type='text'] { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.cp-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.cp-switch input { width: 18px; height: 18px; accent-color: var(--cp-gold); }

.cp-checklist {
	display: grid;
	grid-template-columns: 1fr;
	gap: 5px;
	max-height: 230px;
	overflow-y: auto;
	padding: 8px;
	border: 1px solid #ddd8c9;
	border-radius: 5px;
	background: #fdfcf9;
}
.cp-checklist label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cp-checklist input { accent-color: var(--cp-gold); }

/* ---------------------------------------------------------------- Preview */

.cp-preview-col {
	position: sticky;
	top: 83px;
	flex: 0 0 330px;
}

.cp-preview-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.cp-preview-frame {
	position: relative;
	width: 330px;
	height: 186px;
	overflow: hidden;
	border: 1px solid var(--cp-line);
	border-radius: var(--cp-radius);
	background: #000;
	box-shadow: var(--cp-shadow);
}

.cp-preview-frame iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 1280px;
	height: 720px;
	border: 0;
	transform: scale(0.2578);
	transform-origin: top left;
}

.cp-preview-note { margin: 8px 0 0; color: var(--cp-muted); font-size: 12px; }

/* -------------------------------------------------------------- Questions */

.cp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
}

.cp-toolbar input[type='search'],
.cp-toolbar select {
	padding: 7px 10px;
	border: 1px solid #c9c3b4;
	border-radius: 5px;
	background: #fff;
	font: inherit;
	font-size: 14px;
}

.cp-toolbar input[type='search'] { min-width: 240px; }

.cp-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid var(--cp-line);
	border-radius: var(--cp-radius);
	overflow: hidden;
	box-shadow: var(--cp-shadow);
}

.cp-table th,
.cp-table td {
	padding: 9px 11px;
	border-bottom: 1px solid #ece8dc;
	text-align: left;
	font-size: 13.5px;
	vertical-align: top;
}

.cp-table th {
	background: #f2efe4;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cp-muted);
}

.cp-table tr:last-child td { border-bottom: 0; }
.cp-table tr.is-off td { opacity: 0.5; }

.cp-pill {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 700;
}
.cp-pill-easy { background: #dde9f4; color: #1c4a72; }
.cp-pill-medium { background: #f6e6cf; color: #7a4b12; }
.cp-pill-hard { background: #f5dad8; color: #8a2318; }
.cp-pill-local { background: #dff0e3; color: #1e5c33; }

.cp-pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	font-size: 13.5px;
	color: var(--cp-muted);
}

.cp-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}
.cp-stat {
	padding: 9px 13px;
	background: #fff;
	border: 1px solid var(--cp-line);
	border-radius: var(--cp-radius);
	font-size: 13px;
}
.cp-stat strong { display: block; font-size: 20px; }

/* ------------------------------------------------------------------ Modal */

.cp-modal-back {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(16, 36, 58, 0.55);
}

.cp-modal {
	width: min(720px, 100%);
	max-height: 88vh;
	overflow-y: auto;
	padding: 22px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.cp-modal h3 { margin: 0 0 14px; font-size: 19px; }
.cp-modal .cp-field { box-shadow: none; margin-bottom: 10px; }
.cp-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ------------------------------------------------------------------ Skins */

.cp-skins { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }

.cp-skin {
	padding: 14px;
	background: #fff;
	border: 2px solid var(--cp-line);
	border-radius: var(--cp-radius);
	box-shadow: var(--cp-shadow);
}
.cp-skin.is-active { border-color: var(--cp-gold); }
.cp-skin h4 { margin: 0 0 8px; font-size: 16px; }
.cp-swatches { display: flex; gap: 5px; margin-bottom: 12px; }
.cp-swatch { width: 26px; height: 26px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.15); }
.cp-skin-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ Login */

.cp-login-page {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: linear-gradient(160deg, #16324f, #08131f);
}

.cp-login {
	width: min(400px, 92vw);
	padding: 32px 28px;
	background: var(--cp-paper);
	border-radius: 12px;
	border-top: 5px solid var(--cp-gold);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
	text-align: center;
}

.cp-login h1 { margin: 12px 0 6px; font-size: 21px; }
.cp-login-help { margin: 0 0 18px; color: var(--cp-muted); font-size: 14px; }
.cp-login-error { margin: 0 0 14px; color: var(--cp-warn); font-size: 14px; font-weight: 600; }
.cp-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* The real field stays present for hardware keypads and password managers,
   but the dots above are what people actually watch. */
.cp-pin-input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	pointer-events: none;
}

.cp-pin-dots {
	display: flex;
	justify-content: center;
	gap: 16px;
	margin: 6px 0 22px;
}

.cp-pin-dots span {
	width: 18px;
	height: 18px;
	border: 2px solid #b9b2a0;
	border-radius: 50%;
	background: transparent;
	transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.cp-pin-dots span.is-filled {
	background: var(--cp-navy);
	border-color: var(--cp-navy);
	transform: scale(1.12);
}

.cp-pin-dots.is-working span {
	border-color: var(--cp-gold);
	background: var(--cp-gold);
}

.cp-pinpad {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.cp-pin-key {
	padding: 16px 0;
	border: 1px solid #cdc7b7;
	border-radius: 10px;
	background: #fff;
	color: var(--cp-ink);
	font: inherit;
	font-size: 22px;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
	transition: background 120ms ease, transform 60ms ease;
}

.cp-pin-key:hover { background: #f0ece0; }
.cp-pin-key:active { transform: scale(0.96); background: #e4dfcd; }
.cp-pin-key:focus-visible { outline: 3px solid var(--cp-gold); outline-offset: 2px; }

.cp-pin-alt {
	font-size: 14px;
	color: var(--cp-muted);
}

.cp-login input[type='password'] {
	width: 100%;
	padding: 11px 12px;
	margin-bottom: 12px;
	border: 1px solid #c9c3b4;
	border-radius: 6px;
	font: inherit;
	font-size: 15px;
	text-align: center;
}

/* A PIN badge for the WordPress setup screen. */
.ltd-pin-display {
	display: inline-block;
	padding: 8px 18px;
	background: #10243a;
	color: #f0d264;
	border-radius: 8px;
	font-family: ui-monospace, Consolas, monospace;
	font-size: 30px;
	font-weight: 700;
	letter-spacing: 0.32em;
	text-indent: 0.32em;
}

/* ----------------------------------------------------------------- Notices */

.cp-notice {
	padding: 11px 14px;
	margin-bottom: 14px;
	border-radius: 6px;
	border-left: 4px solid var(--cp-gold);
	background: #fdf6e0;
	font-size: 14px;
}
.cp-notice-ok { border-left-color: var(--cp-ok); background: #e6f4ea; }
.cp-notice-err { border-left-color: var(--cp-warn); background: #fbe9e6; }

.cp-inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.cp-inline-form input[type='text'] {
	padding: 8px 10px;
	border: 1px solid #c9c3b4;
	border-radius: 5px;
	font: inherit;
	min-width: 200px;
}

.cp-code {
	width: 100%;
	min-height: 180px;
	padding: 10px;
	border: 1px solid #c9c3b4;
	border-radius: 5px;
	font-family: ui-monospace, Consolas, monospace;
	font-size: 12.5px;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 1180px) {
	.cp-preview-col { display: none; }
}

@media (max-width: 780px) {
	.cp-body { flex-direction: column; }
	.cp-tabs {
		position: static;
		flex-direction: row;
		flex-wrap: wrap;
		width: 100%;
		max-height: none;
		border-right: 0;
		border-bottom: 1px solid var(--cp-line);
	}
	.cp-content { padding: 14px; }
	.cp-topbar { flex-wrap: wrap; }
}
