/* Mønstersudoku */
.su { display: flex; flex-direction: column; gap: 8px; height: var(--su-h, calc(100dvh - 80px)); min-height: 420px; padding: 8px 12px 10px }
.su-board { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0 }
.su-top { width: var(--su-board-w, 100%); max-width: 100%; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px }
.su-kind { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 6px 0 14px; border-radius: 999px; border: 1px solid var(--pill-border); background: var(--card); font: 600 15px Barlow, sans-serif; color: var(--ink); cursor: pointer; touch-action: manipulation }
.su-kind:hover { border-color: var(--ink-3) }
.su-new-word { padding: 3px 10px; border-radius: 999px; background: var(--sign-blue); color: #fff; font-size: 13px }
.su-clock { font: 700 20px Barlow, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink) }
.su-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: grid; place-items: center }
.su-canvas { image-rendering: pixelated; touch-action: none; cursor: pointer; border-radius: 2px; box-shadow: 0 2px 3px rgba(42, 35, 31, .2), 0 14px 32px rgba(42, 35, 31, .18) }
.su-canvas:focus { outline: none }
.su-canvas:focus-visible { outline: 3px solid var(--sign-blue); outline-offset: 3px }

.su-side { display: flex; flex-direction: column; gap: 8px; flex: none }
.su-status { margin: 0; min-height: 1.4em; font-size: 14px; line-height: 1.35; color: var(--ink-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }

/* The palette: one button per motif, drawn, with its name */
.su-palette { --cols: 5; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 5px }
.su[data-n="4"] .su-palette { --cols: 4 }
.su[data-n="6"] .su-palette { --cols: 3 }
.su-pick { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 1px 3px; border-radius: 10px; border: 1px solid var(--pill-border); background: var(--card); color: var(--ink); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; font: inherit }
.su-pick canvas { width: 30px; height: 30px; image-rendering: pixelated; border-radius: 2px; flex: none }
.su-pick-name { max-width: 100%; font: 600 10.5px/1.1 Barlow, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.su[data-n="6"] .su-pick-name, .su[data-n="4"] .su-pick-name { font-size: 13px }
.su[data-n="4"] .su-pick { min-height: 64px }
.su[data-n="4"] .su-pick canvas { width: 36px; height: 36px }
.su-pick-key { display: none; position: absolute; top: 3px; right: 5px; font: 600 11px Barlow, sans-serif; color: var(--ink-3) }
.su-pick:hover { border-color: var(--ink-3) }
.su-pick:active { transform: translateY(1px) }
.su-pick.current { border-color: var(--sign-blue); box-shadow: inset 0 0 0 1px var(--sign-blue) }
.su-pick.done { opacity: .45 }
.su-palette.pencil .su-pick { border-style: dashed }
.su-palette.pencil .su-pick[aria-pressed="true"] { background: #E7EDF6; border: 1px solid var(--sign-blue); box-shadow: inset 0 0 0 1px var(--sign-blue) }

.su-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px }
.su-tool { min-height: 40px; padding: 0 6px; font-size: 15px }
#su-pencil[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff }

.su-info, .su-about { display: none }
.su-about-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start }
.su-about canvas { width: 56px; height: 56px; image-rendering: pixelated; border-radius: 3px }
.su-about p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-2) }
.su-about strong { color: var(--ink) }

/* Desktop: the cloth on the left, the palette and tools beside it */
@media (min-width: 860px) {
  .su { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; padding: 18px 16px 16px; max-width: 1180px }
  .su-board { gap: 10px }
  .su-side { justify-content: center; gap: 12px }
  .su-status { text-align: left; white-space: normal; min-height: 2.8em; font-size: 15px }
  .su-palette, .su[data-n] .su-palette { --cols: 3; gap: 8px }
  .su[data-n="4"] .su-palette { --cols: 2 }
  .su-pick, .su[data-n] .su-pick { flex-direction: column; gap: 4px; min-height: 84px; padding: 8px 4px 6px; justify-content: center }
  .su-pick canvas { width: 44px; height: 44px }
  .su-pick-name, .su[data-n] .su-pick-name { font-size: 14px }
  .su-pick-key { display: block }
  .su-tool { min-height: 44px }
  .su-info { display: block; padding: 12px 16px }
  .su-about:not([hidden]) { display: block }
  .su-clock { font-size: 22px }
}
@media (min-width: 860px) and (max-height: 760px) {
  .su-pick, .su[data-n] .su-pick { min-height: 66px; padding: 5px 4px }
  .su-pick canvas { width: 34px; height: 34px }
  .su-about { display: none !important }
}

/* Very short phones: a smaller palette */
@media (max-width: 859px) and (max-height: 620px) {
  .su-pick { min-height: 44px }
  .su-pick canvas { width: 24px; height: 24px }
  .su-tool { min-height: 36px }
}

/* The dialogs */
.su-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px }
.su-choice button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--pill-border); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation }
.su-choice button:hover { border-color: var(--ink-3) }
.su-choice button[aria-checked="true"] { border-color: var(--sign-blue); box-shadow: inset 0 0 0 2px var(--sign-blue); background: #F1F5FB }
.su-choice canvas { image-rendering: pixelated; margin-bottom: 4px }
.su-choice b { font-size: 17px }
.su-choice span { font-size: 13px; color: var(--ink-3) }
.su-new-warn { margin: 12px 0 0; font-size: 14px }

.su-names { list-style: none; padding: 0 !important; display: grid; gap: 8px; margin: 8px 0 12px !important }
.su-names li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; font-size: 14px !important; line-height: 1.4 !important; color: var(--ink-2) }
.su-names b { color: var(--ink) }
.su-names canvas { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 3px }
.su-honest { padding: 10px 14px; border-left: 4px solid var(--w-raud); background: var(--linen); border-radius: 0 8px 8px 0 }

.su-held { list-style: none; padding: 0 !important; margin: 6px 0 4px !important; display: flex; flex-wrap: wrap; gap: 8px 12px }
.su-held li { display: flex; align-items: center; gap: 6px; font-size: 14px !important; font-weight: 600 }
.su-held canvas { width: 28px; height: 28px; image-rendering: pixelated; border-radius: 2px }
#su-done .big-score { margin-top: 4px }
#su-done .muted { margin: 0 }

@media (prefers-reduced-motion: reduce) { .su-pick:active { transform: none } }
