/* Shared (theme-agnostic) modal media/layout */
.ssg-flowchart__card {
	border-radius: 16px;
	border: 0;
	background: transparent;
	padding: 0;
	box-shadow: none;
	display: flex;
	justify-content: center;
	margin: 0;
}

.ssg-flowchart__img {
	display: block;
	max-width: 100%;
	max-height: 350px;
	width: 100%;
	height: auto;
	object-fit: contain;
	border-radius: 14px;
	margin: 0;
	border: 0;
	box-shadow: none;
}

/* Image mode:
 - Action modal: parent splits image/text in two columns.
 - Story modal: nested .ssg-flowchart__story does the split.
*/
.ssg-flowchart__modalContent--hasImage {
	display: flex;
	flex-direction: row;
	gap: 1rem;
	align-items: flex-start;
}

.ssg-flowchart__modalContent--hasImage > .ssg-flowchart__img,
.ssg-flowchart__modalContent--hasImage > .ssg-flowchart__modalText {
	flex: 0 0 calc(50% - 0.5rem);
	min-width: 0;
}

.ssg-flowchart__modalContent--hasImage > .ssg-flowchart__story {
	flex: 1 1 100%;
	width: 100%;
	max-width: 100%;
}

.ssg-flowchart__modalContent--hasImage .ssg-flowchart__modalText {
	width: 100%;
	max-width: 100%;
	text-align: left;
	align-self: center;
}

.ssg-flowchart__modalContent--hasImage > .ssg-flowchart__img,
.ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__card {
	width: 100%;
	max-width: 100%;
}

.ssg-flowchart__modalContent--noImage .ssg-flowchart__modalText,
.ssg-flowchart__modalContent--noImage .ssg-flowchart__story {
	width: 100%;
	max-width: 100%;
	text-align: center;
	margin: 0 auto;
}

.ssg-flowchart__modalText {
	padding: 0;
	border-radius: 12px;
}

.ssg-flowchart__modalText > * + * {
	margin-top: 1rem;
}

