:root {
	--bg-0: #0a1017;
	--bg-1: #111a24;
	--bg-2: #1a2634;
	--panel: rgba(13, 22, 31, 0.88);
	--panel-strong: rgba(12, 20, 29, 0.97);
	--line: rgba(153, 178, 201, 0.18);
	--line-strong: rgba(153, 178, 201, 0.34);
	--text: #d8e8f4;
	--text-dim: #95a8b8;
	--accent: #34c7bb;
	--accent-soft: rgba(52, 199, 187, 0.2);
	--warn: #f5b556;
	--error: #ef7168;
	--ok: #69d58a;
	--btn: #223246;
	--btn-hover: #2a3f57;
	--shadow: 0 14px 40px rgba(0, 0, 0, 0.38);
	--radius: 14px;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
	color: var(--text);
	background:
		radial-gradient(1200px 650px at -5% -10%, #203146 0%, transparent 58%),
		radial-gradient(900px 500px at 110% 110%, #20342a 0%, transparent 60%),
		linear-gradient(145deg, var(--bg-0), #0c131b 50%, #0e1721);
	font-family: "Space Grotesk", "Sora", "Segoe UI", sans-serif;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image:
		linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
	background-size: 24px 24px;
	pointer-events: none;
	mix-blend-mode: soft-light;
}

.app-shell {
	position: relative;
	z-index: 1;
	max-width: 1680px;
	min-height: 100vh;
	margin: 0 auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.topbar {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: linear-gradient(170deg, rgba(20, 33, 46, 0.85), rgba(12, 20, 28, 0.92));
	box-shadow: var(--shadow);
}

.brand {
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.top-nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	min-width: 0;
	flex-wrap: wrap;
}

.top-nav-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 32px;
	padding: 6px 11px;
	border-radius: 9px;
	border: 1px solid rgba(153, 178, 201, 0.28);
	background: rgba(25, 39, 54, 0.55);
	color: #c8dbea;
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-decoration: none;
	transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.top-nav-link:hover {
	border-color: rgba(167, 194, 218, 0.52);
	background: rgba(34, 52, 72, 0.8);
	color: #e5f4ff;
}

.top-nav-link.is-active {
	border-color: rgba(78, 237, 226, 0.8);
	background: linear-gradient(145deg, rgba(42, 182, 172, 0.33), rgba(31, 133, 126, 0.35));
	color: #f3fffe;
	box-shadow: inset 0 0 0 1px rgba(42, 182, 172, 0.32);
}

.brand strong {
	font-family: "Sora", sans-serif;
	font-size: 1.1rem;
	letter-spacing: 0.03em;
}

.brand span {
	color: var(--text-dim);
	font-size: 0.92rem;
}

.status-pill {
	font-size: 0.84rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 7px 12px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: rgba(26, 39, 54, 0.7);
}

.status-pill.is-loading {
	color: #d2e6f8;
	border-color: #84a7c5;
}

.status-pill.is-ok {
	color: #b3f5c6;
	border-color: rgba(105, 213, 138, 0.72);
	background: rgba(26, 62, 41, 0.62);
}

.status-pill.is-warning {
	color: #ffe2ac;
	border-color: rgba(245, 181, 86, 0.68);
	background: rgba(63, 45, 17, 0.6);
}

.status-pill.is-error {
	color: #ffc5c1;
	border-color: rgba(239, 113, 104, 0.75);
	background: rgba(67, 24, 24, 0.64);
}

.workspace-grid {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 380px;
	gap: 14px;
}

.workspace-grid.page-single-column {
	grid-template-columns: minmax(0, 1fr);
}

.main-panel,
.sidebar {
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: var(--panel);
	box-shadow: var(--shadow);
}

.main-panel {
	min-height: 0;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.toolbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.view-indicator {
	min-height: 36px;
	padding: 8px 11px;
	border-radius: 10px;
	border: 1px solid rgba(153, 178, 201, 0.24);
	background: rgba(17, 27, 38, 0.72);
	color: #b9d2e4;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	display: inline-flex;
	align-items: center;
}

.upload-btn,
.btn,
.toggle-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 36px;
	padding: 8px 12px;
	border-radius: 11px;
	border: 1px solid var(--line-strong);
	background: linear-gradient(180deg, var(--btn), #1b2a3d);
	color: var(--text);
	font-size: 0.86rem;
	font-weight: 600;
}

.upload-btn {
	cursor: pointer;
}

.upload-btn input {
	display: none;
}

.btn {
	cursor: pointer;
	transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
	background: linear-gradient(180deg, var(--btn-hover), #22354d);
	border-color: rgba(167, 194, 218, 0.42);
}

.btn:active {
	transform: translateY(1px);
}

.btn:disabled {
	opacity: 0.46;
	cursor: not-allowed;
	transform: none;
}

.btn:disabled:hover {
	background: linear-gradient(180deg, var(--btn), #1b2a3d);
	border-color: var(--line-strong);
}

.btn.ghost {
	background: rgba(27, 40, 56, 0.64);
}

.btn.accent {
	background: linear-gradient(145deg, #2ab6ac, #1f857e);
	border-color: rgba(78, 237, 226, 0.8);
	color: #f2fffe;
}

.toggle-chip {
	gap: 7px;
	user-select: none;
	cursor: pointer;
}

.toggle-chip input {
	margin: 0;
	accent-color: var(--accent);
}

.canvas-wrap {
	position: relative;
	flex: 1;
	min-height: 380px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background:
		radial-gradient(circle at 20% 15%, rgba(39, 62, 82, 0.38), transparent 55%),
		conic-gradient(from 45deg at 50% 50%, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.015));
	overflow: hidden;
	display: grid;
	place-items: center;
}

.canvas-wrap.can-pan {
	cursor: grab;
}

.canvas-wrap.can-edit-landmarks {
	cursor: crosshair;
}

.canvas-wrap.is-panning {
	cursor: grabbing;
}

.canvas-wrap.is-editing-landmark {
	cursor: grabbing;
}

.canvas-wrap.is-panning * {
	cursor: grabbing !important;
}

#previewCanvas {
	max-width: 100%;
	max-height: 100%;
	border-radius: 8px;
	background: #0f161f;
}

.canvas-placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	text-align: center;
	gap: 6px;
	color: var(--text-dim);
	background: linear-gradient(160deg, rgba(15, 23, 32, 0.86), rgba(12, 19, 27, 0.76));
	pointer-events: none;
}

.canvas-placeholder h3 {
	margin: 0;
	font-family: "Sora", sans-serif;
	font-size: 1.1rem;
	color: #d3e6f4;
}

.canvas-placeholder p {
	margin: 0;
	font-size: 0.9rem;
}

.status-block {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 10px;
	align-items: stretch;
}

.status-main {
	display: grid;
	gap: 8px;
	min-width: 0;
}

.status-viewport {
	min-width: 0;
	padding: 8px 10px;
	border-radius: 10px;
	border: 1px solid var(--line-strong);
	background: rgba(17, 27, 39, 0.72);
	display: grid;
	align-content: start;
	gap: 6px;
}

.status-viewport h3 {
	margin: 0;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #bdd5e8;
}

.status-control-row {
	margin-top: 0;
}

.status-control-row output {
	min-width: 58px;
}

.detection-summary {
	min-height: 32px;
	padding: 7px 10px;
	border-radius: 10px;
	border: 1px dashed var(--line-strong);
	background: rgba(18, 28, 40, 0.66);
	color: #bcd2e4;
	font-size: 0.86rem;
}

.status-log {
	max-height: 102px;
	overflow: auto;
	display: grid;
	gap: 4px;
	padding-right: 4px;
}

.status-item {
	font-size: 0.8rem;
	color: var(--text-dim);
	border-left: 2px solid transparent;
	padding-left: 8px;
}

.status-item.ok {
	border-left-color: var(--ok);
}

.status-item.warning {
	border-left-color: var(--warn);
}

.status-item.error {
	border-left-color: var(--error);
}

.sidebar {
	min-height: 0;
	overflow: auto;
	padding: 10px;
	display: grid;
	align-content: start;
	gap: 10px;
	background: var(--panel-strong);
    max-height: calc(100vh - 113px);
    overflow: auto;
}

.panel {
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 10px;
	background: linear-gradient(180deg, rgba(17, 28, 39, 0.88), rgba(13, 21, 31, 0.88));
}

.panel h2 {
	margin: 0 0 9px;
	font-family: "Sora", sans-serif;
	font-size: 0.94rem;
	letter-spacing: 0.02em;
	color: #d6edf4;
}

.subsection-title {
	margin-top: 12px;
	padding-top: 8px;
	border-top: 1px solid rgba(153, 178, 201, 0.24);
	font-size: 0.76rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #b5cadf;
}

.gaze-pad {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	border-radius: 12px;
	border: 1px solid rgba(130, 170, 201, 0.36);
	background:
		radial-gradient(circle at 50% 50%, rgba(52, 199, 187, 0.17), rgba(52, 199, 187, 0.04) 46%, transparent 72%),
		linear-gradient(145deg, rgba(22, 35, 49, 0.95), rgba(12, 21, 30, 0.95));
	overflow: hidden;
	touch-action: none;
}

.gaze-grid {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(rgba(170, 205, 230, 0.14) 1px, transparent 1px),
		linear-gradient(90deg, rgba(170, 205, 230, 0.14) 1px, transparent 1px);
	background-size: 24px 24px;
}

.gaze-grid::before,
.gaze-grid::after {
	content: "";
	position: absolute;
	background: rgba(52, 199, 187, 0.36);
}

.gaze-grid::before {
	left: 50%;
	top: 0;
	width: 1px;
	height: 100%;
}

.gaze-grid::after {
	top: 50%;
	left: 0;
	height: 1px;
	width: 100%;
}

.gaze-knob {
	position: absolute;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid #d8fff7;
	background: radial-gradient(circle at 35% 30%, #8bece2 0%, #2ab6ac 55%, #1a736d 100%);
	box-shadow:
		0 0 0 4px rgba(52, 199, 187, 0.24),
		0 5px 10px rgba(0, 0, 0, 0.4);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.split-2 {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.control-row,
.color-row {
	display: grid;
	align-items: center;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto;
	gap: 7px;
	margin-top: 8px;
}

.control-row.compact {
	grid-template-columns: 1fr;
}

.control-row.compact output {
	justify-self: end;
}

.check-row {
	margin-top: 8px;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.control-row label,
.color-row label {
	font-size: 0.8rem;
	color: #b8cad8;
}

input[type="range"] {
	width: 100%;
	accent-color: var(--accent);
}

input[type="color"] {
	width: 42px;
	height: 28px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: transparent;
	padding: 2px;
}

select {
	width: 100%;
	min-height: 32px;
	border-radius: 8px;
	border: 1px solid var(--line-strong);
	background: rgba(25, 38, 53, 0.9);
	color: var(--text);
	padding: 5px 7px;
}

output {
	min-width: 42px;
	text-align: right;
	font-size: 0.78rem;
	color: #d4e7f3;
}

.swatch {
	width: 24px;
	height: 24px;
	border-radius: 7px;
	border: 1px solid var(--line-strong);
	background: #72808a;
}

.check-list {
	display: grid;
	gap: 6px;
	font-size: 0.84rem;
	color: #bacddf;
}

.check-list label {
	display: flex;
	align-items: center;
	gap: 7px;
}

.check-list input {
	accent-color: var(--accent);
}

.blog-list-header {
	display: grid;
	gap: 6px;
	margin-bottom: 12px;
}

.blog-list-header h2 {
	margin: 0;
}

.blog-list-header p {
	margin: 0;
	color: #a8bfd3;
	font-size: 0.9rem;
}

.blog-empty {
	margin: 6px 0 2px;
	padding: 12px;
	border: 1px dashed var(--line-strong);
	border-radius: 10px;
	background: rgba(18, 28, 40, 0.5);
	color: #bdd3e4;
}

.blog-list {
	display: grid;
	gap: 10px;
}

.blog-list-item {
	padding: 12px;
	border-radius: 11px;
	border: 1px solid rgba(153, 178, 201, 0.22);
	background: linear-gradient(180deg, rgba(18, 29, 40, 0.92), rgba(13, 21, 31, 0.92));
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.blog-list-item h2 {
	margin: 0;
	font-size: 1rem;
	font-family: "Sora", sans-serif;
	letter-spacing: 0.01em;
	color: #e1f3ff;
}

.blog-list-title-link {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: color 120ms ease, border-color 120ms ease;
}

.blog-list-title-link:hover {
	color: #f1fbff;
	border-color: rgba(129, 224, 244, 0.7);
}

.blog-list-item .date {
	margin-top: 5px;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #87b9d8;
}

.blog-list-item .excerpt {
	margin: 9px 0 0;
	line-height: 1.55;
	color: #caddeb;
	white-space: pre-wrap;
}

.blog-pagination {
	margin-top: 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	align-items: center;
}

.blog-pagination-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 32px;
	padding: 6px 10px;
	border-radius: 9px;
	border: 1px solid rgba(153, 178, 201, 0.28);
	background: rgba(26, 40, 56, 0.68);
	color: #c8dbea;
	font-size: 0.84rem;
	font-weight: 600;
	text-decoration: none;
	transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

a.blog-pagination-link:hover {
	border-color: rgba(167, 194, 218, 0.52);
	background: rgba(34, 52, 72, 0.84);
	color: #e5f4ff;
}

.blog-pagination-link.is-active {
	border-color: rgba(78, 237, 226, 0.8);
	background: linear-gradient(145deg, rgba(42, 182, 172, 0.33), rgba(31, 133, 126, 0.35));
	color: #f3fffe;
	box-shadow: inset 0 0 0 1px rgba(42, 182, 172, 0.32);
}

.blog-pagination-link.is-disabled {
	opacity: 0.46;
	cursor: not-allowed;
}

.blog-article-content {
	display: grid;
	gap: 10px;
}

.blog-article-content h2 {
	margin: 0;
	font-family: "Sora", sans-serif;
	font-size: clamp(1.2rem, 1.8vw, 1.55rem);
	letter-spacing: 0.01em;
	color: #e1f3ff;
}

.blog-article-content .date {
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #87b9d8;
}

.blog-article-content img {
	max-width: 100%;
	height: auto;
	border-radius: 10px;
	border: 1px solid rgba(153, 178, 201, 0.22);
	background: rgba(16, 26, 36, 0.8);
}

.blog-article-content article {
	padding: 2px 0;
	color: #caddeb;
	line-height: 1.6;
}

.blog-article-content article p {
	margin: 0;
}

.blog-article-content article p + p {
	margin-top: 0.9em;
}

@media (max-width: 1200px) {
	.workspace-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.status-block {
		grid-template-columns: 1fr;
	}

	.sidebar {
		max-height: none;
	}

	.split-2 {
		grid-template-columns: 1fr;
	}

	.topbar {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"brand status"
			"nav nav";
	}

	.brand {
		grid-area: brand;
	}

	.top-nav {
		grid-area: nav;
		justify-content: flex-start;
	}

	.topbar > .status-pill {
		grid-area: status;
		justify-self: end;
	}
}

@media (max-width: 720px) {
	.app-shell {
		padding: 10px;
	}

	.topbar {
		grid-template-columns: 1fr;
		grid-template-areas:
			"brand"
			"nav"
			"status";
	}

	.topbar > .status-pill {
		justify-self: start;
	}

	.toolbar {
		gap: 6px;
	}

	.upload-btn,
	.btn,
	.toggle-chip {
		width: 100%;
	}

	.canvas-wrap {
		min-height: 260px;
	}
}
