/* Picture Logic Grid (w038) */
.pl { display: grid; gap: .5rem; }
.pl > * { min-width: 0; }
.pl .kit-status:empty, .pl .kit-note:empty { display: none; }

.pl-modes { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; border: 1px solid var(--border); border-radius: .8rem; background: #0c1220; }
.pl-modes button, .pl-sizes button { min-width: 0; border: 0; background: transparent; padding-inline: .4rem; line-height: 1.2; }
.pl .pl-modes button[aria-pressed="true"], .pl .pl-sizes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.pl-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem; padding: .25rem; border: 1px solid var(--border); border-radius: .8rem; }
.pl-sizes button { font-variant-numeric: tabular-nums; }

.pl-bar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem .75rem; }
.pl-title { min-width: 0; margin: 0; font-size: 1.05rem; line-height: 1.3; }
.pl-clock { margin: 0; margin-inline-start: auto; font: 800 1.25rem/1.2 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }

/* The board: one focusable grid. Cell and clue sizes come from the page script (--cell, --clue). */
.pl-board-wrap { display: flex; justify-content: center; max-width: 100%; padding-block: 2px; }
.pl-board { --cell: 28px; --clue: 14px; border-collapse: collapse; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: .2rem; }
.pl-board:focus { outline: none; }
.pl-board:focus-visible { outline: 3px solid #ffd36e; outline-offset: 2px; }
.pl-board th { padding: 0; color: var(--text); font-size: var(--clue); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pl-board th.ok { color: #6f7d98; }
.pl-rc { padding-inline: .2em .45em !important; text-align: end; white-space: nowrap; }
.pl-cc { vertical-align: bottom; padding-block: .15em .3em !important; }
.pl-stack { display: flex; flex-direction: column; align-items: center; }
.pl-board tr:nth-child(even) .pl-rc, .pl-cc:nth-child(odd) { background: #19233a; }
.pl-cell { width: var(--cell); height: var(--cell); min-width: var(--cell); padding: 0; border: 1px solid #3c4a66; background: #0c1220; cursor: pointer; text-align: center; vertical-align: middle; }
.pl-cell.edge-r { border-right: 2px solid #8b9bbd; }
.pl-cell.edge-b { border-bottom: 2px solid #8b9bbd; }
.pl .pl-cell.filled { background: #e6ecf7; }
.pl-cell.marked::after { content: '✕'; display: block; color: #9aa8c4; font-size: calc(var(--cell) * .55); font-weight: 700; line-height: 1; }
.pl-board.kbd:focus .pl-cell.cursor { outline: 3px solid #ffd36e; outline-offset: -3px; }
.pl-board.kbd:focus .pl-cell.cursor.filled { outline-color: #c77800; }
.pl-board.done .pl-cell { cursor: default; border-color: #253047; }
.pl-board.done .pl-cell.marked::after { content: none; }
.pl .pl-board.done .pl-cell.filled { background: var(--accent); }
.pl-board.done th { color: #6f7d98; }

.pl-tools { width: 100%; max-width: 560px; margin: .25rem auto 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .4rem; align-items: stretch; }
.pl-toolset { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; border: 1px solid var(--border); border-radius: .8rem; background: #0c1220; }
.pl-toolset button { display: flex; align-items: center; justify-content: center; gap: .4rem; min-width: 0; min-height: 48px; padding: .3rem .4rem; border: 2px solid transparent; background: transparent; line-height: 1.15; }
.pl .pl-toolset button[aria-pressed="true"] { border-color: var(--accent); background: #13231f; }
.pl-tool-icon { display: inline-grid; place-items: center; flex: none; width: 1.3rem; height: 1.3rem; border: 1px solid #8b9bbd; border-radius: .2rem; font-size: .95rem; line-height: 1; }
.pl-tool-icon.fill { background: #e6ecf7; }
.pl-icon-text { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem; min-width: 52px; padding: .2rem .5rem; line-height: 1.1; }
.pl-icon-text svg { display: block; flex: none; }
.pl-icon-text small { font-size: .8rem; font-weight: 700; }

.pl-result { display: grid; gap: .6rem; padding: 1rem; border: 2px solid var(--accent); border-radius: 1rem; background: #13231f; text-align: center; }
.pl-result h2 { margin: 0; font-size: clamp(1.3rem, 5vw, 1.8rem); line-height: 1.25; }
.pl-result h2:focus { outline: none; }
.pl-result-time { margin: 0; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-result-actions { justify-content: center; }
.pl-result-actions button { min-height: 52px; }

.pl-how { border: 1px solid var(--border); border-radius: .85rem; background: #0c1220; }
.pl-how summary { display: flex; align-items: center; min-height: 48px; padding: .5rem 1rem; cursor: pointer; font-weight: 700; }
.pl-how-body { display: grid; gap: .6rem; padding: 0 1rem 1rem; }
.pl-how-body p { margin: 0; }
.pl-ex-title { font-weight: 700; }
.pl-examples { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.pl-examples li { display: grid; gap: .3rem; padding: .6rem .75rem; border-radius: .7rem; background: var(--card); }
.pl-ex-line { display: inline-flex; align-items: center; }
.pl-ex-clue { min-width: 3rem; padding-inline-end: .5rem; font-weight: 800; text-align: end; font-variant-numeric: tabular-nums; }
.pl-ex-cell { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid #3c4a66; background: #0c1220; font-weight: 700; color: #9aa8c4; }
.pl-ex-cell + .pl-ex-cell { border-inline-start: 0; }
.pl .pl-ex-cell.filled { background: #e6ecf7; }
.pl-ex-cell.marked::after { content: '✕'; }

.pl-stats { display: grid; gap: .5rem; padding: 1rem; border: 1px solid var(--border); border-radius: .85rem; }
.pl-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0; text-align: center; }
.pl-stat-grid dt { color: var(--muted); font-size: .85rem; overflow-wrap: break-word; hyphens: manual; }
.pl-stat-grid dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pl-best-title { margin: .25rem 0 0; font-size: 1rem; color: var(--muted); }
.pl-footer-actions { justify-content: flex-end; }

/* Phones: Undo and Restart show their symbol; the name stays in the accessible label and tooltip. */
@media (max-width: 639px) {
  .pl-icon-text small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pl-icon-text { min-width: 48px; padding-inline: .3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pl * { scroll-behavior: auto; transition: none !important; }
}
