.fmg {
	--fmg-accent: #7ab38b;
	--fmg-accent-dark: #7ab38b;
	--fmg-ink: #242424;
	--fmg-text: #615f5a;
	--fmg-muted: #807d77;
	--fmg-line: #dedbd4;
	--fmg-surface: #fff;
	--fmg-warm: #f7f5f0;
	--fmg-focus: #7ab38b;
	background: #fbfaf7;
	border: 1px solid var(--fmg-line);
	color: var(--fmg-text);
	font-family: inherit;
	line-height: 1.5;
	margin: 2rem auto;
	max-width: 1480px;
	padding: clamp(1rem, 3vw, 2.5rem);
}

.fmg *,
.fmg *::before,
.fmg *::after {
	box-sizing: border-box;
}

.fmg__header {
	border-bottom: 1px solid var(--fmg-line);
	margin-bottom: 1.5rem;
	padding-bottom: 1.4rem;
}

.fmg__eyebrow {
	color: var(--fmg-accent-dark);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	margin: 0 0 0.3rem;
	text-transform: uppercase;
}

.fmg__title,
.fmg h3,
.fmg h4 {
	color: var(--fmg-ink);
	font-family: Georgia, "Times New Roman", serif;
}

.fmg__title {
	font-size: clamp(1.8rem, 4vw, 3rem);
	font-weight: 400;
	line-height: 1.12;
	margin: 0;
}

.fmg__intro {
	font-size: 1rem;
	margin: 0.7rem 0 0;
	max-width: 760px;
}

.fmg__community-nav {
	margin: 0.8rem 0 0;
}

.fmg__community-nav a {
	color: #7ab38b;
	font-size: 0.86rem;
	font-weight: 600;
	text-decoration: none;
}

.fmg__community-nav a:hover,
.fmg__community-nav a:focus {
	color: #659e76;
}

.fmg__hp {
	left: -9999px;
	opacity: 0;
	position: absolute;
	width: 1px;
}

[data-fmg-community-result] {
	color: #7ab38b;
	display: inline-block;
	font-size: 0.78rem;
	font-weight: 600;
	margin-top: 0.45rem;
}

[data-fmg-community-result][hidden] {
	display: none;
}

.fmg__layout {
	align-items: start;
	display: grid;
	gap: clamp(1rem, 2.5vw, 2rem);
	grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
}

.fmg__controls {
	display: grid;
	gap: 0.9rem;
}

.fmg__panel,
.fmg__chart-card,
.fmg__preview-card,
.fmg__warnings {
	background: var(--fmg-surface);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	box-shadow: 0 3px 14px rgba(36, 36, 36, 0.035);
}

.fmg__panel {
	margin: 0;
	min-width: 0;
	padding: 1rem;
}

.fmg__panel legend {
	align-items: center;
	color: var(--fmg-ink);
	display: flex;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 1.02rem;
	font-weight: 600;
	padding: 0 0.25rem;
}

.fmg__panel legend span {
	align-items: center;
	background: var(--fmg-accent);
	border-radius: 50%;
	color: #fff;
	display: inline-flex;
	font-family: Arial, sans-serif;
	font-size: 0.72rem;
	height: 1.55rem;
	justify-content: center;
	margin-right: 0.5rem;
	width: 1.55rem;
}

.fmg__grid {
	display: grid;
	gap: 0.75rem;
}

