:root {
	--bg: #121317;
	--panel: #181a1f;
	--panel-2: #1e2026;
	--border: #2b2d34;
	--text: #e9e7e2;
	--muted: #8d8f97;
	--red: #d13b3b;
	--red-dim: #7a2626;
	--green: #3ecf8e;
	--amber: #e0a63c;
	--radius: 4px;
	font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
}

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.error-text { color: var(--red); }

code {
	font-family: "IBM Plex Mono", monospace;
	background: var(--panel-2);
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 0.85em;
}

/* --- public status --- */

.public-view { min-height: 100vh; padding: 24px clamp(18px, 5vw, 72px); }
.public-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.account-controls { display: flex; align-items: center; gap: 10px; }
.public-status { width: min(760px, 100%); margin: clamp(64px, 14vh, 150px) auto 0; }
.public-status h1 { margin: 0; font-size: 2rem; }
.public-status > .muted { margin: 6px 0 24px; }
.public-status .stat-card { min-height: 100px; }

/* --- shell layout --- */

.shell {
	display: flex;
	min-height: 100vh;
}

.sidebar {
	width: 260px;
	flex-shrink: 0;
	background: var(--panel);
	border-right: 1px solid var(--border);
	padding: 20px 16px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

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

.brand-mark {
	width: 34px;
	height: 34px;
	border-radius: var(--radius);
	background: linear-gradient(160deg, var(--red), var(--red-dim));
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 1.1rem;
	flex-shrink: 0;
}

.brand-name { font-weight: 600; line-height: 1.2; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }

.power-card {
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px;
}

.power-card .account-controls { justify-content: space-between; margin-top: 12px; }
.power-card .btn { padding: 5px 9px; font-size: 0.8rem; }

.power-row {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
}

.dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--muted);
	flex-shrink: 0;
}

.dot.running { background: var(--amber); }
.dot.ready { background: var(--green); box-shadow: 0 0 0 3px rgba(62,207,142,0.15); }

#status-user { margin-top: 4px; min-height: 1em; }

.power-buttons {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

.btn {
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 500;
	padding: 8px 14px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--panel-2);
	color: var(--text);
	cursor: pointer;
	flex: 1;
}

.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #b83232; }

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

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.side-nav-item {
	padding: 9px 10px;
	border-radius: var(--radius);
	cursor: pointer;
	color: var(--muted);
	font-size: 0.9rem;
	border-left: 2px solid transparent;
}

.side-nav-item:hover { color: var(--text); }

.side-nav-item.active {
	color: var(--text);
	background: var(--panel-2);
	border-left: 2px solid var(--red);
}

/* --- content --- */

.content {
	flex: 1;
	padding: 28px 36px;
	max-width: 920px;
}

.panel h2 { margin-top: 0; }

.stat-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 18px 0 28px;
}

.stat-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-left: 2px solid var(--red-dim);
	border-radius: var(--radius);
	padding: 14px 16px;
}

.stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-family: "IBM Plex Mono", monospace; font-size: 1.5rem; }

.guild-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.guild-table th {
	text-align: left;
	color: var(--muted);
	font-weight: 500;
	font-size: 0.8rem;
	padding: 8px 10px;
	border-bottom: 1px solid var(--border);
}

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

.guild-table td:nth-child(2), .guild-table td:nth-child(3) {
	font-family: "IBM Plex Mono", monospace;
}

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }

input, textarea, select {
	width: 100%;
	background: var(--panel-2);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: var(--radius);
	padding: 9px 10px;
	font-family: inherit;
	font-size: 0.9rem;
}

textarea { resize: vertical; }

.log-console {
	background: #0c0d10;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px;
	height: 460px;
	overflow-y: auto;
	font-family: "IBM Plex Mono", monospace;
	font-size: 0.83rem;
	line-height: 1.6;
}

.log-line { color: var(--muted); }
.log-time { color: #55575f; margin-right: 8px; }

.feature-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

.feature-item {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 16px;
}

.feature-title { font-weight: 600; margin-bottom: 4px; }
.feature-desc { color: var(--muted); font-size: 0.88rem; }

.xp-toolbar {
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 8px;
}

.xp-toolbar .form-row { width: min(100%, 360px); }
.xp-summary { margin: 0 0 14px; }
.xp-export { flex: initial; width: auto; white-space: nowrap; margin-bottom: 14px; }
.xp-search-row { max-width: 360px; }

.table-wrap { width: 100%; overflow-x: auto; }
.xp-table { min-width: 680px; }
.xp-table td:nth-child(1), .xp-table td:nth-child(3), .xp-table td:nth-child(4) {
	font-family: "IBM Plex Mono", monospace;
}

.xp-member-details {
	display: block;
	color: var(--muted);
	font-size: 0.75rem;
	margin-top: 3px;
}

.xp-progress {
	width: 120px;
	height: 6px;
	margin-bottom: 5px;
	background: var(--panel-2);
	border-radius: 3px;
	overflow: hidden;
}

.xp-progress span {
	display: block;
	height: 100%;
	background: var(--red);
}

.xp-table td small { color: var(--muted); font-size: 0.75rem; }

.xp-award-form {
	display: grid;
	grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) auto;
	align-items: end;
	gap: 12px;
	max-width: 760px;
}

.xp-award-form .form-row { margin: 0; }
.xp-award-form .btn { flex: initial; min-height: 38px; }
#xp-award-result { min-height: 1.2em; }

.poll-form { max-width: 560px; }
.poll-form .btn { flex: initial; }
#poll-result { min-height: 1.2em; }

.announcement-layout {
	display: grid;
	grid-template-columns: minmax(280px, 1fr) minmax(240px, 0.85fr);
	align-items: start;
	gap: 28px;
	max-width: 920px;
}

.announcement-form .btn { flex: initial; }
.announcement-color-row input[type="color"] {
	width: 52px;
	height: 40px;
	padding: 3px;
	cursor: pointer;
}

.announcement-preview-wrap { min-width: 0; }
.announcement-preview {
	margin-top: 8px;
	padding: 16px;
	background: #23252b;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.announcement-preview-accent {
	min-height: 120px;
	padding: 4px 0 4px 14px;
	border-left: 4px solid var(--red);
	white-space: pre-wrap;
	word-break: break-word;
}

.announcement-preview-author { color: #b7bac2; font-size: 0.78rem; margin-bottom: 8px; }
.announcement-preview-accent strong { display: block; font-size: 1rem; }
.announcement-preview-accent p { margin: 8px 0 18px; line-height: 1.5; }
.announcement-preview-footer { color: #8d8f97; font-size: 0.72rem; }
#announcement-result { min-height: 1.2em; }

@media (max-width: 720px) {
	.public-header { align-items: flex-start; flex-direction: column; }
	.public-status { margin-top: 72px; }
	.public-view .stat-grid { grid-template-columns: 1fr; }
	.shell { flex-direction: column; }
	.sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
	.stat-grid { grid-template-columns: repeat(2, 1fr); }
	.content { padding: 20px; }
	.xp-toolbar { align-items: stretch; flex-direction: column; gap: 0; }
	.xp-export { align-self: flex-start; margin-bottom: 14px; }
	.xp-award-form { grid-template-columns: 1fr; gap: 0; }
	.xp-award-form .btn { width: 100%; }
	.poll-form .btn { width: 100%; }
	.announcement-layout { grid-template-columns: 1fr; gap: 20px; }
	.announcement-form .btn { width: 100%; }
}
