:root {
	--bg: #f1f6ee;
	--panel: #ffffff;
	--panel2: #f4f8f1;
	--ink: #14201a;
	--muted: #566759;
	--line: #d3dfce;
	--accent: #28883a;
	--accent-ink: #ffffff;
	--accent2: #a8740f;
	--cell-empty: #e3ebe1;
	--radius: 3px;
	--hit: #d9482f;
	--r3: #4f7fbf;
	--warn: #c0392b;
	--glow: rgba(40, 136, 58, 0.16);
	--gridline: rgba(40, 90, 50, 0.05);
	--tint: rgba(40, 136, 58, 0.08);
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0e1210;
		--panel: #171d19;
		--panel2: #121713;
		--ink: #e8f0e9;
		--muted: #93a398;
		--line: #27322b;
		--accent: #5ec266;
		--accent-ink: #0a170c;
		--accent2: #e0b155;
		--cell-empty: #222b25;
		--hit: #ff7a66;
		--r3: #7fa8e0;
		--warn: #ff7a66;
		--glow: rgba(94, 194, 102, 0.13);
		--gridline: rgba(130, 210, 140, 0.045);
		--tint: rgba(94, 194, 102, 0.09);
	}
}
:root[data-theme="dark"] {
	--bg: #0e1210;
	--panel: #171d19;
	--panel2: #121713;
	--ink: #e8f0e9;
	--muted: #93a398;
	--line: #27322b;
	--accent: #5ec266;
	--accent-ink: #0a170c;
	--accent2: #e0b155;
	--cell-empty: #222b25;
	--hit: #ff7a66;
	--r3: #7fa8e0;
	--warn: #ff7a66;
	--glow: rgba(94, 194, 102, 0.13);
	--gridline: rgba(130, 210, 140, 0.045);
	--tint: rgba(94, 194, 102, 0.09);
}
:root[data-theme="dark"] {
	color-scheme: dark;
}
:root[data-theme="light"] {
	color-scheme: light;
}
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
html {
	scroll-behavior: smooth;
}
body {
	background: var(--bg);
	color: var(--ink);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}
a {
	color: var(--accent);
	text-underline-offset: 3px;
}
.wrap {
	width: min(1040px, 100% - 2rem);
	margin-inline: auto;
}

/* Шапка */
.site-header {
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 10;
}
.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	height: 60px;
}
.logo {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 800;
	font-size: 1.1rem;
	text-decoration: none;
	color: var(--ink);
	letter-spacing: -0.01em;
}
.logo svg {
	width: 26px;
	height: 26px;
	flex: none;
}
.menu {
	display: flex;
	gap: 1.3rem;
	list-style: none;
	font-size: 0.95rem;
}
.menu a {
	color: var(--muted);
	text-decoration: none;
}
.menu a:hover,
.menu a[aria-current="page"] {
	color: var(--ink);
}

/* Главная */
.hero {
	padding: 3.5rem 0 2rem;
}
.hero h1 {
	font-size: clamp(1.9rem, 5vw, 3rem);
	line-height: 1.12;
	letter-spacing: -0.03em;
	max-width: 20ch;
}
.hero p {
	color: var(--muted);
	font-size: 1.1rem;
	max-width: 58ch;
	margin-top: 1rem;
}
.tools-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	padding: 1rem 0 3rem;
}
.tcard {
	display: block;
	background: var(--panel);
	border: 1px solid var(--line);
	border-bottom: 4px solid var(--accent);
	border-radius: var(--radius);
	padding: 1.3rem 1.3rem 1.2rem;
	text-decoration: none;
	color: var(--ink);
	transition:
		transform 0.12s,
		border-color 0.12s;
}
.tcard:hover {
	transform: translateY(-2px);
	border-color: var(--accent);
}
.tcard .ico {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	color: var(--accent2);
	text-transform: uppercase;
}
.tcard h2 {
	font-size: 1.2rem;
	margin: 0.3rem 0 0.35rem;
	letter-spacing: -0.01em;
}
.tcard p {
	color: var(--muted);
	font-size: 0.94rem;
}

/* Страница инструмента */
.page-head {
	padding: 2.2rem 0 1rem;
}
.crumbs {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 0.6rem;
}
.crumbs a {
	color: var(--muted);
}
.page-head h1 {
	font-size: clamp(1.6rem, 4vw, 2.3rem);
	letter-spacing: -0.025em;
	line-height: 1.15;
}
.page-head p {
	color: var(--muted);
	margin-top: 0.6rem;
	max-width: 62ch;
}
.tool {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1.4rem;
	margin: 1rem 0 1.5rem;
}
.tool + .tool {
	margin-top: 0;
}
.tool h2 {
	font-size: 1.05rem;
	margin-bottom: 0.9rem;
}
.fields {
	display: grid;
	gap: 0.9rem 1rem;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	margin-bottom: 1.1rem;
}
label.f {
	display: block;
	font-size: 0.82rem;
	color: var(--muted);
	font-weight: 600;
}
label.f input,
label.f select {
	display: block;
	width: 100%;
	margin-top: 0.3rem;
	padding: 0.6rem 0.7rem;
	font: inherit;
	font-size: 1rem;
	color: var(--ink);
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: 6px;
}
label.f input:focus,
label.f select:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-color: transparent;
}
label.f input:disabled {
	opacity: 0.55;
}
.choices {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.2rem;
	margin-bottom: 1.1rem;
	font-size: 0.95rem;
}
.choices label {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
}
.choices input {
	accent-color: var(--accent);
	width: 1.05rem;
	height: 1.05rem;
}
.results {
	display: grid;
	gap: 0.5rem;
}
.res {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding: 0.65rem 0.9rem;
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: 6px;
}
.res span {
	color: var(--muted);
	font-size: 0.92rem;
}
.res b {
	font-size: 1.02rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}
.res.big {
	border-color: var(--accent);
}
.res.big b {
	color: var(--accent);
	font-size: 1.25rem;
}
canvas {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 1rem 0;
	border: 1px solid var(--line);
	border-radius: 6px;
	image-rendering: pixelated;
}
details {
	margin-top: 1rem;
}
summary {
	cursor: pointer;
	font-weight: 600;
	font-size: 0.95rem;
}
pre#rows {
	margin-top: 0.7rem;
	max-height: 320px;
	overflow: auto;
	padding: 0.8rem;
	font-size: 0.8rem;
	line-height: 1.5;
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: 6px;
}

