:root {
  --ink: #2b2150;
  --muted: #6f6792;
  --brand: #34106c;
  --line: #e2dcf3;
  --floor: #efeaf9;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh; height: var(--hoehe, 100dvh); overflow: hidden; /* --hoehe = innerHeight из app.js (старый Safari: vh больше видимого окна) */
  background: #fff; color: var(--ink);
  font: 500 16px/1.4 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  overscroll-behavior: none;
}
button { font: inherit; cursor: default; touch-action: manipulation; }
[hidden] { display: none !important; }

.schloss { font-style: normal; font-size: 12px; margin-left: 4px; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 15px; background: #fff; color: var(--ink); white-space: nowrap; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn--small { padding: 6px 12px; font-size: 14px; background: #f1eefc; color: var(--brand); }
.btn--small:hover { background: #e6e0fa; }
.btn--primary { background: var(--brand); color: #fff; padding: 13px 22px; font-size: 17px; }
.btn--primary:hover { background: #4a1d94; }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 10px 16px 12px; gap: 8px; }
.info { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1100px; }
.clock, .zuege { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.zuege b { color: var(--ink); }
.stats { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.stats b { color: var(--ink); font-size: 16px; margin-right: 4px; }
.st { padding: 3px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.st--3 { background: #dcf3ea; color: #1f7a5a; }
.st--4 { background: #fff1c9; color: #8a5a00; }
.st--5 { background: #fde0e6; color: #b3264f; }
.bildwahl { display: inline-flex; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--brand); white-space: nowrap; cursor: default; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: default; }
.vorschau { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 2px 10px 2px 2px; font-size: 14px; font-weight: 700; color: var(--brand); }
.vorschau img { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; display: block; }
.vorschau[aria-pressed="true"] { border-color: var(--brand); }

/* поле: квадрат по меньшей стороне свободного места. --brett (px) считает app.js по размеру .feld —
   без aspect-ratio и cqw: на старых iPad они не работают, плитки вытягивались в высоту и уезжали за край */
.feld { flex: 1; min-height: 0; width: 100%; max-width: 1100px; display: grid; place-items: center; }
#brett {
  --n: 3; --brett: min(92vw, 62vh); --luft: calc(var(--brett) * .012); --zelle: calc((var(--brett) - 2 * var(--luft)) / var(--n));
  position: relative; width: var(--brett); height: var(--brett); touch-action: none;
  background: var(--floor); border-radius: 18px; padding: var(--luft);
  box-shadow: inset 0 2px 6px rgba(52, 16, 108, .12);
}
.teil { position: absolute; left: var(--luft); top: var(--luft); width: var(--zelle); height: var(--zelle); padding: calc(var(--luft) * 0.9);
  transition: transform .13s cubic-bezier(.3, .7, .4, 1); will-change: transform; }
#brett.ohne-anim .teil { transition: none; }
.gesicht { position: relative; width: 100%; height: 100%; border-radius: 12%; display: grid; place-items: center;
  background: var(--farbe, #ccc); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .16), 0 2px 5px rgba(52, 16, 108, .18);
  color: #fff; font-weight: 800; font-size: calc(var(--zelle) * .42); text-shadow: 0 2px 0 rgba(0, 0, 0, .15);
  transition: border-radius .5s, box-shadow .5s; }
.ist-bild .gesicht { background-size: calc(var(--n) * 100%) calc(var(--n) * 100%); background-color: #ddd; box-shadow: 0 2px 5px rgba(52, 16, 108, .25); }
.nr { display: none; }
.mit-nummern .nr { display: block; }
.ist-bild .nr { position: absolute; left: 6%; top: 5%; font-size: 40%; line-height: 1; padding: .18em .38em; border-radius: .5em; background: rgba(255, 255, 255, .88); color: var(--brand); text-shadow: none; }
.letztes { opacity: 0; pointer-events: none; }

/* мелкие эффекты: плитка встала на место — вспышка; ход невозможен — плитка вздрагивает */
.teil.passt .gesicht { animation: passt .5s ease-out; }
@keyframes passt { 0% { filter: brightness(1.35); box-shadow: 0 0 0 4px #fff, 0 0 18px 6px rgba(245, 220, 73, .9); } 100% { filter: none; } }
.teil.wackeln .gesicht { animation: wackeln .25s ease-in-out; }
@keyframes wackeln { 25% { transform: translateX(-4%); } 50% { transform: translateX(4%); } 75% { transform: translateX(-2%); } }

/* собрано: зазоры исчезают, недостающая плитка проявляется — картинка целиком */
#brett.fertig .teil { padding: 0; transition: transform .13s, padding .6s ease .15s; }
#brett.fertig .letztes { opacity: 1; transition: opacity .6s ease .35s; }
#brett.fertig .gesicht { border-radius: 0; }
#brett.fertig:not(.ist-bild) .gesicht { border-radius: 12%; }
#brett.fertig:not(.ist-bild) .teil { padding: calc(var(--luft) * 0.9); }
#brett.fertig:not(.ist-bild) .letztes { opacity: 0; }
#brett.fertig.ist-bild .teil:first-of-type .gesicht { border-top-left-radius: 14px; }

#vorschauGross { position: absolute; inset: var(--luft); width: calc(100% - 2 * var(--luft)); height: calc(100% - 2 * var(--luft)); object-fit: cover; border-radius: 12px; z-index: 5; box-shadow: 0 8px 30px rgba(20, 10, 60, .35); pointer-events: none; }
.hint { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }

/* окна */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(27, 20, 70, .45); z-index: 21; padding: 16px; } /* 15.10.2026: окна выше общей шапки (.kl-leiste, z-index 20), иначе крестик высокого окна прячется под ней */
.modal__card { position: relative; background: #fff; border-radius: 22px; padding: 28px 32px; text-align: center; width: min(400px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  box-shadow: 0 24px 60px rgba(20, 10, 60, .3); animation: pop .35s cubic-bezier(.2, .9, .25, 1.3); }
.modal__card--breit { width: min(760px, 100%); }
.modal__zu { position: absolute; right: 12px; top: 12px; border: 0; background: #f1eefc; color: var(--brand); width: 34px; height: 34px; border-radius: 10px; font-weight: 800; }
.modal h2 { margin: 6px 0 12px; font-size: 26px; }
.win__star { font-size: 54px; color: #f5b400; line-height: 1; }
.win h2 { font-size: 30px; margin-bottom: 4px; }
.win p { margin: 0 0 20px; color: var(--muted); }
.win__knoepfe { display: flex; flex-direction: column; align-items: center; gap: 10px; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.galerie__bild { border: 3px solid transparent; background: #f7f5fd; border-radius: 14px; padding: 6px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink); }
.galerie__bild img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; display: block; }
.galerie__bild.aktiv { border-color: var(--brand); }
.galerie__bild.zu img { filter: grayscale(.6) opacity(.6); }
.galerie__bild:hover { background: #efeaf9; }
.foto__plus { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; border: 2px dashed #c9bfe9; font-size: 48px; color: var(--brand); font-weight: 400; }
.premium__liste { text-align: left; padding-left: 20px; margin: 0 0 12px; line-height: 1.7; }
.premium__liste .bald { color: var(--muted); }
.premium__klein { font-size: 14px; color: var(--muted); margin: 0; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 22; }

@media (max-width: 760px) {
  .info { flex-wrap: wrap; justify-content: center; gap: 8px 12px; }
  .stats { order: 5; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .modal__card { padding: 24px 18px; }
  .galerie { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .teil { transition: none; } .modal__card { animation: none; } }


/* собранная картинка — без номеров и без швов между плитками */
#brett.fertig.ist-bild .nr { display: none; }
#brett.fertig.ist-bild .gesicht { box-shadow: none; transform: scale(1.006); }
.galerie__bild .schloss { margin: 0 4px 0 0; }

/* Reise (klReise, kl-leiste.js): размер и режим задаёт этап — их переключатели скрыты */
.kl-in-reise #groesse, .kl-in-reise #modus { display: none; }
.reise-info { font-size: 14px; font-weight: 700; color: var(--muted); }
.reise-info b { color: var(--ink); }
#winKarte { margin: -4px 0 18px; }
.win__star { letter-spacing: 4px; }
