/* ── Reset & base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--bg: #0a0e1a;
	--bg2: #111827;
	--bg3: #1a2035;
	--border: #1e2d4a;
	--text: #e2e8f0;
	--text-muted: #6b7fa3;
	--green: #22c55e;
	--green-dim: #15803d;
	--red: #ef4444;
	--red-dim: #991b1b;
	--yellow: #f59e0b;
	--blue: #3b82f6;
	--blue-dim: #1e40af;
	--purple: #8b5cf6;
	--font-sans: system-ui, sans-serif;
	--font-mono: "Consolas", "Courier New", monospace;
	--radius: 8px;
	--shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ── Light mode overrides ──────────────────────────────────────────────────── */
[data-theme="light"] {
	--bg: #f1f5f9;
	--bg2: #ffffff;
	--bg3: #e8edf4;
	--border: #cbd5e1;
	--text: #1e293b;
	--text-muted: #64748b;
	--shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

html {
	height: 100%;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.5;
	transition:
		background 0.2s,
		color 0.2s;
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

.page-main {
	flex: 1;
}

body.chat-page .page-main {
	display: contents;
}

a {
	color: var(--blue);
	text-decoration: none;
}

code {
	font-family: var(--font-mono);
	font-size: 12px;
	background: var(--bg3);
	padding: 1px 5px;
	border-radius: 4px;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background: radial-gradient(ellipse at center, #111827 0%, #0a0e1a 100%);
}

.login-wrap {
	width: 100%;
	max-width: 380px;
	padding: 16px;
}

.login-logo {
	text-align: center;
	margin-bottom: 24px;
}

.login-logo h1 {
	font-size: 28px;
	font-weight: 900;
	letter-spacing: 3px;
	color: var(--text);
}

.logo-sub {
	display: block;
	font-size: 11px;
	letter-spacing: 6px;
	color: var(--text-muted);
	font-weight: 400;
	margin-top: -4px;
}

.logo-sword {
	font-size: 36px;
	display: block;
	margin-bottom: 8px;
}

.login-logo-img {
	width: 80px;
	height: 80px;
	object-fit: contain;
	display: block;
	margin: 0 auto 12px;
	border-radius: 12px;
}

.login-card {
	max-width: 380px;
}

.login-card h2 {
	margin-bottom: 20px;
	font-size: 16px;
	color: var(--text-muted);
	text-align: center;
	font-weight: 400;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.login-hint {
	text-align: center;
	margin-top: 16px;
	color: var(--text-muted);
	font-size: 12px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
}

.card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.card-header h2 {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .6px;
	text-transform: uppercase;
	color: var(--text);
}

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

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field {
	margin-bottom: 16px;
}

.field label {
	display: block;
	font-size: 12px;
	color: var(--text-muted);
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
	width: 100%;
	padding: 10px 12px;
	background: var(--bg3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	min-height: 42px;
	box-sizing: border-box;
}

input:focus {
	border-color: var(--blue);
}

textarea {
	width: 100%;
	padding: 10px 12px;
	background: var(--bg3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	resize: vertical;
	min-height: 90px;
	line-height: 1.5;
	font-family: inherit;
	box-sizing: border-box;
}

textarea:focus {
	border-color: var(--blue);
}

select {
	width: 100%;
	padding: 9px 12px;
	background: var(--bg3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	min-height: 42px;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

select:focus {
	border-color: var(--blue);
}

/* Named class aliases — used by admin form pages */
.form-label {
	display: block;
	font-size: 0.82em;
	font-weight: 500;
	color: var(--text-muted);
	margin-bottom: 5px;
	letter-spacing: 0.01em;
}

.form-control {
	width: 100%;
	padding: 9px 12px;
	background: var(--bg3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	min-height: 42px;
	box-sizing: border-box;
	font-family: inherit;
	appearance: none;
}

.form-control:focus {
	border-color: var(--blue);
}

textarea.form-control {
	min-height: 100px;
	resize: vertical;
}

select.form-control {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

/* ── Admin content layouts ────────────────────────────────────────────────── */
.main-content {
	padding: 24px;
	max-width: 1400px;
	margin: 0 auto;
}

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	flex-wrap: wrap;
	gap: 10px;
}

.page-header h1 {
	font-size: 1.1em;
	font-weight: 700;
	margin: 0;
	letter-spacing: 0.5px;
}

.two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	align-items: start;
}

@media (max-width: 900px) {
	.main-content {
		padding: 16px;
	}
	.two-col {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.main-content {
		padding: 12px;
	}
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 18px;
	border-radius: var(--radius);
	border: none;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.3px;
	transition:
		opacity 0.15s,
		transform 0.1s;
	user-select: none;
}

.btn:active {
	transform: scale(0.97);
}

.btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.btn-primary {
	background: var(--blue);
	color: #fff;
}

.btn-success {
	background: var(--green);
	color: #fff;
}

.btn-danger {
	background: var(--red);
	color: #fff;
}

.btn-warning {
	background: var(--yellow);
	color: #000;
}

.btn-ghost {
	background: transparent;
	color: var(--text-muted);
	border: 1px solid var(--border);
}

.btn-ghost:hover {
	color: var(--text);
	border-color: var(--text-muted);
}

.btn-ghost.active,
.btn-ghost.nav-active {
	color: var(--text);
	border-color: var(--text-muted);
	background: var(--surface2);
}

.btn-sm {
	padding: 5px 12px;
	font-size: 12px;
}

.btn-full {
	width: 100%;
}

.log-filters {
	display: flex;
	gap: 4px;
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
	padding: 10px 14px;
	border-radius: var(--radius);
	margin-bottom: 16px;
	font-size: 13px;
}

.alert-error {
	background: rgba(239, 68, 68, 0.15);
	border: 1px solid var(--red);
	color: var(--red);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
	position: fixed;
	left: 0;
	top: 0;
	width: 220px;
	height: 100vh;
	background: var(--bg2);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	z-index: 200;
	overflow-y: auto;
	overflow-x: hidden;
}

.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 16px 14px;
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.sidebar-logo {
	width: 28px;
	height: 28px;
	object-fit: contain;
	border-radius: 6px;
	flex-shrink: 0;
}

.sidebar-brand .brand-name {
	font-size: 14px;
	font-weight: 900;
	letter-spacing: 2px;
	line-height: 1.2;
}

.sidebar-brand .brand-sub {
	font-size: 9px;
	font-weight: 400;
	color: var(--text-muted);
	letter-spacing: 3px;
}

.sidebar-user-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	font-size: 12px;
	color: var(--text-muted);
	border-bottom: 1px solid var(--border);
	flex-shrink: 0;
}

.sidebar-user-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--green);
	flex-shrink: 0;
}

.sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 8px;
	flex: 1;
}

.sidebar-link {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 7px 12px;
	border-radius: 6px;
	font-size: 13px;
	color: var(--text-muted);
	text-decoration: none;
	transition:
		background 0.12s,
		color 0.12s,
		box-shadow 0.12s;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sidebar-link:hover {
	background: var(--bg3);
	color: var(--text);
}

.sidebar-link.active {
	background: rgba(59, 130, 246, 0.10);
	color: var(--blue);
	font-weight: 600;
	box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-footer {
	padding: 8px 8px 12px;
	border-top: 1px solid var(--border);
	flex-shrink: 0;
}

.sidebar-signout {
	color: var(--text-muted) !important;
}

.sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 195;
}

.sidebar-overlay.active {
	display: block;
}

/* ── Mobile topbar ────────────────────────────────────────────────────────── */
.mobile-topbar {
	display: none;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	height: 50px;
	background: var(--bg2);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 190;
	flex-shrink: 0;
	gap: 12px;
}

.mobile-brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Legacy header classes (kept for any remaining references) */
.brand-name {
	font-size: 16px;
	font-weight: 900;
	letter-spacing: 2px;
}

.brand-sub {
	font-size: 10px;
	font-weight: 400;
	color: var(--text-muted);
	letter-spacing: 3px;
}

/* ── Dashboard grid ───────────────────────────────────────────────────────── */
.dashboard {
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	max-width: 1400px;
	margin: 0 auto;
}

.grid-row {
	display: grid;
	gap: 20px;
}

.grid-2 {
	grid-template-columns: 1fr 1fr;
}

.card-wide {
	width: 100%;
}

/* ── Status card ──────────────────────────────────────────────────────────── */
.indicator {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--text-muted);
	flex-shrink: 0;
}

.indicator.online {
	background: var(--green);
	box-shadow: 0 0 8px var(--green);
	animation: pulse 2s infinite;
}

.indicator.offline {
	background: var(--red);
}

.indicator.starting {
	background: var(--yellow);
	animation: pulse 1s infinite;
}

@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}
}

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

.stat {
	background: var(--bg3);
	border-radius: var(--radius);
	padding: 14px;
	text-align: center;
}

.stat-label {
	font-size: 11px;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 6px;
}

.stat-value {
	font-size: 18px;
	font-weight: 700;
	color: var(--text);
}

/* ── Player list ──────────────────────────────────────────────────────────── */
.player-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-height: 80px;
}

.player-list li {
	padding: 8px 12px;
	background: var(--bg3);
	border-radius: 6px;
	font-size: 13px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.player-list li::before {
	content: "●";
	color: var(--green);
	font-size: 8px;
}

.player-empty {
	color: var(--text-muted);
	justify-content: center;
}

.player-empty::before {
	display: none;
}

/* ── Update card ──────────────────────────────────────────────────────────── */
.update-row {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}

.update-info {
	text-align: center;
	min-width: 120px;
}

.update-label {
	font-size: 11px;
	color: var(--text-muted);
	text-transform: uppercase;
	margin-bottom: 4px;
}

.update-version {
	font-size: 16px;
	font-weight: 700;
	font-family: var(--font-mono);
}

.update-arrow {
	font-size: 24px;
	color: var(--text-muted);
}

.update-actions {
	margin-left: auto;
}

.update-progress {
	margin-top: 16px;
	padding: 12px 14px;
	background: var(--bg3);
	border-radius: var(--radius);
	border-left: 3px solid var(--blue);
	font-family: var(--font-mono);
	font-size: 12px;
	line-height: 1.8;
	max-height: 200px;
	overflow-y: auto;
}

.update-progress .prog-line {
	color: var(--text-muted);
}

.update-progress .prog-line.active {
	color: var(--text);
}

.update-progress .prog-line.done {
	color: var(--green);
}

.update-progress .prog-line.error {
	color: var(--red);
}

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.control-msg {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: var(--radius);
	font-size: 13px;
}

.control-msg.ok {
	background: rgba(34, 197, 94, 0.12);
	border: 1px solid var(--green);
	color: var(--green);
}

.control-msg.error {
	background: rgba(239, 68, 68, 0.12);
	border: 1px solid var(--red);
	color: var(--red);
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.toggle-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	user-select: none;
}

.toggle-text {
	font-size: 11px;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.toggle-switch {
	position: relative;
	width: 36px;
	height: 20px;
}

.toggle-switch input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.toggle-track {
	position: absolute;
	inset: 0;
	border-radius: 20px;
	background: var(--bg3);
	border: 1px solid var(--border);
	transition:
		background 0.2s,
		border-color 0.2s;
}

.toggle-track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--text-muted);
	transition:
		transform 0.2s,
		background 0.2s;
}

.toggle-switch input:checked + .toggle-track {
	background: rgba(34, 197, 94, 0.2);
	border-color: var(--green);
}

.toggle-switch input:checked + .toggle-track::after {
	transform: translateX(16px);
	background: var(--green);
}

.toggle-switch input:disabled + .toggle-track {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ── Management pages ─────────────────────────────────────────────────────── */
.field-row {
	display: flex;
	gap: 8px;
	align-items: center;
}

.field-row input {
	padding: 8px 12px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
}

.field-row input:focus {
	outline: none;
	border-color: var(--blue);
}

/* Announcement / notice rows — shared between admin and public pages */
.note-row {
	padding: 10px 0;
	border-bottom: 1px solid var(--border);
}

.note-row:last-child {
	border-bottom: none;
}

.note-text {
	font-size: 0.88em;
	margin-bottom: 3px;
	white-space: pre-wrap;
}

.note-meta {
	font-size: 0.75em;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

/* ── RCON console ─────────────────────────────────────────────────────────── */
.rcon-output {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	min-height: 120px;
	max-height: 220px;
	overflow-y: auto;
	padding: 10px 12px;
	font-family: var(--font-mono);
	font-size: 12px;
	margin-bottom: 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rcon-line {
	line-height: 1.5;
}

.rcon-line.cmd {
	color: var(--blue);
}

.rcon-line.out {
	color: var(--text);
}

.rcon-line.err {
	color: var(--red);
}

.rcon-input-row {
	display: flex;
	gap: 8px;
	align-items: center;
}

.rcon-prompt {
	color: var(--green);
	font-family: var(--font-mono);
	font-size: 14px;
}

.rcon-input-row input {
	flex: 1;
	font-family: var(--font-mono);
}

/* ── Live log ─────────────────────────────────────────────────────────────── */
.log-output {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	height: 320px;
	overflow-y: auto;
	padding: 10px 12px;
	font-family: var(--font-mono);
	font-size: 12px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.log-line {
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-all;
}

.log-line.warn {
	color: var(--yellow);
}

.log-line.error {
	color: var(--red);
}

.log-line.info {
	color: var(--text);
}

.log-line.dim {
	color: var(--text-muted);
}

.log-status {
	font-size: 11px;
	color: var(--text-muted);
}

.log-status.connected {
	color: var(--green);
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap {
	overflow-x: auto;
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.data-table th {
	padding: 10px 14px;
	text-align: left;
	font-size: 11px;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 1px solid var(--border);
}

.data-table td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
	border-bottom: none;
}

.data-table tr:hover td {
	background: var(--bg3);
}

.table-empty {
	text-align: center;
	color: var(--text-muted);
	padding: 24px !important;
}

.col-nowrap {
	white-space: nowrap;
}

/* ── Status badges ────────────────────────────────────────────────────────── */
.badge {
	display: inline-flex;
	padding: 2px 8px;
	border-radius: 99px;
	font-size: 11px;
	font-weight: 600;
}

.badge-green {
	background: rgba(34, 197, 94, 0.15);
	color: var(--green);
}

.badge-red {
	background: rgba(239, 68, 68, 0.15);
	color: var(--red);
}

.badge-yellow {
	background: rgba(245, 158, 11, 0.15);
	color: var(--yellow);
}

.badge-blue {
	background: rgba(59, 130, 246, 0.15);
	color: var(--blue);
}

.badge-muted {
	background: var(--bg3);
	color: var(--text-muted);
}

/* ── Chat ─────────────────────────────────────────────────────────────────── */
body.chat-page {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	height: var(--app-height, 100dvh);
	overflow: hidden;
}

.chat-layout {
	display: flex;
	flex: 1;
	overflow: hidden;
}

.chat-main {
	display: flex;
	flex-direction: column;
	flex: 1;
	overflow: hidden;
	min-width: 0;
}

.chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.chat-msg {
	display: flex;
	gap: 10px;
	align-items: flex-start;
}

.chat-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	flex-shrink: 0;
	background: var(--bg3);
	border: 1px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
	color: var(--text-muted);
}

.chat-avatar.is-claude {
	background: rgba(139, 92, 246, 0.15);
	border-color: var(--purple);
	color: var(--purple);
}

.chat-bubble {
	flex: 1;
	min-width: 0;
}

.chat-meta {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 3px;
}

.chat-username {
	font-size: 13px;
	font-weight: 700;
	color: var(--text);
}

.chat-username.is-claude {
	color: var(--purple);
}

.chat-time {
	font-size: 11px;
	color: var(--text-muted);
}

.chat-text {
	font-size: 14px;
	color: var(--text);
	line-height: 1.55;
	word-break: break-word;
	white-space: pre-wrap;
}

.msg-claude .chat-text {
	color: #d8b4fe;
}

.chat-mention {
	color: var(--purple);
	font-weight: 600;
}

/* Private messages */
.msg-pm {
	background: rgba(250, 204, 21, 0.06);
	border-left: 3px solid #ca8a04;
	border-radius: 6px;
	padding-left: 6px;
}

.chat-pm-tag {
	font-size: 0.7rem;
	font-weight: 600;
	color: #ca8a04;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-left: 6px;
}

/* /btw aside messages — public but not relayed to game */
.msg-btw {
	background: rgba(139, 92, 246, 0.06);
	border-left: 3px solid var(--purple);
	border-radius: 6px;
	padding-left: 6px;
}

.msg-btw .chat-pm-tag {
	color: var(--purple);
}

.chat-input-bar {
	display: flex;
	gap: 10px;
	padding: 12px 16px;
	background: var(--bg2);
	border-top: 1px solid var(--border);
}

.chat-input-bar input {
	flex: 1;
}

.chat-sidebar {
	width: 190px;
	flex-shrink: 0;
	background: var(--bg2);
	border-left: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	padding: 16px 14px;
	overflow-y: auto;
}

.chat-sidebar-header {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.sidebar-close {
	display: none;
	background: transparent;
	border: none;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 14px;
	padding: 0;
	line-height: 1;
}

.sidebar-close:hover {
	color: var(--text);
}

#sidebar-toggle {
	display: none;
}

.presence-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.presence-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}

.presence-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
	background: var(--green);
	box-shadow: 0 0 6px var(--green);
	animation: pulse 2s infinite;
}

.presence-dot.is-claude {
	background: var(--purple);
	box-shadow: 0 0 6px var(--purple);
}

.presence-name {
	color: var(--text);
}

.presence-name.is-claude {
	color: var(--purple);
	font-weight: 700;
}

.presence-empty {
	font-size: 12px;
	color: var(--text-muted);
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden {
	display: none !important;
}

/* ── Hamburger button ─────────────────────────────────────────────────────── */
.hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 36px;
	height: 36px;
	padding: 6px;
	background: transparent;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	flex-shrink: 0;
}

.hamburger span {
	display: block;
	height: 2px;
	background: var(--text);
	border-radius: 2px;
	transition:
		transform 0.2s,
		opacity 0.2s;
}

.hamburger.open span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
	opacity: 0;
}

.hamburger.open span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.grid-2 {
		grid-template-columns: 1fr;
	}

	.update-row {
		flex-direction: column;
		align-items: flex-start;
	}

	.update-actions {
		margin-left: 0;
	}

	.controls-row {
		gap: 8px;
	}

	.controls-row .btn {
		flex: 1;
	}

	.dashboard {
		padding: 12px;
		gap: 12px;
	}

	/* Sidebar slides in from left on mobile */
	.sidebar {
		transform: translateX(-100%);
		transition: transform 0.25s ease;
	}

	.sidebar.open {
		transform: translateX(0);
	}

	/* Mobile topbar visible */
	.mobile-topbar {
		display: flex;
	}

	.hamburger {
		display: flex;
	}

	/* Chat sidebar — slides in from right on mobile */
	.chat-sidebar {
		position: fixed;
		top: 50px;
		right: 0;
		bottom: 0;
		width: 200px;
		z-index: 210;
		transform: translateX(100%);
		transition: transform 0.25s ease;
		border-left: 1px solid var(--border);
		box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
	}

	.chat-sidebar.sidebar-open {
		transform: translateX(0);
	}

	.sidebar-close {
		display: block;
	}

	#sidebar-toggle {
		display: inline-flex;
	}
}
@media (min-width: 769px) {
	/* Sidebar always visible and static on desktop */
	.sidebar {
		transform: none !important;
	}

	.mobile-topbar {
		display: none !important;
	}

	.hamburger {
		display: none !important;
	}

	/* Chat sidebar always visible on desktop */
	.chat-sidebar {
		transform: none !important;
		position: static !important;
	}

	/* Push content right of sidebar — :has() for modern browsers, .has-sidebar for JS fallback */
	body:has(.sidebar) {
		padding-left: 220px;
	}

	body.has-sidebar {
		padding-left: 220px;
	}
}

/* ── Site notices ──────────────────────────────────────────────────────── */
.site-notice {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 20px;
	border-left: 4px solid var(--danger);
	background: rgba(220, 53, 69, 0.12);
	color: var(--text);
}

.site-notice--error {
	border-color: var(--danger);
	background: rgba(220, 53, 69, 0.12);
}

.site-notice--warn {
	border-color: var(--warning);
	background: rgba(255, 193, 7, 0.1);
}

.site-notice--info {
	border-color: var(--primary);
	background: rgba(13, 110, 253, 0.1);
}

.site-notice-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 0.9rem;
}