.article {
	max-width: 70ch;
	padding-bottom: 1rem;
}
.article h2 {
	font-size: 1.3rem;
	margin: 1.8rem 0 0.6rem;
	letter-spacing: -0.015em;
}
.article p,
.article li {
	color: var(--muted);
}
.article p {
	margin-bottom: 0.8rem;
}
.article ul,
.article ol {
	padding-left: 1.3rem;
	margin-bottom: 0.8rem;
}
.article li {
	margin-bottom: 0.3rem;
}
.article code {
	background: var(--panel2);
	border: 1px solid var(--line);
	padding: 0.05rem 0.35rem;
	border-radius: 4px;
	font-size: 0.9em;
	color: var(--ink);
}
table.t {
	border-collapse: collapse;
	width: 100%;
	margin: 0.5rem 0 1rem;
	font-size: 0.92rem;
}
table.t th,
table.t td {
	text-align: left;
	padding: 0.45rem 0.7rem;
	border-bottom: 1px solid var(--line);
}
table.t th {
	color: var(--ink);
}
table.t td {
	color: var(--muted);
}
.related {
	padding: 1.5rem 0 3rem;
}
.related h2 {
	font-size: 1.1rem;
	margin-bottom: 0.8rem;
}
.related ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.related a {
	display: block;
	padding: 0.45rem 0.9rem;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 999px;
	text-decoration: none;
	color: var(--ink);
	font-size: 0.92rem;
}
.related a:hover {
	border-color: var(--accent);
}

.notfound {
	min-height: 55vh;
	display: grid;
	place-content: center;
	text-align: center;
	padding: 3rem 0;
}
.notfound .code {
	font-size: clamp(5rem, 18vw, 9rem);
	font-weight: 800;
	letter-spacing: -0.05em;
	line-height: 1;
	color: var(--accent);
}
.notfound p {
	color: var(--muted);
	margin: 0.8rem 0 1.5rem;
}
.btn {
	display: inline-block;
	padding: 0.7rem 1.3rem;
	background: var(--accent);
	color: var(--accent-ink);
	border-radius: 6px;
	font-weight: 700;
	text-decoration: none;
}

.site-footer {
	border-top: 1px solid var(--line);
	background: var(--panel);
	padding: 1.8rem 0;
	color: var(--muted);
	font-size: 0.88rem;
}
.site-footer .wrap {
	display: grid;
	gap: 0.8rem;
}
.site-footer ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.2rem;
}
.site-footer a {
	color: var(--muted);
	text-decoration: none;
}
.site-footer a:hover {
	color: var(--ink);
}

@media (max-width: 640px) {
	.logo span {
		display: none;
	}
	.res {
		flex-direction: column;
		gap: 0.15rem;
	}
	.res b {
		text-align: left;
	}
}

/* ===== Расширение: иллюстрации, формы, контакты ===== */
.ill {
	margin: 1.2rem 0 1.6rem;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 1rem;
}
.ill svg {
	display: block;
	width: 100%;
	max-width: 620px;
	height: auto;
	margin: 0 auto;
}
.ill figcaption {
	color: var(--muted);
	font-size: 0.88rem;
	margin-top: 0.7rem;
	text-align: center;
}
.ill .a {
	fill: var(--accent);
}
.ill .b {
	fill: var(--accent2);
}
.ill .c {
	fill: #4f7fbf;
}
.ill .d {
	fill: var(--ink);
}
.ill .e {
	fill: var(--cell-empty);
}
.ill .tx {
	fill: var(--ink);
}
.ill .tm {
	fill: var(--muted);
}
.ill .onc {
	fill: #ffffff;
}
.ill .ln {
	stroke: var(--line);
	stroke-width: 1;
}
.ill .dash {
	stroke: var(--muted);
	stroke-width: 1.2;
	stroke-dasharray: 4 4;
}
.ill .curve {
	stroke: var(--accent);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.ill .curve2 {
	stroke: var(--accent2);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.ill .dot {
	fill: var(--accent2);
	stroke: var(--panel);
	stroke-width: 2;
}
.ill .slot {
	fill: var(--cell-empty);
	stroke: var(--line);
}
.ill .beam {
	fill: var(--accent2);
	opacity: 0.55;
}
.ill .c1 {
	fill: #8fd694;
	stroke: var(--panel);
	stroke-width: 1;
}
.ill .c2 {
	fill: #4fa75a;
	stroke: var(--panel);
	stroke-width: 1;
}
.ill .c3 {
	fill: #2f7a3a;
	stroke: var(--panel);
	stroke-width: 1;
}
.article .ill + .ill {
	margin-top: -0.6rem;
}

.hero {
	display: grid;
	grid-template-columns: 1.3fr 0.9fr;
	gap: 2rem;
	align-items: center;
}
.hero-art svg {
	width: 100%;
	max-width: 320px;
	height: auto;
	display: block;
	margin-inline: auto;
}
.search {
	margin-top: 1.4rem;
	width: 100%;
	max-width: 440px;
	padding: 0.75rem 1rem;
	font: inherit;
	font-size: 1rem;
	color: var(--ink);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 999px;
}
.search:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-color: transparent;
}

label.f textarea {
	display: block;
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.7rem;
	font: inherit;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--ink);
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: 6px;
	resize: vertical;
	min-height: 9rem;
}
label.f textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-color: transparent;
}
label.f input[type="range"] {
	padding: 0;
	accent-color: var(--accent);
	border: 0;
	background: none;
}
.hint {
	color: var(--muted);
	font-size: 0.85rem;
	margin: -0.4rem 0 0.8rem;
}
.hint code,
.tool code {
	background: var(--panel2);
	border: 1px solid var(--line);
	padding: 0.02rem 0.3rem;
	border-radius: 4px;
	font-size: 0.9em;
}
.tool-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.2rem 0 1.4rem;
}
.btn.sm {
	padding: 0.5rem 1rem;
	font-size: 0.88rem;
	border: 1px solid var(--accent);
	cursor: pointer;
	font-family: inherit;
}
.btn.ghost {
	background: transparent;
	color: var(--ink);
	border-color: var(--line);
}
.btn.ghost:hover {
	border-color: var(--accent);
}
.notice {
	margin-bottom: 0.6rem;
	padding: 0.65rem 0.9rem;
	border-left: 4px solid var(--accent2);
	background: var(--panel2);
	border-radius: 6px;
	font-size: 0.9rem;
	color: var(--ink);
}
.okbox {
	margin: 0.3rem 0;
	padding: 0.65rem 0.9rem;
	border-left: 4px solid var(--accent);
	background: var(--panel2);
	border-radius: 6px;
	font-size: 0.9rem;
}
.res small {
	color: var(--muted);
	font-weight: 400;
}
h3.sub {
	font-size: 0.95rem;
	margin: 0.9rem 0 0.2rem;
	color: var(--muted);
}
.tablewrap {
	overflow-x: auto;
	margin-bottom: 0.6rem;
}
.tablewrap table.t {
	min-width: 460px;
}