.fmg__grid--2,
.fmg__measurements {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fmg__measurements {
	display: none;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

.fmg__measurements.is-custom {
	display: grid;
}

.fmg__field {
	display: grid;
	gap: 0.32rem;
	margin-bottom: 0.75rem;
}

.fmg__field:last-child {
	margin-bottom: 0;
}

.fmg__field label,
.fmg__color > span:first-child {
	color: var(--fmg-ink);
	font-size: 0.8rem;
	font-weight: 650;
}

.fmg__field label span {
	color: var(--fmg-muted);
	font-weight: 400;
}

.fmg__field small {
	color: var(--fmg-muted);
	font-size: 0.7rem;
	line-height: 1.35;
}

.fmg input[type="number"],
.fmg input[type="text"],
.fmg select {
	appearance: none;
	background: #fff;
	border: 1px solid #c9c6bf;
	border-radius: 4px;
	color: var(--fmg-ink);
	font: inherit;
	font-size: 0.86rem;
	height: 42px;
	max-width: 100%;
	padding: 0 0.7rem;
	width: 100%;
}

.fmg select {
	background-image:
		linear-gradient(45deg, transparent 50%, #555 50%),
		linear-gradient(135deg, #555 50%, transparent 50%);
	background-position:
		calc(100% - 16px) 17px,
		calc(100% - 11px) 17px;
	background-repeat: no-repeat;
	background-size: 5px 5px, 5px 5px;
	padding-right: 2rem;
}

.fmg input[readonly] {
	background: var(--fmg-warm);
}

.fmg__calculation-summary {
	background: var(--fmg-warm);
	border: 1px solid var(--fmg-line);
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin-bottom: 0.45rem;
}

.fmg__calculation-summary .fmg__field {
	gap: 0.1rem;
	margin: 0;
	padding: 0.45rem 0.55rem;
}

.fmg__calculation-summary .fmg__field:not(:last-child) {
	border-right: 1px solid var(--fmg-line);
}

.fmg__calculation-summary .fmg__field label {
	font-size: 0.68rem;
}

[data-fmg-stitch-panel].is-shop-yarn [data-fmg-calculated] {
	background: transparent;
	border: 0;
	color: var(--fmg-ink);
	font-family: Georgia, "Times New Roman", serif;
	font-size: 1.05rem;
	font-weight: 600;
	height: auto;
	line-height: 1.2;
	min-height: 0;
	padding: 0;
	pointer-events: none;
}

.fmg__calculation-note {
	color: var(--fmg-muted);
	font-size: 0.7rem;
	line-height: 1.4;
	margin: 0 0 0.85rem;
}

.fmg__advanced-settings {
	border-top: 1px solid var(--fmg-line);
	margin-top: 0.8rem;
	padding-top: 0.65rem;
}

.fmg__advanced-settings summary {
	color: var(--fmg-muted);
	cursor: pointer;
	font-size: 0.74rem;
	font-weight: 650;
}

.fmg__advanced-settings .fmg__field {
	margin: 0.7rem 0 0;
}

.fmg input[type="range"] {
	accent-color: var(--fmg-accent-dark);
	min-height: 35px;
	width: 100%;
}

.fmg input:focus-visible,
.fmg select:focus-visible,
.fmg button:focus-visible,
.fmg__chart-scroll:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--fmg-focus) 38%, transparent);
	outline-offset: 2px;
}

.fmg__colors {
	display: grid;
	gap: 0.65rem;
}

.fmg__shop-yarn {
	border-bottom: 1px solid var(--fmg-line);
	margin-bottom: 0.9rem;
	padding-bottom: 0.9rem;
}

.fmg__shop-yarn[hidden] {
	display: none;
}

.fmg__section-label {
	color: var(--fmg-ink);
	font-size: 0.8rem;
	font-weight: 700;
	margin: 0 0 0.55rem;
}

.fmg__section-label--custom {
	color: var(--fmg-muted);
	font-size: 0.72rem;
}

.fmg__yarn-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin-bottom: 0.8rem;
}

.fmg__yarn-presets button {
	background: #f3f1ec;
	border: 1px solid var(--fmg-line);
	border-radius: 999px;
	color: var(--fmg-text);
	cursor: pointer;
	font: inherit;
	font-size: 0.69rem;
	font-weight: 650;
	min-height: 34px;
	padding: 0.38rem 0.65rem;
}

.fmg__yarn-presets button[aria-pressed="true"] {
	background: var(--fmg-accent-dark);
	border-color: var(--fmg-accent-dark);
	color: #fff;
}

.fmg__shop-color {
	align-items: center;
	display: grid;
	gap: 0.45rem;
	grid-template-columns: 30px minmax(0, 1fr);
}

.fmg__shop-color-grid {
	grid-template-columns: 1fr;
}

.fmg__shop-color > i {
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px #aaa69f;
	display: block;
	height: 28px;
	width: 28px;
}

.fmg__shop-color select {
	font-size: 0.75rem;
	min-width: 0;
}

.fmg__shop-color.is-enhanced {
	display: block;
}

.fmg__shop-color.is-enhanced > i {
	display: none;
}

.fmg__visual-color-picker {
	position: relative;
	width: 100%;
}

.fmg .fmg__color-picker-toggle {
	align-items: center;
	background: #fff;
	border: 1px solid #c9c6bf;
	border-radius: 4px;
	color: var(--fmg-ink);
	cursor: pointer;
	display: grid !important;
	font: inherit;
	gap: 0.5rem;
	grid-template-columns: 26px minmax(0, 1fr) auto;
	justify-content: stretch !important;
	justify-items: stretch;
	min-height: 44px;
	padding: 0.4rem 0.6rem;
	text-align: left !important;
	width: 100%;
}

.fmg__color-picker-toggle > i,
.fmg__color-picker-menu button > i {
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px #9d9992;
	height: 24px;
	width: 24px;
}