.site-notice-content strong {
	font-weight: 600;
}

.site-notice-dismiss {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 1rem;
	line-height: 1;
	padding: 0 4px;
	flex-shrink: 0;
}

.site-notice-dismiss:hover {
	color: var(--text);
}

/* ── Public navigation ─────────────────────────────────────────────────── */
.public-nav {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	padding: 0 28px;
	height: 62px;
	border-bottom: 1px solid var(--border);
	gap: 18px;
	position: sticky;
	top: 0;
	z-index: 200;
	background: var(--bg);
	backdrop-filter: blur(8px);
}
.nav-logo {
	display: flex;
	align-items: center;
	gap: 9px;
	text-decoration: none;
	color: var(--text);
	flex-shrink: 0;
}
.nav-logo span {
	font-weight: 800;
	letter-spacing: 2px;
	font-size: .88em;
}

.nav-player-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 0.78em;
	font-weight: 600;
	background: rgba(34, 197, 94, 0.12);
	color: var(--green);
	border: 1px solid rgba(34, 197, 94, 0.25);
}

.nav-player-badge .dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--green);
}

.nav-player-badge.offline {
	background: rgba(100, 116, 139, 0.1);
	color: var(--text-muted);
	border-color: rgba(100, 116, 139, 0.2);
}

.nav-player-badge.offline .dot {
	background: var(--text-muted);
}