.contact-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	margin: 1rem 0 1.5rem;
}
.ccard {
	display: grid;
	gap: 0.3rem;
	padding: 1.4rem;
	background: var(--panel);
	border: 1px solid var(--line);
	border-bottom: 4px solid var(--accent);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--ink);
	transition:
		transform 0.12s,
		border-color 0.12s;
}
.ccard:hover {
	transform: translateY(-2px);
	border-color: var(--accent);
}
.ccard .ico {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent2);
}
.ccard b {
	font-size: 1.35rem;
	letter-spacing: -0.01em;
	word-break: break-word;
}
.ccard span:last-child {
	color: var(--muted);
	font-size: 0.92rem;
}
.site-footer p a {
	color: var(--ink);
}

@media (max-width: 760px) {
	.hero {
		grid-template-columns: 1fr;
	}
	.hero-art {
		order: -1;
	}
	.hero-art svg {
		max-width: 220px;
	}
}
.hero-art .c1 {
	fill: #8fd694;
	stroke: var(--bg);
	stroke-width: 1;
}
.hero-art .c2 {
	fill: #4fa75a;
	stroke: var(--bg);
	stroke-width: 1;
}
.hero-art .c3 {
	fill: #2f7a3a;
	stroke: var(--bg);
	stroke-width: 1;
}

/* ===== Живые визуализации результатов ===== */
.viz {
	margin-top: 1rem;
}
.viz:empty {
	display: none;
}
.viz svg {
	display: block;
	width: 100%;
	height: auto;
}
.viz .a {
	fill: var(--accent);
}
.viz .b {
	fill: var(--accent2);
}
.viz .c {
	fill: #4f7fbf;
}
.viz .d {
	fill: var(--ink);
}
.viz .e {
	fill: var(--cell-empty);
}
.viz .bm {
	fill: var(--muted);
	opacity: 0.4;
}
.viz .tx {
	fill: var(--ink);
}
.viz .tm {
	fill: var(--muted);
}
.viz .warn {
	fill: var(--warn);
}
.viz .halo {
	stroke: var(--panel);
	stroke-width: 4px;
	paint-order: stroke;
	stroke-linejoin: round;
}
.viz .ln {
	stroke: var(--line);
	stroke-width: 1;
}
.viz .dash {
	stroke: var(--muted);
	stroke-width: 1.2;
	stroke-dasharray: 4 4;
}
.viz .boxline {
	fill: none;
	stroke: var(--line);
	stroke-width: 1.2;
	stroke-dasharray: 3 3;
}
.viz .scale {
	stroke: var(--ink);
	stroke-width: 2;
}
.viz .limit {
	stroke: var(--ink);
	stroke-width: 1.5;
	stroke-dasharray: 3 3;
}
.viz .curve {
	stroke: var(--accent);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.viz .curve2 {
	stroke: var(--accent2);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.viz .dot {
	fill: var(--accent2);
	stroke: var(--panel);
	stroke-width: 2;
}
.viz .area {
	fill: var(--accent);
	opacity: 0.22;
}
.viz .slot {
	fill: var(--cell-empty);
	stroke: var(--line);
}
.viz .slot.off {
	opacity: 0.35;
}
.viz .ghost {
	fill: none;
	stroke: var(--muted);
	stroke-width: 1.2;
	stroke-dasharray: 4 3;
	opacity: 0.7;
}
.viz .lay {
	stroke: var(--panel);
	stroke-width: 1;
}
.viz .beam {
	fill: var(--accent2);
	opacity: 0.55;
}
.viz .ring {
	fill: none;
	stroke: var(--accent2);
	stroke-width: 2;
}

/* ===== v4: иконки, картинки на карточках, поиск крепости ===== */
:root {
	--r1: var(--accent);
	--r2: var(--accent2);
}

/* Иконки: контур, цвет берут у текста */
.ic {
	width: 1.15em;
	height: 1.15em;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.menu a,
.related a,
.site-footer ul a,
.flinks a,
.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}
.menu a .ic {
	width: 1.05em;
	height: 1.05em;
}
.btn .ic {
	width: 1.05em;
	height: 1.05em;
}
.btn.sm .ic {
	width: 1em;
	height: 1em;
}
.related a .ic,
.site-footer ul a .ic {
	color: var(--accent);
}
.related ul,
.site-footer ul {
	align-items: center;
}
.flinks {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.4rem;
}
.flinks a {
	color: var(--ink);
	text-decoration: none;
}
.flinks a:hover {
	color: var(--accent);
}
.flinks .ic {
	color: var(--accent);
}
.btn.go {
	display: inline-flex;
}
.ccard .ico {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}
.ccard .ico .ic {
	width: 1.3em;
	height: 1.3em;
	color: var(--accent);
}

/* Поиск с иконкой */
.searchbox {
	position: relative;
	margin-top: 1.4rem;
	max-width: 440px;
}
.searchbox .search {
	margin-top: 0;
	max-width: none;
	padding-left: 2.7rem;
}
.searchbox .ic {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--muted);
	pointer-events: none;
	width: 1.2em;
	height: 1.2em;
}

/* Карточки главной: картинка сверху */
.tcard {
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.tcard .art {
	border-bottom: 1px solid var(--line);
	background: var(--panel2);
}
.tcard .art svg {
	display: block;
	width: 100%;
	height: auto;
}
.tcard .tbody {
	padding: 1rem 1.2rem 1.15rem;
}
.tcard .ico {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}
.tcard .ico .ic {
	width: 1.5em;
	height: 1.5em;
	padding: 0.22rem;
	border-radius: 6px;
	background: var(--panel2);
	border: 1px solid var(--line);
	color: var(--accent);
	stroke-width: 1.7;
	box-sizing: content-box;
}
.tcard:hover .ico .ic {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: var(--accent);
}

/* Шапка страницы инструмента с картинкой */
.page-head.has-art {
	display: grid;
	grid-template-columns: 1fr minmax(180px, 280px);
	gap: 1.5rem;
	align-items: center;
}
.page-head .banner {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--panel2);
}
.page-head .banner svg {
	display: block;
	width: 100%;
	height: auto;
}
@media (max-width: 700px) {
	.page-head.has-art {
		grid-template-columns: 1fr;
		gap: 1rem;
	}
	.page-head .banner {
		max-width: 320px;
	}
}
@media (max-width: 480px) {
	.menu {
		gap: 0.8rem;
	}
	.menu a span {
		display: none;
	}
	.menu a .ic {
		width: 1.3em;
		height: 1.3em;
	}
}

/* Общие цвета для рисунков: карточки, баннеры, иллюстрации, визуализации */
.art .bg {
	fill: var(--panel2);
}
.art .a {
	fill: var(--accent);
}
.art .b {
	fill: var(--accent2);
}
.art .c {
	fill: #4f7fbf;
}
.art .d {
	fill: var(--ink);
}
.art .e {
	fill: var(--cell-empty);
}
.art .bm {
	fill: var(--muted);
	opacity: 0.4;
}
.art .tx {
	fill: var(--ink);
}
.art .tm {
	fill: var(--muted);
}
.art .ln {
	stroke: var(--line);
	stroke-width: 1;
}
.art .dash {
	stroke: var(--muted);
	stroke-width: 1.2;
	stroke-dasharray: 4 4;
}
.art .boxline {
	fill: none;
	stroke: var(--line);
	stroke-width: 1.2;
	stroke-dasharray: 3 3;
}
.art .scale {
	stroke: var(--ink);
	stroke-width: 2;
}
.art .curve {
	stroke: var(--accent);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.art .curve2 {
	stroke: var(--accent2);
	stroke-width: 2.5;
	stroke-linejoin: round;
}
.art .dot {
	fill: var(--accent2);
	stroke: var(--panel2);
	stroke-width: 2;
}
.art .area {
	fill: var(--accent);
	opacity: 0.22;
}
.art .slot {
	fill: var(--cell-empty);
	stroke: var(--line);
}
.art .beam {
	fill: var(--accent2);
	opacity: 0.55;
}
.art .ring {
	fill: none;
	stroke: var(--accent2);
	stroke-width: 2;
}

/* Поиск крепости: лучи, точки бросков, кольца */
.art .ray,
.ill .ray,
.viz .ray {
	fill: none;
	stroke-width: 2.5;
	stroke-linecap: round;
}
.art .ray.r1,
.ill .ray.r1,
.viz .ray.r1 {
	stroke: var(--r1);
}
.art .ray.r2,
.ill .ray.r2,
.viz .ray.r2 {
	stroke: var(--r2);
}
.art .ray.r3,
.ill .ray.r3,
.viz .ray.r3 {
	stroke: var(--r3);
}
.ill .head.r1,
.viz .head.r1 {
	fill: var(--r1);
}
.ill .head.r2,
.viz .head.r2 {
	fill: var(--r2);
}
.ill .head.r3,
.viz .head.r3 {
	fill: var(--r3);
}
.art .pt,
.ill .pt,
.viz .pt {
	stroke-width: 2;
}
.art .pt {
	stroke: var(--panel2);
}
.ill .pt,
.viz .pt {
	stroke: var(--panel);
}
.art .pt.r1,
.ill .pt.r1,
.viz .pt.r1 {
	fill: var(--r1);
}
.art .pt.r2,
.ill .pt.r2,
.viz .pt.r2 {
	fill: var(--r2);
}
.art .pt.r3,
.ill .pt.r3,
.viz .pt.r3 {
	fill: var(--r3);
}
.art .hitdot,
.ill .hitdot,
.viz .hitdot {
	fill: var(--hit);
}
.art .ringband,
.ill .ringband,
.viz .ringband {
	fill: none;
	stroke: var(--muted);
	opacity: 0.14;
}
.ill .ringband.cur,
.viz .ringband.cur {
	stroke: var(--accent);
	opacity: 0.3;
}
.art .cring,
.ill .cring,
.viz .cring {
	fill: none;
	stroke: var(--line);
	stroke-width: 1;
}
.ill .hub,
.viz .hub {
	fill: var(--ink);
}
.ill .ring {
	fill: none;
	stroke: var(--accent2);
	stroke-width: 2;
}
.ill .halo {
	stroke: var(--panel);
	stroke-width: 4px;
	paint-order: stroke;
	stroke-linejoin: round;
}
.ill .scale {
	stroke: var(--ink);
	stroke-width: 2;
}

/* Номер броска в заголовке полей */
.badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	margin-right: 0.5rem;
	border-radius: 50%;
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--accent-ink);
	vertical-align: middle;
}
.badge.r1 {
	background: var(--r1);
}
.badge.r2 {
	background: var(--r2);
}
.badge.r3 {
	background: var(--r3);
}

