:root {
	--bg: #0b0d17;
	--bg-elev: rgba(255, 255, 255, 0.04);
	--bg-elev-2: rgba(255, 255, 255, 0.06);
	--border: rgba(255, 255, 255, 0.08);
	--border-strong: rgba(255, 255, 255, 0.14);
	--text: #e7e9f3;
	--text-dim: #a2a7bd;
	--text-mute: #6d7391;
	--primary: #7c5cff;
	--primary-2: #4ecdc4;
	--accent: #ff8ac1;
	--danger: #ff6b6b;
	--success: #4ade80;
	--warn: #fbbf24;
	--shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.5);
	--radius: 14px;
	--radius-sm: 10px;
	--mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
	--font:
		-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto,
		Helvetica, Arial, sans-serif;
}

:root[data-theme='light'] {
	--bg: #f4f6fb;
	--bg-elev: rgba(255, 255, 255, 0.72);
	--bg-elev-2: rgba(255, 255, 255, 0.86);
	--border: rgba(15, 23, 42, 0.08);
	--border-strong: rgba(15, 23, 42, 0.14);
	--text: #1a1d2e;
	--text-dim: #545a76;
	--text-mute: #8a90a8;
	--primary: #6b48ff;
	--primary-2: #14b8a6;
	--accent: #ec4899;
	--shadow: 0 20px 45px -25px rgba(60, 72, 120, 0.28);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: var(--font);
	color: var(--text);
	background: var(--bg);
	min-height: 100vh;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.bg-orb {
	position: fixed;
	border-radius: 50%;
	filter: blur(90px);
	opacity: 0.55;
	pointer-events: none;
	z-index: 0;
}
.orb-1 {
	width: 520px;
	height: 520px;
	background: radial-gradient(circle, #7c5cff, transparent 70%);
	top: -160px;
	left: -140px;
}
.orb-2 {
	width: 480px;
	height: 480px;
	background: radial-gradient(circle, #4ecdc4, transparent 70%);
	bottom: -180px;
	right: -140px;
}
.orb-3 {
	width: 380px;
	height: 380px;
	background: radial-gradient(circle, #ff8ac1, transparent 70%);
	top: 40%;
	left: 55%;
	opacity: 0.35;
}

:root[data-theme='light'] .bg-orb {
	opacity: 0.32;
}
:root[data-theme='light'] .orb-1 {
	background: radial-gradient(circle, #a89bff, transparent 70%);
}
:root[data-theme='light'] .orb-2 {
	background: radial-gradient(circle, #7fe0d8, transparent 70%);
}
:root[data-theme='light'] .orb-3 {
	background: radial-gradient(circle, #ffb3d5, transparent 70%);
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 28px;
	backdrop-filter: blur(18px) saturate(140%);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	background: color-mix(in oklab, var(--bg) 70%, transparent);
	border-bottom: 1px solid var(--border);
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
}
.logo {
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--primary), var(--primary-2));
	color: white;
	box-shadow: 0 6px 22px -6px color-mix(in oklab, var(--primary) 60%, transparent);
}
.brand-text h1 {
	margin: 0;
	font-size: 16px;
	letter-spacing: 0.4px;
}
.brand-text span {
	font-size: 12px;
	color: var(--text-mute);
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.search-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid var(--border);
	background: var(--bg-elev);
	border-radius: 10px;
	color: var(--text-dim);
	transition:
		border-color 0.2s,
		background 0.2s;
	min-width: 260px;
}
.search-wrap:focus-within {
	border-color: var(--primary);
	background: var(--bg-elev-2);
}
.search-wrap input {
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--text);
	font: inherit;
	width: 100%;
}

.icon-btn {
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	border: 1px solid var(--border);
	background: var(--bg-elev);
	color: var(--text-dim);
	border-radius: 10px;
	cursor: pointer;
	transition:
		color 0.2s,
		border-color 0.2s,
		background 0.2s;
}
.icon-btn:hover {
	color: var(--text);
	border-color: var(--border-strong);
}
.icon-btn .icon-moon {
	display: none;
}
:root[data-theme='light'] .icon-btn .icon-sun {
	display: none;
}
:root[data-theme='light'] .icon-btn .icon-moon {
	display: block;
}

.layout {
	display: grid;
	grid-template-columns: 240px 1fr;
	gap: 24px;
	padding: 24px 28px 60px;
	position: relative;
	z-index: 1;
	max-width: 1400px;
	margin: 0 auto;
}

.sidebar {
	position: sticky;
	top: 82px;
	align-self: start;
	height: calc(100vh - 100px);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.nav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px;
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	box-shadow: var(--shadow);
	overflow-y: auto;
}
.nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: 9px;
	color: var(--text-dim);
	cursor: pointer;
	font-size: 14px;
	transition:
		color 0.2s,
		background 0.2s;
	user-select: none;
}
.nav-item:hover {
	color: var(--text);
	background: var(--bg-elev-2);
}
.nav-item.active {
	color: var(--text);
	background: color-mix(in oklab, var(--primary) 22%, transparent);
}
.nav-item .dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--primary);
	opacity: 0;
	transition: opacity 0.2s;
}
.nav-item.active .dot {
	opacity: 1;
}
.nav-item.hidden {
	display: none;
}

.sidebar-footer {
	padding: 10px 14px;
	color: var(--text-mute);
	font-size: 11px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.content {
	display: flex;
	flex-direction: column;
	gap: 22px;
	min-width: 0;
}

.tool {
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px 22px;
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	box-shadow: var(--shadow);
	scroll-margin-top: 90px;
	transition: border-color 0.25s;
}
.tool:hover {
	border-color: var(--border-strong);
}
.tool.hidden {
	display: none;
}

.tool-head {
	margin-bottom: 14px;
}
.tool-head h2 {
	margin: 0 0 4px;
	font-size: 18px;
	letter-spacing: 0.2px;
}
.tool-head p {
	margin: 0;
	color: var(--text-mute);
	font-size: 13px;
}

.tool-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.col {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.toolbar .right {
	margin-left: auto;
}

.btn {
	appearance: none;
	border: 1px solid var(--border-strong);
	background: var(--bg-elev-2);
	color: var(--text);
	padding: 7px 14px;
	border-radius: 9px;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	transition:
		transform 0.1s,
		border-color 0.2s,
		background 0.2s,
		color 0.2s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.btn:hover {
	border-color: var(--primary);
}
.btn:active {
	transform: translateY(1px);
}
.btn.primary {
	background: linear-gradient(
		135deg,
		var(--primary),
		color-mix(in oklab, var(--primary) 60%, var(--primary-2))
	);
	border-color: transparent;
	color: white;
	box-shadow: 0 6px 22px -8px color-mix(in oklab, var(--primary) 70%, transparent);
}
.btn.primary:hover {
	filter: brightness(1.08);
}
.btn.ghost {
	background: transparent;
	border-color: var(--border);
	color: var(--text-dim);
}
.btn.ghost:hover {
	color: var(--text);
	border-color: var(--border-strong);
}

.file-btn {
	position: relative;
	overflow: hidden;
}

textarea,
input[type='text'],
input[type='number'],
input[type='datetime-local'],
select {
	width: 100%;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	color: var(--text);
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	font: inherit;
	font-size: 13px;
	outline: none;
	transition:
		border-color 0.2s,
		background 0.2s;
}
input:focus,
textarea:focus,
select:focus {
	border-color: var(--primary);
}
input[type='color'] {
	padding: 3px;
	height: 40px;
	cursor: pointer;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}

textarea {
	min-height: 180px;
	resize: vertical;
	line-height: 1.55;
}
.mono {
	font-family: var(--mono);
}

.status {
	font-size: 12px;
	color: var(--text-mute);
	padding: 4px 10px;
	border: 1px dashed var(--border-strong);
	border-radius: 999px;
}
.status.ok {
	color: var(--success);
	border-color: color-mix(in oklab, var(--success) 60%, transparent);
	border-style: solid;
}
.status.err {
	color: var(--danger);
	border-color: color-mix(in oklab, var(--danger) 60%, transparent);
	border-style: solid;
}
.status.inline {
	padding: 2px 8px;
}

.inline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-dim);
	font-size: 13px;
}
.inline input[type='number'],
.inline select {
	width: auto;
	min-width: 72px;
	padding: 6px 8px;
}
.inline.block {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
	color: var(--text-dim);
	font-size: 12px;
}

.grid-2 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 12px;
}
.card {
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}
.card-title {
	font-size: 12px;
	color: var(--text-mute);
	letter-spacing: 0.5px;
	text-transform: uppercase;
}
.big {
	font-family: var(--mono);
	font-size: 22px;
	letter-spacing: 0.5px;
}
.sub {
	font-family: var(--mono);
	font-size: 13px;
	color: var(--text-dim);
	word-break: break-all;
}
.row {
	display: flex;
	gap: 8px;
}
.row input {
	flex: 1;
}

.hash-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.hash-row {
	display: grid;
	grid-template-columns: 84px 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.hash-row .name {
	color: var(--text-dim);
	font-size: 12px;
	letter-spacing: 0.5px;
}
.hash-row .val {
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--text);
	word-break: break-all;
}

.qr-preview {
	display: grid;
	place-items: center;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	min-height: 320px;
	padding: 14px;
}
#qrCanvas {
	max-width: 100%;
	height: auto;
	background: white;
	border-radius: 8px;
}

