.sg-wrap { max-width: 1168px; margin: 0 auto; padding: 0 24px; }
main p, main li { color: var(--text-muted); font-size: 1.05rem; line-height: 1.65; }
main strong { color: var(--text); font-weight: 600; }
main a { text-underline-offset: 3px; }

.sg-head { padding: 112px 0 28px; }
.sg-crumbs { font-size: 0.92rem; color: var(--text-dim); margin-bottom: 14px; }
.sg-crumbs a { color: var(--text-muted); }
.sg-crumbs span { margin: 0 8px; color: #475569; }
.sg-head h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.08; letter-spacing: -0.012em; margin-bottom: 14px; }
.sg-intro { font-size: 1.15rem; color: #b8c4d6; max-width: 66ch; }
.sg-meta { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 18px; font-size: 0.93rem; color: var(--text-dim); }
.sg-meta span::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-right: 9px; vertical-align: 2px; }

/* The tool: preview first, settings beside it (below it on phones). */
.sg-tool { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; padding-bottom: 56px; }
main section.sg-stage { padding: 0; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sg-tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.sg-tab { background: none; border: 1px solid transparent; color: var(--text-muted); font: 600 0.92rem var(--font-display); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.sg-tab[aria-pressed="true"] { background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.45); color: #dbeafe; }
.sg-canvas { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 28px; }
.sg-canvas.wall { background: radial-gradient(ellipse at 50% 35%, #e9e4dc 0%, #d6cfc4 55%, #c4bcae 100%); }
.sg-canvas.paths { background: #0b1120; background-image: linear-gradient(rgba(148,163,184,0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.07) 1px, transparent 1px); background-size: 24px 24px; }
.sg-canvas svg { width: 100%; height: 100%; overflow: visible; }
.sg-loading { position: absolute; inset: auto 0 14px; text-align: center; font-size: 0.9rem; color: #57534e; }
.sg-facts { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 0.95rem; color: var(--text-muted); }
.sg-facts b { color: var(--text); font-weight: 600; }
.sg-fit { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 16px; }
.sg-chip { font-size: 0.86rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.sg-chip.ok { border-color: rgba(34, 197, 94, 0.45); color: #bbf7d0; background: rgba(34, 197, 94, 0.08); }
.sg-warn { margin: 0 18px 16px; padding: 10px 14px; border-left: 3px solid var(--amber); background: rgba(245, 158, 11, 0.08); border-radius: 0 8px 8px 0; font-size: 0.95rem; color: #fde68a; }
.sg-warn:empty { display: none; }

.sg-form { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.sg-form h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.sg-field { display: block; margin-bottom: 14px; }
.sg-field > span { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.sg-field input[type="text"], .sg-field input[type="number"], .sg-field select { width: 100%; box-sizing: border-box; background: #0b1120; border: 1px solid #2a3a55; color: var(--text); border-radius: 8px; padding: 10px 12px; font: 500 1rem var(--font-body, sans-serif); }
.sg-field input:focus-visible, .sg-field select:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.sg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sg-units { display: inline-flex; border: 1px solid #2a3a55; border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.sg-units button { background: none; border: 0; color: var(--text-muted); padding: 7px 14px; font: 600 0.9rem var(--font-display); cursor: pointer; }
.sg-units button[aria-pressed="true"] { background: rgba(59, 130, 246, 0.2); color: #dbeafe; }
.sg-check { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.98rem; color: var(--text-muted); cursor: pointer; }
.sg-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.sg-btn { display: block; width: 100%; box-sizing: border-box; text-align: center; margin-top: 18px; background: var(--primary); color: #fff !important; padding: 14px 18px; border-radius: 9px; font: 700 1.05rem var(--font-display); }
.sg-btn:hover { background: var(--primary-hover); text-decoration: none; }
.sg-small { margin-top: 10px; font-size: 0.88rem !important; color: var(--text-dim) !important; line-height: 1.5 !important; text-align: center; }

main section.sg-section { padding: 44px 0; border-top: 1px solid var(--border); }
.sg-section h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.35rem, 2.2vw, 1.7rem); color: var(--text); margin-bottom: 18px; }
.sg-tips { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; }
.sg-tips li { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; font-size: 1rem; }
.sg-tips b { display: block; font-family: var(--font-display); color: var(--text); font-size: 1.05rem; margin-bottom: 6px; }
.sg-faq { max-width: 780px; }
.sg-faq details { border-top: 1px solid var(--border); }
.sg-faq details:last-of-type { border-bottom: 1px solid var(--border); }
.sg-faq summary { cursor: pointer; padding: 16px 0; font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--text); }
.sg-faq details p { padding: 0 0 18px; font-size: 1rem; max-width: 68ch; }
.sg-more { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.sg-more li { border: 1px dashed #334155; border-radius: 12px; padding: 16px 18px; }
.sg-more b { display: block; font-family: var(--font-display); color: var(--text); }
.sg-more span { font-size: 0.9rem; color: var(--text-dim); }

@media (max-width: 960px) { .sg-tool { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .sg-wrap { padding: 0 16px; }
    .sg-head { padding-top: 92px; }
    .sg-canvas { padding: 16px; aspect-ratio: 4 / 3; }
}

/* Form built from the template's parameters. */
.sg-field input[type="number"] { -moz-appearance: textfield; }
.sg-sizes { margin: 4px 0 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.sg-sizes summary { cursor: pointer; font-size: 0.92rem; font-weight: 600; color: var(--text-muted); padding: 4px 0 10px; }
.sg-sizes summary:focus-visible, .sg-tab:focus-visible, .sg-units button:focus-visible, .sg-btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.sg-noscript { color: var(--text-muted); padding: 16px 20px; }
.sg-more a { display: block; color: inherit; text-decoration: none; }
.sg-more a:hover b { color: #93c5fd; }
.sg-more li { padding: 0; }
.sg-more a { padding: 16px 18px; border-radius: 12px; }
.sg-index-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; padding-bottom: 56px; }
.sg-index-grid a { display: block; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; color: inherit; text-decoration: none; height: 100%; box-sizing: border-box; }
.sg-index-grid a:hover { border-color: rgba(59, 130, 246, 0.55); }
.sg-index-grid b { display: block; font-family: var(--font-display); font-size: 1.12rem; color: var(--text); margin-bottom: 6px; }
.sg-index-grid span { font-size: 0.98rem; color: var(--text-muted); line-height: 1.5; }
.sg-field[hidden], .sg-loading[hidden] { display: none; }
