.board-page {
	height: 100%;
	max-width: 1220px;
	margin: 0 auto;
	padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 52px) 24px;
	color: #1f1f1d;
	box-sizing: border-box;
	position: relative;
}
.board-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 22px;
}
.board-head h1 {
	font-size: clamp(28px, 4vw, 42px);
	font-weight: 560;
	letter-spacing: -0.04em;
	margin: 0;
}
.board-actions {
	display: flex;
	gap: 6px;
	align-items: center;
}
.board-actions button {
	border: 1px solid #e8e6e1;
	background: transparent;
	color: #6e6d69;
	border-radius: 999px;
	font: inherit;
	font-size: 13px;
	padding: 9px 13px;
	cursor: pointer;
	transition:
		background 0.18s ease,
		border-color 0.18s ease;
}
.board-actions button:hover {
	background: #f3f2ee;
	border-color: #dedbd4;
}
.board-shell {
	position: relative;
	background: #fffefa;
	border: 1px solid #e8e6e1;
	min-height: min(68vh, 680px);
	height: calc(100vh - 252px);
	max-height: 760px;
	overflow: hidden;
	border-radius: 12px;
	box-shadow: 0 15px 40px rgba(45, 42, 34, 0.035);
}
.board-canvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #fffefa;
	touch-action: none;
	overscroll-behavior: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	cursor: crosshair;
	transform-origin: center center;
}
.board-toolbar {
	position: absolute;
	left: 50%;
	bottom: 17px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 6px 7px;
	background: rgba(255, 255, 254, 0.96);
	border: 1px solid #e8e6e1;
	border-radius: 12px;
	box-shadow: 0 7px 24px rgba(39, 36, 30, 0.09);
	backdrop-filter: blur(12px);
	white-space: nowrap;
	max-width: calc(100% - 28px);
	box-sizing: border-box;
}
.board-toolbar button {
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: 8px;
	color: #6e6d69;
	cursor: pointer;
	font: inherit;
	font-size: 12px;
	line-height: 28px;
	height: 30px;
	padding: 0 9px;
}
.board-toolbar button:hover,
.board-toolbar button.active,
.board-toolbar button.chosen {
	background: #f3f2ee;
	color: #1f1f1d;
}
.board-divider {
	width: 1px;
	height: 21px;
	background: #e8e6e1;
	margin: 0 3px;
}
.board-colors {
	display: flex;
	gap: 5px;
	padding: 0 3px;
}
.board-color {
	width: 19px !important;
	height: 19px !important;
	border-radius: 50% !important;
	padding: 0 !important;
	position: relative;
}
.board-color::before {
	content: "";
	display: block;
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	background: var(--ink);
}
.board-color.chosen {
	background: #f3f2ee !important;
}
.board-color.chosen::after {
	content: "";
	position: absolute;
	inset: 1px;
	border: 1px solid #8d8b84;
	border-radius: 50%;
}
.board-sizes {
	display: flex;
	gap: 1px;
}
.board-sizes button {
	padding: 0 6px !important;
}
.board-undo,
.board-redo {
	font-size: 21px !important;
	line-height: 25px !important;
	padding: 0 7px !important;
}
.pen-toggle {
	display: flex;
	align-items: center;
	gap: 5px;
	color: #6e6d69;
	font-size: 12px;
	padding: 0 5px;
	cursor: pointer;
}
.pen-toggle input {
	accent-color: #1f1f1d;
}
.board-clear {
	color: #a85d54 !important;
}
.board-cursor {
	position: absolute;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	border: 1px solid rgba(94, 116, 133, 0.55);
	background: rgba(94, 116, 133, 0.13);
	transform: translate(-50%, -50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.board-cursor.visible {
	opacity: 1;
}
.board-history-panel {
	position: absolute;
	z-index: 5;
	top: 90px;
	right: clamp(16px, 4vw, 52px);
	width: min(390px, calc(100% - 32px));
	max-height: calc(100% - 120px);
	overflow: auto;
	background: #fff;
	border: 1px solid #e8e6e1;
	border-radius: 12px;
	padding: 16px;
	box-shadow: 0 18px 50px rgba(39, 36, 30, 0.13);
}
.history-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 13px;
}
.history-head h2 {
	font-size: 18px;
	font-weight: 520;
	margin: 0;
}
.history-close {
	border: 0;
	background: transparent;
	color: #8d8b84;
	font-size: 24px;
	cursor: pointer;
	line-height: 1;
}
.history-list {
	display: grid;
	gap: 12px;
}
.history-card {
	margin: 0;
}
.history-card img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	background: #f3f2ee;
	border-radius: 8px;
	display: block;
}
.history-card time {
	display: block;
	font-size: 11px;
	color: #a3a19c;
	margin: 6px 2px;
}
.history-empty {
	display: grid;
	place-items: center;
	color: #a3a19c;
	font-size: 13px;
	width: 100%;
	aspect-ratio: 16 / 10;
	background: #f3f2ee;
	border-radius: 8px;
}
.history-actions {
	display: flex;
	gap: 12px;
	align-items: center;
}
.history-actions a,
.history-actions button {
	border: 0;
	background: transparent;
	color: #6e6d69;
	font: inherit;
	font-size: 12px;
	padding: 2px 0;
	cursor: pointer;
	text-decoration: none;
}
.history-actions button {
	color: #a85d54;
}
.board-page button:focus-visible,
.board-page input:focus-visible {
	outline: 2px solid #8c8275;
	outline-offset: 2px;
}
@media (max-width: 680px) {
	.board-page {
		padding: 22px 12px calc(82px + env(safe-area-inset-bottom));
	}
	.board-head {
		margin-bottom: 15px;
	}
	.board-head h1 {
		font-size: 30px;
	}
	.board-actions {
		gap: 2px;
	}
	.board-actions button {
		font-size: 12px;
		padding: 8px 9px;
	}
	.board-shell {
		height: calc(100dvh - 220px);
		min-height: 440px;
		border-radius: 10px;
	}
	.board-toolbar {
		left: 9px;
		right: 9px;
		bottom: 10px;
		transform: none;
		justify-content: center;
		gap: 1px;
		padding: 5px 4px;
		white-space: normal;
		flex-wrap: wrap;
		max-height: 112px;
		overflow: visible;
	}
	.board-toolbar button {
		padding: 0 5px;
	}
	.board-sizes {
		display: none;
	}
	.board-divider {
		margin: 0 1px;
	}
	.board-colors {
		gap: 1px;
	}
	.board-color {
		width: 18px !important;
	}
	.pen-toggle {
		padding: 0 3px;
	}
	.pen-toggle span {
		font-size: 11px;
	}
	.board-clear {
		padding: 0 4px !important;
	}
	.board-history-panel {
		top: 70px;
		right: 12px;
		max-height: calc(100% - 92px);
	}
}
.board-toolbar {
	border-radius: 20px;
	max-width: calc(100% - 20px);
}
.board-toolbar button,
.board-palette summary {
	min-height: 42px;
	padding: 0 12px;
	display: inline-grid;
	place-items: center;
}
.board-toolbar button.active {
	color: #43563f;
	background: #e8eee2;
}
.board-palette summary {
	font-size: 13px;
	border-radius: 12px;
	list-style: none;
	cursor: pointer;
}
.board-palette summary::-webkit-details-marker {
	display: none;
}
.board-palette[open] summary {
	background: var(--soft);
}
.board-tray {
	position: absolute;
	bottom: calc(100% + 8px);
	right: 0;
	width: min(290px, 100%);
	padding: 12px;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	background: #fffefa;
	border: 1px solid var(--line);
	border-radius: 15px;
	box-shadow: 0 6px 20px #38432c14;
}
.board-tray .board-colors,
.board-tray .board-sizes {
	display: flex;
	justify-content: center;
	width: 100%;
}
.board-tray .board-color {
	width: 34px !important;
	min-height: 34px;
}
.board-tray .board-color::before {
	inset: 9px;
}
.board-tray .board-color.chosen::after {
	inset: 5px;
}
.board-actions button:disabled {
	opacity: 0.45;
	cursor: default;
}
@media (max-width: 680px) {
	.board-toolbar {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		width: max-content;
		flex-wrap: nowrap;
	}
	.board-shell {
		min-height: 270px;
	}
}
.board-viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: none;
}
.board-canvas {
	transform-origin: 0 0;
}
.board-sync {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 24px;
	font-size: 12px;
	color: #62735c;
}
.board-sync span::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	background: currentColor;
	border-radius: 50%;
	margin-right: 7px;
}
.board-sync button {
	font-size: 12px;
	text-decoration: underline;
}
.board-toolbar .pen-toggle {
	flex-direction: row;
	display: flex;
	min-height: 44px;
}
@media (min-width: 700px) and (max-width: 1440px) and (any-pointer: coarse) {
	#view.board-page {
		display: flex;
		flex-direction: column;
		padding: clamp(16px, 3vw, 32px);
		max-width: none;
		overflow: hidden;
	}
	.board-head {
		align-items: center;
		flex: none;
		margin-bottom: 14px;
	}
	.board-actions button {
		min-height: 44px;
	}
	.board-shell {
		flex: 1;
		min-height: 0;
		height: auto;
		max-height: none;
		border-radius: 18px;
	}
	.board-viewport {
		bottom: 72px;
	}
	.board-toolbar {
		bottom: 0;
		left: 0;
		right: 0;
		transform: none;
		width: 100%;
		max-width: none;
		height: 72px;
		justify-content: center;
		border: 0;
		border-top: 1px solid var(--line);
		border-radius: 0;
		box-shadow: none;
		background: #f8f8f2;
	}
	.board-toolbar button,
	.board-palette summary {
		min-width: 44px;
		min-height: 44px;
	}
	.board-palette {
		position: relative;
	}
	.board-tray {
		width: 265px;
		right: -70px;
	}
	.board-toolbar .pen-toggle {
		margin-left: 12px;
	}
}
@media (max-width: 680px) {
	.board-toolbar .pen-toggle {
		font-size: 11px;
	}
	.board-toolbar button,
	.board-palette summary {
		padding-inline: 8px;
	}
}
.board-cursor {
	background: #648478;
	border-color: #fff;
	width: 10px;
	height: 10px;
}
.board-cursor span {
	position: absolute;
	left: 11px;
	top: -3px;
	white-space: nowrap;
	font-size: 11px;
	padding: 2px 7px;
	border-radius: 7px;
	color: #445c50;
	background: #e9f1e8;
}
.board-sync span[data-waiting="true"] {
	color: #856c4e;
}
@media (min-width: 701px) and (max-width: 1100px) and (any-pointer: coarse) {
	#app:has(.board-page) > aside {
		width: 82px;
		padding-inline: 8px;
	}
	#app:has(.board-page) > aside .brand {
		justify-content: center;
		padding: 0;
	}
	#app:has(.board-page) > aside .brand b {
		display: none;
	}
	#app:has(.board-page) > aside :is(nav button, .prefs) {
		flex-direction: column;
		justify-content: center;
		gap: 3px;
		padding: 8px;
		font-size: 12px;
	}
}
