/* Quoridor: the Hedge Maze */
:root {
	--c0: #5cb4ff;
	--c1: #ff6f86;
	--c2: #ffc94a;
	--c3: #bb98ff;
	--ink: #fff7e6;
	--ink-soft: #d9e6d8;
	--ink-dim: #a9c2b4;
	--gold: #f0c46a;
	--gold-deep: #a8701f;
	--night: #0b231e;
	--panel: rgba(9, 32, 27, 0.78);
	--panel-line: rgba(240, 196, 106, 0.28);
	--groove: #0f2f27;
	--display: 'Cinzel Decorative', Georgia, serif;
	--text: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}
html,
body {
	margin: 0;
	height: 100%;
	overflow: hidden;
	background: var(--night);
	color: var(--ink);
	font-family: var(--text);
	-webkit-tap-highlight-color: transparent;
}
body {
	background:
		radial-gradient(ellipse at 50% 45%, rgba(8, 30, 25, 0.35) 0%, rgba(6, 22, 19, 0.78) 75%),
		url('assets/maze-bg.webp') center / cover no-repeat,
		var(--night);
}
@media (max-aspect-ratio: 4/5) {
	body {
		background:
			linear-gradient(180deg, rgba(6, 22, 19, 0.55), rgba(6, 22, 19, 0.35) 40%, rgba(6, 22, 19, 0.8)),
			url('assets/maze-bg-tall.webp') center top / cover no-repeat,
			var(--night);
	}
}
button,
input,
select {
	font: inherit;
	color: inherit;
}
button {
	cursor: pointer;
}
button:disabled {
	cursor: default;
}
:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 2px;
}
[hidden] {
	display: none !important;
}
.c0 {
	--pc: var(--c0);
}
.c1 {
	--pc: var(--c1);
}
.c2 {
	--pc: var(--c2);
}
.c3 {
	--pc: var(--c3);
}