.fmg__color-picker-toggle > span {
	font-size: 0.8rem;
	font-weight: 600;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fmg__color-picker-toggle > small {
	color: var(--fmg-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.67rem;
}

.fmg__color-picker-menu {
	background: #fff;
	border: 1px solid #aaa69f;
	box-shadow: 0 10px 28px rgba(36, 36, 36, 0.18);
	left: 0;
	max-height: 260px;
	overflow-y: auto;
	padding: 0.3rem;
	position: absolute;
	right: 0;
	top: calc(100% + 4px);
	z-index: 30;
}

.fmg__color-picker-menu[hidden] {
	display: none;
}

.fmg__color-picker-menu button {
	align-items: center;
	background: #fff;
	border: 0;
	color: var(--fmg-ink);
	cursor: pointer;
	display: grid;
	font: inherit;
	gap: 0.55rem;
	grid-template-columns: 26px minmax(0, 1fr) auto;
	min-height: 42px;
	padding: 0.42rem 0.5rem;
	text-align: left;
	width: 100%;
}

.fmg__color-picker-menu button:hover,
.fmg__color-picker-menu button:focus-visible,
.fmg__color-picker-menu button[aria-selected="true"] {
	background: var(--fmg-warm);
}

.fmg__color-picker-menu button[aria-selected="true"] {
	box-shadow: inset 3px 0 var(--fmg-accent-dark);
}

.fmg__color-picker-menu button > span {
	font-size: 0.77rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fmg__color-picker-menu button > small {
	color: var(--fmg-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.66rem;
}

.fmg button.fmg__swap-colors {
	align-items: center;
	align-self: center;
	background: var(--fmg-accent-dark);
	border: 1px solid var(--fmg-accent-dark);
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	height: 2rem;
	justify-self: center;
	margin: -0.15rem 0;
	min-height: 2rem;
	padding: 0;
	width: 2rem;
}

.fmg button.fmg__swap-colors:hover {
	background: var(--fmg-accent);
	border-color: var(--fmg-accent);
	color: #fff;
}

.fmg button.fmg__swap-colors:focus-visible {
	outline: 3px solid var(--fmg-focus);
	outline-offset: 2px;
}

.fmg__swap-colors svg {
	fill: none;
	height: 1rem;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
	width: 1rem;
}

.fmg__shop-link {
	color: var(--fmg-accent-dark);
	display: inline-block;
	font-size: 0.74rem;
	font-weight: 650;
	margin-top: 0.1rem;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.fmg__color {
	align-items: center;
	display: flex;
	justify-content: space-between;
}

.fmg__color-control {
	align-items: center;
	display: flex;
	gap: 0.55rem;
}

.fmg__color input {
	background: transparent;
	border: 1px solid var(--fmg-line);
	border-radius: 50%;
	cursor: pointer;
	height: 38px;
	overflow: hidden;
	padding: 2px;
	width: 38px;
}

.fmg__color input::-webkit-color-swatch-wrapper {
	padding: 0;
}

.fmg__color input::-webkit-color-swatch {
	border: 0;
	border-radius: 50%;
}

.fmg__color output {
	color: var(--fmg-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.74rem;
	min-width: 64px;
}

.fmg__checks {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-top: 0.75rem;
}

.fmg__checks label {
	align-items: center;
	color: var(--fmg-ink);
	cursor: pointer;
	display: flex;
	font-size: 0.76rem;
	gap: 0.45rem;
	line-height: 1.25;
}

.fmg input[type="checkbox"] {
	appearance: none;
	background-color: #fff;
	border: 1px solid #777;
	border-radius: 2px;
	flex: 0 0 auto;
	height: 18px;
	margin: 0;
	width: 18px;
}

.fmg input[type="checkbox"]:checked {
	background-color: var(--fmg-accent);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M3.5 9.2 7.2 13l7.4-8' fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.6'/%3E%3C/svg%3E");
	background-position: center;
	background-repeat: no-repeat;
	background-size: 16px 16px;
	border-color: var(--fmg-accent);
}

.fmg input[type="checkbox"]:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

[data-fmg-free-design-control][hidden] {
	display: none !important;
}

[data-fmg-shop-yarn-control][hidden],
[data-fmg-custom-yarn-control][hidden] {
	display: none !important;
}

.fmg__preset-select {
	height: 1px !important;
	margin: -1px !important;
	overflow: hidden !important;
	padding: 0 !important;
	position: absolute !important;
	width: 1px !important;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.fmg__motif-presets {
	display: grid;
	gap: 0.45rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fmg .fmg__motif-presets button {
	--btn-bgcolor: #fff;
	--btn-brd-color: var(--fmg-line);
	--btn-brd-width: 1px;
	--btn-color: var(--fmg-ink);
	align-items: center;
	background: #fff;
	border: 1px solid var(--fmg-line);
	border-radius: 0;
	color: var(--fmg-ink);
	display: grid;
	gap: 0.45rem;
	grid-template-columns: 38px minmax(0, 1fr);
	justify-content: initial;
	min-height: 68px;
	padding: 0.4rem;
	text-align: left;
	text-transform: none;
	transition: none;
}

.fmg .fmg__motif-presets button:hover {
	background: #f7faf8;
	border-color: #9ec8aa;
}

.fmg .fmg__motif-presets button[aria-pressed="true"] {
	--btn-bgcolor: #f2f7f3;
	--btn-brd-color: #7ab38b;
	background: #f2f7f3;
	border-color: #7ab38b;
	box-shadow: inset 3px 0 #7ab38b;
}

.fmg__motif-presets canvas {
	background: transparent;
	display: block;
	height: 50px;
	image-rendering: pixelated;
	width: 38px;
}

.fmg__motif-presets button > span {
	display: grid;
	gap: 0.1rem;
	min-width: 0;
}

.fmg__motif-presets strong {
	color: var(--fmg-ink);
	font-size: 0.72rem;
	line-height: 1.2;
}

.fmg__motif-presets small {
	color: var(--fmg-muted);
	font-size: 0.61rem;
	font-weight: 400;
	line-height: 1.25;
}

.fmg__preset-note {
	background: var(--fmg-warm);
	border-left: 3px solid var(--fmg-accent);
	color: var(--fmg-text);
	font-size: 0.75rem;
	line-height: 1.45;
	margin: 0 0 0.75rem;
	padding: 0.65rem 0.75rem;
}

.fmg__actions,
.fmg__export-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.55rem;
}

.fmg__actions {
	align-items: center;
	border-top: 1px solid var(--fmg-line);
	justify-content: space-between;
	margin-top: 0.75rem;
	padding-top: 0.65rem;
}

.fmg__auto-preview-note {
	color: var(--fmg-accent-dark);
	font-size: 0.7rem;
	font-weight: 650;
	margin: 0;
}

.fmg__auto-preview-note::before {
	content: "✓";
	margin-right: 0.3rem;
}

.fmg__action-buttons {
	display: flex;
	gap: 0.4rem;
}

.fmg__actions .fmg__button {
	min-height: 36px;
	padding: 0.5rem 0.7rem;
}

.fmg__actions .fmg__button--primary {
	flex-grow: 0;
}

.fmg .fmg__button {
	background-color: #f7f7f7;
	border: 1px solid #e5e5e5;
	border-radius: 0;
	color: #333333;
	cursor: pointer;
	font: inherit;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.2;
	min-height: 43px;
	padding: 0.7rem 0.9rem;
	transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.fmg .fmg__button:hover {
	background-color: #ededed;
	border-color: #d7d7d7;
}

.fmg__button:active {
	transform: translateY(1px);
}

.fmg .fmg__button.fmg__button--primary {
	background-color: var(--fmg-accent);
	border-color: var(--fmg-accent);
	color: #fff;
	flex-grow: 1;
}

.fmg .fmg__button.fmg__button--primary:hover {
	background-color: #659e76;
	border-color: #659e76;
	color: #fff;
}

.fmg .fmg__button.fmg__button--quiet {
	background: transparent;
	border-color: transparent;
}

.fmg__results {
	min-width: 0;
	position: sticky;
	top: 1rem;
}

.fmg__result-head {
	align-items: center;
	display: flex;
	justify-content: space-between;
	margin-bottom: 0.8rem;
}

.fmg__result-head h3 {
	font-size: clamp(1.3rem, 2vw, 1.8rem);
	font-weight: 400;
	margin: 0;
}

.fmg__view-switch {
	background: #edece8;
	display: inline-flex;
	padding: 3px;
}

.fmg__view-switch button {
	background: transparent;
	border: 0;
	color: #555;
	cursor: pointer;
	font: inherit;
	font-size: 0.78rem;
	font-weight: 650;
	min-height: 36px;
	padding: 0.45rem 0.75rem;
}

.fmg__view-switch button[aria-pressed="true"] {
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	color: var(--fmg-ink);
}

.fmg__visuals {
	align-items: start;
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1.6fr) minmax(230px, 0.7fr);
}

.fmg__chart-card,
.fmg__preview-card {
	min-width: 0;
	padding: clamp(0.75rem, 2vw, 1.15rem);
}

.fmg__chart-card h4,
.fmg__preview-card h4,
.fmg__warnings h4 {
	font-size: 1rem;
	margin: 0;
}

.fmg__chart-toolbar {
	align-items: center;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	margin-bottom: 0.8rem;
}

.fmg__chart-toolbar label {
	align-items: center;
	color: var(--fmg-muted);
	display: flex;
	font-size: 0.7rem;
	gap: 0.4rem;
}

.fmg__chart-toolbar input {
	width: 90px;
}

.fmg__chart-toolbar-actions {
	align-items: center;
	display: flex;
	gap: 0.7rem;
}

.fmg button.fmg__chart-edit {
	--btn-bgcolor: #f7f7f7;
	--btn-brd-color: #dedbd5;
	--btn-brd-width: 1px;
	--btn-color: #333;
	align-items: center;
	background: #f7f7f7;
	border: 1px solid #dedbd5;
	border-radius: 0;
	color: #333;
	display: inline-flex;
	font-size: 0.7rem;
	font-weight: 600;
	gap: 0.3rem;
	min-height: 32px;
	padding: 0.35rem 0.55rem;
}

.fmg button.fmg__chart-edit[aria-pressed="true"] {
	--btn-bgcolor: #7ab38b;
	--btn-brd-color: #7ab38b;
	--btn-color: #fff;
	background-color: #7ab38b !important;
	border-color: #7ab38b;
	color: #fff !important;
}

.fmg__chart-edit svg {
	fill: none;
	height: 0.9rem;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
	width: 0.9rem;
}

.fmg__draw-tools {
	align-items: center;
	background: #f2f7f3;
	border-left: 4px solid var(--fmg-accent);
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: space-between;
	margin: 0 0 0.75rem;
	padding: 0.55rem 0.65rem;
}

.fmg__draw-tools[hidden] {
	display: none;
}

.fmg__draw-tools p {
	color: var(--fmg-text);
	font-size: 0.7rem;
	line-height: 1.4;
	margin: 0;
}

.fmg__draw-colors {
	display: flex;
	gap: 0.35rem;
}

.fmg .fmg__draw-colors button {
	--btn-bgcolor: #fff;
	--btn-brd-color: var(--fmg-line);
	--btn-brd-width: 1px;
	--btn-color: #333;
	align-items: center;
	background: #fff;
	border: 1px solid var(--fmg-line);
	border-radius: 0;
	color: #333;
	display: inline-flex;
	font-size: 0.68rem;
	font-weight: 600;
	gap: 0.3rem;
	min-height: 32px;
	padding: 0.3rem 0.45rem;
}

.fmg .fmg__draw-colors button[aria-pressed="true"] {
	--btn-brd-color: #7ab38b;
	border-color: #7ab38b;
	box-shadow: inset 0 0 0 1px #7ab38b;
}

.fmg__draw-colors i {
	border: 1px solid #77736c;
	display: block;
	height: 0.85rem;
	width: 0.85rem;
}

.fmg .fmg__draw-tools .fmg__button {
	flex: 0 0 auto;
	min-height: 32px;
	padding: 0.35rem 0.55rem;
}

.fmg__chart-scroll {
	background:
		linear-gradient(45deg, #f7f6f3 25%, transparent 25%),
		linear-gradient(-45deg, #f7f6f3 25%, transparent 25%);
	background-size: 12px 12px;
	border: 1px solid var(--fmg-line);
	max-height: min(72vh, 900px);
	overflow: auto;
	overscroll-behavior: contain;
	padding: 0.5rem;
}

.fmg__chart-scroll.is-drawing {
	border-color: var(--fmg-accent);
	box-shadow: 0 0 0 2px rgba(122, 179, 139, 0.18);
}

.fmg__chart-scroll.is-drawing canvas {
	cursor: crosshair;
	touch-action: none;
}

.fmg__chart-scroll canvas {
	display: block;
	margin: 0 auto;
	max-width: none;
}

.fmg__preview-card canvas {
	display: block;
	height: auto;
	margin: 0 auto;
	max-height: 560px;
	max-width: 100%;
	width: 100%;
}

.fmg__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.8rem 1.2rem;
	margin-top: 0.8rem;
}

.fmg__legend span {
	align-items: center;
	color: var(--fmg-text);
	display: inline-flex;
	font-size: 0.75rem;
	gap: 0.4rem;
}

.fmg__legend i {
	border: 1px solid #77736c;
	display: inline-block;
	height: 18px;
	width: 18px;
}

.fmg__anatomy {
	border-top: 1px solid var(--fmg-line);
	display: grid;
	gap: 0.3rem;
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0.7rem 0 0;
}

.fmg__anatomy li {
	align-items: center;
	display: flex;
	font-size: 0.72rem;
	gap: 0.4rem;
}

.fmg__dot {
	border-radius: 50%;
	display: inline-block;
	height: 8px;
	width: 8px;
}

.fmg__dot--cuff {
	background: var(--fmg-accent-dark);
}

.fmg__dot--thumb {
	background: #b1772e;
}

.fmg__dot--crown {
	background: #7d537a;
}

.fmg__warnings {
	margin-top: 1rem;
	padding: 1rem 1.1rem;
}

.fmg__warnings ul {
	display: grid;
	gap: 0.35rem;
	list-style: none;
	margin: 0.65rem 0 0;
	max-height: 160px;
	overflow: auto;
	padding: 0;
}

.fmg__warnings li {
	color: #8f241e;
	font-size: 0.76rem;
	padding-left: 1.25rem;
	position: relative;
}

.fmg__warnings li::before {
	content: "!";
	font-weight: 800;
	left: 0;
	position: absolute;
}

.fmg__warnings li.is-clear {
	color: #316844;
}

.fmg__warnings li.is-clear::before {
	content: "✓";
}

.fmg__share {
	background: var(--fmg-surface);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	margin-top: 1rem;
	padding: 1rem 1.1rem;
}

.fmg__share-head h4 {
	font-size: 1.05rem;
	margin: 0;
}

.fmg__share-head p {
	color: var(--fmg-muted);
	font-size: 0.75rem;
	margin: 0.2rem 0 0;
}

.fmg__share-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	margin-top: 0.85rem;
}

.fmg__share-card {
	background: var(--fmg-warm);
	border: 1px solid var(--fmg-line);
	border-radius: 6px;
	min-width: 0;
	padding: 0.8rem;
}

.fmg__share-card h5 {
	color: var(--fmg-ink);
	font-size: 0.86rem;
	margin: 0;
}

.fmg__share-card > p:not(.fmg__share-status) {
	color: var(--fmg-muted);
	font-size: 0.68rem;
	line-height: 1.4;
	margin: 0.2rem 0 0.65rem;
	min-height: 1.9em;
}

.fmg__save-design > label,
.fmg__email-form > label {
	color: var(--fmg-ink);
	display: block;
	font-size: 0.68rem;
	font-weight: 700;
	margin-bottom: 0.3rem;
}

.fmg__share-input-row {
	display: flex;
	gap: 0.4rem;
}

.fmg__share-input-row input {
	min-width: 0;
}

.fmg__share-input-row .fmg__button {
	flex: 0 0 auto;
}

.fmg__share-card .fmg__share-input-row {
	flex-direction: column;
}

.fmg__share-card .fmg__button {
	background-color: #7ab38b;
	border-color: #7ab38b;
	border-radius: 0;
	color: #fff;
	font-weight: 600;
	justify-content: center;
	width: 100%;
}

.fmg .fmg__share-card .fmg__button:hover {
	background-color: #659e76;
	border-color: #659e76;
	color: #fff;
}

.fmg__export-card .fmg__export-actions {
	display: grid;
	gap: 0.4rem;
	grid-template-columns: 1fr;
	margin: 0;
}

.fmg__share-card small {
	color: var(--fmg-muted);
	display: block;
	font-size: 0.68rem;
	line-height: 1.4;
	margin-top: 0.35rem;
}

.fmg__email-verification {
	margin-top: 0.45rem;
}

.fmg__email-verification[hidden] {
	display: none;
}

[data-fmg-share-link-result] {
	margin-top: 0.45rem;
}

[data-fmg-share-link-result][hidden] {
	display: none;
}

[data-fmg-share-link-result] input {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.7rem;
}

.fmg__saved-designs {
	display: grid;
	gap: 0.3rem;
	list-style: none;
	margin: 0.55rem 0 0;
	max-height: 150px;
	overflow-y: auto;
	padding: 0;
}

.fmg__saved-designs li {
	align-items: center;
	background: var(--fmg-warm);
	display: flex;
	font-size: 0.73rem;
	gap: 0.5rem;
	justify-content: space-between;
	padding: 0.35rem 0.45rem;
}

.fmg__saved-designs li > span:first-child {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fmg__saved-designs li > span:last-child {
	display: flex;
	flex: 0 0 auto;
	gap: 0.25rem;
}

.fmg__saved-designs button {
	background: transparent;
	border: 0;
	color: var(--fmg-accent-dark);
	cursor: pointer;
	font-size: 0.68rem;
	font-weight: 700;
	padding: 0.2rem;
}

.fmg__saved-designs button:last-child {
	color: #8f241e;
}

.fmg__share-status {
	font-size: 0.72rem;
	font-weight: 600;
	margin: 0.4rem 0 0;
	min-height: 1.1em;
}

.fmg__share-status.is-success {
	color: #316844;
}

.fmg__share-status.is-error {
	color: #8f241e;
}

.fmg__print-details {
	color: var(--fmg-muted);
	display: none;
	font-size: 0.76rem;
	margin-top: 1rem;
}

.fmg__instructions {
	border-top: 1px solid var(--fmg-line);
	margin-top: clamp(2rem, 4vw, 3.5rem);
	padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

.fmg__instructions-head {
	max-width: 850px;
}

.fmg__instructions-head h3 {
	font-size: clamp(1.55rem, 3vw, 2.2rem);
	font-weight: 400;
	line-height: 1.2;
	margin: 0;
}

.fmg__instructions-head > p:last-child {
	margin: 0.65rem 0 0;
}

.fmg__instruction-method {
	background: var(--fmg-surface);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	color: var(--fmg-ink);
	font-size: 0.92rem;
	line-height: 1.55;
	margin: 0 0 1.2rem;
	max-width: 850px;
	padding: 0.95rem 1.1rem;
}

.fmg__instruction-method p {
	margin: 0;
}

.fmg__instruction-method p + p {
	margin-top: 0.7rem;
}

.fmg__instruction-glossary {
	background: var(--fmg-surface);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	margin: 0 0 1.4rem;
	max-width: 850px;
	padding: 0.75rem 1.1rem 0.85rem;
}

.fmg__instruction-glossary summary {
	color: var(--fmg-ink);
	cursor: pointer;
	font-size: 0.92rem;
	font-weight: 700;
	list-style: none;
}

.fmg__instruction-glossary summary::-webkit-details-marker {
	display: none;
}

.fmg__instruction-glossary summary::after {
	color: var(--fmg-muted);
	content: " +";
	font-weight: 400;
}

.fmg__instruction-glossary[open] summary::after {
	content: " –";
}

.fmg__instruction-glossary dl {
	display: grid;
	gap: 0.85rem;
	grid-template-columns: 1fr;
	margin: 0.85rem 0 0;
}

.fmg__instruction-glossary dt {
	color: var(--fmg-ink);
	font-size: 0.82rem;
	font-weight: 700;
}

.fmg__instruction-glossary dd {
	color: var(--fmg-ink);
	font-size: 0.82rem;
	line-height: 1.5;
	margin: 0.2rem 0 0;
}

.fmg__instruction-steps-wide {
	grid-column: 1 / -1;
}

.fmg__instruction-facts {
	background: var(--fmg-line);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin: 1.4rem 0;
	overflow: hidden;
}

.fmg__instruction-facts > div {
	background: var(--fmg-surface);
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
	padding: 0.85rem 1rem;
}

.fmg__instruction-facts span {
	color: var(--fmg-muted);
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.fmg__instruction-facts strong {
	color: var(--fmg-ink);
	font-size: 0.88rem;
	overflow-wrap: anywhere;
}

.fmg__yarn-requirement {
	align-items: center;
	background: #eef5ef;
	border: 1px solid #c9dcca;
	border-radius: 10px;
	display: grid;
	gap: 1.25rem;
	grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.25fr);
	margin: 0 0 1.4rem;
	padding: 1rem 1.1rem;
}

.fmg__yarn-requirement p {
	margin: 0 0 0.15rem;
}

.fmg__yarn-requirement > div > strong {
	color: var(--fmg-ink);
	display: block;
	font-size: 1.15rem;
}

.fmg__yarn-requirement small {
	color: var(--fmg-muted);
	display: block;
	font-size: 0.7rem;
	margin-top: 0.2rem;
}

.fmg__yarn-requirement dl {
	display: grid;
	gap: 0.6rem;
	grid-template-columns: 1fr 1fr;
	margin: 0;
}

.fmg__yarn-requirement dl > div {
	background: rgba(255, 255, 255, 0.75);
	border-radius: 7px;
	padding: 0.65rem 0.75rem;
}

.fmg__yarn-requirement dt {
	color: var(--fmg-muted);
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
}

.fmg__yarn-requirement dd {
	color: var(--fmg-ink);
	font-size: 0.8rem;
	font-weight: 600;
	margin: 0.15rem 0 0;
}

.fmg__cart-action {
	align-items: center;
	border-top: 1px solid #c9dcca;
	display: flex;
	gap: 0.65rem;
	grid-column: 1 / -1;
	padding-top: 0.9rem;
}

.fmg__cart-action p {
	font-size: 0.75rem;
	font-weight: 600;
	margin: 0;
}

.fmg__cart-action p.is-success {
	color: #316844;
}

.fmg__cart-action p.is-error {
	color: #8f241e;
}

.fmg__cart-action a {
	color: var(--fmg-accent-dark);
	font-size: 0.75rem;
	font-weight: 700;
	margin-left: auto;
}

.fmg__instruction-steps {
	counter-reset: fmg-instruction;
	display: grid;
	gap: 0.95rem;
	grid-template-columns: 1fr;
	list-style: none;
	margin: 0;
	max-width: 850px;
	padding: 0;
}

.fmg__instruction-steps > li {
	background: var(--fmg-surface);
	border: 1px solid var(--fmg-line);
	border-radius: 10px;
	counter-increment: fmg-instruction;
	min-width: 0;
	padding: 1rem 1.1rem 1rem 3.65rem;
	position: relative;
}

.fmg__instruction-steps > li::before {
	align-items: center;
	background: var(--fmg-accent);
	border-radius: 50%;
	color: #fff;
	content: counter(fmg-instruction);
	display: flex;
	font-size: 0.8rem;
	font-weight: 700;
	height: 2rem;
	justify-content: center;
	left: 1rem;
	position: absolute;
	top: 1rem;
	width: 2rem;
}

.fmg__instruction-steps h4 {
	font-size: 1rem;
	margin: 0 0 0.35rem;
}

.fmg__instruction-steps p {
	font-size: 0.9rem;
	line-height: 1.55;
	margin: 0;
}

.fmg__instruction-steps p + p {
	margin-top: 0.65rem;
}

.fmg__instruction-steps a,
.fmg__instructions-head a {
	color: var(--fmg-accent-dark);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.fmg__instruction-note {
	background: var(--fmg-warm);
	border-left: 4px solid var(--fmg-accent-dark);
	margin-top: 1rem;
	padding: 0.85rem 1rem;
}

@media (max-width: 1120px) {
	.fmg__layout {
		grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
	}

	.fmg__visuals {
		grid-template-columns: 1fr;
	}

	.fmg__preview-card canvas {
		max-width: 480px;
	}
}

@media (max-width: 780px) {
	.fmg {
		border-left: 0;
		border-right: 0;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		padding: 1rem;
		width: 100vw;
	}

	.fmg__layout {
		display: block;
	}

	.fmg__controls {
		margin-bottom: 1.5rem;
	}

	.fmg__results {
		position: static;
	}

	.fmg__chart-scroll {
		max-height: 68vh;
	}

	.fmg__instruction-facts {
		grid-template-columns: 1fr 1fr;
	}

	.fmg__instruction-glossary dl {
		grid-template-columns: 1fr;
	}

	.fmg__share-grid {
		grid-template-columns: 1fr;
	}

	.fmg__yarn-requirement {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 460px) {
	.fmg__grid--2 {
		grid-template-columns: 1fr;
	}

	.fmg__calculation-summary {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.fmg__calculation-summary .fmg__field {
		border-bottom: 1px solid var(--fmg-line);
	}

	.fmg__calculation-summary .fmg__field:nth-child(even) {
		border-right: 0;
	}

	.fmg__calculation-summary .fmg__field:nth-last-child(-n + 2) {
		border-bottom: 0;
	}

	.fmg__checks {
		grid-template-columns: 1fr;
	}

	.fmg__result-head,
	.fmg__chart-toolbar {
		align-items: flex-start;
		flex-direction: column;
	}

	.fmg__actions .fmg__button {
		flex: 1 1 45%;
	}

	.fmg__share-input-row {
		align-items: stretch;
		flex-direction: column;
	}

	.fmg__instruction-facts,
	.fmg__instruction-steps,
	.fmg__instruction-glossary dl {
		grid-template-columns: 1fr;
	}

	.fmg__yarn-requirement dl {
		grid-template-columns: 1fr;
	}

	.fmg__cart-action {
		align-items: stretch;
		flex-direction: column;
	}

	.fmg__cart-action a {
		margin-left: 0;
	}
}

@media print {
	@page {
		margin: 12mm;
		size: auto;
	}

	body * {
		visibility: hidden;
	}

	.fmg.is-printing,
	.fmg.is-printing * {
		visibility: visible;
	}

	.fmg.is-printing {
		background: #fff;
		border: 0;
		left: 0;
		margin: 0;
		max-width: none;
		padding: 0;
		position: absolute;
		top: 0;
		width: 100%;
	}

	.fmg.is-printing .fmg__layout {
		display: block;
	}

	.fmg.is-printing .fmg__controls,
	.fmg.is-printing .fmg__view-switch,
	.fmg.is-printing .fmg__chart-toolbar label,
	.fmg.is-printing .fmg__share,
	.fmg.is-printing .fmg__anatomy {
		display: none;
	}

	.fmg.is-printing .fmg__header {
		margin-bottom: 10mm;
	}

	.fmg.is-printing .fmg__results {
		position: static;
	}

	.fmg.is-printing .fmg__visuals {
		display: grid;
		grid-template-columns: minmax(0, 2fr) minmax(180px, 0.7fr);
	}

	.fmg.is-printing .fmg__chart-card,
	.fmg.is-printing .fmg__preview-card,
	.fmg.is-printing .fmg__warnings {
		border: 1px solid #bbb;
		box-shadow: none;
		break-inside: avoid;
	}

	.fmg.is-printing .fmg__chart-scroll {
		border: 0;
		max-height: none;
		overflow: visible;
		padding: 0;
	}

	.fmg.is-printing .fmg__chart-scroll canvas {
		height: auto !important;
		max-width: 100%;
		width: auto !important;
	}

	.fmg.is-printing .fmg__print-details {
		display: block;
	}

	.fmg.is-printing .fmg__instruction-glossary {
		break-inside: avoid;
	}

	.fmg.is-printing .fmg__instruction-glossary dl {
		display: grid;
	}

	.fmg.is-printing .fmg__instruction-steps > li {
		break-inside: avoid;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fmg *,
	.fmg *::before,
	.fmg *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