.ssg-flowchart__actions {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ssg-flowchart__modalContent--hasImage .ssg-flowchart__btnPrimary {
	width: 100%;
	max-width: 100%;
}

@media (max-width: 900px) {
	.ssg-flowchart__modalContent--hasImage {
		display: flex;
		flex-direction: column;
		gap: 1rem;
	}

	.ssg-flowchart__modalContent--hasImage .ssg-flowchart__modalText {
		order: 1;
	}

	.ssg-flowchart__modalContent--hasImage > .ssg-flowchart__img,
	.ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__card {
		order: 2;
	}
}

/* Shared (theme-agnostic) sound button placement + sizing */
.ssg-flowchart__soundBtn {
	position: absolute;
	top: 30px;
	right: 30px;
	width: 44px;
	min-width: 44px;
	height: 44px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

/* Raise the entire flowchart context when any modal is open. */
.ssg-flowchart.ssg-flowchart--modal-open {
	position: relative;
	z-index: 2147483646;
}

/* Pirate theme only (nested CSS). */

#game.theme-pirate,
#game.theme-pirat-og-sorover {

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story {
		display: grid;
		grid-template-columns: calc(50% - 0.5rem) calc(50% - 0.5rem);
		gap: 1rem;
		align-items: center;
		width: 100%;
		max-width: 100%;
	}

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__modalText {
		align-self: center;
		text-align: center;
	}

	@media (max-width: 900px) {
		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story {
			display: flex;
			flex-direction: column;
			gap: 1rem;
		}

		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__modalText {
			order: 1;
		}

		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__card {
			order: 2;
		}
	}

	/* Page wrapper */
	&.ssg-flowchartPage {
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		overflow: hidden;
	}

	&.ssg-flowchartPage>.container {
		width: 100%;
		position: relative;
		z-index: 1;
	}

	/* Board (pirate map): 16:9 fits within viewport width and height */
	& .ssg-flowchart__board {
		position: relative;
		--ssg-flowchart-board-vspace: max(5.5rem, calc(env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px) + 4.5rem));
		aspect-ratio: 16 / 9;
		width: min(100%, calc((100dvh - var(--ssg-flowchart-board-vspace)) * 16 / 9));
		max-width: 100%;
		max-height: calc(100dvh - var(--ssg-flowchart-board-vspace));
		height: auto;
		background-image: var(--ssg-flowchart-map, none);
		background-size: cover;
		background-position: center;
		background-repeat: no-repeat;
		overflow: hidden;
		min-height: 0;
		padding: 18px;
		border-radius: 0;
		border: 0;
	}

	/* Layering */
	& .ssg-flowchart__path {
		z-index: 1;
	}

	& .ssg-flowchart__nodes {
		z-index: 2;
	}

	& .ssg-flowchart__token {
		z-index: 3;
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__board {
			padding: 22px;
		}
	}

	/* Path */
	& .ssg-flowchart__path {
		pointer-events: none;
		position: absolute;
		inset: 0;
		overflow: hidden;
	}

	& .ssg-flowchart__pathSvg {
		width: 100%;
		height: 100%;
		display: block;
		overflow: hidden;
	}

	& .ssg-flowchart__pathStroke {
		stroke: rgba(255, 255, 255, 0.92);
	}

	& .ssg-flowchart__routeDash {
		stroke: #c42029;
		stroke-width: 16;
		stroke-dasharray: 36 24;
	}

	& .ssg-flowchart__pathEndRing,
	& .ssg-flowchart__pathEndX {
		stroke: #c42029;
	}

	& .ssg-flowchart__routeUnderlay {
		stroke: rgba(79, 37, 23, 0.55);
	}

	/* Nodes + token */
	& .ssg-flowchart__nodes {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
	}

	& .ssg-flowchart__token {
		position: absolute;
		left: 0%;
		top: 50%;
		transform: translate(-50%, -50%);
		width: 44px;
		height: 44px;
		border-radius: 999px;
		background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.15)), #f59e0b;
		box-shadow: 0 14px 26px rgba(0, 0, 0, 0.22);
		border: 2px solid rgba(255, 255, 255, 0.55);
		transition: left 1600ms cubic-bezier(.2, .9, .25, 1), top 1600ms cubic-bezier(.2, .9, .25, 1), transform 1600ms cubic-bezier(.2, .9, .25, 1);
	}

	& .ssg-flowchart__token::after {
		content: "";
		position: absolute;
		inset: 9px;
		border-radius: 999px;
		background: rgba(15, 23, 42, 0.18);
		box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25);
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__token {
			width: 52px;
			height: 52px;
		}

		& .ssg-flowchart__token::after {
			inset: 11px;
		}
	}

	/* Toolbar */
	& .ssg-flowchart__toolbar {
		margin-top: 12px;
		display: flex;
		justify-content: center;
	}

	& .ssg-flowchart__btnReset {
		background: rgba(15, 23, 42, 0.08);
		color: rgba(15, 23, 42, 0.82);
	}

	& .ssg-flowchart__btnReset:hover {
		background: rgba(15, 23, 42, 0.12);
	}

	/* Node buttons */
	& .ssg-flowchart__node {
		position: absolute;
		overflow: visible;
		transform: translate(-50%, -50%);
		width: 46px;
		height: 46px;
		border-radius: 999px;
		/* iOS pirate app checkpoint: chunky 3D token */
		--ssg-node-rim-top: rgba(250, 204, 21, 0.92);
		--ssg-node-rim-bot: rgba(245, 158, 11, 0.80);
		--ssg-node-rim-edge: rgba(250, 204, 21, 0.26);
		--ssg-node-parchment-a: #f8efd9;
		--ssg-node-parchment-b: #f1dfbf;
		background: linear-gradient(180deg, var(--ssg-node-rim-top), var(--ssg-node-rim-bot));
		border: 1px solid var(--ssg-node-rim-edge);
		box-shadow:
			0 18px 34px rgba(0, 0, 0, 0.40),
			0 8px 16px rgba(0, 0, 0, 0.26),
			inset 0 1px 0 rgba(255, 255, 255, 0.30),
			inset 0 -10px 18px rgba(0, 0, 0, 0.22);
		color: #2a1a08;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		font-weight: 900;
		font-size: 16px;
		cursor: pointer;
		user-select: none;
		transition:
			transform 140ms cubic-bezier(.2, .9, .2, 1),
			box-shadow 140ms cubic-bezier(.2, .9, .2, 1),
			filter 140ms ease,
			border-color 140ms ease,
			background 140ms ease;
	}

	& .ssg-flowchart__node::before {
		/* thick brass rim + specular, reads like a real 3D bezel */
		content: "";
		position: absolute;
		inset: 0;
		border-radius: 999px;
		pointer-events: none;
		background:
			radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 48%),
			radial-gradient(circle at 78% 78%, rgba(79, 37, 23, 0.22), rgba(0, 0, 0, 0) 58%);
		box-shadow:
			/* top lip highlight */
			inset 0 2px 0 rgba(255, 255, 255, 0.28),
			/* bottom lip shadow */
			inset 0 -14px 18px rgba(79, 37, 23, 0.28),
			/* rim thickness cue */
			inset 0 0 0 3px rgba(79, 37, 23, 0.18);
	}

	& .ssg-flowchart__node::after {
		/* recessed parchment insert + inner bevel (the “hole”) */
		content: "";
		position: absolute;
		inset: 7px;
		border-radius: 999px;
		pointer-events: none;
		background:
			radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 52%),
			radial-gradient(circle at 70% 72%, rgba(79, 37, 23, 0.10), rgba(0, 0, 0, 0) 58%),
			linear-gradient(180deg, var(--ssg-node-parchment-a), var(--ssg-node-parchment-b));
		box-shadow:
			/* inner bevel highlight */
			inset 0 2px 0 rgba(255, 255, 255, 0.46),
			inset 2px 2px 0 rgba(255, 255, 255, 0.18),
			/* inner bevel shadow */
			inset 0 -10px 14px rgba(79, 37, 23, 0.20),
			inset -2px -2px 0 rgba(79, 37, 23, 0.14),
			/* hard separation line between rim and insert */
			0 0 0 2px rgba(79, 37, 23, 0.10);
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__node {
			width: 54px;
			height: 54px;
			font-size: 18px;
		}
	}

	& .ssg-flowchart__node[aria-current="step"] {
		/* Current: brighter gold + punchier parchment */
		--ssg-node-rim-top: rgba(252, 211, 77, 0.98);
		--ssg-node-rim-bot: rgba(245, 158, 11, 0.92);
		--ssg-node-rim-edge: rgba(255, 255, 255, 0.22);
		--ssg-node-parchment-a: #fff3d8;
		--ssg-node-parchment-b: #f6dcae;
		color: #1f1302;
		box-shadow:
			0 22px 44px rgba(0, 0, 0, 0.46),
			0 10px 22px rgba(0, 0, 0, 0.30),
			0 0 0 7px rgba(250, 204, 21, 0.10),
			inset 0 1px 0 rgba(255, 255, 255, 0.34),
			inset 0 -10px 22px rgba(0, 0, 0, 0.18);
	}

	& .ssg-flowchart__node[data-visited="true"]:not([aria-current="step"]) {
		/* Visited: warmer, slightly darker brass (still same 3D token) */
		--ssg-node-rim-top: rgba(250, 204, 21, 0.78);
		--ssg-node-rim-bot: rgba(245, 158, 11, 0.66);
		--ssg-node-rim-edge: rgba(250, 204, 21, 0.20);
		--ssg-node-parchment-a: #f4e6cd;
		--ssg-node-parchment-b: #e9d1a7;
		color: #1f1302;
		filter: saturate(0.96) contrast(1.02);
	}

	& .ssg-flowchart__node:hover:not([disabled]) {
		/* Lift + richer brass + iOS-style glow */
		transform: translate(-50%, calc(-50% - 2px)) scale(1.03);
		filter: brightness(1.04) saturate(1.08);
		border-color: rgba(250, 204, 21, 0.34);
		box-shadow:
			0 22px 44px rgba(0, 0, 0, 0.46),
			0 10px 22px rgba(0, 0, 0, 0.30),
			0 0 0 6px rgba(250, 204, 21, 0.08),
			inset 0 1px 0 rgba(255, 255, 255, 0.34),
			inset 0 -10px 22px rgba(0, 0, 0, 0.18);
	}

	& .ssg-flowchart__node:active:not([disabled]) {
		/* Press down */
		transform: translate(-50%, calc(-50% + 1px)) scale(0.99);
		filter: brightness(0.98) saturate(1);
		box-shadow:
			0 14px 26px rgba(0, 0, 0, 0.36),
			0 6px 12px rgba(0, 0, 0, 0.24),
			inset 0 1px 0 rgba(255, 255, 255, 0.24),
			inset 0 -12px 22px rgba(0, 0, 0, 0.22);
	}

	& .ssg-flowchart__node[disabled] {
		cursor: default;
		pointer-events: none;
		/* Disabled: pirate brown “locked wood” token (no opacity tricks) */
		background: linear-gradient(180deg, #8b552f, #5a3119);
		border-color: rgba(79, 37, 23, 0.38);
		box-shadow:
			0 10px 18px rgba(0, 0, 0, 0.26),
			0 4px 10px rgba(0, 0, 0, 0.18),
			inset 0 1px 0 rgba(255, 255, 255, 0.16),
			inset 0 -8px 18px rgba(0, 0, 0, 0.12);
		color: rgba(255, 255, 255, 0.92);
		filter: saturate(0.92) contrast(0.98) brightness(0.98);
	}

	& .ssg-flowchart__node[disabled]::before {
		/* wood grain + darker rim shadow to signal “locked” */
		background:
			radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 52%),
			radial-gradient(circle at 78% 78%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 60%),
			repeating-linear-gradient(115deg, rgba(79, 37, 23, 0.14) 0 3px, rgba(79, 37, 23, 0) 3px 7px);
		box-shadow:
			inset 0 2px 0 rgba(255, 255, 255, 0.18),
			inset 0 -14px 18px rgba(0, 0, 0, 0.24),
			inset 0 0 0 3px rgba(79, 37, 23, 0.22);
	}

	& .ssg-flowchart__node[disabled]::after {
		background:
			radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 52%),
			radial-gradient(circle at 70% 72%, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0) 58%),
			linear-gradient(180deg, #6f3f22, #4b2713);
		box-shadow:
			inset 0 2px 0 rgba(255, 255, 255, 0.16),
			inset 2px 2px 0 rgba(255, 255, 255, 0.08),
			inset 0 -10px 14px rgba(0, 0, 0, 0.26),
			inset -2px -2px 0 rgba(0, 0, 0, 0.18),
			0 0 0 2px rgba(0, 0, 0, 0.14);
		filter: none;
	}

	/* Newly unlocked node "appears" with a game-y pop */
	& .ssg-flowchart__node--appear {
		will-change: transform, opacity, box-shadow, filter;
		animation: ssgNodeAppear 820ms cubic-bezier(.2, .95, .25, 1) both;
	}

	/* Modal */
	& .ssg-flowchart__modal {
		position: fixed;
		inset: 0;
		z-index: 9999;
		display: grid;
		place-items: center;
		padding: 18px;
		/* Animate both open + close via JS-controlled state */
		opacity: 0;
		pointer-events: none;
		transition: opacity 220ms ease-out;
	}

	& .ssg-flowchart__modal[data-state="open"] {
		opacity: 1;
		pointer-events: auto;
	}

	& .ssg-flowchart__modal[data-state="closing"] {
		opacity: 0;
		pointer-events: none;
	}

	& .ssg-flowchart__modalBackdrop {
		position: absolute;
		inset: 0;
		/* Stormy sea / foggy night backdrop */
		background: #544741ed;
		opacity: 0;
		transition: opacity 220ms ease-out;
	}

	& .ssg-flowchart__modal[data-state="open"] .ssg-flowchart__modalBackdrop {
		opacity: 1;
	}

	& .ssg-flowchart__modalPanel {
		position: relative;
		z-index: 1;
		width: min(920px, 95vw, calc(100vw - 36px));
		max-height: min(95vh, calc(100vh - 36px));
		/* Avoid the annoying 1px “always scrollable” panel; only inner content scrolls. */
		overflow: hidden;
		/* iOS pirate app: carved wood frame + parchment interior */
		color: #1f1302;
		border-radius: 26px;
		padding: 18px;
		transform: translateY(18px) scale(0.98);
		opacity: 0;
		filter: blur(2px);
		transition:
			transform 320ms cubic-bezier(.2, .9, .2, 1),
			opacity 220ms ease-out,
			filter 260ms ease-out;
		box-shadow:
			/* overall lift */
			0 52px 140px rgba(0, 0, 0, 0.72),
			0 18px 46px rgba(0, 0, 0, 0.48),
			/* bevel: top highlight + bottom shade */
			inset 0 2px 0 rgba(255, 255, 255, 0.26),
			inset 0 -18px 26px rgba(0, 0, 0, 0.22),
			/* crisp inner edge (helps 3D separation) */
			inset 0 0 0 1px rgba(250, 204, 21, 0.10);
	}

	& .ssg-flowchart__modal[data-state="open"] .ssg-flowchart__modalPanel {
		transform: translateY(0px) scale(1);
		opacity: 1;
		filter: blur(0);
	}

	& .ssg-flowchart__modal[data-state="closing"] .ssg-flowchart__modalPanel {
		transform: translateY(10px) scale(0.985);
		opacity: 0;
		filter: blur(2px);
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__modalPanel {
			padding: 22px;
			border-radius: 28px;
		}
	}

	& .ssg-flowchart__modalPanel::before {
		/* 3D wooden bezel */
		content: "";
		position: absolute;
		inset: -10px;
		border-radius: 32px;
		z-index: -1;
		background:
			/* directional sheen so it reads as carved depth */
			radial-gradient(980px 560px at 22% 18%, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0) 58%),
			radial-gradient(880px 520px at 78% 82%, rgba(0, 0, 0, 0.30), rgba(0, 0, 0, 0) 60%),
			linear-gradient(135deg, #7a3f22, #4b2412);
		box-shadow:
			0 26px 70px rgba(0, 0, 0, 0.56),
			/* hard bevel edge */
			inset 0 2px 0 rgba(255, 255, 255, 0.14),
			inset 0 -18px 28px rgba(0, 0, 0, 0.42),
			inset 0 0 0 2px rgba(0, 0, 0, 0.18);
	}

	& .ssg-flowchart__modalPanel::after {
		/* Brass rim + rivets illusion */
		content: "";
		position: absolute;
		inset: 8px;
		border-radius: 20px;
		pointer-events: none;
		background:
			radial-gradient(circle at 12px 12px, rgba(250, 204, 21, 0.95) 0 2px, rgba(0, 0, 0, 0) 3px),
			radial-gradient(circle at calc(100% - 12px) 12px, rgba(250, 204, 21, 0.95) 0 2px, rgba(0, 0, 0, 0) 3px),
			radial-gradient(circle at 12px calc(100% - 12px), rgba(250, 204, 21, 0.95) 0 2px, rgba(0, 0, 0, 0) 3px),
			radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), rgba(250, 204, 21, 0.95) 0 2px, rgba(0, 0, 0, 0) 3px);
		box-shadow:
			/* rim thickness + shine */
			inset 0 0 0 2px rgba(250, 204, 21, 0.22),
			inset 0 2px 0 rgba(255, 255, 255, 0.18),
			inset 0 -10px 16px rgba(0, 0, 0, 0.22);
		opacity: 0.9;
	}

	& .ssg-flowchart__modalClose {
		position: absolute;
		top: 10px;
		right: 12px;
		width: 44px;
		height: 44px;
		border-radius: 999px;
		border: 1px solid rgba(250, 204, 21, 0.28);
		background:
			radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 55%),
			linear-gradient(180deg, rgba(250, 204, 21, 0.78), rgba(245, 158, 11, 0.72));
		color: rgba(31, 19, 2, 0.92);
		font-size: 22px;
		line-height: 1;
		cursor: pointer;
		box-shadow:
			0 14px 26px rgba(0, 0, 0, 0.30),
			inset 0 1px 0 rgba(255, 255, 255, 0.55),
			inset 0 -8px 16px rgba(0, 0, 0, 0.22);
		transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
	}

	& .ssg-flowchart__modalClose:hover {
		transform: translateY(-1px);
		filter: brightness(1.02) saturate(1.06);
		box-shadow:
			0 18px 34px rgba(0, 0, 0, 0.34),
			inset 0 1px 0 rgba(255, 255, 255, 0.55),
			inset 0 -8px 16px rgba(0, 0, 0, 0.22);
	}

	& .ssg-flowchart__modalClose:active {
		transform: translateY(0px) scale(0.98);
	}

	& .ssg-flowchart__modalClose:focus-visible {
		outline: 3px solid rgba(56, 189, 248, 0.55);
		outline-offset: 3px;
	}

	& .ssg-flowchart__soundBtn {
		/* Placement + sizing is shared globally (theme-agnostic) */
		appearance: none;
		border: 2px solid #764630;
		border-bottom-width: 5px;
		border-radius: 16px;
		background:
			radial-gradient(420px 240px at 18% 20%, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0) 60%),
			linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0)),
			linear-gradient(180deg, #e6c79a, #d9b07a);
		cursor: pointer;
		box-shadow:
			0 14px 26px rgba(0, 0, 0, 0.20),
			inset 0 1px 0 rgba(255, 255, 255, 0.35),
			inset 0 -10px 18px rgba(0, 0, 0, 0.12);
		transition: transform 140ms ease, filter 140ms ease;
	}

	& .ssg-flowchart__modalContent {
		/* Clean parchment area (no gradient stack) */
		border-radius: 18px;
		padding: 1rem;
		box-shadow: inset 0 0 0 1px rgba(31, 19, 2, 0.10);
		/* Scroll only when content exceeds the 95% modal cap. */
		max-height: calc(min(95vh, calc(100vh - 36px)) - 18px - 18px - 1rem - 1rem);
		overflow: auto;
	}

	& .ssg-flowchart__h {
		font-size: 2rem;
		letter-spacing: -0.01em;
		margin: 0 0 10px 0;
		/* Gold title */
		color: #facc15;
		text-shadow:
			0 2px 0 rgba(0, 0, 0, 0.18),
			0 1px 0 rgba(255, 255, 255, 0.24);
	}

	& .ssg-flowchart__p {
		margin: 0 0 14px 0;
		color: rgba(229, 184, 121, 0.82);
		font-size: 30px;
		font-weight: 600;
	}

	& .ssg-flowchart__grid {
		display: grid;
		grid-template-columns: 1fr;
		gap: 12px;
	}

	@media (min-width: 768px) {
		& .ssg-flowchart__grid {
			grid-template-columns: 1fr 1fr;
			gap: 14px;
		}
	}

	& .ssg-flowchart__story {
		display: block;
	}

	& .ssg-flowchart__cardTitle {
		font-weight: 900;
		margin: 0 0 6px 0;
	}

	& .ssg-flowchart__cardBody {
		margin: 0;
		color: rgba(31, 19, 2, 0.74);
	}

	& .ssg-flowchart__actions {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		margin-top: 14px;
	}

	& .ssg-flowchart__optionRow {
		display: flex;
		/* Stretch so the sound button matches the option button height */
		align-items: stretch;
		gap: 10px;
	}

	& .ssg-flowchart__optionRow > .ssg-flowchart__btn {
		flex: 1 1 auto;
	}

	& .ssg-flowchart__btnSound {
		flex: 0 0 auto;
		width: 44px;
		min-width: 44px;
		height: auto;
		align-self: stretch;
		padding: 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		text-align: center;
	}

	& .ssg-flowchart__soundBtn svg,
	& .ssg-flowchart__btnSound svg {
		width: 22px;
		height: 22px;
		display: block;
	}

	/* Modal option buttons: light wood + full width */
	& .ssg-flowchart__modal .ssg-flowchart__btn {
		appearance: none;
		border: 0;
		cursor: pointer;
		border-radius: 16px;
		padding: 12px 16px;
		font-weight: 900;
		width: 100%;
		text-align: left;
		background:
			radial-gradient(420px 240px at 18% 20%, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0) 60%),
			linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0)),
			linear-gradient(180deg, #e6c79a, #d9b07a);
		color: rgba(31, 19, 2, 0.92);
		box-shadow:
			0 14px 26px rgba(0, 0, 0, 0.20),
			inset 0 1px 0 rgba(255, 255, 255, 0.35),
			inset 0 -10px 18px rgba(0, 0, 0, 0.12);
		transition: transform 140ms ease, filter 140ms ease;
		border: 2px solid #764630;
		border-bottom-width: 5px;
	}

	/* Option sound button: same look as option button, icon-sized */
	& .ssg-flowchart__modal .ssg-flowchart__optionRow > .ssg-flowchart__btnSound {
		width: 63px;
		min-width: 63px;
		height: auto;
		align-self: stretch;
		text-align: center;
		padding: 0;
	}

	& .ssg-flowchart__modal .ssg-flowchart__btnPrimary {
		background:
			radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 56%),
			linear-gradient(180deg, #facc15, #f59e0b);
		color: rgba(31, 19, 2, 0.92);
		box-shadow:
			0 14px 26px rgba(0, 0, 0, 0.22),
			inset 0 1px 0 rgba(255, 255, 255, 0.55),
			inset 0 -10px 18px rgba(0, 0, 0, 0.14);
		max-width: 80%;
		text-align: center;
		cursor: pointer;
		margin: 20px auto;
	}

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__btnPrimary {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	& .ssg-flowchart__modal .ssg-flowchart__btnPrimary:hover {
		filter: brightness(1.01) saturate(1.04);
	}

	& .ssg-flowchart__audio {
		width: 100%;
		margin-top: 10px;
	}

	/* Game modal (server-rendered games/ components) */
	& .ssg-flowchart__gameModal {
		position: fixed;
		inset: 0;
		z-index: 10001;
		opacity: 0;
		pointer-events: none;
	}

	& .ssg-flowchart__gameModal[data-state="opening"],
	& .ssg-flowchart__gameModal[data-state="dark"],
	& .ssg-flowchart__gameModal[data-state="game"] {
		opacity: 1;
		pointer-events: auto;
	}

	& .ssg-flowchart__gameModal[data-state="closing"] {
		pointer-events: none;
	}

	& .ssg-flowchart__gameModalBackdrop {
		position: absolute;
		inset: 0;
		/* Must reach full black at end of fade */
		background: #000;
		opacity: 0;
		z-index: 2;
		/* Allow blocking clicks during black fade/hold */
		pointer-events: auto;
	}

	& .ssg-flowchart__gameModalPanel {
		position: absolute;
		inset: 0;
		background: #fff;
		overflow: auto;
		/* Keep white hidden until we've reached full black */
		opacity: 0;
		z-index: 1;
	}

	/* Allow smooth fade-out on close */
	& .ssg-flowchart__gameModalBackdrop,
	& .ssg-flowchart__gameModalPanel {
		transition: opacity 1000ms linear;
	}

	/* Phase 1: fade to full black in 0.75s, hold 0.25s */
	& .ssg-flowchart__gameModal[data-state="opening"] {
		animation: ssgGameModalIn 1000ms linear forwards;
	}
	& .ssg-flowchart__gameModal[data-state="opening"] .ssg-flowchart__gameModalBackdrop {
		animation: ssgGameBackdropIn 1000ms linear forwards;
	}
	& .ssg-flowchart__gameModal[data-state="opening"] .ssg-flowchart__gameModalPanel {
		opacity: 0;
	}

	/* Phase 1: black screen */
	& .ssg-flowchart__gameModal[data-state="dark"] .ssg-flowchart__gameModalBackdrop {
		opacity: 1;
	}
	& .ssg-flowchart__gameModal[data-state="dark"] .ssg-flowchart__gameModalPanel {
		opacity: 0;
	}

	/* Phase 2: fade to white + show game */
	& .ssg-flowchart__gameModal[data-state="game"] .ssg-flowchart__gameModalBackdrop {
		animation: ssgGameBackdropOut 1000ms linear forwards;
		/* Once game is revealed, don't block interactions */
		pointer-events: none;
	}
	& .ssg-flowchart__gameModal[data-state="game"] .ssg-flowchart__gameModalPanel {
		/* Reveal white instantly once we're fully black */
		opacity: 1;
	}

	/* Closing: fade whole overlay away */
	& .ssg-flowchart__gameModal[data-state="closing"] {
		animation: ssgGameModalOut 1000ms linear forwards;
	}
	& .ssg-flowchart__gameModal[data-state="closing"] .ssg-flowchart__gameModalBackdrop,
	& .ssg-flowchart__gameModal[data-state="closing"] .ssg-flowchart__gameModalPanel {
		opacity: 0;
	}

	& .ssg-flowchart__gameModalContent {
		width: 100vw;
		min-height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	& .ssg-flowchart__gameModalContent > [data-ssg-flowchart-game-instance] {
		width: 100%;
	}

	@media (prefers-reduced-motion: reduce) {

		& .ssg-flowchart__modalPanel,
		& .ssg-flowchart__modalBackdrop,
		& .ssg-flowchart__modal,
		& .ssg-flowchart__btn,
		& .ssg-flowchart__modalClose {
			transition: none !important;
		}

		& .ssg-flowchart__node--appear {
			animation: none !important;
		}
	}
}

/* Future theme (nested CSS). Entirely standalone from pirate theme. */
#game.theme-future,
#game.theme-fremtid {

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story {
		display: grid;
		grid-template-columns: calc(50% - 0.5rem) calc(50% - 0.5rem);
		gap: 1rem;
		align-items: start;
		width: 100%;
		max-width: 100%;
	}

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__modalText {
		align-self: center;
		text-align: center;
	}

	@media (max-width: 900px) {
		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story {
			display: flex;
			flex-direction: column;
			gap: 1rem;
		}

		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__modalText {
			order: 1;
		}

		& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__story .ssg-flowchart__card {
			order: 2;
		}
	}

	/* Theme tokens (consistent futuristic palette + contrast) */
	--f-bg-0: #020617;              /* page/backdrop base */
	--f-bg-1: rgba(2, 6, 23, 0.86); /* glass surfaces */
	--f-panel: rgba(15, 23, 42, 0.78);
	--f-border: rgba(148, 163, 184, 0.22);
	--f-text: rgba(240, 249, 255, 0.94);
	--f-text-dim: rgba(186, 230, 253, 0.82);
	--f-accent: rgba(34, 211, 238, 1);   /* cyan */
	--f-accent-2: rgba(167, 139, 250, 1);/* violet */
	--f-warn: rgba(251, 146, 60, 1);     /* orange for route emphasis */

	/* Page wrapper */
	&.ssg-flowchartPage {
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		overflow: hidden;
	}

	&.ssg-flowchartPage > .container {
		width: 100%;
		position: relative;
		z-index: 1;
	}

	/* Board: keep 16:9 fit, but add “glass frame” */
	& .ssg-flowchart__board {
		position: relative;
		--ssg-flowchart-board-vspace: max(5.5rem, calc(env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px) + 4.5rem));
		aspect-ratio: 16 / 9;
		width: min(100%, calc((100dvh - var(--ssg-flowchart-board-vspace)) * 16 / 9));
		max-width: 100%;
		max-height: calc(100dvh - var(--ssg-flowchart-board-vspace));
		height: auto;
		background-image: var(--ssg-flowchart-map, none);
		background-size: cover;
		background-position: center;
		background-repeat: no-repeat;
		overflow: hidden;
		min-height: 0;
		padding: 18px;
		border-radius: 18px;
		border: 1px solid rgba(34, 211, 238, 0.22);	
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__board {
			padding: 22px;
			border-radius: 22px;
		}
	}

	/* Layering */
	& .ssg-flowchart__path { z-index: 1; }
	& .ssg-flowchart__nodes { z-index: 2; }
	& .ssg-flowchart__token { z-index: 3; }

	/* Path */
	& .ssg-flowchart__path {
		pointer-events: none;
		position: absolute;
		inset: 0;
		overflow: hidden;
	}

	& .ssg-flowchart__pathSvg {
		width: 100%;
		height: 100%;
		display: block;
		overflow: hidden;
		/* Give the whole route a bit of depth */
		filter:
			drop-shadow(0 2px 0 rgba(2, 6, 23, 0.55))
			drop-shadow(0 0 10px rgba(34, 211, 238, 0.12));
	}

	& .ssg-flowchart__pathStroke {
		stroke: rgba(240, 249, 255, 0.90);
		stroke-width: 12;
		filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.16));
	}

	& .ssg-flowchart__routeDash {
		stroke: rgba(251, 146, 60, 0.98);
		stroke-width: 14;
		stroke-dasharray: 18 18;
		filter:
			drop-shadow(0 0 10px rgba(251, 146, 60, 0.22))
			drop-shadow(0 0 22px rgba(251, 146, 60, 0.12));
	}

	& .ssg-flowchart__pathEndRing,
	& .ssg-flowchart__pathEndX {
		/* Match the route dash so the "X marks the spot" is consistent */
		stroke: rgba(251, 146, 60, 0.98);
		filter:
			drop-shadow(0 0 10px rgba(251, 146, 60, 0.24))
			drop-shadow(0 0 20px rgba(251, 146, 60, 0.14));
	}

	& .ssg-flowchart__routeUnderlay {
		stroke: rgba(34, 211, 238, 0.22);
	}

	/* Nodes + token */
	& .ssg-flowchart__nodes {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
	}

	/* Token: “energy orb” (different from pirate coin) */
	& .ssg-flowchart__token {
		position: absolute;
		left: 0%;
		top: 50%;
		transform: translate(-50%, -50%);
		width: 44px;
		height: 44px;
		border-radius: 16px;
		background:
			radial-gradient(circle at 35% 30%, rgba(240, 249, 255, 0.92), rgba(240, 249, 255, 0.08) 55%),
			radial-gradient(circle at 70% 75%, rgba(167, 139, 250, 0.46), rgba(167, 139, 250, 0) 62%),
			linear-gradient(135deg, rgba(34, 211, 238, 0.92), rgba(15, 23, 42, 0.92));
		border: 1px solid rgba(34, 211, 238, 0.34);
		box-shadow:
			0 18px 40px rgba(2, 6, 23, 0.32),
			0 0 0 8px rgba(34, 211, 238, 0.12),
			0 0 28px rgba(34, 211, 238, 0.26),
			0 0 18px rgba(167, 139, 250, 0.18);
		transition: left 1600ms cubic-bezier(.2, .9, .25, 1), top 1600ms cubic-bezier(.2, .9, .25, 1), transform 1600ms cubic-bezier(.2, .9, .25, 1);
	}

	& .ssg-flowchart__token::after {
		content: "";
		position: absolute;
		inset: 7px;
		border-radius: 14px;
		background:
			radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
			radial-gradient(circle at 70% 75%, rgba(251, 146, 60, 0.22), rgba(251, 146, 60, 0) 60%);
		box-shadow: inset 0 0 0 1px rgba(240, 249, 255, 0.14);
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__token { width: 52px; height: 52px; border-radius: 18px; }
		& .ssg-flowchart__token::after { inset: 9px; border-radius: 16px; }
	}

	/* Toolbar */
	& .ssg-flowchart__toolbar {
		margin-top: 12px;
		display: flex;
		justify-content: center;
	}

	& .ssg-flowchart__btnReset {
		background: rgba(2, 6, 23, 0.22);
		color: var(--f-text);
		border: 1px solid rgba(34, 211, 238, 0.22);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	& .ssg-flowchart__btnReset:hover {
		background: rgba(34, 211, 238, 0.10);
	}

	/* Node buttons: “neon tiles” (not pirate tokens) */
	& .ssg-flowchart__node {
		position: absolute;
		overflow: visible;
		transform: translate(-50%, -50%);
		width: 46px;
		height: 46px;
		border-radius: 14px;
		background:
			radial-gradient(36px 22px at 30% 28%, rgba(240, 249, 255, 0.26), rgba(240, 249, 255, 0) 60%),
			linear-gradient(135deg, rgba(15, 23, 42, 0.80), rgba(2, 6, 23, 0.94));
		border: 1px solid rgba(34, 211, 238, 0.34);
		box-shadow:
			0 18px 40px rgba(2, 6, 23, 0.42),
			0 0 0 6px rgba(34, 211, 238, 0.10),
			inset 0 1px 0 rgba(240, 249, 255, 0.10);
		color: var(--f-text);
		display: inline-flex;
		align-items: center;
		justify-content: center;
		font-weight: 900;
		font-size: 16px;
		cursor: pointer;
		user-select: none;
		transition: transform 140ms cubic-bezier(.2, .9, .2, 1), box-shadow 140ms cubic-bezier(.2, .9, .2, 1), border-color 140ms ease, filter 140ms ease;
	}

	& .ssg-flowchart__node::before {
		content: "";
		position: absolute;
		inset: -1px;
		border-radius: 14px;
		pointer-events: none;
		background:
			linear-gradient(135deg, rgba(34, 211, 238, 0.42), rgba(34, 211, 238, 0) 58%),
			radial-gradient(circle at 70% 70%, rgba(167, 139, 250, 0.22), rgba(167, 139, 250, 0) 62%);
		opacity: 0.85;
	}

	& .ssg-flowchart__node::after {
		content: "";
		position: absolute;
		inset: 7px;
		border-radius: 10px;
		pointer-events: none;
		background:
			linear-gradient(135deg, rgba(167, 139, 250, 0.14), rgba(2, 6, 23, 0) 64%),
			radial-gradient(circle at 35% 30%, rgba(240, 249, 255, 0.20), rgba(240, 249, 255, 0) 55%);
		box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.10);
	}

	@media (min-width: 1024px) {
		& .ssg-flowchart__node { width: 54px; height: 54px; font-size: 18px; border-radius: 16px; }
		& .ssg-flowchart__node::before { border-radius: 16px; }
		& .ssg-flowchart__node::after { border-radius: 12px; }
	}

	& .ssg-flowchart__node[aria-current="step"] {
		border-color: rgba(34, 211, 238, 0.80);
		filter: brightness(1.06) saturate(1.10);
		box-shadow:
			0 22px 50px rgba(2, 6, 23, 0.50),
			0 0 0 9px rgba(34, 211, 238, 0.18),
			0 0 30px rgba(34, 211, 238, 0.28),
			0 0 22px rgba(167, 139, 250, 0.16),
			inset 0 1px 0 rgba(240, 249, 255, 0.14);
	}

	& .ssg-flowchart__node[data-visited="true"]:not([aria-current="step"]) {
		border-color: rgba(167, 139, 250, 0.36);
		filter: saturate(1.01);
	}

	& .ssg-flowchart__node:hover:not([disabled]) {
		transform: translate(-50%, calc(-50% - 2px)) scale(1.03);
		border-color: rgba(34, 211, 238, 0.70);
		box-shadow:
			0 24px 56px rgba(2, 6, 23, 0.52),
			0 0 0 8px rgba(34, 211, 238, 0.16),
			0 0 26px rgba(34, 211, 238, 0.22),
			0 0 18px rgba(167, 139, 250, 0.12);
	}

	& .ssg-flowchart__node:active:not([disabled]) {
		transform: translate(-50%, calc(-50% + 1px)) scale(0.99);
		filter: brightness(0.98);
	}

	& .ssg-flowchart__node[disabled] {
		cursor: default;
		pointer-events: none;
		background: linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(2, 6, 23, 0.72));
		border-color: rgba(148, 163, 184, 0.20);
		color: rgba(148, 163, 184, 0.92);
		box-shadow:
			0 14px 28px rgba(2, 6, 23, 0.30),
			inset 0 1px 0 rgba(240, 249, 255, 0.06);
		filter: none;
	}

	/* Future theme uses a different appear animation than pirate */
	& .ssg-flowchart__node--appear {
		will-change: transform, opacity, box-shadow, filter;
		animation: ssgNodeAppearFuture 820ms cubic-bezier(.2, .95, .25, 1) both;
	}

	/* Modal */
	& .ssg-flowchart__modal {
		position: fixed;
		inset: 0;
		z-index: 9999;
		display: grid;
		place-items: center;
		padding: 18px;
		opacity: 0;
		pointer-events: none;
		transition: opacity 220ms ease-out;
	}

	& .ssg-flowchart__modal[data-state="open"] { opacity: 1; pointer-events: auto; }
	& .ssg-flowchart__modal[data-state="closing"] { opacity: 0; pointer-events: none; }

	& .ssg-flowchart__modalBackdrop {
		position: absolute;
		inset: 0;
		/* Strong separation from the modal panel */
		background: rgba(2, 6, 23, 0.78);
		opacity: 0;
		transition: opacity 220ms ease-out;
	}

	& .ssg-flowchart__modal[data-state="open"] .ssg-flowchart__modalBackdrop { opacity: 1; }

	& .ssg-flowchart__modalPanel {
		position: relative;
		z-index: 1;
		width: min(920px, 95vw, calc(100vw - 36px));
		max-height: min(95vh, calc(100vh - 36px));
		overflow: hidden;
		color: var(--f-text);
		border-radius: 22px;
		padding: 16px;
		transform: translateY(14px) scale(0.985);
		opacity: 0;
		filter: blur(2px);
		transition: transform 320ms cubic-bezier(.2, .9, .2, 1), opacity 220ms ease-out, filter 260ms ease-out;
		background:
			radial-gradient(900px 520px at 18% 18%, rgba(34, 211, 238, 0.22), rgba(0, 0, 0, 0) 60%),
			radial-gradient(700px 420px at 88% 22%, rgba(167, 139, 250, 0.18), rgba(0, 0, 0, 0) 62%),
			linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
		border: 1px solid rgba(34, 211, 238, 0.42);
		box-shadow:
			0 70px 180px rgba(2, 6, 23, 0.66),
			0 22px 54px rgba(2, 6, 23, 0.40),
			0 0 0 1px rgba(34, 211, 238, 0.22),
			0 0 54px rgba(34, 211, 238, 0.16),
			0 0 40px rgba(167, 139, 250, 0.12);
	}

	& .ssg-flowchart__modal[data-state="open"] .ssg-flowchart__modalPanel {
		transform: translateY(0px) scale(1);
		opacity: 1;
		filter: blur(0);
	}

	& .ssg-flowchart__modal[data-state="closing"] .ssg-flowchart__modalPanel {
		transform: translateY(10px) scale(0.985);
		opacity: 0;
		filter: blur(2px);
	}

	& .ssg-flowchart__modalClose {
		position: absolute;
		top: 10px;
		right: 12px;
		width: 44px;
		height: 44px;
		border-radius: 14px;
		border: 1px solid rgba(34, 211, 238, 0.22);
		background: rgba(2, 6, 23, 0.20);
		color: var(--f-text);
		font-size: 22px;
		line-height: 1;
		cursor: pointer;
		box-shadow: 0 14px 26px rgba(2, 6, 23, 0.38), inset 0 1px 0 rgba(240, 249, 255, 0.08);
		transition: transform 140ms ease, filter 140ms ease;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	& .ssg-flowchart__modalClose:hover { transform: translateY(-1px); filter: brightness(1.05) saturate(1.05); }
	& .ssg-flowchart__modalClose:active { transform: translateY(0px) scale(0.98); }
	& .ssg-flowchart__modalClose:focus-visible { outline: 3px solid rgba(34, 211, 238, 0.55); outline-offset: 3px; }

	/* Sound button (placement is global; theme provides visual style) */
	& .ssg-flowchart__soundBtn {
		appearance: none;
		border-radius: 16px;
		border: 1px solid rgba(34, 211, 238, 0.34);
		border-bottom-width: 4px;
		background:
			radial-gradient(520px 300px at 18% 20%, rgba(240, 249, 255, 0.22), rgba(240, 249, 255, 0) 62%),
			radial-gradient(520px 320px at 85% 88%, rgba(167, 139, 250, 0.14), rgba(167, 139, 250, 0) 62%),
			linear-gradient(180deg, rgba(30, 41, 59, 0.62), rgba(15, 23, 42, 0.58));
		color: var(--f-text);
		cursor: pointer;
		box-shadow:
			0 18px 36px rgba(2, 6, 23, 0.34),
			0 0 0 8px rgba(34, 211, 238, 0.10),
			0 0 26px rgba(34, 211, 238, 0.16),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.28);
		transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	& .ssg-flowchart__soundBtn svg,
	& .ssg-flowchart__soundBtn svg * {
		stroke: rgba(255, 255, 255, 0.98);
	}

	& .ssg-flowchart__soundBtn:hover {
		transform: translateY(-1px);
		filter: brightness(1.05) saturate(1.05);
		border-color: rgba(34, 211, 238, 0.50);
		box-shadow:
			0 22px 46px rgba(2, 6, 23, 0.38),
			0 0 0 9px rgba(34, 211, 238, 0.14),
			0 0 34px rgba(34, 211, 238, 0.18),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.28);
	}

	& .ssg-flowchart__soundBtn:active {
		transform: translateY(0px) scale(0.98);
		filter: brightness(0.99);
	}

	& .ssg-flowchart__soundBtn svg {
		color: rgba(255, 255, 255, 0.98);
		fill: rgba(255, 255, 255, 0.98);
		filter:
			drop-shadow(0 0 8px rgba(34, 211, 238, 0.22))
			drop-shadow(0 0 16px rgba(167, 139, 250, 0.10));
	}

	& .ssg-flowchart__soundBtn:focus-visible { outline: 3px solid rgba(34, 211, 238, 0.55); outline-offset: 3px; }

	& .ssg-flowchart__modalContent {
		border-radius: 16px;
		padding: 1rem;
		box-shadow:
			inset 0 0 0 1px rgba(34, 211, 238, 0.18),
			inset 0 0 0 999px rgba(240, 249, 255, 0.06);
		max-height: calc(min(95vh, calc(100vh - 36px)) - 16px - 16px - 1rem - 1rem);
		overflow: auto;
		background: rgba(15, 23, 42, 0.55);
	}

	& .ssg-flowchart__h {
		font-size: 2rem;
		letter-spacing: -0.01em;
		margin: 0 0 10px 0;
		color: rgba(240, 249, 255, 0.96);
		text-shadow:
			0 0 22px rgba(34, 211, 238, 0.22),
			0 0 18px rgba(167, 139, 250, 0.14);
	}

	& .ssg-flowchart__p {
		margin: 0 0 14px 0;
		color: var(--f-text-dim);
		font-size: 28px;
		font-weight: 650;
	}

	& .ssg-flowchart__grid {
		display: grid;
		grid-template-columns: 1fr;
		gap: 12px;
	}

	@media (min-width: 768px) {
		& .ssg-flowchart__grid {
			grid-template-columns: 1fr 1fr;
			gap: 14px;
		}
	}

	& .ssg-flowchart__cardBody { margin: 0; color: rgba(226, 232, 240, 0.82); }

	/* Option rows (button + sound button aligned right) */
	& .ssg-flowchart__optionRow {
		display: flex;
		align-items: stretch;
		gap: 10px;
	}

	& .ssg-flowchart__optionRow > .ssg-flowchart__btn {
		flex: 1 1 auto;
	}

	& .ssg-flowchart__btnSound {
		flex: 0 0 auto;
		width: 44px;
		min-width: 44px;
		height: auto;
		align-self: stretch;
		padding: 0;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		text-align: center;
	}

	& .ssg-flowchart__btnSound svg,
	& .ssg-flowchart__btnSound svg * {
		width: 22px;
		height: 22px;
		display: block;
		color: rgba(255, 255, 255, 0.98);
		fill: rgba(255, 255, 255, 0.98);
		stroke: rgba(255, 255, 255, 0.98);
	}

	/* Modal buttons */
	& .ssg-flowchart__modal .ssg-flowchart__btn {
		appearance: none;
		cursor: pointer;
		border-radius: 16px;
		padding: 12px 16px;
		font-weight: 900;
		width: 100%;
		text-align: left;
		color: var(--f-text);
		background:
			radial-gradient(520px 300px at 18% 20%, rgba(240, 249, 255, 0.20), rgba(240, 249, 255, 0) 62%),
			radial-gradient(520px 320px at 85% 88%, rgba(167, 139, 250, 0.12), rgba(167, 139, 250, 0) 62%),
			linear-gradient(180deg, rgba(30, 41, 59, 0.56), rgba(15, 23, 42, 0.50));
		border: 1px solid rgba(34, 211, 238, 0.26);
		border-bottom-width: 4px;
		box-shadow:
			0 18px 36px rgba(2, 6, 23, 0.30),
			0 0 0 8px rgba(34, 211, 238, 0.08),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.26);
		transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	/* Option sound button: same "future button" look, icon-sized */
	& .ssg-flowchart__modal .ssg-flowchart__btnSound {
		appearance: none;
		cursor: pointer;
		border-radius: 16px;
		padding: 12px 16px;
		font-weight: 900;
		text-align: center;
		color: var(--f-text);
		background:
			radial-gradient(520px 300px at 18% 20%, rgba(240, 249, 255, 0.20), rgba(240, 249, 255, 0) 62%),
			radial-gradient(520px 320px at 85% 88%, rgba(167, 139, 250, 0.12), rgba(167, 139, 250, 0) 62%),
			linear-gradient(180deg, rgba(30, 41, 59, 0.56), rgba(15, 23, 42, 0.50));
		border: 1px solid rgba(34, 211, 238, 0.26);
		border-bottom-width: 4px;
		box-shadow:
			0 18px 36px rgba(2, 6, 23, 0.30),
			0 0 0 8px rgba(34, 211, 238, 0.08),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.26);
		transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	& .ssg-flowchart__modal .ssg-flowchart__btnSound:hover {
		transform: translateY(-1px);
		filter: brightness(1.04) saturate(1.04);
		border-color: rgba(34, 211, 238, 0.40);
		box-shadow:
			0 22px 46px rgba(2, 6, 23, 0.34),
			0 0 0 9px rgba(34, 211, 238, 0.12),
			0 0 28px rgba(34, 211, 238, 0.14),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.26);
	}

	& .ssg-flowchart__modal .ssg-flowchart__btnSound:active {
		transform: translateY(0px) scale(0.99);
		filter: brightness(0.99);
	}

	& .ssg-flowchart__modal .ssg-flowchart__optionRow > .ssg-flowchart__btnSound {
		width: 63px;
		min-width: 63px;
		height: auto;
		align-self: stretch;
		text-align: center;
		padding: 0;
	}

	& .ssg-flowchart__modal .ssg-flowchart__btn:hover {
		transform: translateY(-1px);
		filter: brightness(1.04) saturate(1.04);
		border-color: rgba(34, 211, 238, 0.40);
		box-shadow:
			0 22px 46px rgba(2, 6, 23, 0.34),
			0 0 0 9px rgba(34, 211, 238, 0.12),
			0 0 28px rgba(34, 211, 238, 0.14),
			inset 0 1px 0 rgba(240, 249, 255, 0.18),
			inset 0 -12px 18px rgba(2, 6, 23, 0.26);
	}

	& .ssg-flowchart__modal .ssg-flowchart__btn:active {
		transform: translateY(0px) scale(0.99);
		filter: brightness(0.99);
	}

	& .ssg-flowchart__modal .ssg-flowchart__btnPrimary {
		background:
			radial-gradient(520px 300px at 18% 20%, rgba(240, 249, 255, 0.26), rgba(240, 249, 255, 0) 62%),
			linear-gradient(135deg, rgba(34, 211, 238, 0.44), rgba(167, 139, 250, 0.30));
		border-color: rgba(34, 211, 238, 0.56);
		max-width: 80%;
		text-align: center;
		margin: 20px auto;
	}

	& .ssg-flowchart__modalContent--hasImage .ssg-flowchart__btnPrimary {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	/* Game modal: keep it as a simple white overlay */
	& .ssg-flowchart__gameModal {
		position: fixed;
		inset: 0;
		z-index: 10001;
		opacity: 0;
		pointer-events: none;
		transition: opacity 220ms ease-out;
	}

	& .ssg-flowchart__gameModal[data-state="opening"],
	& .ssg-flowchart__gameModal[data-state="dark"],
	& .ssg-flowchart__gameModal[data-state="game"] {
		opacity: 1;
		pointer-events: auto;
	}

	& .ssg-flowchart__gameModal[data-state="closing"] {
		opacity: 0;
		pointer-events: none;
	}

	& .ssg-flowchart__gameModalBackdrop,
	& .ssg-flowchart__gameModalPanel {
		position: absolute;
		inset: 0;
		background: #fff;
		opacity: 1;
	}

	& .ssg-flowchart__gameModalPanel {
		overflow: auto;
	}

	& .ssg-flowchart__gameModalContent {
		width: 100vw;
		min-height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	& .ssg-flowchart__gameModalContent > [data-ssg-flowchart-game-instance] {
		width: 100%;
	}

	@media (prefers-reduced-motion: reduce) {
		& .ssg-flowchart__modalPanel,
		& .ssg-flowchart__modalBackdrop,
		& .ssg-flowchart__modal,
		& .ssg-flowchart__btn,
		& .ssg-flowchart__modalClose {
			transition: none !important;
		}

		& .ssg-flowchart__node--appear {
			animation: none !important;
		}
	}
}

@keyframes ssgNodeAppearFuture {
	0% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.72);
		filter: brightness(1.08) saturate(1.08) blur(0.6px);
		box-shadow:
			inset 0 1px 0 rgba(240, 249, 255, 0.10),
			0 0 0 0 rgba(34, 211, 238, 0),
			0 10px 18px rgba(2, 6, 23, 0.40);
	}

	22% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.18);
		filter: brightness(1.03) saturate(1.06) blur(0px);
		box-shadow:
			inset 0 1px 0 rgba(240, 249, 255, 0.12),
			0 0 0 12px rgba(34, 211, 238, 0.20),
			0 0 22px rgba(167, 139, 250, 0.12),
			0 18px 30px rgba(2, 6, 23, 0.34);
	}

	40% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(0.96);
		filter: blur(0px);
		box-shadow:
			inset 0 1px 0 rgba(240, 249, 255, 0.10),
			0 0 0 8px rgba(34, 211, 238, 0.14),
			0 14px 24px rgba(2, 6, 23, 0.30);
	}

	70% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(0.99);
		box-shadow:
			inset 0 1px 0 rgba(240, 249, 255, 0.10),
			0 0 0 6px rgba(34, 211, 238, 0.10),
			0 12px 22px rgba(2, 6, 23, 0.28);
	}

	100% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
		filter: blur(0px);
		box-shadow:
			inset 0 1px 0 rgba(240, 249, 255, 0.10),
			0 10px 18px rgba(2, 6, 23, 0.32);
	}
}

