/* Sudoku polarhub.de/sudoku/ (ergänzt /shared/polar.css und /hub.css; eigene Klassen sd-…) */
[hidden] { display: none !important; }
:root { --richtig: #2e8b4a; --hand: #0b5fd0; }
@media (prefers-color-scheme: dark) { :root { --richtig: #3f9d5b; --hand: #7db4ff; } }
.hero { padding-bottom: 24px; }
.klein { font-size: .88rem; margin-top: 12px; }
.btn.klein { margin: 0; padding: 6px 14px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn[aria-pressed=true] { background: var(--accent); color: #fff; }

.sd-spiel { text-align: center; }
.sd-spiel > .sd-modi + .klein { margin: 0 0 14px; }
.sd-modi { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 12px 22px; margin-bottom: 12px; }
.sd-gruppe { display: grid; gap: 5px; justify-items: center; }
.kap { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 3px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 9%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent); max-width: 100%; }
.seg button { min-width: 42px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg button:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.seg button[aria-selected=true] { background: var(--accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent); }
@media (max-width: 520px) { .seg button { min-width: 0; padding: 6px 10px; font-size: .84rem; } }

/* Spielfeld: 81 Kacheln, die Blöcke sind durch Abstand getrennt (elf Spuren: 3 + Abstand + 3 + Abstand + 3) */
.sd-feld { container-type: inline-size; width: min(100%, 500px); margin: 0 auto; }
.sd-brett { display: grid; width: 100%; aspect-ratio: 1; gap: 5px;
    grid-template-columns: repeat(3, 1fr) 9px repeat(3, 1fr) 9px repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr) 9px repeat(3, 1fr) 9px repeat(3, 1fr); }
.sd-z { all: unset; box-sizing: border-box; position: relative; display: grid; place-items: center; cursor: pointer; grid-column: var(--gc); grid-row: var(--gr);
    border: 2px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
    font-size: clamp(1.15rem, 6.2cqi, 2.1rem); line-height: 1; font-weight: 700; color: var(--text); }
.sd-z.fest { cursor: default; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.sd-z:focus-visible { outline: none; }
.sd-z.wahl::after { content: ""; position: absolute; inset: 2px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 2px var(--accent); pointer-events: none; }

/* Handschrift: die Zahlen sind gezeichnete Striche und schreiben sich beim Eintragen selbst */
.hand { width: 62%; height: 78%; overflow: visible; fill: none; stroke: var(--hand); stroke-linecap: round; stroke-linejoin: round; }
.hand path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.sd-z.neu .hand path { animation: schreib .42s cubic-bezier(.5, .1, .4, 1) both; }
@keyframes schreib { from { stroke-dashoffset: 1; } }
.sd-n { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.sd-n .hand { stroke: var(--muted); width: 100%; height: 100%; padding: 14%; }
.sd-welle .sd-z { animation: welle .45s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc((var(--r) + var(--c)) * 28ms); }
@keyframes welle { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }

/* Ergebnis am Ende: Fertig – richtig oder falsch */
.sd-meldung { margin: 12px 0 0; }
.sd-meldung.fehler { color: var(--err); }
.sd-ergebnis { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px auto 0; padding: 10px 18px; width: fit-content; max-width: 100%; border-radius: 14px; font-weight: 700; animation: ploppen .4s cubic-bezier(.2, 1.5, .4, 1) both; }
.sd-ergebnis.richtig { background: color-mix(in srgb, var(--richtig) 16%, transparent); color: var(--richtig); }
.sd-ergebnis.falsch { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.sd-sym { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.richtig .sd-sym { background: var(--richtig); } .falsch .sd-sym { background: var(--err); }
.sd-sym svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes ploppen { from { transform: scale(.6); opacity: 0; } }

/* Zahlenleiste */
.sd-tasten { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; width: min(100%, 500px); margin: 18px auto 0; }
.sd-tasten button { height: 52px; padding: 0; border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--text); font: inherit; font-weight: 700; font-size: 1.25rem; cursor: pointer; transition: filter .15s; }
.sd-tasten button:hover { filter: brightness(.95); }
.sd-reihe { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

/* Statistik */
.sd-zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; text-align: center; }
.sd-zahlen strong { display: block; font-size: 1.6rem; line-height: 1.2; }
.sd-zahlen span { font-size: .78rem; color: var(--muted); }
.sd-verteilung { display: grid; gap: 6px; margin-top: 16px; }
.sd-verteilung div { display: grid; grid-template-columns: 6.2em 1fr 2em 3.2em; align-items: center; gap: 8px; font-size: .86rem; font-variant-numeric: tabular-nums; text-align: left; }
.sd-verteilung em { font-style: normal; color: var(--muted); text-align: right; }
.sd-verteilung progress { width: 100%; height: 12px; border: 0; border-radius: 4px; background: var(--accent-soft); accent-color: var(--richtig); }
.sd-verteilung progress::-webkit-progress-bar { background: var(--accent-soft); border-radius: 4px; }
.sd-verteilung progress::-webkit-progress-value { background: var(--richtig); border-radius: 4px; }
.sd-verteilung progress::-moz-progress-bar { background: var(--richtig); border-radius: 4px; }

/* Bestenliste und Profil (wie bei Wordle) */
.kopfzeile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.liste { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.liste th, .liste td { padding: 10px 16px; text-align: right; overflow-wrap: anywhere; }
.liste th:nth-child(-n+2), .liste td:nth-child(-n+2) { text-align: left; }
.liste th:first-child, .liste td:first-child { width: 1%; padding-right: 0; color: var(--muted); }
.liste th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.liste tr + tr td { border-top: 1px solid var(--line); }
.liste tr.ich td { background: var(--accent-soft); font-weight: 700; }
h2 small { font-size: .8rem; font-weight: 500; }
#profil form { display: grid; gap: 14px; margin-top: 16px; }
#profil label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--muted); }
#profil label.haken { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; color: var(--text); }
#profil .haken input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
#profil input[type=text] { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
#profil .reihe { margin-top: 0; justify-content: flex-start; }
#p-status.fehler { color: var(--err); }
.reihe { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.reihe .btn { margin: 0; }

/* Breite Bildschirme: Rätsel links, Bestenliste, Statistik und Profil rechts */
@media (min-width: 1000px) {
    main.wrap { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr); gap: 0 32px; grid-template-rows: auto auto auto auto 1fr auto; align-items: start; }
    main.wrap > .hero, main.wrap > noscript, main.wrap > .wissen { grid-column: 1 / -1; }
    main.wrap > .sd-spiel { grid-column: 1; grid-row: 3 / span 3; }
    main.wrap > .best { grid-column: 2; grid-row: 3; margin-top: 0; }
    main.wrap > .sd-stat { grid-column: 2; grid-row: 4; }
    main.wrap > #profil { grid-column: 2; grid-row: 5; }
    main.wrap > .wissen { grid-row: 6; }
}
@media (prefers-reduced-motion: reduce) { .sd-z.neu .hand path, .sd-welle .sd-z, .sd-ergebnis { animation: none; } }