/* ── Public footer ─────────────────────────────────────────────────────────── */
.public-footer {
	text-align: center;
	padding: 28px 20px;
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.78em;
	line-height: 1.8;
}

.public-footer a {
	color: var(--text-muted);
	text-decoration: none;
}

.public-footer a:hover {
	color: var(--text);
}

/* ── Player search autocomplete ─────────────────────────────────────────────── */
.player-ac-wrap {
	position: relative;
	display: inline-block;
}

.player-ac-wrap input {
	width: 100%;
}

.player-ac-list {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 200;
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: 6px;
	margin-top: 2px;
	overflow: hidden;
	box-shadow: var(--shadow);
}

.player-ac-item {
	padding: 8px 12px;
	cursor: pointer;
	font-size: 0.88em;
	display: flex;
	align-items: center;
	gap: 8px;
}
.player-ac-item:hover,
.player-ac-item.ac-active {
	background: var(--bg3);
}

.player-ac-item img {
	width: 20px;
	height: 20px;
	border-radius: 3px;
	flex-shrink: 0;
}

/* ── Public page mobile ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.public-nav {
		padding: 0 14px;
		height: 54px;
		gap: 8px;
	}

	.public-nav .btn-sm {
		padding: 4px 8px;
		font-size: 0.75em;
	}

	.public-nav .nav-player-badge {
		font-size: 0.72em;
	}

	/* Hide lower-priority nav links on very small screens */
	.public-nav .nav-hide-sm {
		display: none !important;
	}

	.public-grid {
		grid-template-columns: 1fr !important;
		padding: 0 12px 40px;
	}

	/* Leaderboard: hide avatar column */
	.lb-row {
		grid-template-columns: 36px 1fr 80px !important;
	}

	.lb-avatar {
		display: none !important;
	}

	/* Player profile stat grid */
	.stat-grid {
		grid-template-columns: 1fr 1fr !important;
	}

	/* Activity chart: fewer visible bars on narrow screens */
	.activity-chart .activity-bar:nth-child(-n + 15) {
		display: none;
	}

	/* Session row 2-col on mobile */
	.sess-row {
		grid-template-columns: 1fr 1fr !important;
	}

	.sess-row > div:last-child {
		display: none;
	}
}

