@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@500;600;700&display=swap");

:root {
	--bg: #000000;
	--surface: #0a0a0a;
	--surface-hover: #121220;
	--border: rgba(255, 255, 255, 0.1);
	--border-hover: rgba(180, 150, 220, 0.4);
	--text: #ffffff;
	--text-dim: rgba(255, 255, 255, 0.5);
	--text-faint: rgba(255, 255, 255, 0.35);
	--accent: #b496dc;
	--accent-dark: #5a4a7a;
	--accent-glow: rgba(180, 150, 220, 0.15);
	--radius: 14px;
	--radius-sm: 8px;
	--transition: 0.2s ease;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	height: 100%;
}

body {
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

#bg-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 0;
	pointer-events: none;
}

.view {
	position: relative;
	z-index: 1;
	min-height: 100vh;
}

.loading-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	pointer-events: auto;
}

.loading-overlay.overlay-scoped {
	position: absolute;
}

#loading-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.loading-dots {
	position: relative;
	z-index: 1;
	display: flex;
	gap: 12px;
}

.loading-content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
}

.loading-text {
	font-size: 0.85rem;
	font-weight: 300;
	color: var(--text-dim);
	letter-spacing: 0.02em;
}

.loading-dots span {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #b496dc;
	box-shadow: 0 0 12px rgba(180, 150, 220, 0.8);
	animation: dotBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes dotBounce {
	0%, 100% {
		transform: translateY(0) scale(1);
		opacity: 0.4;
	}
	50% {
		transform: translateY(-18px) scale(1.3);
		opacity: 1;
	}
}

.hidden {
	display: none !important;
}

.wordmark {
	font-family: "Outfit", "Inter", sans-serif;
	font-size: 2.5rem;
	font-weight: 700;
	letter-spacing: -0.03em;
	background: linear-gradient(
		135deg,
		#e8d5f5 0%,
		#c9a8e8 25%,
		#9b7fc4 50%,
		#c9a8e8 75%,
		#e8d5f5 100%
	);
	background-size: 200% 200%;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
	animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
	0% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0% 50%;
	}
}

.subtitle {
	font-size: 0.85rem;
	font-weight: 300;
	color: var(--text-dim);
	margin-top: 4px;
	letter-spacing: 0.02em;
}

.error-text {
	color: rgba(255, 100, 100, 0.85);
	font-size: 0.8rem;
	min-height: 1.2em;
	margin-top: 14px;
	letter-spacing: 0.01em;
}

#login-view {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.login-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	animation: fadeInScale 0.5s ease;
}

.login-card .wordmark {
	font-size: 3rem;
	margin-bottom: 36px;
}

#login-form {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	width: 300px;
	max-width: 90vw;
}

#password-input {
	width: 100%;
	height: 46px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-family: inherit;
	font-size: 0.95rem;
	padding: 0 16px;
	outline: none;
	transition: border-color var(--transition), background var(--transition);
}

#password-input::placeholder {
	color: var(--text-faint);
}

#password-input:focus {
	border-color: var(--accent);
	background: rgba(180, 150, 220, 0.05);
}

#login-button {
	width: 100%;
	height: 46px;
	background: linear-gradient(135deg, #c9a8e8, #9b7fc4);
	color: #fff;
	border: none;
	border-radius: var(--radius-sm);
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 500;
	cursor: pointer;
	transition: opacity var(--transition), transform var(--transition),
		box-shadow var(--transition);
}

#login-button:hover {
	opacity: 0.9;
	box-shadow: 0 0 20px var(--accent-glow);
}

#login-button:active {
	transform: scale(0.98);
}

#dashboard-view {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: 40px 24px;
	animation: fadeInUp 0.4s ease;
	height: 100vh;
	overflow: hidden;
}

.dash-header {
	text-align: center;
	margin-bottom: 48px;
	flex-shrink: 0;
}

#dash-main {
	width: 100%;
	max-width: 960px;
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding-right: 8px;
	scrollbar-width: thin;
	scrollbar-color: rgba(180, 150, 220, 0.4) transparent;
}

#dash-main::-webkit-scrollbar {
	width: 8px;
}

#dash-main::-webkit-scrollbar-track {
	background: transparent;
}

#dash-main::-webkit-scrollbar-thumb {
	background: rgba(180, 150, 220, 0.35);
	border-radius: 4px;
}

#dash-main::-webkit-scrollbar-thumb:hover {
	background: rgba(180, 150, 220, 0.6);
}

.category-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 18px;
}

.category-card {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 14px;
	padding: 28px 24px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	transition: transform var(--transition), border-color var(--transition),
		background var(--transition), box-shadow var(--transition);
}