.color-body {
	display: grid;
	grid-template-columns: 1fr 1.4fr;
	gap: 16px;
	align-items: stretch;
}
.color-preview {
	min-height: 220px;
	border-radius: var(--radius-sm);
	background: #7c5cff;
	border: 1px solid var(--border);
	box-shadow: 0 20px 40px -20px color-mix(in oklab, #7c5cff 60%, transparent);
	transition:
		background 0.2s,
		box-shadow 0.2s;
}
.color-inputs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.regex-row {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 4px 12px;
}
.regex-row .slash {
	color: var(--text-mute);
	font-family: var(--mono);
}
.regex-row input {
	border: 0;
	background: transparent;
	padding: 8px 0;
}
.regex-row .flags {
	max-width: 80px;
}

.regex-out {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.highlight {
	white-space: pre-wrap;
	word-break: break-all;
	padding: 12px 14px;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	min-height: 120px;
	font-size: 13px;
	line-height: 1.6;
}
.highlight mark {
	background: color-mix(in oklab, var(--primary) 35%, transparent);
	color: var(--text);
	padding: 1px 3px;
	border-radius: 4px;
}

.diff-view {
	padding: 12px 14px;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	font-size: 13px;
	line-height: 1.55;
	min-height: 160px;
	overflow: auto;
	max-height: 480px;
}
.diff-line {
	display: block;
	padding: 1px 8px;
	border-radius: 4px;
	white-space: pre-wrap;
	word-break: break-all;
}
.diff-line.add {
	background: color-mix(in oklab, var(--success) 18%, transparent);
	color: color-mix(in oklab, var(--success) 80%, var(--text));
}
.diff-line.del {
	background: color-mix(in oklab, var(--danger) 18%, transparent);
	color: color-mix(in oklab, var(--danger) 80%, var(--text));
	text-decoration: line-through;
}
.diff-line.eq {
	color: var(--text-dim);
}

.footer {
	text-align: center;
	color: var(--text-mute);
	font-size: 12px;
	padding: 20px 0;
}

.toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	padding: 10px 18px;
	border-radius: 10px;
	background: color-mix(in oklab, var(--bg) 80%, black);
	border: 1px solid var(--border-strong);
	color: var(--text);
	font-size: 13px;
	box-shadow: var(--shadow);
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 0.2s,
		transform 0.2s;
	z-index: 50;
}
.toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (max-width: 960px) {
	.layout {
		grid-template-columns: 1fr;
		padding: 16px;
	}
	.sidebar {
		position: static;
		height: auto;
	}
	.nav {
		flex-direction: row;
		overflow-x: auto;
	}
	.nav-item {
		white-space: nowrap;
	}
	.sidebar-footer {
		display: none;
	}
	.two-col,
	.color-body,
	.regex-out {
		grid-template-columns: 1fr;
	}
	.search-wrap {
		min-width: 0;
		width: 200px;
	}
	.topbar {
		padding: 12px 16px;
	}
}

@media (max-width: 600px) {
	.brand-text span {
		display: none;
	}
	.search-wrap {
		display: none;
	}
	.hash-row {
		grid-template-columns: 1fr;
	}
}

/* Scrollbar */
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}
::-webkit-scrollbar-thumb {
	background: var(--border-strong);
	border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
	background: color-mix(in oklab, var(--primary) 60%, transparent);
}
::-webkit-scrollbar-track {
	background: transparent;
}