/* ===== v5: шрифты ===== */
@font-face {
	font-family: "Inter";
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	src: url("fonts/inter-400.woff") format("woff");
}
@font-face {
	font-family: "Inter";
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	src: url("fonts/inter-600.woff") format("woff");
}
@font-face {
	font-family: "Inter";
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	src: url("fonts/inter-700.woff") format("woff");
}
@font-face {
	font-family: "JetBrains Mono";
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	src: url("fonts/jbmono-400.woff") format("woff");
}
@font-face {
	font-family: "JetBrains Mono";
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	src: url("fonts/jbmono-700.woff") format("woff");
}
:root {
	--font-text:
		"Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--font-pix:
		"Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--font-mono:
		"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
body {
	font-family: var(--font-text);
	font-feature-settings: "kern", "calt";
	min-height: 100vh;
	background-image:
		radial-gradient(900px 420px at 8% -4%, var(--glow), transparent 70%),
		linear-gradient(var(--gridline) 1px, transparent 1px),
		linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
	background-size:
		auto,
		32px 32px,
		32px 32px;
	background-position:
		0 0,
		0 0,
		0 0;
}
button,
input,
select,
textarea {
	font-family: inherit;
}
h1,
h2,
h3,
.logo span,
.res.big b,
.notfound .code,
.badge,
.chip.on {
	font-family: var(--font-pix);
	font-weight: 700;
}
h1,
h2,
h3 {
	letter-spacing: -0.015em;
}
code,
pre,
.hint code,
.tool code,
.article code {
	font-family: var(--font-mono);
}
.res b,
table.t td,
table.t th,
.ccard b {
	font-variant-numeric: tabular-nums;
}
[hidden] {
	display: none !important;
}

/* ===== v5: шапка ===== */
.site-header {
	background: var(--panel);
	background: color-mix(in srgb, var(--panel) 86%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}
.logo {
	font-weight: 700;
	font-size: 1.15rem;
}
.nav nav {
	margin-left: auto;
}
.menu a {
	padding: 0.35rem 0.15rem;
	border-bottom: 2px solid transparent;
}
.menu a:hover,
.menu a[aria-current="page"] {
	color: var(--ink);
	border-bottom-color: var(--accent);
}
.themebtn {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	margin-left: 0.7rem;
	flex: none;
	cursor: pointer;
	color: var(--ink);
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.themebtn:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.themebtn .ic {
	width: 1.25rem;
	height: 1.25rem;
}

/* ===== v5: главная ===== */
.hero h1 {
	font-size: clamp(2rem, 5.2vw, 3.2rem);
	line-height: 1.12;
	max-width: 18ch;
}
.hero p {
	font-size: 1.05rem;
}
.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.4rem 0 0;
}
.chip {
	font-size: 0.88rem;
	padding: 0.42rem 0.9rem;
	color: var(--ink);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	cursor: pointer;
}
.chip:hover {
	border-color: var(--accent);
}
.chip.on {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: var(--accent);
}
.recent:empty {
	display: none;
}
.recent {
	margin: 1.2rem 0 0.2rem;
}
.recent h2 {
	font-size: 1.05rem;
	margin-bottom: 0.55rem;
}
.recent ul {
	list-style: none;
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.recent a {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 0.65rem;
	align-items: center;
	padding: 0.6rem 0.8rem;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--ink);
}
.recent a:hover {
	border-color: var(--accent);
}
.recent .ic {
	grid-row: span 2;
	width: 1.4rem;
	height: 1.4rem;
	color: var(--accent);
}
.recent .rn {
	font-weight: 600;
	font-size: 0.92rem;
}
.recent .rt {
	color: var(--muted);
	font-size: 0.8rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tools-grid {
	padding-top: 1.1rem;
}
.tcard .art {
	overflow: hidden;
}
.tcard .art svg {
	transition: transform 0.3s ease;
}
.tcard:hover .art svg {
	transform: scale(1.05);
}
.tcard h2 {
	font-size: 1.15rem;
}

/* ===== v5: пиксельные углы панелей ===== */
.tool,
.tcard,
.ill,
.ccard,
.history,
.recent a,
.page-head .banner {
	clip-path: polygon(
		0 4px,
		4px 4px,
		4px 0,
		calc(100% - 4px) 0,
		calc(100% - 4px) 4px,
		100% 4px,
		100% calc(100% - 4px),
		calc(100% - 4px) calc(100% - 4px),
		calc(100% - 4px) 100%,
		4px 100%,
		4px calc(100% - 4px),
		0 calc(100% - 4px)
	);
}
.tcard:focus-visible,
.ccard:focus-visible,
.recent a:focus-visible {
	clip-path: none;
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

/* ===== v5: панели калькуляторов ===== */
.tool {
	padding: 1.5rem;
}
.tool > h2 {
	font-size: 1.1rem;
}
.tool > h2::before {
	content: "";
	display: inline-block;
	width: 0.55em;
	height: 0.55em;
	margin-right: 0.55em;
	background: var(--accent);
	vertical-align: 0.03em;
}
label.f {
	font-size: 0.8rem;
	letter-spacing: 0.01em;
	text-transform: none;
}
label.f input,
label.f select,
label.f textarea {
	margin-top: 0.35rem;
	padding: 0.7rem 0.8rem;
	font-size: 1.02rem;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	transition:
		border-color 0.12s,
		box-shadow 0.12s;
}
label.f input:focus,
label.f select:focus,
label.f textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--tint);
}
label.f input[type="file"] {
	padding: 0.5rem;
	font-size: 0.92rem;
}
label.f input[type="file"]::file-selector-button {
	margin-right: 0.8rem;
	padding: 0.45rem 0.9rem;
	font: inherit;
	font-weight: 600;
	color: var(--accent-ink);
	background: var(--accent);
	border: 0;
	border-radius: var(--radius);
	cursor: pointer;
}
label.f textarea {
	font-family: var(--font-mono);
	font-size: 0.9rem;
}
.choices label {
	padding: 0.15rem 0;
}

.results {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
	gap: 0.55rem 0.7rem;
}
.results > :not(.res) {
	grid-column: 1 / -1;
}
.res {
	flex-wrap: wrap;
	border: 1px solid var(--line);
	border-left: 3px solid var(--line);
	border-radius: var(--radius);
	background: var(--panel2);
}
.res b {
	margin-left: auto;
}
.res.big {
	grid-column: 1 / -1;
	border-left-color: var(--accent);
	background:
		linear-gradient(90deg, var(--tint), transparent 70%), var(--panel2);
	padding: 0.85rem 1rem;
}
.res.big b {
	font-size: 1.5rem;
	line-height: 1.2;
}
.res.big span {
	font-weight: 600;
	color: var(--ink);
}
h3.sub {
	margin: 1rem 0 0.3rem;
	font-size: 0.95rem;
}
.notice,
.okbox {
	border-radius: var(--radius);
}
.viz {
	margin-top: 1.1rem;
}
.viz h3.sub {
	margin-top: 1.2rem;
}
.viz > svg,
.ill svg {
	background: transparent;
}
table.t tr.cur td {
	color: var(--ink);
	font-weight: 700;
	background: var(--tint);
}

/* ===== v5: кнопки ===== */
.btn {
	border: 0;
	border-radius: var(--radius);
	box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
	transition:
		filter 0.12s,
		transform 0.06s;
}
.btn:hover {
	filter: brightness(1.08);
}
.btn:active {
	transform: translateY(1px);
	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}
.btn:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}
.btn.sm {
	border: 0;
	padding: 0.55rem 1rem;
}
.btn.ghost {
	color: var(--ink);
	background: var(--panel);
	border: 1px solid var(--line);
	box-shadow: inset 0 -3px 0 var(--line);
}
.btn.ghost:hover {
	border-color: var(--accent);
	filter: none;
}
.tool-actions {
	gap: 0.55rem;
}

/* ===== v5: подсказка предмета, команда, образец цвета, история ===== */
.tip {
	display: inline-block;
	min-width: 230px;
	max-width: 100%;
	padding: 0.55rem 0.8rem;
	color: #ffffff;
	background: #100010;
	border: 3px solid #2b0a66;
	box-shadow: 0 0 0 2px #100010;
	font-family: var(--font-mono);
	font-size: 0.92rem;
	line-height: 1.4;
}
.tip .tn {
	font-weight: 700;
	color: #ffffff;
}
.tip .te {
	color: #aaaaaa;
}
.tip .tl {
	color: #aa00aa;
	font-style: italic;
}
.tip .tl[data-i="0"] {
	font-style: normal;
}
.tip .tu {
	color: #5555ff;
}
.tip .tg {
	margin-top: 0.45rem;
	font-size: 0.78rem;
	color: #555555;
}
.tip.tag {
	min-width: 0;
	background: rgba(0, 0, 0, 0.6);
	border-color: transparent;
	box-shadow: none;
	padding: 0.2rem 0.7rem;
}
pre.cmd {
	grid-column: 1 / -1;
	white-space: pre-wrap;
	word-break: break-all;
	font-size: 0.88rem;
	line-height: 1.55;
	padding: 0.9rem 1rem;
	margin-bottom: 0.2rem;
	background: var(--panel2);
	border: 1px solid var(--line);
	border-left: 4px solid var(--accent);
	border-radius: var(--radius);
}
pre#rows {
	font-family: var(--font-mono);
}
.sw {
	display: inline-block;
	width: 1.05em;
	height: 1.05em;
	margin-right: 0.55rem;
	vertical-align: -0.15em;
	border: 1px solid rgba(0, 0, 0, 0.4);
}
.history {
	margin: 0 0 1.2rem;
	padding: 0.7rem 1rem;
	background: var(--panel);
	border: 1px solid var(--line);
}
.history ul {
	list-style: none;
	margin: 0.6rem 0;
}
.history li a {
	display: block;
	padding: 0.35rem 0;
	font-size: 0.9rem;
	color: var(--ink);
	text-decoration: none;
	border-bottom: 1px dashed var(--line);
	word-break: break-word;
}
.history li a:hover {
	color: var(--accent);
}
.art .rs,
.viz .rs,
.ill .rs {
	fill: var(--hit);
}
.flinks .ic,
.site-footer ul a .ic {
	stroke-width: 1.8;
}

