/* Beginner path board. Colour, type and radius come from the --lg-* tokens in
   category-index4.css so the board matches the category index and inherits its
   dark theme. The terrain artwork (boards/<lang>.svg) keeps its own palette;
   it is a picture, not chrome. */

html, body {
	margin: 0;
	background: var(--lg-page, #fff);
	color: var(--lg-text);
	font-family: Montserrat, Arial, sans-serif;
}
a { color: var(--lg-blue); }
#header2 .header2-lang { text-decoration: none; }
#header2 .header2-lang:hover { color: #fff; text-decoration: underline; }

/* ---- stand-in header ---- */
.board-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 56px;
	padding: 0 20px;
	background: var(--lg-ink);
	color: #fff;
	font-size: 15px;
}
.board-brand { color: #fff; font-weight: 800; text-decoration: none; letter-spacing: .01em; }
.board-back { color: rgba(255, 255, 255, .72); text-decoration: none; font-size: 13px; }
.board-back:hover { color: #fff; text-decoration: underline; }

/* ---- layout ---- */
.board {
	max-width: 820px;
	margin: 0 auto;
	padding: 24px 20px 56px;
}

/* ---- band: title, progress, continue ---- */
.board-band {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--lg-line);
}
.board-region {
	margin: 0 0 4px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--lg-text-muted);
}
.board-title {
	margin: 0;
	font-size: 30px;
	font-weight: 600;
	letter-spacing: -.01em;
	line-height: 1.1;
}
.board-band-progress {
	display: flex;
	align-items: center;
	gap: 18px;
	flex: 1 1 280px;
	justify-content: flex-end;
}
.board-progress {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 150px;
	flex: 0 1 220px;
}
.board-progress-count {
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	color: var(--lg-text-muted);
	white-space: nowrap;
}
.board-progress-bar {
	flex: 1;
	height: 6px;
	border-radius: 3px;
	background: var(--lg-line);
	overflow: hidden;
}
.board-progress-bar > span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--lg-blue);
	border-radius: 3px;
	transition: width .4s ease;
}
.board-continue {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 18px;
	border-radius: 999px;
	background: var(--lg-blue);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.board-continue:hover { filter: brightness(1.08); }
.board-continue:focus-visible,
.board-toggle button:focus-visible,
.board-stop a:focus-visible,
.board-list a:focus-visible {
	outline: 3px solid var(--lg-blue);
	outline-offset: 3px;
}
:root[data-theme="dark"] .board-continue { color: var(--lg-page); }

/* ---- view toggle ---- */
.board-tools {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	flex-wrap: wrap;
	margin: 14px 0;
}
.board-level {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 9px;
}
.board-toggle {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--lg-line);
	border-radius: 999px;
}
.board-toggle button {
	appearance: none;
	border: 0;
	border-radius: 999px;
	padding: 6px 14px;
	background: none;
	color: var(--lg-text-muted);
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}
.board-toggle button[aria-pressed="true"] {
	background: var(--lg-surface);
	color: var(--lg-text);
	font-weight: 600;
}

/* ---- first visit: a tip pointing at Beginner (levelHint in board.js) ----
   One line in a small bubble under the level switch, its tail at the Beginner
   button (beside the switch on wide screens, so the map keeps its height),
   and a ring on the button that pulses three times and then stays. */
.board-hint {
	position: relative;
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 3px 4px 3px 12px;
	border-radius: 10px;
	background: var(--lg-surface);
	color: var(--lg-text);
	font-size: 13px;
	line-height: 1.3;
	animation: board-hint-in .45s ease .25s both;
}
.board-hint[hidden] { display: none; }
.board-hint::before {
	content: "";
	position: absolute;
	left: 40px;
	top: -4px;
	width: 10px;
	height: 10px;
	border-radius: 2px;
	background: inherit;
	transform: rotate(45deg);
}
.board-hint strong { font-weight: 600; }
.board-hint button {
	appearance: none;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--lg-text-muted);
	font: inherit;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
}
.board-hint button:hover { background: var(--lg-hover); color: var(--lg-text); }
.board-hint button:focus-visible { outline: 2px solid var(--lg-blue); outline-offset: 1px; }
.board-toggle button.is-nudged {
	position: relative;
	color: var(--lg-text);
	box-shadow: inset 0 0 0 1.5px var(--lg-blue);
}
.board-toggle button.is-nudged::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px solid var(--lg-blue);
	border-radius: inherit;
	opacity: 0;
	pointer-events: none;
	animation: board-nudge 1.7s ease-out .9s 3;
}
@keyframes board-hint-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: none; }
}
@keyframes board-hint-in-wide {
	from { opacity: 0; transform: translateX(-4px); }
	to { opacity: 1; transform: none; }
}
@keyframes board-nudge {
	0% { opacity: .75; transform: none; }
	100% { opacity: 0; transform: scale(1.3, 1.75); }
}
@media (prefers-reduced-motion: reduce) {
	.board-hint, .board-toggle button.is-nudged::after { animation: none; }
}