@media (max-width: 480px) {
	.public-nav .btn-sm {
		display: none;
	}

	.public-nav .nav-cta {
		display: inline-flex !important;
	}
}

/* ── Mobile responsiveness overhaul ────────────────────────────────────────── */

/* Admin hamburger — increase touch target to 44px minimum */
.hamburger {
	width: 44px !important;
	height: 44px !important;
}

/* Admin sidebar close button */
.sidebar-close-btn {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 18px;
	padding: 4px;
	line-height: 1;
	margin-left: auto;
	flex-shrink: 0;
}

.sidebar-close-btn:hover {
	color: var(--text);
}

@media (max-width: 768px) {
	.sidebar-close-btn {
		display: block;
	}
}

/* Public nav mobile hamburger button */
.pub-hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 10px;
	background: transparent;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	flex-shrink: 0;
	order: 99;
}

.pub-hamburger span {
	display: block;
	height: 2px;
	background: var(--text);
	border-radius: 2px;
	transition:
		transform 0.2s,
		opacity 0.2s;
}

.pub-hamburger.open span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.pub-hamburger.open span:nth-child(2) {
	opacity: 0;
}

.pub-hamburger.open span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Public nav mobile dropdown */
.pub-nav-menu {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	background: var(--bg2);
	border-bottom: 2px solid var(--border);
	z-index: 500;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
	max-height: 80vh;
	overflow-y: auto;
	flex-direction: column;
}