/* ===== v5: телефоны и предпочтения ===== */
@media (max-width: 640px) {
	.tool {
		padding: 1.1rem;
	}
	label.f input,
	label.f select {
		min-height: 48px;
		font-size: 16px;
	}
	label.f textarea {
		font-size: 15px;
	}
	.btn.sm {
		min-height: 44px;
		padding: 0.6rem 1rem;
	}
	.choices {
		gap: 0.3rem 1.1rem;
	}
	.choices label {
		min-height: 40px;
	}
	.choices input {
		width: 1.25rem;
		height: 1.25rem;
	}
	.chip {
		min-height: 40px;
	}
	.res.big b {
		font-size: 1.3rem;
	}
	.res b {
		margin-left: 0;
	}
	.results {
		grid-template-columns: 1fr;
	}
	.themebtn {
		margin-left: 0.4rem;
	}
}
@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
	.tcard:hover .art svg {
		transform: none;
	}
}

/* ===== v5: карта по сиду ===== */
.mapwrap {
	position: relative;
	margin: 0.6rem 0 0.4rem;
}
.mapwrap canvas {
	margin: 0;
	width: 100%;
	cursor: grab;
	touch-action: none;
	image-rendering: auto;
	background: #10201a;
}
.mapwrap canvas:active {
	cursor: grabbing;
}
.maptip {
	position: absolute;
	z-index: 3;
	min-width: 150px;
	max-width: 220px;
	padding: 0.4rem 0.6rem;
	font-size: 0.82rem;
	line-height: 1.4;
	pointer-events: none;
	color: #fff;
	background: rgba(10, 18, 14, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: var(--radius);
}
.maptip span {
	color: #b8c8bd;
}
.structs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1rem;
	margin: 0 0 0.8rem;
	font-size: 0.9rem;
}
.structs label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
}
.structs label.off {
	opacity: 0.45;
	cursor: not-allowed;
}
.structs input {
	accent-color: var(--accent);
}
.mk {
	display: inline-grid;
	place-items: center;
	min-width: 1.35rem;
	height: 1.35rem;
	padding: 0 0.2rem;
	font-size: 0.7rem;
	font-weight: 700;
	color: #fff;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
	margin: 0.4rem 0 1rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.legend:empty {
	display: none;
}
.lgi {
	display: inline-flex;
	align-items: center;
}
.gofields {
	align-items: end;
}
.gobtn {
	display: flex;
	align-items: end;
}
.gobtn .btn {
	min-height: 48px;
}

/* ===== v6: карта по сиду ===== */
.mapwrap {
	position: relative;
}
.mapwrap canvas {
	width: 100%;
	height: auto;
	margin: 0.6rem 0;
	cursor: grab;
	touch-action: none;
	image-rendering: auto;
	background: #10201a;
}
.mapwrap canvas:active {
	cursor: grabbing;
}
.maptip {
	position: absolute;
	z-index: 3;
	min-width: 150px;
	padding: 0.4rem 0.6rem;
	pointer-events: none;
	font-size: 0.82rem;
	line-height: 1.4;
	color: #fff;
	background: rgba(10, 16, 12, 0.92);
	border: 1px solid rgba(255, 255, 255, 0.25);
}
.maptip span {
	color: #b8c8bd;
}
.structs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.1rem;
	margin: 0 0 0.9rem;
	font-size: 0.9rem;
}
.structs label {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
}
.structs label.off {
	opacity: 0.45;
	cursor: not-allowed;
}
.structs input {
	accent-color: var(--accent);
}
.mk {
	display: inline-grid;
	place-items: center;
	min-width: 1.4rem;
	height: 1.4rem;
	padding: 0 0.2rem;
	font-size: 0.7rem;
	font-weight: 700;
	color: #fff;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
	margin: 0.4rem 0 1rem;
	font-size: 0.85rem;
	color: var(--muted);
}
.legend:empty {
	display: none;
}
.lgi {
	display: inline-flex;
	align-items: center;
}
.gofields {
	align-items: end;
	margin-top: 0.8rem;
}
.gobtn {
	display: flex;
	align-items: end;
}