@keyframes ssgNodeAppear {
	0% {
		opacity: 0;
		transform: translate(-50%, -50%) scale(0.72);
		filter: brightness(1.08) saturate(1.08) blur(0.6px);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 0 rgba(250, 204, 21, 0),
			0 10px 18px rgba(0, 0, 0, 0.35);
	}

	22% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.18);
		filter: brightness(1.03) saturate(1.04) blur(0px);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 12px rgba(250, 204, 21, 0.20),
			0 18px 30px rgba(0, 0, 0, 0.28);
	}

	40% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(0.96);
		filter: blur(0px);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 8px rgba(250, 204, 21, 0.14),
			0 14px 24px rgba(0, 0, 0, 0.26);
	}

	56% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.10);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 10px rgba(250, 204, 21, 0.16),
			0 16px 28px rgba(0, 0, 0, 0.26);
	}

	70% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(0.99);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 6px rgba(250, 204, 21, 0.10),
			0 12px 22px rgba(0, 0, 0, 0.24);
	}

	82% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1.04);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 0 0 5px rgba(250, 204, 21, 0.08),
			0 12px 22px rgba(0, 0, 0, 0.22);
	}

	100% {
		opacity: 1;
		transform: translate(-50%, -50%) scale(1);
		filter: blur(0px);
		box-shadow:
			inset 2px 2px 0 #fff1d4,
			inset -2px -2px 0 #9a6a3a,
			0 10px 18px rgba(0, 0, 0, 0.30);
	}
}

/* Game modal animations must be top-level (not nested). */
@keyframes ssgGameModalIn {
	0% { opacity: 0; }
	75% { opacity: 1; }
	100% { opacity: 1; }
}

@keyframes ssgGameBackdropIn {
	0% { opacity: 0; }
	75% { opacity: 1; }
	100% { opacity: 1; }
}

@keyframes ssgGameBackdropOut {
	0% { opacity: 1; }
	100% { opacity: 0; }
}

@keyframes ssgGamePanelIn {
	0% { opacity: 0; }
	100% { opacity: 1; }
}

@keyframes ssgGameModalOut {
	0% { opacity: 1; }
	100% { opacity: 0; }
}