.category-card:hover {
	border-color: var(--border-hover);
	background: var(--surface-hover);
	box-shadow: 0 0 20px var(--accent-glow);
}

.category-card:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.category-card {
	animation: cardEnter 0.4s ease backwards;
}

.category-card:nth-child(1) {
	animation-delay: 0s;
}
.category-card:nth-child(2) {
	animation-delay: 0.08s;
}
.category-card:nth-child(3) {
	animation-delay: 0.16s;
}
.category-card:nth-child(4) {
	animation-delay: 0.24s;
}

@keyframes cardEnter {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.category-icon {
	width: 36px;
	height: 36px;
	color: var(--accent);
}

.category-name {
	font-size: 1.3rem;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.category-desc {
	font-size: 0.82rem;
	font-weight: 300;
	color: var(--text-dim);
}

.category-detail {
	animation: fadeInUp 0.3s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.detail-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: none;
	color: var(--text-dim);
	font-family: inherit;
	font-size: 0.85rem;
	cursor: pointer;
	padding: 6px 0;
	margin-bottom: 28px;
	transition: color var(--transition);
}

.detail-back:hover {
	color: var(--accent);
}

.detail-title {
	font-size: 1.8rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	margin-bottom: 28px;
}

.site-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	width: 100%;
}

.site-card {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	transition: transform var(--transition), border-color var(--transition),
		background var(--transition);
	animation: cardEnter 0.3s ease backwards;
}

.site-card:nth-child(1) {
	animation-delay: 0s;
}
.site-card:nth-child(2) {
	animation-delay: 0.06s;
}
.site-card:nth-child(3) {
	animation-delay: 0.12s;
}
.site-card:nth-child(4) {
	animation-delay: 0.18s;
}

.site-card:hover {
	border-color: var(--border-hover);
	background: var(--surface-hover);
	box-shadow: 0 0 15px var(--accent-glow);
}

.site-card:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.site-icon {
	width: 32px;
	height: 32px;
	border-radius: 7px;
	flex-shrink: 0;
	object-fit: contain;
	background: rgba(255, 255, 255, 0.05);
}

.site-fallback {
	width: 32px;
	height: 32px;
	border-radius: 7px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text);
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--border);
}

.site-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.site-name {
	font-size: 0.95rem;
	font-weight: 500;
}

.site-desc {
	font-size: 0.75rem;
	font-weight: 300;
	color: var(--text-dim);
	line-height: 1.4;
}

#proxy-view {
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.proxy-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 16px;
	background: rgba(0, 0, 0, 0.85);
	border-bottom: 1px solid var(--border);
	backdrop-filter: blur(8px);
	z-index: 10;
	flex-shrink: 0;
}

.nav-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	font-family: inherit;
	font-size: 0.83rem;
	font-weight: 400;
	padding: 7px 14px;
	cursor: pointer;
	transition: border-color var(--transition), background var(--transition);
}

.nav-button:hover {
	border-color: var(--border-hover);
	background: rgba(255, 255, 255, 0.05);
}

.proxy-title {
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--text);
	text-align: center;
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#proxy-container {
	flex: 1;
	position: relative;
	overflow: hidden;
	background: var(--bg);
}

#proxy-container iframe {
	border: none;
	width: 100%;
	height: 100%;
	display: block;
}

.proxy-error {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 24px;
	background: var(--bg);
	z-index: 50;
}

.error-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	max-width: 420px;
	padding: 40px 32px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	animation: fadeInUp 0.3s ease;
}

.error-icon {
	color: var(--accent);
	margin-bottom: 4px;
	opacity: 0.8;
}

.error-title {
	font-family: "Outfit", "Inter", sans-serif;
	font-size: 1.4rem;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.error-msg {
	font-size: 0.9rem;
	font-weight: 400;
	color: var(--text);
}

.error-warning {
	font-size: 0.82rem;
	font-weight: 300;
	color: var(--accent);
	background: rgba(180, 150, 220, 0.08);
	border: 1px solid rgba(180, 150, 220, 0.2);
	border-radius: var(--radius-sm);
	padding: 10px 16px;
	line-height: 1.5;
}

.proxy-error .nav-button {
	margin-top: 8px;
}

#browser-view {
	display: flex;
	flex-direction: column;
	height: 100vh;
}

.browser-chrome {
	flex-shrink: 0;
	background: rgba(0, 0, 0, 0.9);
	border-bottom: 1px solid var(--border);
	backdrop-filter: blur(8px);
}

.browser-tabs {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 8px 0;
}

.browser-tab-list {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 1 1 auto;
	min-width: 0;
}

.browser-tab-list::-webkit-scrollbar {
	display: none;
}