/* ===== v6: ровная обводка кнопок ===== */
.btn,
.btn.sm,
.btn.ghost,
.chip,
.themebtn {
	box-shadow: none;
	-webkit-tap-highlight-color: transparent;
}
.btn,
.btn.sm {
	border: 2px solid var(--accent);
	background: var(--accent);
	color: var(--accent-ink);
	border-radius: 6px;
}
.btn.ghost {
	border: 2px solid var(--line);
	background: var(--panel);
	color: var(--ink);
}
.btn:hover {
	filter: none;
	border-color: var(--ink);
}
.btn.ghost:hover {
	border-color: var(--accent);
	color: var(--ink);
}
.btn:active {
	transform: none;
	box-shadow: none;
}
.btn:focus {
	outline: none;
}
.btn:focus-visible,
.chip:focus-visible,
.themebtn:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}
.btn.ghost:focus-visible {
	outline-color: var(--ink);
}
.chip,
.themebtn {
	border-width: 2px;
	border-radius: 6px;
}
.chip:focus {
	outline: none;
}

/* v8: рамка целиком, без срезанных углов (срез clip-path обрезал границу и при наведении углы пропадали) */
.tool,
.tcard,
.ill,
.ccard,
.history,
.recent a,
.page-head .banner {
	clip-path: none;
	border-radius: 8px;
}
.tcard,
.ccard,
.recent a {
	border-width: 2px;
	overflow: hidden;
}
.tcard:hover,
.ccard:hover,
.recent a:hover {
	border-color: var(--accent);
}
.tcard:focus-visible,
.ccard:focus-visible,
.recent a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}
.logo img {
	width: 28px;
	height: 28px;
	flex: none;
	image-rendering: pixelated;
	display: block;
}

