:root {
	color-scheme: dark;
	--font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
	--bg: #0a0d14;
	--panel: #11151f;
	--panel-2: #171c2a;
	--border: #232b42;
	--border-soft: #1b2133;
	--text: #e8ebf4;
	--muted: #8b93a7;
	--accent: #5a7cf4;
	--accent-soft: rgba(109, 141, 255, 0.14);
	--green: #77d9a8;
	--amber: #f2b96b;
	--red: #f28b82;
	--gold: #f2c94c;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: var(--font-ui);
	font-size: 14px;
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* ---------- header ---------- */

header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 52px;
	padding: 0 18px;
	background: rgba(10, 13, 20, 0.75);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border-soft);
}

.brand {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: -0.01em;
	display: flex;
	align-items: center;
	gap: 9px;
}

.brand b {
	color: var(--accent);
}

.logo {
	display: inline-grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 7px;
	background: var(--accent);
	color: #fff;
}

.logo .bi {
	font-size: 14px;
}

.privacy .bi {
	font-size: 12px;
	vertical-align: -1px;
	margin-right: 2px;
}

.privacy {
	font-size: 12px;
	color: var(--green);
	background: rgba(119, 217, 168, 0.1);
	border: 1px solid rgba(119, 217, 168, 0.25);
	padding: 4px 10px;
	border-radius: 999px;
	white-space: nowrap;
}

/* ---------- universal polish ---------- */

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-radius: 4px;
}

/* the links textarea is the main typing surface — no focus ring/tint */
textarea:focus,
textarea:focus-visible {
	outline: none;
}

::selection {
	background: rgba(90, 124, 244, 0.35);
}

button .bi {
	font-size: 12.5px;
}

.tab .bi {
	font-size: 13px;
}

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

main {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	gap: 14px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 16px 18px;
	height: calc(100vh - 52px);
}

.pane {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--panel);
	border: 1px solid var(--border-soft);
	border-radius: 14px;
	overflow: hidden;
}

.pane-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--border-soft);
	background: rgba(255, 255, 255, 0.015);
	min-height: 46px;
}

.pane-title {
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.09em;
	color: var(--muted);
}

.pane-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 14px;
	border-top: 1px solid var(--border-soft);
}

.hint {
	font-size: 11.5px;
	color: #6a7288;
}

.stats {
	font-size: 12px;
	display: inline-flex;
	gap: 9px;
	align-items: center;
	min-height: 1em;
	flex-wrap: wrap;
}

.stats .bi {
	font-size: 11px;
	vertical-align: -1px;
}

.stats .ok {
	color: var(--green);
}

.stats .warn {
	color: var(--amber);
}

.stats .default-name {
	color: var(--gold);
	font-weight: 600;
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: inline-block;
	vertical-align: bottom;
}

.hint-dot {
	width: 3px;
	height: 3px;
	border-radius: 999px;
	background: #3d4559;
	display: inline-block;
}

.stats .dim {
	color: #6a7288;
}

/* ---------- input error strip ---------- */

.errstrip {
	margin: 0 14px 10px;
	padding: 7px 11px;
	border: 1px solid rgba(242, 139, 130, 0.35);
	background: rgba(242, 139, 130, 0.08);
	border-radius: 9px;
	font-size: 12px;
	color: #ffb3ad;
	display: flex;
	align-items: baseline;
	gap: 7px;
	word-break: break-all;
}

.errstrip .bi {
	font-size: 12px;
	align-self: center;
	flex-shrink: 0;
}

/* ---------- input ---------- */

textarea {
	flex: 1;
	width: 100%;
	min-height: 0;
	resize: none;
	padding: 14px;
	background: transparent;
	border: 0;
	outline: none;
	color: var(--text);
	font: 13px/1.7 var(--font-mono);
	caret-color: var(--accent);
}

textarea::placeholder {
	color: #566073;
}

/* ---------- tabs & actions ---------- */

.tabs {
	display: flex;
	gap: 2px;
	background: var(--bg);
	padding: 3px;
	border-radius: 9px;
	border: 1px solid var(--border-soft);
}

.tab {
	border: 0;
	background: transparent;
	color: var(--muted);
	font-size: 12.5px;
	padding: 5px 12px;
	border-radius: 7px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

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

.tab.active {
	background: var(--accent-soft);
	color: var(--text);
}

#node-count {
	color: var(--accent);
	font-weight: 600;
}

#node-count:empty {
	display: none;
}

.pane-actions {
	display: flex;
	gap: 7px;
}

/* ---------- buttons ---------- */