/* ---- regions ---- */
.board-region-block + .board-region-block { margin-top: 30px; }
.board-region-title {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
}
.board-lists .board-region-title { margin-top: 26px; }
.board-lists .board-region-title:first-child { margin-top: 0; }
.board-region-kicker {
	font-size: 12px;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--lg-text-muted);
}
.board-region-count {
	margin-left: auto;
	font-size: 13px;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	color: var(--lg-text-muted);
}

/* ---- map ---- */
.board-map {
	position: relative;
	width: 100%;
	aspect-ratio: 720 / 1350;      /* overwritten from the data file */
	border-radius: 120px 120px 28px 28px;
	overflow: hidden;
	background: #eaf0dd;           /* matches the terrain ground so edges never show */
}
.board-terrain, .board-terrain svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.board-art {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.board-art img {
	position: absolute;
	height: auto;
}
.board-stops {
	list-style: none;
	margin: 0;
	padding: 0;
}
.board-stop {
	position: absolute;
	transform: translate(-50%, -50%);
	width: 160px;
}
.board-stop a {
	display: flex;
	flex-direction: column;
	align-items: center;
	color: var(--lg-text);
	text-decoration: none;
}
.board-stone {
	display: grid;
	place-items: center;
	width: 54px;
	height: 54px;
	border: 5px solid #fbfcf3;
	border-radius: 50%;
	background: #bfcda7;
	color: #2d3f33;
	box-shadow: 0 5px 0 #9cac89, 0 8px 15px rgba(86, 114, 58, .12);
	font-size: 19px;
	font-weight: 600;
	transition: transform .15s ease;
}
.board-stop a:hover .board-stone { transform: translateY(-4px); }
.board-stop.is-done .board-stone { background: #477659; color: #fff; box-shadow: 0 5px 0 #325b41; }
.board-stop.is-next .board-stone { background: #dd8050; color: #fff; box-shadow: 0 5px 0 #b95f35, 0 0 0 8px rgba(233, 181, 138, .35); }
.board-stone svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.board-stop-title {
	margin-top: 9px;
	padding: 5px 10px;
	border-radius: 7px;
	background: rgba(248, 250, 239, .93);
	color: #273e35;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}
/* Native name over the English title (titleHtml in board.js). */
.board-stop-title:has(.board-native) {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1.2;
}
.board-native { font-size: 14px; font-weight: 600; }
.board-native rt { font-size: 9px; font-weight: 400; color: #4d6358; }
.board-en { font-size: 11px; font-weight: 500; color: #4d6358; }
.board-row-title { display: flex; flex-direction: column; line-height: 1.25; }
.board-row-title .board-native { font-size: 16px; }
.board-row-title .board-native rt { font-size: 9px; color: var(--lg-text-muted); }
.board-row-title .board-en { font-size: 13px; font-weight: 400; color: var(--lg-text-muted); }

/* With intermediate stops spaced along the trail the stones sit closer together;
   alternate the label side so neighbours do not stack. */
.board-stop.is-dense .board-stone { width: 46px; height: 46px; font-size: 16px; }
.board-stop.is-dense a { flex-direction: row; gap: 8px; }
.board-stop.is-dense .board-stop-title { margin-top: 0; }
.board-stops .board-stop.is-dense:nth-child(odd) a { flex-direction: row-reverse; }
.board-stop.is-dense { width: auto; }
.board-stops .board-stop.is-dense:nth-child(odd) { transform: translate(calc(-100% + 23px), -50%); }
.board-stops .board-stop.is-dense:nth-child(even) { transform: translate(-23px, -50%); }

/* A label that would sit on a neighbouring stone moves to another side of its
   own stone (clearLabels in board.js); the stone stays on its spot.
   :nth-child(n) only lifts these above the dense odd/even rules. */
.board-stop { --stone-half: 27px; }
.board-stop.is-dense { --stone-half: 23px; }
.board-stops .board-stop:nth-child(n):is(.label-right, .label-left, .label-below) { width: auto; }
.board-stops .board-stop:nth-child(n):is(.label-right, .label-left) a { flex-direction: row; gap: 6px; }
.board-stops .board-stop:nth-child(n).label-left a { flex-direction: row-reverse; }
.board-stops .board-stop:nth-child(n).label-below a { flex-direction: column; gap: 0; }
.board-stops .board-stop:nth-child(n):is(.label-right, .label-left) .board-stop-title { margin-top: 0; }
.board-stops .board-stop:nth-child(n).label-below .board-stop-title { margin-top: 6px; }
.board-stops .board-stop:nth-child(n).label-right { transform: translate(calc(-1 * var(--stone-half)), -50%); }
.board-stops .board-stop:nth-child(n).label-left { transform: translate(calc(-100% + var(--stone-half)), -50%); }
.board-stops .board-stop:nth-child(n).label-below { transform: translate(-50%, calc(-1 * var(--stone-half))); }

/* ---- side trails: a winding sand footpath + small stones ----
   The path is a group board.js adds to the terrain under the main trail
   (sideLayer): an edge, the path over it, and a dotted line down its middle,
   in the lesson stones' sand so path and stones read as one thing against
   the green ground. Widths are in the terrain's viewBox units, as the main
   trail's are (26 and 17). */
.board-branches path {
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.board-branch-edge path { stroke: #b9a66b; stroke-width: 14; }
.board-branch-way path { stroke: #f7edc6; stroke-width: 9; }
.board-branch-dots path { stroke: #a48d4f; stroke-width: 2; stroke-dasharray: 2 8; }
.board-sides { list-style: none; margin: 0; padding: 0; }
/* The stone sits on the path; its label hangs under it, or goes over or beside
   it where that is clearer (drawBranches in board.js). */
.board-side {
	--side-half: 19px;
	position: absolute;
	transform: translate(-50%, calc(-1 * var(--side-half)));
}
.board-side a {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
}
.board-side.label-above { transform: translate(-50%, calc(-100% + var(--side-half))); }
.board-side.label-above a { flex-direction: column-reverse; }
.board-side.label-above .board-side-title { margin: 0 0 5px; }
.board-side.label-right { transform: translate(calc(-1 * var(--side-half)), -50%); }
.board-side.label-right a { flex-direction: row; }
.board-side.label-right .board-side-title { margin: 0 0 0 5px; }
.board-side.label-left { transform: translate(calc(-100% + var(--side-half)), -50%); }
.board-side.label-left a { flex-direction: row-reverse; }
.board-side.label-left .board-side-title { margin: 0 5px 0 0; }
.board-side-stone {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	box-sizing: border-box;
	border: 3px solid #fbfcf3;
	border-radius: 50%;
	background: #e6d9a8;
	color: #5b4a1c;
	box-shadow: 0 3px 0 #c4b57e;
	font-size: 14px;
	font-weight: 600;
	transition: transform .15s ease;
}
.board-side a:hover .board-side-stone { transform: translateY(-3px); }
.board-side.is-seen .board-side-stone,
.board-list .is-side.is-seen .board-side-stone { background: #8fae7b; color: #fff; box-shadow: 0 3px 0 #6d8c5b; }
.board-side-stone svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.board-side-title {
	margin-top: 5px;
	padding: 2px 7px;
	border-radius: 6px;
	background: rgba(248, 250, 239, .93);
	color: #5b4a1c;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}
.board-side a:focus-visible { outline: 3px solid var(--lg-blue); outline-offset: 3px; border-radius: 8px; }

/* list view: side lessons indented under their stop */
.board-list .is-side { margin-left: 34px; }
.board-list .is-side a { padding: 9px 14px; font-weight: 400; border-style: dashed; }
.board-list .is-side .board-stop-state { white-space: nowrap; }
.board-list .is-side .board-side-stone { width: 30px; height: 30px; font-size: 12px; border-width: 2px; box-shadow: none; }

/* ---- "More stations" (All) ---- */
/* category-index4.css makes every bare <section> a flex row, which put the
   title beside the list and kept the list one narrow column. */
.board-more { display: block; margin-top: 28px; }
.board-more[hidden] { display: none; }
.board-more-title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--lg-text-muted);
}
.board-stone-plain { background: var(--lg-line); box-shadow: none; border-color: transparent; }

/* ---- list view ---- */
.board-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 10px;
}
.board-lists { display: grid; gap: 10px; }
/* display: grid above wins over the UA [hidden] { display: none }, which is
   why the list was sitting under the map. */
.board-lists[hidden],
.board-maps[hidden],
.board-region-block[hidden] {
	display: none;
}
.board-list a {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 16px;
	border: 1px solid var(--lg-line);
	border-radius: var(--lg-radius);
	background: var(--lg-surface);
	color: var(--lg-text);
	text-decoration: none;
	font-weight: 600;
}
.board-list a:hover { background: var(--lg-surface-raised); border-color: var(--lg-line-strong); }
.board-list .board-stone { width: 40px; height: 40px; font-size: 14px; border-width: 3px; box-shadow: none; flex-shrink: 0; }
.board-list .board-stop-state { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--lg-text-muted); }
.board-list .is-next .board-stop-state { color: #c9683a; font-weight: 600; }

/* ---- phone ---- */
@media (max-width: 640px) {
	.board { padding: 18px 14px 40px; }
	.board-title { font-size: 24px; }
	.board-band { gap: 14px; }
	.board-band-progress { flex-basis: 100%; justify-content: space-between; }
	.board-map { border-radius: 80px 80px 23px 23px; }
	.board-stone { width: 46px; height: 46px; font-size: 16px; }
	.board-stop { width: 125px; --stone-half: 23px; }
	.board-stop-title { font-size: 11px; }
	.board-stop-title:has(.board-native) { padding: 3px 7px; line-height: 1.12; }
	.board-native { font-size: 11.5px; }
	.board-native rt { font-size: 7px; }
	.board-en { font-size: 9px; }
	/* Dense trail on a narrow map: smaller stones and tighter labels so
	   neighbouring stops along the path don't overlap. */
	.board-stop.is-dense { --stone-half: 17px; }
	.board-stop.is-dense .board-stone { width: 34px; height: 34px; font-size: 13px; border-width: 3px; }
	.board-stop.is-dense a { gap: 5px; }
	.board-stop.is-dense .board-stop-title { font-size: 10px; padding: 3px 7px; }
	.board-stop.is-dense .board-native { font-size: 10.5px; }
	.board-stop.is-dense .board-en { font-size: 8.5px; }
	.board-stops .board-stop.is-dense:nth-child(odd) { transform: translate(calc(-100% + 17px), -50%); }
	.board-stops .board-stop.is-dense:nth-child(even) { transform: translate(-17px, -50%); }
	.board-side { --side-half: 15px; }
	.board-side-stone { width: 30px; height: 30px; font-size: 12px; border-width: 2px; }
	/* A 375px map has no room for side labels between the main stones; the
	   numbered stones stay, and the list view carries the lesson names. */
	.board-side-title { display: none; }
	.board-list .is-side { margin-left: 22px; }
}

/* ---- side panel: markup is always there, shown on wide screens only ---- */
.board-panel { display: none; }

/* ---- "More stations" as a grid once there is room for columns ---- */
@media (min-width: 900px) {
	.board-more .board-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* ---- wide screens: regions on their side, one screen each. Keep the width
   in step with WIDE_MQ in board.js. The panel's own rules sit here too but it
   only appears from 1400px (next block); below that the map takes the full
   width, since stops on a map under about 1000px wide crowd each other. ---- */
@media (min-width: 1100px) {
	.board { max-width: 1480px; }
	/* never taller than the window: a region is one screen */
	.board-maps { max-width: max(1000px, calc((100vh - 110px) * 1.875)); }
	.board-lists { max-width: 860px; }

	/* the Beginner tip beside the level switch, its tail pointing left */
	.board-level { flex-direction: row; align-items: center; gap: 13px; }
	.board-hint { animation-name: board-hint-in-wide; }
	.board-hint::before { left: -4px; top: 50%; margin-top: -5px; }

	.board-region-block.is-wide .board-map { border-radius: 28px; }
	/* a long region's further pages follow like lines of text */
	.board-region-block + .board-region-block.is-continued { margin-top: 10px; }

	/* Stops on a turned map: stone on the trail, label under it (or over it,
	   or beside it: clearLabels), wrapping instead of running into the next
	   stop along. */
	.board-stop.is-wide {
		--stone-half: 26px;
		width: max-content;
		max-width: 140px;
		transform: translate(-50%, calc(-1 * var(--stone-half)));
	}
	.board-stop.is-wide .board-stone { width: 42px; height: 42px; font-size: 15px; }
	.board-stop.is-wide .board-stop-title {
		margin-top: 6px;
		white-space: normal;
		text-align: center;
		line-height: 1.2;
	}
	.board-stop.is-wide .board-stop-title:has(.board-native) { padding: 4px 8px; line-height: 1.15; }
	.board-stop.is-wide .board-native { font-size: 13px; }
	.board-stop.is-wide .board-en { font-size: 10.5px; }
	.board-stops .board-stop.is-wide.label-above a { flex-direction: column-reverse; }
	.board-stops .board-stop.is-wide.label-above .board-stop-title { margin: 0 0 6px; }
	.board-stops .board-stop.is-wide.label-above { transform: translate(-50%, calc(-100% + var(--stone-half))); }
	.board-stops .board-stop.is-wide:is(.label-right, .label-left) { width: max-content; max-width: 215px; }
	.board-stop.is-shown .board-stone { outline: 3px solid #2d3f33; outline-offset: 3px; }

	.board-panel-stop {
		padding: 18px;
		border: 1px solid var(--lg-line);
		border-radius: var(--lg-radius);
		background: var(--lg-surface);
	}
	.board-panel-name {
		display: flex;
		flex-direction: column;
		gap: 2px;
		margin: 0 0 6px;
		font-size: 22px;
		font-weight: 600;
		line-height: 1.2;
	}
	.board-panel-name .board-native { font-size: 22px; }
	.board-panel-name .board-native rt { font-size: 11px; color: var(--lg-text-muted); }
	.board-panel-name .board-en { font-size: 14px; font-weight: 400; color: var(--lg-text-muted); }
	.board-panel-state { margin: 0; font-size: 13px; color: var(--lg-text-muted); }
	.board-panel-state.is-next { color: #c9683a; font-weight: 600; }
	.board-panel-stop .board-continue { margin-top: 14px; }
	.board-panel-sub {
		margin: 20px 0 8px;
		font-size: 12px;
		font-weight: 600;
		letter-spacing: .12em;
		text-transform: uppercase;
		color: var(--lg-text-muted);
	}
	.board-panel .board-list { gap: 6px; }
	.board-panel .board-list .is-side { margin-left: 0; }
	.board-panel .board-list .is-side a { gap: 10px; padding: 8px 10px; font-size: 14px; background: none; }
	.board-panel .board-list .is-side .board-stop-state { display: none; }

	.board-panel-regions { margin-top: 22px; }
	.board-panel-regions ol { list-style: none; margin: 0; padding: 0; }
	.board-panel-regions a {
		display: grid;
		grid-template-columns: 1fr auto;
		gap: 6px 10px;
		padding: 9px 4px;
		color: var(--lg-text);
		text-decoration: none;
		font-size: 14px;
		font-weight: 600;
	}
	.board-panel-regions a:hover .board-panel-region-name { text-decoration: underline; }
	.board-panel-regions .board-progress-bar { grid-column: 1 / -1; flex: none; height: 4px; }
	.board-panel-regions a:focus-visible { outline: 3px solid var(--lg-blue); outline-offset: 2px; border-radius: 6px; }
}

@media (min-width: 1400px) {
	.board-layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 290px;
		gap: 28px;
		align-items: start;
	}
	.board-panel {
		display: block;
		position: sticky;
		top: 16px;
		max-height: calc(100vh - 32px);
		overflow-y: auto;
	}
}
