/* Sudoku guide pages: practice grid, technique explorer and the live example grids inside the guide text.
   Chrome stays monochrome; the pastel cell tints are the puzzle's own markings (same meaning as on the sudoku solver). */
.sg-tool, .sg-demo { --sg-thin: #c4c4c4; --sg-thick: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sg-tool, :root:not([data-theme="light"]) .sg-demo { --sg-thin: #444; } }
:root[data-theme="dark"] .sg-tool, :root[data-theme="dark"] .sg-demo { --sg-thin: #444; }

.sg-tool-intro { margin: 0 0 14px; }
.sg-chips { margin-bottom: 14px; }
.sg-select { margin-bottom: 14px; max-width: 420px; }
.sg-select select { min-height: 44px; }
.sg-demo { margin: 20px 0 28px; }
.prose h2[id] { scroll-margin-top: 84px; }
.sg-demo-on { background: var(--soft); border-radius: var(--r-lg); padding: 16px; }
.sg-tool .sg-demo-main { margin: 0; padding: 0; background: transparent; }
.sg-dtop, .sg-pbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sg-dtop .seg button { min-width: 40px; padding: 7px 12px; }
.sg-dtop .seg[hidden] { display: none; }
.sg-dbody { display: grid; grid-template-columns: minmax(0, 468px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sg-dbody > * { min-width: 0; }
@media (max-width: 760px) { .sg-dbody { grid-template-columns: minmax(0, 1fr); } }
.prose .sg-dbody { grid-template-columns: minmax(0, 1fr); }

/* grid */
.sg-gridwrap { max-width: 100%; padding: 2px; }
.sg-grid { --cs: 40px; display: grid; grid-template-columns: repeat(9, var(--cs)); grid-auto-rows: var(--cs); width: max-content; margin: 0 auto;
  border: 2px solid var(--sg-thick); border-radius: 4px; user-select: none; -webkit-user-select: none; touch-action: manipulation; outline: none; background: var(--canvas); }
.sg-grid:focus-visible { box-shadow: 0 0 0 3px var(--focus); }
.sg-grid .c { position: relative; background: var(--canvas); color: var(--ink); border-right: 1px solid var(--sg-thin); border-bottom: 1px solid var(--sg-thin);
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.sg-grid .c:nth-child(9n) { border-right: 0; }
.sg-grid .c:nth-child(n+73) { border-bottom: 0; }
.sg-grid .c.tr { border-right: 2px solid var(--sg-thick); }
.sg-grid .c.tb { border-bottom: 2px solid var(--sg-thick); }
.sg-grid[tabindex] .c { cursor: pointer; }
.sg-grid .v { font-size: calc(var(--cs) * .58); line-height: 1; position: relative; z-index: 2; }
.sg-grid .gv .v { font-weight: 650; }
.sg-grid .us .v { color: var(--muted); font-weight: 450; }
.prose .sg-grid .v { color: inherit; }
.sg-grid .pm { position: absolute; inset: 1px; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; z-index: 1;
  font-size: calc(var(--cs) * .25); line-height: 1; color: var(--muted); pointer-events: none; }
.sg-grid .pm:empty { display: none; }
.sg-grid .pm i { font-style: normal; display: flex; align-items: center; justify-content: center; }
.sg-grid .pm i.x { color: var(--err); text-decoration: line-through; font-weight: 700; }

/* highlights (pastel tints carry dark text in both themes) */
.sg-grid .c.pe { background: var(--soft); }
.sg-grid .c.sel { background: var(--lilac); }
.sg-grid .c.hu { background: var(--cream); }
.sg-grid .c.ha { background: var(--lilac); }
.sg-grid .c.hb { background: var(--mint); }
.sg-grid .c.hp { background: var(--lime); }
.sg-grid .c.sel .v, .sg-grid .c.hu .v, .sg-grid .c.ha .v, .sg-grid .c.hb .v, .sg-grid .c.hp .v,
.sg-grid .c.sel .pm, .sg-grid .c.hu .pm, .sg-grid .c.ha .pm, .sg-grid .c.hb .pm, .sg-grid .c.hp .pm { color: #1f1f1f; }
.sg-grid .c.hp .v { font-weight: 700; color: #000; }
.sg-grid .c.wr { background: var(--pink); }
.sg-grid .c.wr .v { color: #b42318; }
.sg-grid .c.sel .pm i.x, .sg-grid .c.hu .pm i.x, .sg-grid .c.ha .pm i.x, .sg-grid .c.hb .pm i.x, .sg-grid .c.hp .pm i.x, .sg-grid .c.wr .pm i.x { color: #8a150d; }

/* explanation and legend */
.sg-explain { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.sg-explain p { margin: 0 0 6px; font-size: 16px; }
.sg-explain p:last-child { margin-bottom: 0; }
.sg-explain .eyebrow { margin-bottom: 2px; }
.sg-explain .note { font-size: 14px; margin-top: 8px; }
.sg-tech { font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -0.2px; }
.sg-acts { margin-top: 12px; }
.sg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.sg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sg-legend .k { display: inline-flex; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); font-style: normal; }
.sg-legend .k.ha { background: var(--lilac); } .sg-legend .k.hb { background: var(--mint); } .sg-legend .k.hu { background: var(--cream); } .sg-legend .k.hp { background: var(--lime); }
.sg-legend .k.kx { border: 0; width: auto; height: auto; color: var(--err); text-decoration: line-through; font-weight: 700; font-size: 13px; }
.sg-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; min-height: 40px; cursor: pointer; color: var(--ink); }
.sg-check input { width: 18px; height: 18px; accent-color: var(--ink); }

/* practice */
.sg-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sg-pad .sg-k { min-height: 46px; padding: 0; font-size: 20px; font-weight: 550; border-radius: 12px; }
.sg-pad .sg-k2 { font-size: 14px; }
.sg-pacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sg-pmsg { margin-top: 10px; }
.sg-pkeys { text-align: left; }
@media (hover: none) { .sg-pkeys { display: none; } }

@media print {
  .sg-acts, .sg-pad, .sg-pacts, .sg-pbar, .sg-dtop, .sg-legendwrap, .sg-pkeys { display: none !important; }
}

/* chain links of the step shown (puzzle marking: one fixed orange that reads on white, pastel tints and the dark canvas) */
.sg-grid { position: relative; }
.sg-grid .sg-links { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.sg-links line, .sg-links circle { fill: none; stroke: #e8590c; vector-effect: non-scaling-stroke; }
.sg-links .sg-ls { stroke-width: 2px; }
.sg-links .sg-lw { stroke-width: 1.6px; stroke-dasharray: 4 3; }
.sg-links .sg-lf { stroke-width: 1.6px; stroke-dasharray: 1.5 2.5; stroke-linecap: round; }
.sg-links .sg-ring { stroke-width: 1.4px; }
.sg-links .sg-arrow { fill: #e8590c; stroke: none; }
.sg-legend .k.kls, .sg-legend .k.klw { border: 0; border-radius: 0; height: 0; width: 18px; border-top: 2px solid #e8590c; }
.sg-legend .k.klw { border-top-style: dashed; }
