/* Судоку за деца: same restrained colours as Mentorio's other games, with friendly shapes. */
body.sd-page { background: #f2f5fa; color: #0f1429; }
.sd-main { max-width: 1060px; margin: 32px auto 60px; padding: 0 20px; }
.sd-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); align-items: start; gap: 24px; }
.sd-card { min-width: 0; padding: 24px; background: #fff; border: 1px solid #dce3ef; border-radius: 10px; }
.sd-side { display: grid; gap: 16px; }
.sd-card h2 { margin: 0 0 12px; font-size: 20px; line-height: 1.3; }
.sd-eyebrow { display: block; margin-bottom: 6px; color: #8a6d00; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.sd-muted { margin: 12px 0 0; color: #66768a; font-size: 12px; line-height: 1.6; }

/* Shapes */
.sd-shape { display: block; width: 100%; height: 100%; overflow: visible; }
.sd-shape > * { stroke: #102440; stroke-width: 4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sd-shape--triangle > * { fill: #ffe38a; }
.sd-shape--square > * { fill: #bcd7ff; }
.sd-shape--circle > * { fill: #ffc4c4; }
.sd-shape--rectangle > * { fill: #b8eccb; }

/* Top bar */
.sd-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sd-levels { display: inline-flex; padding: 3px; border: 1px solid #dce3ef; border-radius: 8px; background: #f8fafc; }
.sd-page .sd-levels button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 6px; background: transparent; color: #536477; font-size: 13px; font-weight: 800; line-height: 1; box-shadow: none; }
.sd-page .sd-levels button[aria-pressed=true] { background: #102440; color: #fff; }
.sd-page .sd-levels button:not([aria-pressed=true]):hover { background: #eaf0f7; }
.sd-filled { color: #536477; font-size: 13px; font-variant-numeric: tabular-nums; }
.sd-filled span { color: #0f1429; font-weight: 800; }

/* Board: 4 × 4 with heavy lines between the 2 × 2 blocks */
.sd-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; max-width: 440px; aspect-ratio: 1; margin: 22px auto 0; border: 3px solid #102440; border-radius: 8px; overflow: hidden; background: #fff; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.sd-page button.sd-cell { display: grid; place-items: center; min-width: 0; min-height: 0; aspect-ratio: 1; margin: 0; padding: 18%; border: 0; border-right: 1px solid #c3cddb; border-bottom: 1px solid #c3cddb; border-radius: 0; background: #fff; box-shadow: none; cursor: pointer; transition: background-color 120ms ease; }
.sd-page button.sd-cell:nth-child(4n) { border-right: 0; }
.sd-page button.sd-cell:nth-child(4n + 2) { border-right: 3px solid #102440; }
.sd-page button.sd-cell:nth-child(n + 13) { border-bottom: 0; }
.sd-page button.sd-cell:nth-child(n + 5):nth-child(-n + 8) { border-bottom: 3px solid #102440; }
.sd-page button.sd-cell:hover:not(.is-given) { background: #f2f6fb; }
.sd-page button.sd-cell:focus-visible { position: relative; z-index: 1; outline: 3px solid #3f6297; outline-offset: -5px; }
.sd-page button.sd-cell.is-given { background: #f4f6f9; cursor: default; }
.sd-page button.sd-cell.is-given .sd-shape > * { stroke-width: 5; }
.sd-page button.sd-cell.is-conflict { background: #ffe9ea; box-shadow: inset 0 0 0 3px #d4505d; }
.sd-page button.sd-cell.is-solved { background: #e8f7ee; cursor: default; }
.sd-cell .sd-shape { animation: sd-pop 180ms ease-out; }
.sd-cell.is-shake { animation: sd-shake 260ms ease; }
.sd-cell.is-hint { background: #fff3bc !important; }
@keyframes sd-pop { from { transform: scale(.6); opacity: .3; } to { transform: scale(1); opacity: 1; } }
@keyframes sd-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.sd-page p.sd-message { min-height: 1.6em; margin: 16px 0 14px; color: #102440; font-size: 14px; font-weight: 800; line-height: 1.6; text-align: center; }
.sd-message.error { color: #a02a33 !important; }
.sd-message.success { color: #267346 !important; }

/* Shape picker */
.sd-palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 580px; margin: 0 auto; padding: 12px; border: 1px solid #e3e8ef; border-radius: 10px; background: #f8fafc; }
.sd-page .sd-pick { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 0; padding: 10px 6px 8px; border: 1px solid #d5dfea; border-radius: 8px; background: #fff; color: #536477; font-size: 11px; font-weight: 800; line-height: 1.2; box-shadow: none; cursor: pointer; }
.sd-pick .sd-shape { width: 40px; height: 40px; }
.sd-pick--erase i { display: grid; place-items: center; width: 40px; height: 40px; color: #536477; font-size: 22px; }
.sd-pick__name { max-width: 100%; font-size: 10.5px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.sd-pick__left { position: absolute; top: 4px; right: 5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #eef2f7; color: #536477; font-size: 11px; line-height: 18px; font-variant-numeric: tabular-nums; }
.sd-page .sd-pick:hover { background: #eef3f9; border-color: #aabbd1; }
.sd-page .sd-pick[aria-pressed=true] { background: #fff3bc; border-color: #bea229; box-shadow: 0 0 0 1px #bea229; color: #102440; }
.sd-pick.is-done .sd-pick__left { background: #d9f3e3; color: #126b37; }

/* Buttons */
.sd-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.sd-page .sd-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 14px; border: 1px solid #cbd4e1; border-radius: 6px; background: #fff; color: #102440; font-size: 13px; font-weight: 800; line-height: 1.4; box-shadow: none; cursor: pointer; }
.sd-page .sd-button:hover { background: #edf1f6; border-color: #aabbd1; }
.sd-page .sd-button:disabled { opacity: .5; cursor: default; }
.sd-page .sd-primary { background: #fcd000; border-color: #fcd000; color: #0f1429; }
.sd-page .sd-primary:hover { background: #e6be00; border-color: #e6be00; }
.sd-result { margin-top: 18px; padding: 18px; border: 1px solid #b7e1c6; border-radius: 10px; background: #effaf3; text-align: center; }
.sd-result h2 { margin: 0 0 6px; color: #126b37; font-size: 22px; }
.sd-result p { margin: 0 0 14px; color: #285c3d; font-size: 14px; }

/* Side */
.sd-rules { margin: 0; padding-left: 20px; color: #37475b; font-size: 14px; line-height: 1.7; }
.sd-rules li + li { margin-top: 6px; }
.sd-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.sd-legend span { display: flex; align-items: center; gap: 8px; color: #536477; font-size: 13px; font-weight: 700; }
.sd-legend .sd-shape { flex: none; width: 26px; height: 26px; }
.sd-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.sd-stats div { padding: 10px; border: 1px solid #e3e8ef; border-radius: 8px; background: #f8fafc; text-align: center; }
.sd-stats dt { color: #66768a; font-size: 12px; }
.sd-stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* Help */
.sd-page dialog.sd-help { position: relative; width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 40px 28px 28px; border: 1px solid #dce3ef; border-radius: 10px; background: #fff; overflow: auto; color: #0f1429; }
.sd-page dialog.sd-help::backdrop { background: #0f142999; }
.sd-help h2 { margin: 0 0 14px; font-size: 26px; }
.sd-help .sd-rules { text-align: left; }
.sd-help form { margin-top: 20px; text-align: center; }
.sd-page .sd-help-close { position: absolute; right: 12px; top: 10px; display: grid; place-items: center; min-width: 40px; min-height: 40px; padding: 8px; border: 0; background: transparent; color: #637286; font-size: 19px; line-height: 1; box-shadow: none; }
.sd-page .sd-help-close:hover { color: #102440; background: #f2f5fa; border-radius: 6px; }

@media (max-width: 820px) {
	.sd-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
	.sd-main { margin-top: 16px; padding: 0 12px; }
	.sd-card { padding: 16px; }
	.sd-palette { gap: 5px; padding: 8px; }
	.sd-pick .sd-shape, .sd-pick--erase i { width: 32px; height: 32px; }
	.sd-pick__name { font-size: 10px; }
	.sd-page .sd-button { flex: 1 1 45%; }
}
@media (prefers-reduced-motion: reduce) { .sd-cell .sd-shape, .sd-cell.is-shake { animation: none; } }

/* Испечати: one SVG drawing of the box with the given shapes, centred on an A4 page. */
.sd-print-sheet { display: none; }
@media print {
	@page { size: A4; margin: 20mm; }
	html, body.sd-page { background: #fff !important; }
	body.sd-page > *:not(.sd-main),
	.sd-main > :not(.sd-print-sheet) { display: none !important; }
	.sd-main { max-width: none; margin: 0; padding: 0; }
	.sd-print-sheet { display: block; width: 150mm; margin: 25mm auto 0; break-inside: avoid; }
	.sd-print-sheet svg { display: block; width: 100%; height: auto; }
}