button {
	font: inherit;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

button:active {
	transform: translateY(1px);
}

button.primary {
	background: var(--accent);
	color: #fff;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 7px 16px;
	font-weight: 500;
}

button.primary:hover {
	background: #6b8cff;
}

button.ghost {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 6px 14px;
}

button.ghost:hover {
	border-color: var(--accent);
	color: #fff;
	background: var(--accent-soft);
}

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

button:disabled {
	opacity: 0.4;
	cursor: default;
	filter: none;
}

/* ---------- nodes panel ---------- */

.panel {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 12px;
}

.nodes {
	display: grid;
	gap: 8px;
}

.node {
	background: var(--panel-2);
	border: 1px solid var(--border-soft);
	border-radius: 10px;
	padding: 11px 13px;
	transition: border-color 0.15s, background 0.15s;
}

.node:hover {
	border-color: var(--border);
	background: #1a2032;
}

.node.is-default {
	border-color: rgba(242, 201, 76, 0.5);
	background: rgba(242, 201, 76, 0.045);
}

.node.is-default:hover {
	background: rgba(242, 201, 76, 0.07);
}

.node-top {
	display: flex;
	align-items: center;
	gap: 8px;
}

.node-idx {
	font: 500 11px var(--font-mono);
	color: #5a6377;
	flex-shrink: 0;
}

.node-name {
	font-weight: 600;
	font-size: 13.5px;
	letter-spacing: -0.005em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}

.default-chip {
	font-size: 10px;
	color: var(--gold);
	border: 1px solid rgba(242, 201, 76, 0.4);
	border-radius: 999px;
	padding: 2px 8px;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	flex-shrink: 0;
}

.default-chip .bi {
	font-size: 10px;
}

.node-actions {
	display: flex;
	gap: 2px;
	flex-shrink: 0;
}

.copy-node {
	background: transparent;
	border: 0;
	color: #566073;
	font-size: 13.5px;
	padding: 3px 6px;
	border-radius: 6px;
	display: inline-flex;
}

.copy-node:hover {
	color: var(--accent);
	background: var(--accent-soft);
}

.star {
	background: transparent;
	border: 0;
	color: #566073;
	font-size: 15px;
	padding: 2px 6px;
	border-radius: 6px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
}

.star:hover {
	color: var(--gold);
	background: rgba(242, 201, 76, 0.12);
}

.star.on {
	color: var(--gold);
}

.badges {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin: 7px 0 6px;
}

.chip {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 2.5px 8px;
	border-radius: 999px;
	border: 1px solid var(--border);
	color: var(--muted);
	white-space: nowrap;
}

.chip.t-vless {
	color: #9db4ff;
	border-color: rgba(109, 141, 255, 0.45);
	background: rgba(109, 141, 255, 0.08);
}

.chip.t-vmess {
	color: #d0aaff;
	border-color: rgba(170, 120, 255, 0.45);
	background: rgba(170, 120, 255, 0.08);
}

.chip.t-sec {
	color: #8ee6b8;
	border-color: rgba(119, 217, 168, 0.4);
	background: rgba(119, 217, 168, 0.07);
}

.chip.warn {
	color: var(--red);
	border-color: rgba(242, 139, 130, 0.45);
	background: rgba(242, 139, 130, 0.08);
}

.chip.alt {
	color: #9aa3b8;
}

.node-server {
	font: 11.5px/1.6 var(--font-mono);
	color: var(--muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.more-chip {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--muted);
	font-size: 12px;
	padding: 8px;
}

/* ---------- json panel ---------- */

.json {
	margin: 0;
	height: 100%;
	overflow: auto;
	font: 12.5px/1.65 var(--font-mono);
	white-space: pre;
	padding: 14px 16px;
	user-select: text;
}

.j-key {
	color: #82aaff;
}

.j-str {
	color: #c3e88d;
}

.j-num {
	color: #f78c6c;
}

.j-kw {
	color: #c792ea;
}

/* ---------- errors ---------- */

.errlist {
	margin: 0 0 10px;
	padding: 8px 12px;
	border: 1px solid rgba(242, 139, 130, 0.35);
	background: rgba(242, 139, 130, 0.07);
	border-radius: 10px;
	font-size: 12px;
	color: #ffb3ad;
	white-space: pre-wrap;
	word-break: break-all;
}

/* ---------- misc ---------- */

.empty {
	height: 100%;
	display: grid;
	place-content: center;
	text-align: center;
	color: #566073;
	gap: 6px;
}

.chip .bi {
	font-size: 10px;
	vertical-align: -1px;
}

.empty-icon .bi {
	font-size: 36px;
	opacity: 0.6;
}

.toast {
	position: fixed;
	bottom: 26px;
	left: 50%;
	transform: translateX(-50%);
	background: #1c2333;
	border: 1px solid var(--border);
	color: var(--text);
	padding: 9px 18px;
	border-radius: 10px;
	font-size: 13px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
	z-index: 50;
	transition: opacity 0.25s;
	opacity: 0;
	pointer-events: none;
}

.hidden {
	display: none !important;
}

::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

::-webkit-scrollbar-thumb {
	background: #2a3350;
	border-radius: 6px;
	border: 2px solid var(--panel);
}

::-webkit-scrollbar-track {
	background: transparent;
}

/* ---------- responsive ---------- */

@media (max-width: 920px) {
	body {
		overflow: auto;
	}

	main {
		grid-template-columns: 1fr;
		height: auto;
	}

	.pane-head {
		flex-wrap: wrap;
	}

	textarea {
		height: 180px;
	}

	.panel {
		max-height: 60vh;
	}
}