/* ===== v12: карта по сиду — управление, строка координат, легенда, результаты ===== */
.mapwrap {
	position: relative;
	margin: 0.6rem 0 0.5rem;
	background: #10201a;
	border: 2px solid var(--line);
	border-radius: 8px;
	overflow: hidden;
}
.mapwrap canvas {
	display: block;
	margin: 0;
	width: 100%;
	border: 0;
}
.mapctl {
	position: absolute;
	left: 10px;
	top: 10px;
	display: grid;
	gap: 6px;
	z-index: 2;
}
.mapctl button {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	cursor: pointer;
	color: #fff;
	background: rgba(10, 18, 14, 0.72);
	border: 2px solid rgba(255, 255, 255, 0.28);
	border-radius: 6px;
	-webkit-tap-highlight-color: transparent;
}
.mapctl button:hover {
	border-color: #fff;
	background: rgba(10, 18, 14, 0.9);
}
.mapctl button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
.mapctl .ic {
	width: 18px;
	height: 18px;
}
.mapbar {
	position: absolute;
	right: 0;
	bottom: 0;
	max-width: 100%;
	padding: 0.25rem 0.6rem;
	font-size: 0.78rem;
	color: #e8f0ea;
	background: rgba(10, 18, 14, 0.72);
	pointer-events: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.mapbar:empty {
	display: none;
}
.mapwrap:fullscreen {
	display: flex;
	width: 100vw;
	height: 100vh;
	border: 0;
	border-radius: 0;
}
.mapwrap:-webkit-full-screen {
	display: flex;
	width: 100vw;
	height: 100vh;
	border: 0;
}
.mapwrap:fullscreen canvas {
	flex: 1;
}
.maptip {
	border-radius: 6px;
}
.legend {
	gap: 0.4rem 0.5rem;
}
.lgi {
	gap: 0.4rem;
	padding: 0.25rem 0.6rem;
	font: inherit;
	font-size: 0.82rem;
	color: var(--ink);
	background: var(--panel);
	border: 2px solid var(--line);
	border-radius: 6px;
	cursor: pointer;
}
.lgi:hover {
	border-color: var(--accent);
}
.lgi.on {
	border-color: var(--ink);
	background: var(--panel2);
}
.lgi .sw {
	width: 0.9rem;
	height: 0.9rem;
	flex: none;
	border-radius: 3px;
	border: 1px solid rgba(0, 0, 0, 0.35);
}
.lgi em {
	font-style: normal;
	color: var(--muted);
	font-size: 0.78rem;
}
.lgi.reset {
	color: var(--accent);
}
.lgi:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
.subh {
	margin: 1.1rem 0 0.4rem;
	font-size: 1rem;
}
.golink {
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px dashed currentColor;
}
.golink:hover {
	border-bottom-style: solid;
}
.pinact {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.5rem 0 0.2rem;
}
.xdel {
	margin-left: 0.4rem;
	padding: 0 0.4rem;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--muted);
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 4px;
	cursor: pointer;
}
.xdel:hover {
	color: #fff;
	background: #c0392b;
	border-color: #c0392b;
}
@media (max-width: 640px) {
	.mapctl button {
		width: 40px;
		height: 40px;
	}
	.legend .lgi {
		padding: 0.35rem 0.6rem;
	}
}

/* ===== v13: полный экран карты ===== */
.mapctl {
	left: 42px;
	top: 24px;
}
.mapwrap.mapfs {
	position: fixed;
	inset: 0;
	z-index: 99999;
	width: 100vw;
	height: 100vh;
	margin: 0;
	border: 0;
	border-radius: 0;
}
.mapwrap.mapfs canvas {
	height: 100%;
}
html.mapfs-lock,
html.mapfs-lock body {
	overflow: hidden;
}
.mapwrap:fullscreen .mapbar,
.mapwrap.mapfs .mapbar {
	font-size: 0.85rem;
	padding: 0.35rem 0.8rem;
}
.mapwrap:fullscreen .mapctl button,
.mapwrap.mapfs .mapctl button {
	width: 42px;
	height: 42px;
}

/* ===== v16: кнопка «На весь экран» справа снизу ===== */
.mapfs-btn {
	position: absolute;
	right: 10px;
	bottom: 36px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.5rem 0.85rem;
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	color: #fff;
	background: rgba(10, 18, 14, 0.78);
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-radius: 6px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.mapfs-btn:hover {
	border-color: #fff;
	background: rgba(10, 18, 14, 0.92);
}
.mapfs-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}
.mapfs-btn .ic {
	width: 1.1em;
	height: 1.1em;
}
@media (max-width: 640px) {
	.mapfs-btn span {
		display: none;
	}
	.mapfs-btn {
		padding: 0.55rem;
	}
}

/* v17: строка состояния карты не меняет высоту */
#mpstat {
	min-height: 1.7em;
	margin: 0.3rem 0;
}

/* v19: индикатор детализации поверх карты (не двигает страницу) */
.mapprog {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	z-index: 2;
	padding: 0.3rem 0.8rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: #fff;
	background: rgba(10, 18, 14, 0.78);
	border-radius: 999px;
	pointer-events: none;
	white-space: nowrap;
}
.mapprog[hidden] {
	display: none;
}

/* v19: индикатор детализации поверх карты (не двигает страницу) */
.mapprog {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	z-index: 2;
	padding: 0.3rem 0.8rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: #fff;
	background: rgba(10, 18, 14, 0.78);
	border-radius: 999px;
	pointer-events: none;
	white-space: nowrap;
}
.mapprog[hidden] {
	display: none;
}

/* v20: меню по правой кнопке на карте */
.mapmenu {
	position: absolute;
	z-index: 5;
	min-width: 210px;
	padding: 4px;
	color: #fff;
	background: rgba(12, 20, 16, 0.96);
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.mapmenu[hidden] {
	display: none;
}
.mm-head {
	display: grid;
	gap: 2px;
	padding: 0.45rem 0.7rem 0.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.18);
	margin-bottom: 4px;
	font-size: 0.86rem;
}
.mm-head span {
	color: #b8c8bd;
	font-size: 0.78rem;
}
.mm-sep {
	height: 1px;
	margin: 4px 6px;
	background: rgba(255, 255, 255, 0.15);
}
.mm-item {
	display: block;
	width: 100%;
	padding: 0.42rem 0.7rem;
	font: inherit;
	font-size: 0.86rem;
	text-align: left;
	color: #fff;
	background: transparent;
	border: 0;
	border-radius: 5px;
	cursor: pointer;
}
.mm-item:hover,
.mm-item:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	outline: none;
}
.mm-item.danger {
	color: #ff9a8a;
}

