/* ===== Interactive guided tour: spotlight overlay + floating step panel ===== */

:root {
	--tour-dim: rgba(6, 14, 28, 0.5);
	--tour-z: 2147483000;
}

/* A full-screen SVG dim with N mask cut-outs frames one or more highlighted
   areas at once. Visual only (pointer-events: none) so the page stays usable. */
.tour-dim {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: var(--tour-z);
	pointer-events: none;
}

.tour-dim-fill {
	fill: var(--tour-dim);
}

/* Glow ring drawn around the highlighted target (non-interactive). */
.tour-ring {
	position: fixed;
	z-index: calc(var(--tour-z) + 1);
	pointer-events: none;
	border-radius: 10px;
	box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px rgba(255, 255, 255, 0.15), 0 0 22px 4px color-mix(in srgb, var(--accent) 55%, transparent);
	transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.tour-ring.is-hidden {
	display: none;
}

/* Floating step panel, docked to the right. */
.tour-panel {
	position: fixed;
	top: 50%;
	right: 22px;
	transform: translateY(-50%);
	width: min(420px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	z-index: calc(var(--tour-z) + 2);
	pointer-events: auto;
	background: var(--card);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(4, 12, 30, 0.45);
	padding: 16px 16px 14px;
	display: grid;
	gap: 10px;
	animation: tour-panel-in 0.22s ease;
}

@keyframes tour-panel-in {
	from { opacity: 0; transform: translateY(-50%) translateX(10px); }
	to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* Welcome / overview screen: centered, a touch wider than the step panels. */
.tour-panel.is-intro {
	top: 50%;
	left: 50%;
	right: auto;
	transform: translate(-50%, -50%);
	width: min(440px, calc(100vw - 32px));
	animation: tour-intro-in 0.24s ease;
}

@keyframes tour-intro-in {
	from { opacity: 0; transform: translate(-50%, -46%); }
	to   { opacity: 1; transform: translate(-50%, -50%); }
}

.tour-panel-head {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tour-panel-icon {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 9px;
	background: var(--accent-soft);
	color: var(--accent-strong);
}

.tour-panel-icon svg {
	width: 20px;
	height: 20px;
}

.tour-panel-step {
	flex: 1 1 auto;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--muted);
}

.tour-panel-close {
	flex: 0 0 auto;
	background: none;
	border: none;
	color: var(--muted);
	cursor: pointer;
	width: 28px;
	height: 28px;
	border-radius: 7px;
	display: grid;
	place-items: center;
}

.tour-panel-close:hover {
	background: var(--surface-soft);
	color: var(--ink);
}

.tour-panel-close svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
}

.tour-panel-title {
	margin: 0;
	font-size: 1.06rem;
	font-weight: 700;
	line-height: 1.3;
}

.tour-panel-lead {
	margin: 0;
	line-height: 1.5;
	color: var(--ink);
}

.tour-panel-points {
	margin: 0;
	padding-left: 18px;
	display: grid;
	gap: 6px;
	line-height: 1.45;
	font-size: 0.92rem;
}

.tour-panel-points code,
.tour-panel-lead code,
.tour-panel-hint code {
	background: var(--surface-soft);
	border: 1px solid var(--line);
	border-radius: 5px;
	padding: 0.5px 5px;
	font-size: 0.85em;
}

.tour-panel-hint {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	background: var(--accent-soft);
	border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
	border-radius: 9px;
	padding: 9px 11px;
	font-size: 0.92rem;
	line-height: 1.45;
	color: var(--ink);
}

.tour-panel-hint::before {
	content: "👆";
	flex: 0 0 auto;
}

.tour-panel-hint > span {
	flex: 1 1 auto;
	min-width: 0;
}

.tour-panel-hint.is-tip::before {
	content: "💡";
}

/* ----- Sub-step checklist ----- */
.tour-checklist {
	display: grid;
	gap: 6px;
	margin-top: 2px;
}

.tour-check {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	padding: 8px 10px;
	border: 1px solid var(--line);
	border-radius: 9px;
	background: var(--surface-soft);
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.tour-check:hover {
	border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.tour-check.is-active {
	border-color: var(--accent);
	background: var(--accent-soft);
}

/* Green check-mark box — overrides the app's global toggle-switch styling of
   input[type=checkbox] (higher specificity: scoped under .tour-panel). */
.tour-panel .tour-check-box {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	min-width: 20px;
	margin: 1px 0 0;
	padding: 0;
	border: 2px solid var(--line);
	border-radius: 6px;
	background: var(--card);
	position: relative;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tour-panel .tour-check-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	border-radius: 0;
	background: none;
	transform: rotate(45deg);
	opacity: 0;
	transition: opacity 0.12s ease;
}

.tour-panel .tour-check-box:checked {
	background: var(--ok);
	border-color: var(--ok);
}

.tour-panel .tour-check-box:checked::after {
	opacity: 1;
	background: none;
	transform: rotate(45deg);
}

.tour-check-label {
	flex: 1 1 auto;
	font-size: 0.92rem;
	line-height: 1.4;
	color: var(--ink);
}

.tour-check.is-done .tour-check-label {
	color: var(--muted);
	text-decoration: line-through;
}

.tour-panel-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.tour-btn {
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	border-radius: 9px;
	padding: 8px 14px;
	cursor: pointer;
	border: 1px solid var(--line);
	background: transparent;
	color: var(--ink);
}

.tour-btn:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.tour-btn.is-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
	margin-left: auto;
}

.tour-btn.is-primary:hover {
	background: var(--accent-strong);
	border-color: var(--accent-strong);
	color: #fff;
}

.tour-btn.is-ghost {
	border-color: transparent;
	color: var(--muted);
	padding-left: 4px;
	padding-right: 4px;
}

.tour-btn.is-ghost:hover {
	color: var(--danger);
	border-color: transparent;
}

.tour-btn:disabled {
	opacity: 0.45;
	cursor: default;
	pointer-events: none;
}

/* Small confirmation toast when the tour completes. */
.tour-toast {
	position: fixed;
	left: 50%;
	bottom: 26px;
	transform: translateX(-50%);
	z-index: calc(var(--tour-z) + 3);
	background: var(--accent-strong);
	color: #fff;
	padding: 11px 18px;
	border-radius: 999px;
	font-weight: 600;
	box-shadow: 0 12px 30px rgba(4, 12, 30, 0.4);
	animation: tour-toast-in 0.25s ease;
}

@keyframes tour-toast-in {
	from { opacity: 0; transform: translateX(-50%) translateY(10px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* On narrow screens dock the panel to the bottom so it doesn't cover content. */
@media (max-width: 900px) {
	.tour-panel {
		top: auto;
		bottom: 12px;
		right: 12px;
		left: 12px;
		width: auto;
		transform: none;
		max-height: 52vh;
		animation: tour-panel-in-mobile 0.22s ease;
	}

	/* Highlighted target is in the lower half → move the sheet to the top. */
	.tour-panel.tour-dock-top {
		top: 12px;
		bottom: auto;
	}

	@keyframes tour-panel-in-mobile {
		from { opacity: 0; transform: translateY(12px); }
		to   { opacity: 1; transform: translateY(0); }
	}
}

/* ----- Completion window ----- */
.tour-complete-backdrop {
	position: fixed;
	inset: 0;
	z-index: calc(var(--tour-z) + 3);
	display: grid;
	place-items: center;
	background: rgba(6, 14, 28, 0.55);
	padding: 16px;
}

.tour-complete-card {
	background: var(--card);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(4, 12, 30, 0.5);
	padding: 26px 26px 22px;
	width: min(420px, 100%);
	text-align: center;
	display: grid;
	gap: 10px;
	justify-items: center;
	animation: tour-complete-in 0.24s ease;
}

@keyframes tour-complete-in {
	from { opacity: 0; transform: translateY(10px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tour-complete-emoji {
	font-size: 2.4rem;
	line-height: 1;
}

.tour-complete-title {
	margin: 0;
	font-size: 1.3rem;
}

.tour-complete-body {
	margin: 0;
	line-height: 1.5;
	color: var(--ink);
	max-width: 34ch;
}

.tour-complete-card .tour-complete-done {
	margin: 8px 0 0;
	padding-left: 22px;
	padding-right: 22px;
}

/* Start/Restart tour button on the Tutorial page hero. */
.tut-start-tour {
	justify-self: start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	background: var(--accent);
	color: #fff;
	border: 1px solid var(--accent);
	border-radius: 10px;
	padding: 9px 16px;
	font: inherit;
	font-size: 0.94rem;
	font-weight: 650;
	cursor: pointer;
}

.tut-start-tour:hover {
	background: var(--accent-strong);
	border-color: var(--accent-strong);
}

.tut-start-tour svg {
	width: 18px;
	height: 18px;
}