.pub-nav-menu.open {
	display: flex;
}

.pub-nav-menu a {
	padding: 12px 20px;
	font-size: 0.9em;
	color: var(--text-muted);
	text-decoration: none;
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: center;
	transition: background 0.1s;
}

.pub-nav-menu a:last-child {
	border-bottom: none;
}

.pub-nav-menu a:hover {
	background: var(--bg3);
	color: var(--text);
}

/* Global card / table / button responsive fixes */
@media (max-width: 900px) {
	.status-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 768px) {
	.dashboard {
		padding: 12px;
		gap: 14px;
	}

	.card-header {
		flex-wrap: wrap;
		gap: 8px;
	}

	.field-row {
		flex-wrap: wrap;
	}

	/* Ensure tables scroll rather than overflow */
	.card > .data-table,
	.card > div > .data-table {
		display: block;
		overflow-x: auto;
	}
}

@media (max-width: 640px) {
	.card {
		padding: 14px;
	}

	.data-table th,
	.data-table td {
		padding: 7px 8px;
		font-size: 12px;
	}

	.btn-sm {
		padding: 7px 12px;
		min-height: 36px;
	}

	.status-grid {
		grid-template-columns: 1fr 1fr !important;
	}

	.pub-hamburger {
		display: flex;
	}

	/* Public footer wrap */
	.public-footer {
		text-align: center;
		padding: 18px 14px;
		font-size: 0.78em;
	}

	.public-footer a {
		margin: 0 4px;
	}

	/* Compare page — stack at 640px */
	.compare-grid {
		grid-template-columns: 1fr !important;
	}

	/* Records HoF — 2 columns instead of 3 */
	.hof-grid {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 480px) {
	.card {
		padding: 12px;
	}

	.data-table th,
	.data-table td {
		padding: 6px 6px;
		font-size: 11px;
	}

	.status-grid {
		grid-template-columns: 1fr !important;
	}

	/* Stats heatmap — fewer columns */
	.heatmap-row {
		gap: 2px !important;
	}

	.heatmap-cell {
		width: 12px !important;
		height: 12px !important;
	}

	/* Records HoF — single column */
	.hof-grid {
		grid-template-columns: 1fr !important;
	}
}

/* ── Mobile input/textarea fixes ─────────────────────────────────────────────
   16px font prevents iOS Safari from auto-zooming when an input is focused.
   Chat input bar wraps so the text field isn't squeezed by multiple buttons. */
@media (max-width: 768px) {
	input[type="text"],
	input[type="password"],
	input[type="email"],
	input[type="search"],
	input[type="number"],
	input[type="datetime-local"],
	input[type="date"],
	input[type="time"],
	select,
	textarea {
		font-size: 16px;
	}

	/* Admin chat: input goes full-width on its own row, buttons wrap below */
	.chat-input-bar {
		flex-wrap: wrap;
		gap: 6px;
		padding: 10px 12px;
	}

	.chat-input-bar input {
		flex: 1 1 100%;
		order: -1;
	}

	/* Broadcast / RCON / note inputs that sit in flex rows — allow them to wrap */
	.rcon-input-row,
	.note-input-row {
		flex-wrap: wrap;
	}

	.rcon-input-row input,
	.note-input-row input {
		flex: 1 1 100%;
	}

	/* Ensure textareas have a usable minimum height */
	textarea {
		min-height: 100px;
	}

	/* Wall post textarea — give it a bit more room */
	.wall-input {
		min-height: 80px;
	}
}