/* v21: ровные поля формы и одинаковые флажки */
.fields > label.f {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.fields > label.f input,
.fields > label.f select {
	width: 100%;
	box-sizing: border-box;
	min-height: 3.1rem;
}
.choices input,
.structs input {
	width: 1.1rem;
	height: 1.1rem;
	flex: none;
	margin: 0;
}
.choices {
	gap: 0.6rem 1.4rem;
}
.structs {
	gap: 0.55rem 1.3rem;
	align-items: center;
}
.structs label {
	min-height: 1.9rem;
}
.choices label,
.structs label {
	line-height: 1.2;
}
@media (max-width: 640px) {
	.structs input {
		width: 1.25rem;
		height: 1.25rem;
	}
}

/* ===== v22: выпадающий список структур на карте по сиду ===== */
.structs {
	position: relative;
}
.stdrop {
	position: relative;
	display: inline-flex;
}
.stdrop-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	max-width: 100%;
	padding: 0.5rem 0.75rem;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--ink);
	background: var(--panel2);
	border: 2px solid var(--line);
	border-radius: 6px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.stdrop-btn:hover {
	border-color: var(--accent);
}
.stdrop-btn:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
}
.stdrop-btn[aria-expanded="true"] {
	border-color: var(--accent);
}
.stdrop-caps {
	color: var(--muted);
	white-space: nowrap;
}
.stdrop-chips {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	flex-wrap: wrap;
	min-width: 0;
}
.stdrop-none {
	color: var(--muted);
	font-size: 0.82rem;
	font-weight: 400;
}
.stdrop-count {
	min-width: 1.5em;
	padding: 0 0.45em;
	text-align: center;
	font-size: 0.78rem;
	font-weight: 700;
	line-height: 1.55;
	color: var(--accent-ink);
	background: var(--accent);
	border-radius: 999px;
}
.stdrop-count:empty {
	display: none;
}
.stdrop-chev {
	width: 1em;
	height: 1em;
	color: var(--muted);
	transition: transform 0.15s;
}
.stdrop-btn[aria-expanded="true"] .stdrop-chev {
	transform: rotate(180deg);
}
.stdrop-panel {
	position: absolute;
	z-index: 30;
	top: calc(100% + 6px);
	left: 0;
	min-width: 300px;
	max-width: min(92vw, 480px);
	max-height: min(62vh, 480px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--panel);
	border: 2px solid var(--line);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.stdrop-panel[hidden] {
	display: none;
}
.stdrop-actions {
	display: flex;
	gap: 0.5rem;
	padding: 0.5rem 0.6rem;
	border-bottom: 1px solid var(--line);
}
.stdrop-all {
	flex: 1;
	padding: 0.38rem 0.6rem;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--ink);
	background: var(--panel2);
	border: 1px solid var(--line);
	border-radius: 5px;
	cursor: pointer;
}
.stdrop-all:hover {
	border-color: var(--accent);
	color: var(--accent);
}
.stdrop-list {
	overflow-y: auto;
	padding: 0.35rem;
	display: grid;
	gap: 1px;
}
.strow {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.45rem 0.55rem;
	border-radius: 5px;
	cursor: pointer;
}
.strow:hover {
	background: var(--panel2);
}
.strow input {
	accent-color: var(--accent);
	width: 1.05rem;
	height: 1.05rem;
	flex: none;
	margin: 0;
}
.strow.off {
	opacity: 0.5;
	cursor: not-allowed;
}
.stname {
	flex: 1;
	font-size: 0.9rem;
}
@media (max-width: 640px) {
	.stdrop-btn {
		font-size: 0.95rem;
	}
	.stdrop-panel {
		min-width: 0;
	}
	.strow {
		padding: 0.55rem;
	}
}

/* v23: видимая обводка при навигации клавиатурой по канвасу карты */
.mapwrap canvas:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: -3px;
}

/* ===== v30: новые инструменты (наковальня, зелья, броня, время) ===== */
.plan {
	list-style: none;
	margin: 0.6rem 0 0.4rem;
	padding: 0;
	display: grid;
	gap: 0.5rem;
	counter-reset: st;
}
.plan li {
	counter-increment: st;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.7rem;
	padding: 0.6rem 0.8rem;
	background: var(--panel2);
	border: 2px solid var(--line);
	border-radius: 8px;
}
.plan li::before {
	content: counter(st);
	display: grid;
	place-items: center;
	flex: none;
	width: 1.7rem;
	height: 1.7rem;
	border-radius: 50%;
	background: var(--accent);
	color: var(--accent-ink);
	font-weight: 700;
	font-size: 0.85rem;
}
.plan .pl,
.plan .pr {
	padding: 0.2rem 0.6rem;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 6px;
	font-weight: 600;
}
.plan i {
	font-style: normal;
	color: var(--muted);
}
.plan em {
	margin-left: auto;
	font-style: normal;
	font-weight: 700;
	color: var(--accent);
}
.plan small {
	flex-basis: 100%;
	color: var(--muted);
}
.pchain {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}
.pchain span {
	display: grid;
	gap: 2px;
	padding: 0.5rem 0.8rem;
	background: var(--panel2);
	border: 2px solid var(--line);
	border-radius: 8px;
	font-size: 0.9rem;
}
.pchain .ps0 {
	border-color: var(--accent2);
}
.pchain small {
	color: var(--muted);
	font-size: 0.78rem;
}
.pchain i {
	font-style: normal;
	color: var(--muted);
}
.tool textarea {
	width: 100%;
	box-sizing: border-box;
}

/* ===== пиксель-арт: редактор схемы ===== */
#pedit {
	margin: 0.8rem 0 0.4rem;
}
.pbrush {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0.6rem 0;
}
.pb {
	width: 44px;
	height: 44px;
	padding: 3px;
	background: var(--panel2);
	border: 2px solid var(--line);
	border-radius: 8px;
	cursor: pointer;
}
.pb i {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 5px;
	border: 1px solid rgba(0, 0, 0, 0.35);
}
.pb.on {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent);
}
.peditrow {
	margin: 0.4rem 0 0.2rem;
}
#cv {
	touch-action: none;
	max-width: 100%;
	height: auto;
}

.donate{display:flex;flex-wrap:wrap;gap:1.5rem;align-items:center;justify-content:space-between;margin:1.5rem 0;padding:1.2rem;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius)}
.donate-text{flex:1 1 20rem;min-width:0}
.donate-text h2{margin:0 0 .5rem}
.donate-text p{color:var(--muted);margin:0 0 1rem}
.donate-qr{flex:none;display:block;background:#fff;padding:.5rem;border-radius:var(--radius);line-height:0}
.donate-qr img{width:220px;height:220px;max-width:100%;image-rendering:pixelated}