/* ---------- frame ---------- */
#app {
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
}
.bar {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px max(12px, env(safe-area-inset-right)) 2px max(12px, env(safe-area-inset-left));
}
.brand {
	margin: 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: clamp(20px, 3.2vw, 28px);
	letter-spacing: 0.02em;
	color: var(--ink);
	text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.brand-q {
	color: var(--gold);
	font-weight: 900;
}
.bar-actions {
	display: flex;
	gap: 6px;
}
.icon-btn {
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 12px;
	border: 1px solid var(--panel-line);
	background: var(--panel);
	color: var(--ink);
	text-decoration: none;
	transition: background 0.15s, transform 0.1s;
}
.icon-btn:hover {
	background: rgba(24, 70, 58, 0.9);
}
.icon-btn:active {
	transform: scale(0.94);
}
.icon-btn svg,
.tool svg,
.seg-btn svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.icon-btn .mute {
	display: none;
}
.icon-btn.muted .mute {
	display: inline;
}
.icon-btn.muted .wave {
	display: none;
}

.stage {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
	gap: 14px;
	width: 100%;
	max-width: calc(340px + 100vh);
	margin: 0 auto;
	padding: 6px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.side {
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	justify-content: center;
}
.board-wrap {
	min-width: 0;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------- seats ---------- */
.seats {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.seat {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 16px;
	background: var(--panel);
	border: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.seat::before {
	content: '';
	position: absolute;
	left: 0;
	top: 12px;
	bottom: 12px;
	width: 4px;
	border-radius: 0 4px 4px 0;
	background: var(--pc);
	opacity: 0.35;
	transition: opacity 0.25s;
}
.seat.turn {
	border-color: var(--pc);
	box-shadow: 0 0 0 1px var(--pc), 0 0 22px var(--pc), 0 6px 18px rgba(0, 0, 0, 0.3);
	box-shadow: 0 0 0 1px var(--pc), 0 0 22px color-mix(in srgb, var(--pc) 45%, transparent), 0 6px 18px rgba(0, 0, 0, 0.3);
}
.seat.turn::before {
	opacity: 1;
}
.seat.won {
	border-color: var(--gold);
}
.seat-pawn {
	width: 40px;
	height: 40px;
}
.seat-pawn svg {
	width: 100%;
	height: 100%;
}
.seat-main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.seat-name {
	font-weight: 800;
	font-size: 16px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.seat-who {
	font-size: 12px;
	color: var(--ink-dim);
	font-weight: 700;
}
.tokens {
	display: flex;
	gap: 3px;
	margin-top: 3px;
	flex-wrap: wrap;
}
.tokens i {
	width: 12px;
	height: 5px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.12);
}
.tokens i.on {
	background: linear-gradient(#5fbf6e, #2d7f3e);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.seat-steps {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
	min-width: 38px;
}
.seat-steps b {
	font-size: 22px;
	font-weight: 900;
	color: var(--ink);
}
.seat-steps small {
	font-size: 10px;
	font-weight: 800;
	color: var(--ink-dim);
	text-transform: lowercase;
	margin-top: 3px;
}
.seat.thinking .seat-who::after {
	content: ' · thinking…';
	color: var(--pc);
}

/* ---------- status & controls ---------- */
.status {
	margin: 0;
	min-height: 2.6em;
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 800;
	font-size: 15px;
	line-height: 1.3;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.chip {
	display: inline-block;
	flex: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--pc, var(--gold));
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25), 0 0 10px var(--pc, transparent);
}
.dots i {
	display: inline-block;
	width: 4px;
	height: 4px;
	margin-left: 3px;
	border-radius: 50%;
	background: currentColor;
	animation: blink 1.2s infinite;
}
.dots i:nth-child(2) {
	animation-delay: 0.2s;
}
.dots i:nth-child(3) {
	animation-delay: 0.4s;
}
@keyframes blink {
	0%,
	100% {
		opacity: 0.2;
	}
	50% {
		opacity: 1;
	}
}
.link {
	background: none;
	border: 0;
	padding: 0 2px;
	color: var(--gold);
	text-decoration: underline;
	font-weight: 900;
}
.controls {
	display: flex;
	gap: 8px;
	align-items: stretch;
	transition: opacity 0.2s;
}
.controls.idle {
	opacity: 0.55;
}
.seg {
	flex: 1;
	display: flex;
	padding: 4px;
	gap: 4px;
	border-radius: 16px;
	background: var(--panel);
	border: 1px solid var(--panel-line);
}
.seg-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 10px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--ink-soft);
	font-weight: 800;
	font-size: 15px;
	white-space: nowrap;
	transition: background 0.18s, color 0.18s;
}
.seg-btn b {
	display: inline-grid;
	place-items: center;
	min-width: 22px;
	height: 22px;
	margin-left: 2px;
	padding: 0 5px;
	border-radius: 11px;
	background: rgba(255, 255, 255, 0.12);
	font-size: 13px;
}
.seg-btn.on {
	background: linear-gradient(180deg, #f6d47e, #d79f3c);
	color: #2a1a06;
	box-shadow: 0 2px 0 #8a5a17, 0 4px 12px rgba(0, 0, 0, 0.3);
}
.seg-btn.on b {
	background: rgba(42, 26, 6, 0.18);
}
.seg-btn:disabled {
	opacity: 0.45;
}
.tool {
	flex: none;
	width: 52px;
	display: grid;
	place-items: center;
	border-radius: 16px;
	border: 1px solid var(--panel-line);
	background: var(--panel);
	color: var(--ink);
	transition: transform 0.1s, background 0.15s;
}
.tool:active {
	transform: scale(0.94);
}
.tool:disabled {
	opacity: 0.35;
}
.tool.confirm {
	background: linear-gradient(180deg, #6fd68a, #2f9a51);
	border-color: #9af0b0;
	color: #06240f;
	animation: pop 0.25s ease-out;
}
.tool.confirm svg {
	stroke-width: 3;
}
#btn-rotate .ori {
	fill: currentColor;
	stroke: none;
	transform-origin: 12px 12px;
	transition: transform 0.2s;
}
#btn-rotate.v .ori {
	transform: rotate(90deg);
}
@media (pointer: fine) {
	/* with a mouse the hedge turns to follow the pointer */
	#btn-rotate {
		display: none;
	}
}
.mystats {
	margin: 0;
	font-size: 13px;
	color: var(--ink-dim);
	font-weight: 700;
	line-height: 1.5;
}
.mystats b {
	color: var(--ink);
}

/* ---------- board ---------- */
.board {
	--frame: 16px;
	position: relative;
	flex: none;
	padding: var(--frame);
	border-radius: calc(var(--frame) * 1.1);
	background:
		linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.25)),
		repeating-linear-gradient(90deg, #6b431d 0 7px, #5c3816 7px 13px, #70461f 13px 22px),
		#5c3816;
	box-shadow:
		inset 0 0 0 2px var(--gold),
		inset 0 0 0 5px #3a230d,
		0 0 0 2px rgba(240, 196, 106, 0.75),
		0 24px 50px rgba(0, 0, 0, 0.6),
		0 0 70px rgba(255, 181, 71, 0.16);
	touch-action: manipulation;
	user-select: none;
	-webkit-user-select: none;
}
.board.bump {
	animation: bump 0.22s ease-out;
}
@keyframes bump {
	40% {
		transform: translateY(2px) scale(0.997);
	}
}
.inner {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: 6px;
	background: var(--groove);
	box-shadow: inset 0 0 0 calc(var(--gap) * 0.25) var(--groove);
}
.app-wall-cursor .inner,
.wall-mode .inner {
	cursor: crosshair;
}
.tiles {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: repeat(9, var(--cell));
	grid-auto-rows: var(--cell);
	gap: var(--gap);
}
.tile {
	border-radius: 14%;
	background:
		linear-gradient(160deg, rgba(255, 250, 230, 0.18), rgba(80, 50, 10, 0.12)),
		url('assets/sandstone-tile.webp') center / cover,
		#d9b77b;
	box-shadow:
		inset 0 -2px 0 rgba(90, 58, 20, 0.35),
		inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.layer {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* goal edges: a coloured strip on the frame where each pawn is heading */
.goal {
	position: absolute;
	border-radius: 6px;
	background: var(--pc);
	opacity: 0.7;
	transition: opacity 0.3s, box-shadow 0.3s;
}
.goal.none {
	display: none;
}
.goal.active {
	opacity: 1;
	box-shadow: 0 0 14px var(--pc);
}
.goal-top,
.goal-bottom {
	left: calc(var(--frame) + 4px);
	right: calc(var(--frame) + 4px);
	height: calc(var(--frame) * 0.42);
}
.goal-top {
	top: calc(var(--frame) * 0.18);
}
.goal-bottom {
	bottom: calc(var(--frame) * 0.18);
}
.goal-left,
.goal-right {
	top: calc(var(--frame) + 4px);
	bottom: calc(var(--frame) + 4px);
	width: calc(var(--frame) * 0.42);
}
.goal-left {
	left: calc(var(--frame) * 0.18);
}
.goal-right {
	right: calc(var(--frame) * 0.18);
}

/* hedges */
.wall {
	position: absolute;
	z-index: 3;
	border-radius: 999px;
	background:
		radial-gradient(circle at 30% 30%, rgba(160, 230, 140, 0.55) 0 12%, transparent 13%) 0 0 / 9px 9px,
		radial-gradient(circle at 70% 60%, rgba(20, 70, 30, 0.5) 0 14%, transparent 15%) 0 0 / 7px 7px,
		linear-gradient(180deg, #58b866, #2c8040 55%, #1d5c2d);
	box-shadow:
		0 3px 0 #123d1d,
		0 5px 8px rgba(0, 0, 0, 0.5),
		inset 0 1px 1px rgba(220, 255, 200, 0.45);
}
.wall.v {
	background:
		radial-gradient(circle at 30% 30%, rgba(160, 230, 140, 0.55) 0 12%, transparent 13%) 0 0 / 9px 9px,
		radial-gradient(circle at 70% 60%, rgba(20, 70, 30, 0.5) 0 14%, transparent 15%) 0 0 / 7px 7px,
		linear-gradient(90deg, #58b866, #2c8040 55%, #1d5c2d);
}
.wall.by::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 34%;
	max-width: 9px;
	aspect-ratio: 1;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	background: radial-gradient(circle at 35% 35%, #fff 0 15%, var(--pc) 30%);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.wall.v.by::after {
	width: 34%;
	max-width: 9px;
}
.wall.h.by::after {
	width: auto;
	height: 34%;
	max-height: 9px;
}
.wall.fresh {
	animation: plant 0.32s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.wall.fresh::before {
	content: '';
	position: absolute;
	inset: -4px;
	border-radius: inherit;
	box-shadow: 0 0 0 2px rgba(255, 235, 160, 0.85), 0 0 14px rgba(255, 220, 120, 0.8);
	animation: glow 2.4s ease-out forwards;
}
@keyframes plant {
	0% {
		transform: scale(1.25);
		opacity: 0;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}
@keyframes glow {
	0%,
	60% {
		opacity: 1;
	}
	100% {
		opacity: 0.35;
	}
}
.wall.ghost {
	z-index: 6;
	opacity: 0.8;
	box-shadow: 0 0 0 2px var(--pc, #fff), 0 0 16px var(--pc, #fff);
	animation: breathe 1.3s ease-in-out infinite;
}
.wall.ghost.bad {
	background: repeating-linear-gradient(45deg, rgba(255, 90, 90, 0.85) 0 6px, rgba(150, 20, 30, 0.85) 6px 12px);
	box-shadow: 0 0 0 2px #ff6b6b, 0 0 14px rgba(255, 80, 80, 0.8);
}
@keyframes breathe {
	50% {
		opacity: 0.55;
	}
}
.shake {
	animation: shake 0.35s !important;
}
@keyframes shake {
	20%,
	60% {
		translate: -4px 0;
	}
	40%,
	80% {
		translate: 4px 0;
	}
}

/* pawns, move dots, trail */
.pawn,
.dot,
.trail {
	position: absolute;
	left: 0;
	top: 0;
}
.pawn {
	z-index: 5;
	transition: transform 0.28s cubic-bezier(0.3, 1.3, 0.5, 1);
	filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
}
.pawn.instant {
	transition: none;
}
.pawn svg,
.seat-pawn svg,
.result-pawn svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}
.pawn svg {
	transform: scale(1.14);
}
svg .sh {
	fill: rgba(0, 0, 0, 0.35);
}
svg .body {
	fill: var(--pc);
	stroke: rgba(255, 255, 255, 0.85);
	stroke-width: 1.6;
	paint-order: stroke;
}
svg .crown {
	fill: var(--gold);
	stroke: #7a4f12;
	stroke-width: 0.8;
	stroke-linejoin: round;
}
.pawn.turn svg {
	animation: bob 1.6s ease-in-out infinite;
}
.pawn.turn::before {
	content: '';
	position: absolute;
	inset: 8%;
	border-radius: 50%;
	background: radial-gradient(circle, var(--pc), transparent 70%);
	opacity: 0.7;
	background: radial-gradient(circle, color-mix(in srgb, var(--pc) 55%, transparent), transparent 70%);
	animation: halo 1.6s ease-in-out infinite;
}
.pawn.won svg {
	animation: hop 0.6s ease-in-out 3;
}
@keyframes bob {
	50% {
		transform: scale(1.14) translateY(-6%);
	}
}
@keyframes halo {
	50% {
		opacity: 0.5;
		transform: scale(1.1);
	}
}
@keyframes hop {
	50% {
		transform: scale(0.95) translateY(-18%);
	}
}
.dot {
	z-index: 4;
	display: grid;
	place-items: center;
}
.dot::after {
	content: '';
	width: 32%;
	height: 32%;
	border-radius: 50%;
	background: var(--pc);
	background: color-mix(in srgb, var(--pc) 70%, white);
	opacity: 0.75;
	box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18), 0 0 12px var(--pc);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 30%, transparent), 0 0 12px var(--pc);
	animation: soft 1.8s ease-in-out infinite;
}
.dot.jump::after {
	width: 26%;
	height: 26%;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 30%, transparent), 0 0 0 8px rgba(255, 255, 255, 0.12), 0 0 12px var(--pc);
}
.dot.nudge::after {
	animation: nudge 0.5s ease-out;
}
@keyframes soft {
	50% {
		opacity: 0.45;
		transform: scale(0.88);
	}
}
@keyframes nudge {
	40% {
		transform: scale(1.5);
		opacity: 1;
	}
}
.trail {
	z-index: 2;
	display: grid;
	place-items: center;
}
.trail::after {
	content: '';
	width: 56%;
	height: 56%;
	border-radius: 50%;
	border: 2px dashed var(--pc);
	opacity: 0.7;
}

/* ---------- toast ---------- */
.toast {
	position: fixed;
	left: 50%;
	top: 58px;
	z-index: 50;
	transform: translateX(-50%);
	max-width: min(92vw, 460px);
	padding: 12px 18px;
	border-radius: 14px;
	background: rgba(12, 36, 30, 0.96);
	border: 1px solid var(--panel-line);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
	font-weight: 800;
	font-size: 15px;
	text-align: center;
	animation: rise 0.2s ease-out;
}
.toast.bad {
	border-color: #ff8a8a;
}
@keyframes rise {
	from {
		transform: translate(-50%, 10px);
		opacity: 0;
	}
}
@keyframes pop {
	from {
		transform: scale(0.6);
	}
}

/* ---------- sheets ---------- */
.sheet {
	position: fixed;
	inset: 0;
	z-index: 40;
	display: grid;
	place-items: center;
	padding: 12px;
	background: rgba(4, 16, 13, 0.62);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	animation: fade 0.2s ease-out;
}
@keyframes fade {
	from {
		opacity: 0;
	}
}
.card {
	position: relative;
	width: min(100%, 440px);
	max-height: calc(100dvh - 24px);
	overflow: auto;
	padding: 22px 22px 20px;
	border-radius: 22px;
	background:
		radial-gradient(ellipse at 50% 0%, rgba(240, 196, 106, 0.16), transparent 60%),
		linear-gradient(170deg, #17463b, #0c2a23);
	border: 1px solid var(--panel-line);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 30px 70px rgba(0, 0, 0, 0.6);
	text-align: center;
	animation: up 0.28s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes up {
	from {
		transform: translateY(18px) scale(0.98);
		opacity: 0;
	}
}
.card-title {
	margin: 0 0 6px;
	font-family: var(--display);
	font-weight: 700;
	font-size: 26px;
	color: var(--gold);
	text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.card-lead {
	margin: 0 0 16px;
	color: var(--ink-soft);
	font-weight: 600;
	line-height: 1.4;
}
.tabs {
	display: flex;
	gap: 4px;
	padding: 4px;
	margin-bottom: 14px;
	border-radius: 14px;
	background: rgba(0, 0, 0, 0.25);
}
.tab {
	flex: 1;
	min-height: 42px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--ink-soft);
	font-weight: 800;
	font-size: 14px;
}
.tab.on {
	background: var(--ink);
	color: #173b31;
}
.pane {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: left;
}
.field {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 12px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.25);
	border: 1px solid rgba(255, 255, 255, 0.1);
}
.field input,
.four-row input,
.four-row select {
	flex: 1;
	min-width: 0;
	min-height: 46px;
	border: 0;
	background: transparent;
	font-weight: 700;
	font-size: 16px;
	outline: none;
}
.field:focus-within,
.four-row:focus-within {
	border-color: var(--gold);
}
input::placeholder {
	color: var(--ink-dim);
	opacity: 0.8;
}
.levels {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}
.level {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 12px 6px;
	border-radius: 14px;
	border: 2px solid rgba(255, 255, 255, 0.12);
	background: rgba(0, 0, 0, 0.2);
}
.level b {
	font-size: 16px;
}
.level small {
	font-size: 12px;
	color: var(--ink-dim);
	font-weight: 700;
}
.level.on {
	border-color: var(--gold);
	background: rgba(240, 196, 106, 0.14);
	box-shadow: 0 0 16px rgba(240, 196, 106, 0.25);
}
.four-rows {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.four-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 10px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.25);
	border: 1px solid rgba(255, 255, 255, 0.1);
}
.four-row select {
	flex: 0 1 auto;
	max-width: 52%;
	font-size: 14px;
	text-align: right;
}
.four-row select option {
	background: #10352c;
}
.hint {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--ink-dim);
	font-weight: 600;
}
.record {
	margin: 14px 0 0;
	font-size: 13px;
	color: var(--ink-dim);
	font-weight: 700;
}
.record:empty {
	display: none;
}
.record b {
	color: var(--ink);
}
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 14px;
	border: 1px solid var(--panel-line);
	background: rgba(0, 0, 0, 0.2);
	color: var(--ink);
	font-weight: 800;
	font-size: 15px;
	text-decoration: none;
}
.btn.primary {
	border: 0;
	background: linear-gradient(180deg, #f8d784, #d89c35);
	color: #2a1a06;
	box-shadow: 0 3px 0 #8a5a17, 0 8px 20px rgba(0, 0, 0, 0.35);
}
.btn.primary:active {
	transform: translateY(2px);
	box-shadow: 0 1px 0 #8a5a17;
}
.btn.big {
	width: 100%;
	min-height: 54px;
	margin-top: 16px;
	font-size: 19px;
	letter-spacing: 0.02em;
}
.btn.ghost:hover {
	background: rgba(255, 255, 255, 0.08);
}
.row {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 10px;
	flex-wrap: wrap;
}
.row .btn {
	flex: 1;
	padding: 0 10px;
	font-size: 14px;
}

/* result */
.confetti {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
.result-pawn {
	width: 84px;
	height: 84px;
	margin: -4px auto 4px;
	filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
	animation: hop 0.7s ease-in-out 2;
}
.best {
	margin: -6px 0 10px;
	padding: 8px 12px;
	border-radius: 12px;
	background: rgba(240, 196, 106, 0.16);
	border: 1px solid rgba(240, 196, 106, 0.5);
	color: var(--gold);
	font-weight: 900;
	animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.rating {
	margin: 4px 0 0;
	font-size: 17px;
	font-weight: 800;
}
.rating .up {
	color: #7ee0a0;
}
.rating .down {
	color: #ff9a9a;
}
.kept-note {
	margin: 8px 0 10px;
	padding: 8px 12px;
	border: 1px solid rgba(240, 196, 106, 0.5);
	border-radius: 10px;
	background: rgba(0, 0, 0, 0.25);
	font-size: 14px;
	line-height: 1.35;
}
/* "Saved: your game was rated", after a kept game was sent */
.kept-saved {
	position: fixed;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2000;
	margin: 0;
	padding: 8px 16px;
	border-radius: 999px;
	background: #6b4e1a;
	color: var(--ink);
	font-weight: 700;
	font-size: 14px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
	max-width: calc(100vw - 32px);
	text-align: center;
}
.standings {
	list-style: none;
	margin: 0 0 6px;
	padding: 0;
	text-align: left;
}
.standings li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border-radius: 10px;
	font-weight: 800;
}
.standings li:first-child {
	background: rgba(240, 196, 106, 0.14);
}
.standings .place {
	width: 18px;
	color: var(--gold);
	font-family: var(--display);
}
.standings small {
	margin-left: auto;
	color: var(--ink-dim);
}
.rules-card {
	text-align: left;
}
.rules-card .card-title {
	text-align: center;
}
.rules-list {
	margin: 6px 0 10px;
	padding-left: 20px;
	line-height: 1.45;
	font-weight: 600;
	color: var(--ink-soft);
}
.rules-list li {
	margin-bottom: 7px;
}
.rules-list b {
	color: var(--ink);
}
.rules-card .btn {
	width: 100%;
}

/* ---------- portrait / phones ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 720px) {
	.stage {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		grid-auto-rows: auto;
		align-content: center;
		gap: 10px;
		padding-top: 4px;
	}
	html,
	body {
		overflow-x: hidden;
		overflow-y: auto;
	}
	.side {
		display: contents;
	}
	.seats {
		order: 1;
		flex-direction: row;
		gap: 6px;
	}
	.board-wrap {
		order: 2;
	}
	.status {
		order: 3;
		min-height: 1.4em;
		justify-content: center;
		text-align: center;
		font-size: 14px;
	}
	.controls {
		order: 4;
	}
	.mystats {
		order: 5;
		text-align: center;
		font-size: 12px;
	}
	.mystats:empty {
		display: none;
	}
	.seat {
		flex: 1;
		min-width: 0;
		grid-template-columns: auto 1fr auto;
		gap: 6px;
		padding: 7px 9px;
		border-radius: 14px;
	}
	.seat::before {
		top: 8px;
		bottom: 8px;
	}
	.seat-pawn {
		width: 30px;
		height: 30px;
	}
	.seat-name {
		font-size: 14px;
	}
	.seat-who {
		display: none;
	}
	.seat-steps b {
		font-size: 18px;
	}
	.tokens i {
		width: 8px;
		height: 4px;
	}
	.tokens {
		gap: 2px;
	}
	.four .seat {
		grid-template-columns: auto 1fr;
		padding: 6px 7px;
	}
	.four .seat-steps {
		display: none;
	}
	.four .seat-pawn {
		width: 24px;
		height: 24px;
	}
	.four .seat-name {
		font-size: 12px;
	}
	.four .tokens i {
		width: 6px;
	}
	.seg-btn {
		min-height: 46px;
	}
	.bar {
		padding-top: 4px;
	}
	.icon-btn {
		width: 38px;
		height: 38px;
	}
}
@media (max-width: 360px) {
	.seg-btn span {
		font-size: 14px;
	}
	.seg-btn svg {
		display: none;
	}
}
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}

/* mouse: the square under the pointer that the pawn can reach */
.inner.can-move {
	cursor: pointer;
}
.dot.hot::after {
	width: 44%;
	height: 44%;
	opacity: 1;
	animation: none;
	box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.35), 0 0 18px var(--pc);
}