.browser-tab {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid transparent;
	border-bottom: none;
	cursor: pointer;
	flex: 1 1 0;
	min-width: 40px;
	max-width: 220px;
	transition: background var(--transition), border-color var(--transition);
	overflow: hidden;
}

.browser-tab:hover {
	background: rgba(255, 255, 255, 0.06);
}

.browser-tab.active {
	background: rgba(180, 150, 220, 0.08);
	border-color: var(--border-hover);
}

.browser-tab-icon {
	width: 16px;
	height: 16px;
	border-radius: 3px;
	flex: 0 0 16px;
	object-fit: contain;
}

.browser-tab-fallback {
	width: 16px;
	height: 16px;
	border-radius: 3px;
	flex: 0 0 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.6rem;
	font-weight: 600;
	color: var(--text);
	background: rgba(255, 255, 255, 0.08);
}

.browser-tab-label {
	font-size: 0.78rem;
	font-weight: 400;
	color: var(--text-dim);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1 1 auto;
	min-width: 0;
}

.browser-tab.active .browser-tab-label {
	color: var(--text);
}

.browser-tab-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 4px;
	border: none;
	background: none;
	color: var(--text-faint);
	cursor: pointer;
	flex: 0 0 18px;
	transition: background var(--transition), color var(--transition);
}

.browser-tab-close:hover {
	background: rgba(255, 255, 255, 0.1);
	color: var(--text);
}

.browser-new-tab {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: var(--radius-sm);
	border: none;
	background: none;
	color: var(--text-dim);
	cursor: pointer;
	flex-shrink: 0;
	transition: background var(--transition), color var(--transition);
}

.browser-new-tab:hover {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
}

.browser-toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
}

.nav-icon-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	border: none;
	background: none;
	color: var(--text-dim);
	cursor: pointer;
	flex-shrink: 0;
	transition: background var(--transition), color var(--transition);
}

.nav-icon-button:hover {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
}

.browser-form {
	flex: 1;
}

#browser-address {
	width: 100%;
	height: 34px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--border);
	border-radius: 20px;
	color: var(--text);
	font-family: inherit;
	font-size: 0.85rem;
	padding: 0 16px;
	outline: none;
	transition: border-color var(--transition), background var(--transition);
}

#browser-address::placeholder {
	color: var(--text-faint);
}

#browser-address:focus {
	border-color: var(--accent);
	background: rgba(180, 150, 220, 0.05);
}

#browser-content {
	flex: 1;
	position: relative;
	overflow: hidden;
	background: var(--bg);
}

#browser-content iframe {
	border: none;
	width: 100%;
	height: 100%;
	display: block;
}

#browser-content iframe.hidden-tab {
	display: none;
}

@keyframes fadeInScale {
	from {
		opacity: 0;
		transform: scale(0.96);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.logo-wrapper {
	margin: 40px 16px 20px;
}

.logo-wrapper h1 {
	color: var(--text);
	font-weight: 600;
	font-size: 1.8rem;
	letter-spacing: -0.02em;
}

.left-margin {
	margin: 0 16px;
}

.desc {
	color: var(--text-dim);
	max-width: 900px;
}

.credit {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 20px;
	margin-bottom: 16px;
	color: var(--text);
}

.credit span {
	font-weight: 500;
}

.credit a {
	color: var(--text-dim);
	text-decoration: none;
}

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

.credit label {
	cursor: pointer;
	color: var(--text-dim);
	font-size: 0.85rem;
	margin-left: 12px;
}

.credit label::after {
	content: "show license";
}

.credit input:checked + label::after {
	content: "hide license";
}

.credit pre {
	display: none;
	width: 100%;
	margin-top: 12px;
	font-size: 0.75rem;
	color: var(--text-dim);
	white-space: pre-wrap;
	word-break: break-word;
	overflow-x: auto;
}

.credit input:checked ~ pre {
	display: block;
}

@media (max-width: 800px) {
	.category-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.wordmark {
		font-size: 2rem;
	}
	.login-card .wordmark {
		font-size: 2.4rem;
	}
	#dashboard-view {
		padding: 32px 16px 40px;
	}
	.dash-header {
		top: 24px;
		margin-bottom: 32px;
	}
	.category-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.site-grid {
		grid-template-columns: 1fr;
	}
	.nav-button span {
		display: none;
	}
	.proxy-title {
		font-size: 0.82rem;
	}
	.browser-tab {
		max-width: 160px;
	}
	.browser-toolbar {
		gap: 4px;
		padding: 8px;
	}
	#browser-address {
		font-size: 0.78rem;
		padding: 0 12px;
	}
}
