/* =====================================================================
   Juroren-Tablet v3: Fokus auf die eine Aufgabe, die gerade ansteht.
   - Kopf: Sitz, Name, Uhr, Verbindung, Menü (Vollbild, Hell/Dunkel, Schrift)
   - Warten: Pause mit Countdown, Ansage, "Als Nächstes", Programm (aufklappbar)
   - Wertung: Karten antippen = Platz vergeben; Leiste mit Reihenfolge, Rückgängig,
     "Prüfen & abgeben". Notiz/Punkte im Sheet hinter dem Stift an der Karte.
   - Quer: Karten links, Leiste rechts. Hoch: Leiste klebt unten.
   Touch-Ziele ≥ 48 px, Kernaktionen ≥ 64 px. Baut auf den Token in app.css auf.
   ===================================================================== */

html { font-size: 16px; }
html[data-textsize="large"] { font-size: 18px; }
html[data-textsize="xlarge"] { font-size: 20px; }

body.judge {
  --j-head-h: 3.75rem;
  --j-gap: clamp(.6rem, 1.4vw, 1rem);
  --j-card-min: 9.5rem;
  --j-placed: var(--w-primary-bg);
  --j-placed-soft: var(--w-primary-soft);
  margin: 0; min-height: 100dvh; background: var(--w-bg); color: var(--w-text);
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
body.judge :is(button, [role=button]) { touch-action: manipulation; }

/* Pico-Knöpfe neutralisieren; jede Komponente setzt ihr Aussehen selbst */
body.judge button {
  appearance: none; margin: 0; padding: 0; width: auto; border: 0; border-radius: 0;
  background: none; color: inherit; font: inherit; line-height: 1.2; box-shadow: none;
  cursor: pointer; --pico-box-shadow: none;
}
body.judge button:focus-visible { outline: 3px solid var(--w-focus-ring); outline-offset: 2px; }
body.judge button:disabled { cursor: default; }

/* --- Kopf ----------------------------------------------------------------- */
.jh {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .9rem;
  height: var(--j-head-h); padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  background: var(--w-sidebar-bg); color: var(--w-sidebar-text);
}
.jh__seat {
  flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .7rem;
  background: var(--w-sidebar-accent); color: var(--w-sidebar-bg);
  font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.jh__who { min-width: 0; line-height: 1.15; }
.jh__name { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jh__event { font-size: .8rem; color: var(--w-sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jh__clock { margin-left: auto; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.conn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
  background: rgba(255, 255, 255, .08); color: var(--w-sidebar-muted);
}
.conn::before { content: ""; width: .65rem; height: .65rem; border-radius: 50%; background: var(--w-sidebar-muted); flex: none; }
.conn--ok { color: #bbf7d0; }
.conn--ok::before { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.conn--ok .conn__text { display: none; }          /* verbunden: nur der grüne Punkt */
.conn--bad { background: #b91c1c; color: #fff; }
.conn--bad::before { background: #fff; animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.jh__menu {
  display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .75rem;
  color: var(--w-sidebar-text);
}
.jh__menu svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }
body.judge .jh__menu:active { background: rgba(255, 255, 255, .12); }

.jm { padding: var(--j-gap) max(var(--j-gap), env(safe-area-inset-right)) calc(var(--j-gap) * 2) max(var(--j-gap), env(safe-area-inset-left)); }
.jm__loading { padding: 3rem 0; text-align: center; color: var(--w-text-muted); font-size: 1.25rem; }

/* --- Hinweisbalken (Pause/Ansage) ---------------------------------------- */
.jb:empty, .jb:not(:has(.jb__item)) { display: none; }
.jb { display: grid; gap: .5rem; margin-bottom: var(--j-gap); }
.jb__item {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem .9rem;
  padding: .7rem 1rem; border-radius: var(--w-radius-lg); font-size: 1.05rem;
}
.jb__item--pause { background: var(--w-warning-soft); color: var(--w-warning-strong); border: 1px solid var(--w-warning); }
.jb__item--note { background: var(--w-info-soft); color: var(--w-info-strong); border: 1px solid var(--w-info); }
.jb__label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.jb__time { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.jb__text { font-weight: 600; }

/* --- Warten --------------------------------------------------------------- */
.js-wait { max-width: 46rem; margin: 0 auto; display: grid; gap: var(--j-gap); align-content: center; min-height: calc(100dvh - var(--j-head-h) - 3 * var(--j-gap)); }
.wait-hero {
  position: relative; text-align: center; padding: clamp(2rem, 6vh, 4rem) 1.5rem;
  background: var(--w-surface); border: 1px solid var(--w-border); border-radius: 1.25rem; box-shadow: var(--w-shadow-sm);
}
.wait-hero__pulse {
  display: block; width: 1.1rem; height: 1.1rem; margin: 0 auto 1.1rem; border-radius: 50%;
  background: var(--w-success); box-shadow: 0 0 0 0 var(--w-success);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(21, 128, 61, .45); } 100% { box-shadow: 0 0 0 1.4rem rgba(21, 128, 61, 0); } }
.wait-hero__kicker { margin: 0 0 .35rem; font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--w-text-muted); }
.wait-hero__title { margin: 0 0 .5rem; font-size: clamp(1.7rem, 4vw, 2.4rem); }
.wait-hero__sub { margin: 0; font-size: 1.1rem; color: var(--w-text-muted); }
.wait-hero--pause .wait-hero__note { background: var(--w-surface); color: var(--w-text); }
.wait-hero__note {
  margin: 1.4rem auto 0; max-width: 32rem; padding: .8rem 1rem; border-radius: var(--w-radius-lg);
  background: var(--w-info-soft); color: var(--w-info-strong); font-size: 1.2rem; font-weight: 600;
}
.wait-hero--pause { background: var(--w-warning-soft); border-color: var(--w-warning); }
.wait-hero--pause .wait-hero__kicker { color: var(--w-warning-strong); font-size: 1rem; }
.wait-hero__clock {
  margin: 0; font-size: clamp(5rem, 16vw, 9rem); font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.04em; color: var(--w-warning-strong);
}
.wait-hero--pause .wait-hero__sub { margin-top: .6rem; color: var(--w-warning-strong); font-size: 1.3rem; }

.wait-next {
  display: grid; gap: .15rem; padding: 1.1rem 1.4rem; border-radius: 1.1rem;
  background: var(--w-surface); border: 1px solid var(--w-border); border-left: .45rem solid var(--w-primary-bg);
}
.wait-next__label { margin: 0; font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--w-primary); }
.wait-next__class { margin: 0; font-size: 1.6rem; font-weight: 800; }
.wait-next__round { margin: 0; font-size: 1.1rem; color: var(--w-text-muted); }

.wait-program, .wait-last, .done-order {
  background: var(--w-surface); border: 1px solid var(--w-border); border-radius: 1.1rem; padding: 0 1.2rem;
}
.wait-program > summary, .wait-last > summary, .done-order > summary {
  display: flex; align-items: center; gap: .9rem; min-height: 3.5rem; margin: 0;
  font-weight: 700; font-size: 1.05rem; cursor: pointer; list-style: none;
}
:is(.wait-program, .wait-last, .done-order) > summary::-webkit-details-marker { display: none; }
:is(.wait-program, .wait-last, .done-order) > summary::after {
  content: ""; margin-left: auto; width: .6rem; height: .6rem; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .6;
  transition: transform .15s ease; float: none; background: none;
}
:is(.wait-program, .wait-last, .done-order)[open] > summary::after { transform: rotate(-135deg); }
.wait-program__count { color: var(--w-text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.wait-program__bar { flex: 1; max-width: 10rem; height: .4rem; border-radius: 999px; background: var(--w-surface-3); overflow: hidden; }
.wait-program__bar > span { display: block; height: 100%; background: var(--w-success); border-radius: inherit; }
.wait-program__list { list-style: none; margin: 0 0 1rem; padding: 0; }
.wait-program__item {
  display: grid; grid-template-columns: 1.8rem 1fr auto; grid-template-areas: "mark name status" "mark round status";
  column-gap: .6rem; padding: .6rem 0; border-top: 1px solid var(--w-border);
}
.wait-program__mark { grid-area: mark; align-self: center; font-weight: 800; color: var(--w-success); font-size: 1.2rem; text-align: center; }
.wait-program__name { grid-area: name; font-weight: 700; }
.wait-program__round { grid-area: round; color: var(--w-text-muted); font-size: .92rem; }
.wait-program__status { grid-area: status; align-self: center; font-size: .85rem; color: var(--w-text-muted); }
.wait-program__item.is-done { opacity: .6; }
.wait-program__item.is-next .wait-program__mark, .wait-program__item.is-next .wait-program__status { color: var(--w-primary); font-weight: 700; }

/* --- Abgegeben ------------------------------------------------------------ */
.js-done { max-width: 46rem; margin: 0 auto; display: grid; gap: var(--j-gap); align-content: center; min-height: calc(100dvh - var(--j-head-h) - 3 * var(--j-gap)); }
.done-hero {
  display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem 1.5rem; border-radius: 1.25rem;
  background: var(--w-success-soft); border: 1px solid var(--w-success);
}
.done-hero__icon {
  flex: none; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%;
  background: var(--w-success); color: #fff; font-size: 2.2rem; font-weight: 800;
  animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.done-hero__title { margin: 0 0 .2rem; font-size: clamp(1.5rem, 3.5vw, 2rem); color: var(--w-success-strong); }
.done-hero__sub { margin: 0; font-size: 1.1rem; }
.done-wait { padding: 1.2rem 1.4rem; border-radius: 1.1rem; background: var(--w-surface); border: 1px solid var(--w-border); }
.done-wait__meter { display: flex; gap: .4rem; margin-bottom: .8rem; }
.done-wait__meter > span { flex: 1; height: .6rem; border-radius: 999px; background: var(--w-surface-3); }
.done-wait__meter > span.is-in { background: var(--w-success); }
.done-wait__text { margin: 0; font-size: 1.15rem; }
.done-wait__next { margin: .6rem 0 0; color: var(--w-text-muted); }
.done-order .muted { margin: 0 0 .6rem; }

/* --- Reihenfolge (Leiste, Abgabe, gesperrt) -------------------------------- */
.order { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.order li {
  display: grid; grid-template-columns: 2.4rem 3.4rem 1fr auto; align-items: center; column-gap: .5rem;
  min-height: 3.25rem; padding: .25rem .35rem .25rem .6rem; border-radius: var(--w-radius-lg);
  background: var(--w-surface-2); border: 1px solid var(--w-border);
  animation: slide-in .18s ease-out;
}
@keyframes slide-in { from { transform: translateY(-.35rem); opacity: 0; } }
.order__place { font-weight: 800; font-size: 1.15rem; color: var(--w-primary); font-variant-numeric: tabular-nums; }
.order__place::after { content: "."; }
.order li.is-mark .order__place::after { content: none; }
.order li.is-mark .order__place { color: var(--w-danger); }
.order__num { font-weight: 800; font-size: 1.5rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.order__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order__note { grid-column: 3 / -1; font-size: .92rem; color: var(--w-text-muted); white-space: pre-wrap; }
body.judge .order__remove {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  color: var(--w-text-muted); font-size: 1.6rem; line-height: 1;
}
body.judge .order__remove:active { background: var(--w-danger-soft); color: var(--w-danger); }
.order--locked li { background: var(--w-surface); animation: none; grid-template-columns: 2.4rem 3.4rem 1fr; }
.done-order, .wait-last { padding-bottom: .2rem; }
.done-order .order, .wait-last .order { margin-bottom: 1rem; }

/* --- Wertung: Kopf ----------------------------------------------------------- */
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: var(--j-gap); }
.form-head__title h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.form-head__title p { margin: .15rem 0 0; font-size: 1.05rem; color: var(--w-text-muted); }
.form-head__next {
  flex: none; display: grid; justify-items: end; padding: .45rem 1rem; border-radius: var(--w-radius-lg);
  background: var(--w-primary-soft); color: var(--w-primary-strong); line-height: 1.1;
}
.form-head__next-label { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.form-head__next-num { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.form-head__next.is-complete { background: var(--w-success-soft); color: var(--w-success-strong); }

/* --- Wertung: Layout ------------------------------------------------------ */
.form-layout { display: grid; gap: var(--j-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) and (orientation: landscape) {
  .form-layout { grid-template-columns: minmax(0, 1fr) minmax(19rem, 23rem); align-items: start; }
  .tray { position: sticky; top: calc(var(--j-head-h) + var(--j-gap)); max-height: calc(100dvh - var(--j-head-h) - 2 * var(--j-gap)); overflow: auto; }
}

/* --- Karten --------------------------------------------------------------- */
.jcards { display: grid; gap: var(--j-gap); grid-template-columns: repeat(auto-fill, minmax(var(--j-card-min), 1fr)); }
.jcard { position: relative; }
body.judge .jcard__tap {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  width: 100%; min-height: 9.5rem; padding: 3.1rem .6rem 1rem;
  border-radius: 1.1rem; background: var(--w-surface); border: 2px solid var(--w-border);
  box-shadow: 0 1px 0 var(--w-border), var(--w-shadow-sm);
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
}
body.judge .jcard__tap:active { transform: scale(.965); }
.jcard__num { font-size: clamp(2.6rem, 5.5vw, 3.4rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.jcard__name { font-size: .92rem; color: var(--w-text-muted); text-align: center; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jcard__place {
  position: absolute; top: .5rem; left: .5rem; display: none; place-items: center;
  min-width: 2.4rem; height: 2.4rem; padding: 0 .45rem; border-radius: .75rem;
  background: var(--j-placed); color: var(--w-on-primary); font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.jcard.is-placed .jcard__tap { background: var(--j-placed-soft); border-color: var(--j-placed); box-shadow: none; }
.jcard.is-placed .jcard__num { color: var(--w-primary-strong); opacity: .75; }
.jcard.is-placed .jcard__place { display: grid; animation: pop .25s cubic-bezier(.2, 1.6, .4, 1); }
.jcard.is-last .jcard__tap { outline: 3px solid var(--w-focus); outline-offset: 2px; }
body.judge .jcard__more {
  position: absolute; top: .25rem; right: .25rem; display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: .8rem; color: var(--w-text-muted); z-index: 1;
}
body.judge .jcard__more:active { background: var(--w-surface-3); }
.jcard__more svg { width: 1.3rem; height: 1.3rem; }
.jcard__more.has-note { color: var(--w-primary); }
.jcard__more.has-note::after {
  content: ""; position: absolute; top: .55rem; right: .55rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--w-primary-bg);
}

/* --- Leiste --------------------------------------------------------------- */
.tray {
  display: grid; gap: .75rem; padding: 1rem; border-radius: 1.25rem;
  background: var(--w-surface); border: 1px solid var(--w-border); box-shadow: var(--w-shadow-sm);
}
.tray__head { display: flex; align-items: baseline; justify-content: space-between; }
.tray__head h3 { margin: 0; font-size: 1.1rem; }
.tray__count { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; color: var(--w-text-muted); }
.tray__bar { height: .45rem; border-radius: 999px; background: var(--w-surface-3); overflow: hidden; }
.tray__bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--w-primary-bg); transition: width .2s ease; }
.tray__bar.is-complete > span { background: var(--w-success); }
.tray__empty { margin: 0; padding: 1rem; border: 2px dashed var(--w-border-strong); border-radius: var(--w-radius-lg); text-align: center; color: var(--w-text-muted); }
.tray__empty[hidden] { display: none; }
.tray__tools { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
body.judge .tool {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 3.25rem; padding: 0 1rem;
  border-radius: var(--w-radius-lg); background: var(--w-surface-2); border: 1px solid var(--w-border-strong);
  font-weight: 700; font-size: 1.02rem;
}
.tool svg { width: 1.2rem; height: 1.2rem; }
body.judge .tool--quiet { background: none; border-color: transparent; color: var(--w-danger); font-weight: 600; }
body.judge .tool:disabled { opacity: .4; }
body.judge .tool:not(:disabled):active { transform: scale(.97); }
body.judge .tray__submit {
  min-height: 4.25rem; border-radius: 1rem; font-size: 1.3rem; font-weight: 800;
  background: var(--w-primary-bg); color: var(--w-on-primary);
  box-shadow: 0 4px 0 var(--w-primary-hover-bg);
}
body.judge .tray__submit:disabled { background: var(--w-surface-3); color: var(--w-text-muted); box-shadow: none; }
body.judge .tray__submit:not(:disabled) { animation: ready .5s ease; }
@keyframes ready { 40% { transform: scale(1.03); } }

/* Hochformat: Leiste klebt unten, Reihenfolge als Chips */
@media not ((min-width: 900px) and (orientation: landscape)) {
  .form-layout { padding-bottom: 0; }
  .tray {
    position: sticky; bottom: max(.5rem, env(safe-area-inset-bottom)); z-index: 10;
    grid-template-columns: auto 1fr; grid-template-areas: "head head" "bar bar" "order order" "tools submit" "aid aid";
    box-shadow: 0 -6px 24px rgba(16, 24, 40, .14);
  }
  .tray__head { grid-area: head; }
  .tray__bar { grid-area: bar; }
  .tray .order, .tray__empty { grid-area: order; }
  .tray__tools { grid-area: tools; grid-template-columns: auto; }
  body.judge .tray__tools .tool--quiet { display: none; }   /* Hochformat: "Rückgängig" reicht, Liste hat × */
  .tray__submit { grid-area: submit; padding: 0 1.4rem; }
  .tray .aid { grid-area: aid; }
  .tray .order { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
  .tray .order li { flex: none; grid-template-columns: auto auto auto; min-height: 2.75rem; padding: 0 .1rem 0 .6rem; column-gap: .35rem; }
  .tray .order__name { display: none; }
  .tray .order__num { font-size: 1.25rem; }
  .tray .order__place { font-size: .95rem; }
  .tray__empty { padding: .6rem; }
}

/* Sortierhilfe (in der Leiste, zugeklappt) */
.aid { border-top: 1px solid var(--w-border); padding-top: .25rem; }
.aid > summary { display: flex; align-items: baseline; gap: .6rem; min-height: 3rem; align-items: center; font-weight: 700; cursor: pointer; margin: 0; }
.aid__hint { font-weight: 400; font-size: .85rem; color: var(--w-text-muted); }
.judge-suggestion { padding: .5rem 0 .25rem; }
.judge-suggestion__lead { margin: 0 0 .6rem; font-size: .88rem; color: var(--w-text-muted); }
.judge-suggestion__list { list-style: none; padding: 0; margin: 0 0 .6rem; display: grid; gap: .3rem; }
.judge-suggestion__row {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .4rem .6rem;
  border-radius: var(--w-radius-md); border: 1px dashed var(--w-border-strong); background: var(--w-surface-2);
}
.judge-suggestion__row--tied { border-color: var(--w-warning); background: var(--w-warning-soft); }
.judge-suggestion__row--incomplete { opacity: .65; }
.judge-suggestion__num { width: 2.6rem; font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.judge-suggestion__name { flex: 1; min-width: 0; }
.judge-suggestion__total { font-weight: 800; font-variant-numeric: tabular-nums; }
.judge-suggestion__flag { flex-basis: 100%; font-size: .85rem; font-weight: 600; }
.judge-suggestion__flag--tied { color: var(--w-warning-strong); }
.judge-suggestion__flag--incomplete { flex-basis: auto; color: var(--w-text-muted); font-weight: 400; }
.judge-suggestion__note { font-size: .85rem; color: var(--w-text-muted); }
body.judge .judge-suggestion__apply {
  width: 100%; min-height: 3.25rem; border-radius: var(--w-radius-lg); font-weight: 700;
  background: var(--w-surface-2); border: 1px solid var(--w-border-strong);
}

/* --- Dialoge (Sheet, Abgabe, Menü) ---------------------------------------- */
body.judge dialog {
  position: fixed; inset: auto 0 0 0; display: none; margin: 0 auto; padding: 0;
  width: min(40rem, 100%); min-width: 0; height: fit-content; min-height: 0; max-height: 88dvh; overflow: auto;
  border: 0; border-radius: 1.4rem 1.4rem 0 0; background: var(--w-surface); color: var(--w-text);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); backdrop-filter: none;
  padding-bottom: env(safe-area-inset-bottom);
}
body.judge dialog[open] { display: block; animation: sheet-up .22s cubic-bezier(.2, .9, .3, 1); }
body.judge dialog::backdrop { background: rgba(10, 15, 25, .55); }
@keyframes sheet-up { from { transform: translateY(2.5rem); opacity: 0; } }
@media (min-width: 900px) and (orientation: landscape) {
  body.judge dialog { inset: 0; margin: auto; border-radius: 1.4rem; max-height: 86dvh; }
  body.judge dialog[open] { animation-name: dialog-in; }
  @keyframes dialog-in { from { transform: scale(.96); opacity: 0; } }
}

.sheet__page { padding: 0 1.25rem 1.25rem; }
.sheet__head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .8rem;
  margin: 0 -1.25rem 1rem; padding: .9rem 1.25rem; background: var(--w-surface); border-bottom: 1px solid var(--w-border);
}
.sheet__num { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sheet__name { flex: 1; min-width: 0; font-size: 1.15rem; font-weight: 600; }
body.judge .sheet__close {
  min-height: 3rem; padding: 0 1.3rem; border-radius: var(--w-radius-lg);
  background: var(--w-primary-bg); color: var(--w-on-primary); font-weight: 700;
}
.scores { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin-bottom: 1rem; }
.scores--error { outline: 2px solid var(--w-danger); outline-offset: .35rem; border-radius: var(--w-radius-sm); }
.scores__status { grid-column: 1 / -1; font-size: .85rem; color: var(--w-text-muted); }
.score__label { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: .35rem; }
.score__label span { font-weight: 400; color: var(--w-text-muted); font-size: .88rem; }
.score__stepper { display: grid; grid-template-columns: 3.5rem 1fr 3.5rem; gap: .4rem; }
body.judge .score__btn {
  min-height: 3.5rem; border-radius: var(--w-radius-lg); font-size: 1.8rem; font-weight: 700;
  background: var(--w-surface-2); border: 1px solid var(--w-border-strong);
}
body.judge .score__btn:active { background: var(--w-primary-soft); }
.score__input {
  margin: 0 !important; min-height: 3.5rem; text-align: center; font-size: 1.6rem !important; font-weight: 800;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.score__input::-webkit-outer-spin-button, .score__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.note__label { font-size: .88rem; color: var(--w-text-muted); }
.note__text { font-size: 1.15rem !important; margin-bottom: .25rem !important; user-select: text; -webkit-user-select: text; min-height: 6rem; }
.note__status { display: block; min-height: 1.25rem; font-size: .85rem; color: var(--w-text-muted); }
.judge-note__ok, .note__ok { color: var(--w-success); }
.judge-note__err, .note__err { color: var(--w-danger); font-weight: 700; }

.review { padding: 1.4rem 1.4rem 1.2rem !important; }
.review h2 { margin: 0 0 .3rem; font-size: 1.7rem; }
.review__sub { color: var(--w-text-muted); margin: 0 0 1rem; }
.review__list { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .45rem; }
.review__list li {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: .55rem; padding: .55rem .75rem; border-radius: var(--w-radius-lg);
  background: var(--w-surface-2); border: 1px solid var(--w-border);
}
.review__place { font-weight: 800; color: var(--w-primary); font-variant-numeric: tabular-nums; }
.review__num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.review__name { grid-column: 1 / -1; font-size: .8rem; color: var(--w-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review__actions { display: grid; grid-template-columns: 1fr 2fr; gap: .7rem; }
body.judge .review__back { min-height: 4rem; border-radius: 1rem; font-weight: 700; font-size: 1.15rem; background: var(--w-surface-2); border: 1px solid var(--w-border-strong); }
body.judge .review__go { min-height: 4rem; border-radius: 1rem; font-weight: 800; font-size: 1.3rem; background: var(--w-success); color: #fff; box-shadow: 0 4px 0 var(--w-success-strong); }
body.judge .review__go:disabled { opacity: .6; }

.menu { padding: 0 0 1rem !important; }
.menu__head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--w-border); }
.menu__head h2 { margin: 0; font-size: 1.15rem; flex: 1; }
body.judge .menu__close { min-height: 3rem; padding: 0 1.2rem; border-radius: var(--w-radius-lg); background: var(--w-surface-2); border: 1px solid var(--w-border-strong); font-weight: 700; }
.menu__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .6rem; padding: 1rem 1.25rem; }
body.judge .menu__item {
  display: grid; gap: .15rem; justify-items: start; text-align: left; min-height: 4.25rem; padding: .7rem 1rem;
  border-radius: 1rem; background: var(--w-surface-2); border: 1px solid var(--w-border);
}
.menu__item span { font-weight: 700; font-size: 1.08rem; }
.menu__item small { color: var(--w-text-muted); }
body.judge .menu__item:active { background: var(--w-primary-soft); }
.menu__help { padding: 0 1.25rem; }
.menu__help h3 { font-size: 1rem; margin: .4rem 0 .5rem; }
.menu__help ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; color: var(--w-text-muted); }

/* --- Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); z-index: 50; transform: translateX(-50%);
  max-width: calc(100% - 2rem); padding: .9rem 1.3rem; border-radius: 1rem;
  background: var(--w-text); color: var(--w-surface); font-weight: 600; font-size: 1.05rem;
  box-shadow: var(--w-shadow-md); animation: sheet-up .2s ease-out;
}
.toast[hidden] { display: none; }
.toast--warn { background: var(--w-warning); color: #fff; }

/* --- PIN-Seite ------------------------------------------------------------ */
.judge-pin { max-width: 23rem; margin: clamp(1rem, 5vh, 3rem) auto; text-align: center; }
.judge-pin h2 { font-size: 1.9rem; margin-bottom: .35rem; }
.judge-pin__hint { color: var(--w-text-muted); margin-bottom: 1.2rem; }
.judge-pin__error { margin-bottom: 1rem; font-weight: 700; color: var(--w-danger); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-.4rem); } 75% { transform: translateX(.4rem); } }
.judge-pin__input {
  width: 100%; text-align: center; font-size: 2.6rem !important; letter-spacing: .6em; text-indent: .6em;
  font-weight: 800; margin-bottom: 1.1rem !important; min-height: 4.5rem; font-variant-numeric: tabular-nums;
}
.judge-pin__pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
body.judge .judge-pin__key {
  min-height: 4.75rem; border-radius: 1.1rem; font-size: 2rem; font-weight: 700;
  background: var(--w-surface); border: 1px solid var(--w-border-strong); box-shadow: 0 2px 0 var(--w-border);
}
body.judge .judge-pin__key:active { transform: scale(.96); background: var(--w-primary-soft); }
body.judge .judge-pin__key--muted { background: var(--w-surface-3); color: var(--w-text-muted); box-shadow: none; }
body.judge .judge-pin__submit { width: 100%; min-height: 4rem; border-radius: 1rem; font-size: 1.3rem; font-weight: 800; background: var(--w-primary-bg); color: var(--w-on-primary); }

@media (prefers-reduced-motion: reduce) {
  body.judge *, body.judge *::before, body.judge *::after { animation: none !important; transition: none !important; }
}

/* Viele Starter (Eliminationsrunde, große Klassen): kompaktere Karten */
.js-form[data-many] { --j-card-min: 8rem; }
body.judge .js-form[data-many] .jcard__tap { min-height: 7.25rem; padding-top: 2.6rem; }
.js-form[data-many] .jcard__num { font-size: clamp(2.2rem, 4.5vw, 2.8rem); }

/* Auswahl-Modus: gewählte Nummern als Chips statt Liste */
.js-form[data-mode="select"] .tray .order { display: flex; flex-wrap: wrap; gap: .35rem; }
.js-form[data-mode="select"] .tray .order li { grid-template-columns: auto auto; min-height: 2.6rem; padding: 0 .2rem 0 .6rem; column-gap: .2rem; }
.js-form[data-mode="select"] .tray .order__place, .js-form[data-mode="select"] .tray .order__name { display: none; }
.js-form[data-mode="select"] .tray .order__num { font-size: 1.25rem; }
body.judge .js-form[data-mode="select"] .tray .order__remove { width: 2.4rem; height: 2.4rem; font-size: 1.3rem; }

/* --- Vergleich (Callout) --------------------------------------------------- */
.jb__item--callout { background: #fff7e6; color: #7a3e00; border: 2px solid #f59e0b; align-items: center; }
[data-theme=dark] .jb__item--callout { background: rgba(245, 158, 11, .14); color: #fde68a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .jb__item--callout { background: rgba(245, 158, 11, .14); color: #fde68a; } }
.jb__nums { display: flex; flex-wrap: wrap; gap: .35rem; }
.jb__nums b {
  display: inline-grid; place-items: center; min-width: 2.5rem; height: 2.5rem; padding: 0 .45rem; border-radius: .6rem;
  background: #f59e0b; color: #1b1200; font-size: 1.3rem; font-variant-numeric: tabular-nums;
}
body.judge .jb__toggle {
  margin-left: auto; min-height: 2.75rem; padding: 0 1rem; border-radius: .7rem; font-weight: 700;
  border: 2px solid #f59e0b; background: transparent; color: inherit;
}
body.judge .jb__toggle[aria-pressed="true"] { background: #f59e0b; color: #1b1200; }
.jcard.is-called .jcard__tap { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .35); }
.jcard.is-called.is-placed .jcard__tap { border-color: var(--j-placed); }
.jcard__callout {
  position: absolute; top: .85rem; left: 50%; transform: translateX(-50%); display: none; font-size: .72rem; font-weight: 800;
  padding: .1rem .45rem; border-radius: 999px; background: #f59e0b; color: #1b1200;
}
.jcard.is-called .jcard__callout { display: inline-block; }
.js-form.only-callout .jcard:not(.is-called) { display: none; }

/* --- Punktewertung ------------------------------------------------------ */
.jcard__score {
  position: absolute; top: .5rem; left: .5rem; min-width: 2.4rem; height: 2.4rem; padding: 0 .5rem;
  display: grid; place-items: center; border-radius: .75rem; font-weight: 800; font-size: .95rem;
  background: var(--w-surface-3); color: var(--w-text-muted); font-variant-numeric: tabular-nums;
}
.jcard.is-scored .jcard__tap { background: var(--j-placed-soft); border-color: var(--j-placed); box-shadow: none; }
.jcard.is-scored .jcard__score { background: var(--j-placed); color: var(--w-on-primary); font-size: 1.15rem; }
body.judge .tool--next { width: 100%; }
body.judge .sheet__next {
  min-height: 3rem; padding: 0 1.1rem; border-radius: var(--w-radius-lg);
  background: var(--w-surface-2); border: 1px solid var(--w-border-strong); font-weight: 700;
}
.tray--points #judge-suggestion { border-top: 1px solid var(--w-border); padding-top: .5rem; }
.order li.is-score .order__place::after { content: none; }
.order li.is-score { grid-template-columns: 3.4rem 3.4rem 1fr; }
@media not ((min-width: 900px) and (orientation: landscape)) {
  .tray--points { grid-template-columns: 1fr; grid-template-areas: none; }
  .tray--points > * { grid-area: auto; }
  .tray--points #judge-suggestion { display: none; }
}
.js-form[data-mode="points"] .jcard__more { display: none; }
.score__quick { display: grid; grid-template-columns: repeat(10, 1fr); gap: .25rem; margin-top: .35rem; }
body.judge .score__pick {
  min-height: 2.6rem; border-radius: .55rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--w-surface-2); border: 1px solid var(--w-border);
}
body.judge .score__pick.is-on { background: var(--w-primary-bg); color: var(--w-on-primary); border-color: var(--w-primary-bg); }

/* --- Fotos (wenn im Event aktiviert) --------------------------------------- */
.jcard__photo { width: 3.4rem; height: 3.4rem; border-radius: 50%; object-fit: cover; margin-bottom: .15rem; border: 2px solid var(--w-surface); box-shadow: var(--w-shadow-sm); }
.jcard.is-placed .jcard__photo, .jcard.is-scored .jcard__photo { opacity: .75; }
.sheet__photo { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; }

/* =====================================================================
   Arbeitsfläche (Wertung): Karten mit Reglern links, Platzierung live rechts
   ===================================================================== */
.wb-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: var(--j-gap); }
.wb-head__title h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.wb-head__title p { margin: .1rem 0 0; color: var(--w-text-muted); }
.wb-head__next {
  flex: none; display: grid; justify-items: end; padding: .45rem 1rem; border-radius: var(--w-radius-lg);
  background: var(--w-primary-soft); color: var(--w-primary-strong); line-height: 1.1;
}
.wb-head__next:empty { display: none; }
.wb-head__label { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.wb-head__num { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.wb-head__next.is-complete { background: var(--w-success-soft); color: var(--w-success-strong); }

.wb { display: grid; gap: var(--j-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) and (orientation: landscape) {
  .wb { grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); align-items: start; }
  .wb-rank { position: sticky; top: calc(var(--j-head-h) + var(--j-gap)); max-height: calc(100dvh - var(--j-head-h) - 2 * var(--j-gap)); overflow: auto; }
}

/* --- Starter-Karte ------------------------------------------------------- */
.wb-list { display: grid; gap: var(--j-gap); grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); align-content: start; }
.wb-list:has(.ath--compact) { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.ath {
  position: relative; display: grid; gap: .55rem; padding: .7rem .8rem .8rem; border-radius: 1.1rem;
  background: var(--w-surface); border: 2px solid var(--w-border); box-shadow: var(--w-shadow-sm);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .2s ease;
}
.ath.is-placed { border-color: var(--j-placed); }
.ath.is-flash { box-shadow: 0 0 0 4px var(--w-focus); }
body.judge .ath__head {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .6rem; text-align: left;
  min-height: 3.6rem; padding: .2rem .2rem; border-radius: .8rem;
}
body.judge .ath__head:active { background: var(--w-surface-2); }
.ath__photo { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; }
.ath__num { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.ath__name { font-size: .98rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ath__status {
  justify-self: end; padding: .3rem .65rem; border-radius: 999px; font-size: .9rem; font-weight: 800;
  background: var(--w-surface-3); color: var(--w-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ath__status:empty { display: none; }
.ath__status.is-rank { background: var(--j-placed); color: var(--w-on-primary); }
.ath__callout { display: none; }
.ath.is-called { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .3); }
.ath.is-called .ath__callout {
  display: inline-block; position: absolute; top: -.7rem; left: 1rem; font-size: .7rem; font-weight: 800;
  padding: .1rem .5rem; border-radius: 999px; background: #f59e0b; color: #1b1200;
}
.js-form.only-callout .ath:not(.is-called) { display: none; }

/* --- Regler: groß, direkt, Wert daneben ------------------------------------- */
.ath__sliders { display: grid; gap: .15rem; }
.sl { display: grid; grid-template-columns: minmax(6.5rem, 9rem) 1fr 2.8rem; align-items: center; gap: .6rem; margin: 0; }
.sl__name { font-size: .86rem; font-weight: 600; line-height: 1.15; }
.sl__name small { color: var(--w-text-muted); font-weight: 400; }
.sl__val { font-size: 1.15rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.sl.is-unset .sl__val { color: var(--w-text-muted); font-weight: 600; }
body.judge .sl__input {
  -webkit-appearance: none; appearance: none; width: 100%; height: 2.75rem; margin: 0 !important; padding: 0;
  background: transparent; border: 0; cursor: pointer; touch-action: pan-y;
}
.sl__input::-webkit-slider-runnable-track { height: .55rem; border-radius: 999px; background: linear-gradient(90deg, var(--w-danger-soft), var(--w-warning-soft), var(--w-success-soft)); border: 1px solid var(--w-border); }
.sl__input::-moz-range-track { height: .55rem; border-radius: 999px; background: linear-gradient(90deg, var(--w-danger-soft), var(--w-warning-soft), var(--w-success-soft)); border: 1px solid var(--w-border); }
.sl__input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 2.1rem; height: 2.1rem; margin-top: -.85rem; border-radius: 50%;
  background: var(--w-primary-bg); border: 3px solid var(--w-surface); box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.sl__input::-moz-range-thumb { width: 2rem; height: 2rem; border-radius: 50%; background: var(--w-primary-bg); border: 3px solid var(--w-surface); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.sl.is-unset .sl__input::-webkit-slider-thumb { background: var(--w-surface-3); border-color: var(--w-border-strong); }
.sl.is-unset .sl__input::-moz-range-thumb { background: var(--w-surface-3); border-color: var(--w-border-strong); }

/* --- Notiz-Chips + Freitext ----------------------------------------------- */
.ath__notes { display: grid; gap: .4rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
body.judge .tag {
  min-height: 2.25rem; padding: 0 .7rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--w-surface-2); border: 1px solid var(--w-border); color: var(--w-text-muted);
}
body.judge .tag.is-plus { background: var(--w-success-soft); border-color: var(--w-success); color: var(--w-success-strong); }
body.judge .tag.is-minus { background: var(--w-danger-soft); border-color: var(--w-danger); color: var(--w-danger-strong); }
.ath__note {
  margin: 0 !important; min-height: 2.6rem; font-size: .95rem !important; padding: .45rem .6rem !important; resize: vertical;
  user-select: text; -webkit-user-select: text;
}

/* --- Platzierung live --------------------------------------------------------- */
.wb-rank { display: grid; gap: .6rem; padding: .9rem; border-radius: 1.25rem; background: var(--w-surface); border: 1px solid var(--w-border); box-shadow: var(--w-shadow-sm); }
.wb-rank__head { display: flex; align-items: baseline; justify-content: space-between; }
.wb-rank__head h3 { margin: 0; font-size: 1.1rem; }
.wb-rank__count { font-weight: 800; color: var(--w-text-muted); font-variant-numeric: tabular-nums; }
.wb-rank__bar { height: .4rem; border-radius: 999px; background: var(--w-surface-3); overflow: hidden; }
.wb-rank__bar > span { display: block; width: 0; height: 100%; background: var(--w-primary-bg); border-radius: inherit; transition: width .2s ease; }
.wb-rank__bar.is-complete > span { background: var(--w-success); }
.sortmode { display: grid; grid-template-columns: 1fr 1fr; padding: .2rem; border-radius: .8rem; background: var(--w-surface-2); border: 1px solid var(--w-border); }
body.judge .sortmode__btn { min-height: 2.6rem; border-radius: .6rem; font-weight: 700; color: var(--w-text-muted); }
body.judge .sortmode__btn.is-on { background: var(--w-surface); color: var(--w-primary-strong); box-shadow: var(--w-shadow-sm); }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.rank__row {
  position: relative; display: grid; grid-template-columns: auto 2rem 2.6rem 1fr auto auto; align-items: center; gap: .4rem;
  min-height: 3.2rem; padding: .25rem .3rem .25rem .2rem; border-radius: .8rem; background: var(--w-surface-2); border: 1px solid var(--w-border);
  transition: transform .15s ease;
}
.rank__row:not(:has(.rank__grip)) { grid-template-columns: 2rem 2.6rem 1fr auto auto; padding-left: .5rem; }
.rank__row.is-dragging { z-index: 2; transition: none; box-shadow: var(--w-shadow-md); background: var(--w-surface); border-color: var(--w-primary-bg); }
.rank__row.is-drop-before::before, .rank.is-drop-end .rank__row:last-child::after {
  content: ""; position: absolute; left: .4rem; right: .4rem; height: 3px; border-radius: 3px; background: var(--w-primary-bg);
}
.rank__row.is-drop-before::before { top: -3px; }
.rank.is-drop-end .rank__row:last-child::after { bottom: -3px; }
.rank__grip { display: grid; place-items: center; width: 2.2rem; height: 2.8rem; color: var(--w-text-muted); font-size: 1.1rem; letter-spacing: -.2em; cursor: grab; touch-action: none; }
.rank__place { font-weight: 800; color: var(--w-primary); text-align: center; font-variant-numeric: tabular-nums; }
.rank__num { font-weight: 800; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.rank__main { min-width: 0; display: grid; }
.rank__name { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank__tags { display: flex; flex-wrap: wrap; gap: .2rem; }
.rank__tags:empty { display: none; }
.mini { font-size: .68rem; font-weight: 700; padding: 0 .35rem; border-radius: 999px; line-height: 1.5; }
.mini--plus { background: var(--w-success-soft); color: var(--w-success-strong); }
.mini--minus { background: var(--w-danger-soft); color: var(--w-danger-strong); }
.rank__total { font-weight: 800; font-variant-numeric: tabular-nums; }
.rank__close { position: absolute; right: 2.9rem; bottom: -.55rem; z-index: 1; font-size: .66rem; font-weight: 800; padding: 0 .4rem; border-radius: 999px; background: var(--w-warning); color: #fff; }
.rank__row.is-close { border-bottom-color: var(--w-warning); }
body.judge .rank__remove { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: var(--w-text-muted); font-size: 1.4rem; }
body.judge .rank__remove:active { background: var(--w-danger-soft); color: var(--w-danger); }

.rank-open[hidden] { display: none; }
.rank-open__label { margin: .2rem 0 .3rem; font-size: .8rem; color: var(--w-text-muted); font-weight: 600; }
.rank-open__list { display: flex; flex-wrap: wrap; gap: .3rem; }
body.judge .open-chip { min-width: 2.8rem; min-height: 2.6rem; padding: 0 .5rem; border-radius: .7rem; font-weight: 800; font-size: 1.1rem; background: var(--w-surface-2); border: 1px dashed var(--w-border-strong); }
.wb-rank__tools { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.wb-rank__save { margin: 0; font-size: .8rem; color: var(--w-text-muted); text-align: center; min-height: 1rem; }
.wb-rank__save.is-bad { color: var(--w-danger); font-weight: 700; }

/* Hochformat: Platzierung unten als kompakte Leiste */
@media not ((min-width: 900px) and (orientation: landscape)) {
  .wb-rank { position: sticky; bottom: max(.5rem, env(safe-area-inset-bottom)); z-index: 10; box-shadow: 0 -6px 24px rgba(16, 24, 40, .14); max-height: 46dvh; overflow: auto; }
  .wb-list { grid-template-columns: 1fr; }
}

/* --- Gruppen: Kriterien | Posen | Kür ----------------------------------------- */
.wb-groups { display: grid; gap: .5rem; margin-bottom: var(--j-gap); position: sticky; top: var(--j-head-h); z-index: 15; padding: .4rem 0; background: var(--w-bg); }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; justify-self: start; padding: .2rem; border-radius: .9rem; background: var(--w-surface-3); }
body.judge .seg__btn { min-height: 2.9rem; min-width: 8.5rem; padding: 0 1.2rem; border-radius: .7rem; font-weight: 800; color: var(--w-text-muted); }
body.judge .seg__btn.is-on { background: var(--w-surface); color: var(--w-primary-strong); box-shadow: var(--w-shadow-sm); }
.poses { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; padding-bottom: .1rem; }
.poses[hidden] { display: none; }
body.judge .pose {
  flex: none; min-height: 2.8rem; padding: 0 .9rem; border-radius: 999px; font-weight: 700; font-size: .9rem;
  background: var(--w-surface); border: 1px solid var(--w-border); color: var(--w-text-muted);
}
body.judge .pose.is-done { color: var(--w-success-strong); border-color: var(--w-success); }
body.judge .pose.is-done::after { content: " ✓"; }
body.judge .pose.is-on { background: var(--w-primary-bg); border-color: var(--w-primary-bg); color: var(--w-on-primary); }
body.judge .pose-next { flex: none; min-height: 2.8rem; padding: 0 1rem; border-radius: 999px; font-weight: 800; background: var(--w-sidebar-bg); color: #fff; }

.js-form[data-group="criterion"] .ath__sliders:not([data-group="criterion"]),
.js-form[data-group="pose"] .ath__sliders:not([data-group="pose"]),
.js-form[data-group="routine"] .ath__sliders:not([data-group="routine"]) { display: none; }
.ath__sliders .sl[hidden] { display: none; }
.js-form[data-group="pose"] .ath__sliders[data-group="pose"] .sl { grid-template-columns: minmax(6.5rem, 9rem) 1fr 2.8rem; }
.js-form[data-group="pose"] .sl__input { height: 3.4rem; }
.posedots { display: flex; gap: .3rem; padding-left: .1rem; }
.posedots span { width: .7rem; height: .7rem; border-radius: 50%; background: var(--w-surface-3); border: 1px solid var(--w-border-strong); }
.posedots span.is-set { background: var(--w-success); border-color: var(--w-success); }
.posedots span.is-current { outline: 2px solid var(--w-primary-bg); outline-offset: 1px; }
.ath__sub { margin: 0; font-size: .8rem; color: var(--w-text-muted); font-variant-numeric: tabular-nums; }

/* Karten kompakter: Notiz einzeilig bis zum Tippen, Chips klein, kein Fokusrahmen um die Gruppe */
.ath__note { min-height: 2.4rem; height: 2.4rem; transition: height .15s ease; }
.ath__note:focus, .ath__note:not(:placeholder-shown) { height: 4.2rem; }
body.judge .tag { min-height: 2rem; padding: 0 .6rem; font-size: .78rem; }
.tags:focus-within, .tags[role=group]:focus-within { outline: none; box-shadow: none; }
.ath { gap: .4rem; }
/* Posen-Ansicht: nur ein Regler je Karte, alle Starter einer Pose auf einen Blick */
.js-form[data-group="pose"] .ath__notes, .js-form[data-group="pose"] .ath__sub { display: none; }
.js-form[data-group="pose"] .wb-list { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.js-form[data-group="pose"] .ath__sliders[data-group="pose"] .sl { grid-template-columns: 1fr 2.6rem; }
.js-form[data-group="pose"] .ath__sliders[data-group="pose"] .sl__name { display: none; }

/* Hochformat: Platzierungsleiste einspaltig (alte Leisten-Regeln neutralisieren) */
@media not ((min-width: 900px) and (orientation: landscape)) {
  .wb-rank { grid-template-columns: 1fr; grid-template-areas: none; }
  .wb-rank > * { grid-area: auto; }
  .wb-rank .tray__submit { padding: 0; }
}

/* =====================================================================
   Phase D: Posen-Ansage, Nachricht, Vergleich/Duell, Silhouette,
   Konsistenz-Hilfe, Athleten-Historie
   ===================================================================== */

/* --- Hinweisbalken: Nachricht der Regie und aufgerufene Pose --------------- */
.jb__item--msg {
  align-items: center; background: #6d28d9; color: #fff; border: 2px solid #4c1d95;
  box-shadow: 0 6px 20px rgba(109, 40, 217, .35); animation: msg-in .35s cubic-bezier(.2, 1.4, .4, 1), msg-glow 1.1s ease-in-out .35s 3;
}
.jb__item--msg .jb__label { opacity: .85; }
.jb__item--msg .jb__text { font-size: clamp(1.2rem, 2.4vw, 1.55rem); font-weight: 800; line-height: 1.2; }
.jb__icon { width: 1.7rem; height: 1.7rem; flex: none; align-self: center; }
@keyframes msg-in { from { transform: scale(.94); opacity: 0; } }
@keyframes msg-glow { 50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, .28); } }
.jb__item--pose { align-items: center; background: var(--w-primary-soft); color: var(--w-primary-strong); border: 2px solid var(--w-primary-bg); }
.jb__item--pose .jb__text { font-size: 1.25rem; font-weight: 800; }
.jb__btns { display: flex; flex-wrap: wrap; gap: .45rem; margin-left: auto; }
.jb__btns .jb__toggle { margin-left: 0; }
.jb__btns .jb__toggle[hidden] { display: none; }
body.judge .jb__toggle--cmp { background: #f59e0b; color: #1b1200; }
body.judge .jb__toggle--cmp[aria-pressed="true"] { background: transparent; color: inherit; }

/* Posenleiste: aufgerufene Pose markiert, Aufblitzen bei neuer Ansage */
body.judge .pose.is-called { position: relative; border-color: var(--w-primary-bg); border-width: 2px; }
body.judge .pose.is-called::before {
  content: "Ansage"; position: absolute; top: -.55rem; left: 50%; transform: translateX(-50%);
  padding: 0 .4rem; border-radius: 999px; font-size: .6rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: var(--w-primary-bg); color: var(--w-on-primary); line-height: 1.5;
}
.poses { padding-top: .6rem; }
.poses.is-flash { animation: pose-flash .9s ease; }
@keyframes pose-flash { 0%, 60% { background: var(--w-primary-soft); } }

/* --- Karte: Kopfzeile mit „i“, Notizzeile mit Silhouetten-Knopf ------------- */
.ath { align-content: start; }
.ath__top { display: flex; align-items: center; gap: .35rem; }
.ath__top > .ath__head { flex: 1; min-width: 0; }
.ath__photo { flex: none; max-width: none; }
.js-form[data-group="pose"]:not(.is-compare) .ath__info { display: none; }
body.judge .ath__info {
  flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  font: italic 800 1.15rem/1 Georgia, "Times New Roman", serif; color: var(--w-primary);
  background: var(--w-primary-soft); border: 1px solid transparent;
}
body.judge .ath__info:active { transform: scale(.94); }
.ath__notebar { display: flex; gap: .4rem; align-items: flex-start; }
.ath__notebar > .ath__note { flex: 1; min-width: 0; }
body.judge .ath__bodybtn {
  position: relative; flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.4rem; border-radius: .7rem;
  background: var(--w-surface-2); border: 1px solid var(--w-border); color: var(--w-text-muted);
}
.ath__bodybtn svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }
body.judge .ath__bodybtn.is-on { background: var(--w-primary-soft); border-color: var(--w-primary-bg); color: var(--w-primary-strong); }
body.judge .ath__bodybtn.has-marks::after {
  content: ""; position: absolute; top: .25rem; right: .25rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--w-primary-bg);
}

/* --- Körper-Silhouette ----------------------------------------------------- */
.body { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; padding: .55rem; border-radius: .9rem; background: var(--w-surface-2); border: 1px solid var(--w-border); }
.body[hidden] { display: none; }
.body__fig { display: grid; gap: .35rem; justify-items: center; }
.bodysvg { display: block; width: 6.6rem; height: auto; }
.bodysvg[data-show="front"] [data-view="back"], .bodysvg[data-show="back"] [data-view="front"] { display: none; }
.bodysvg .bs-n { fill: var(--w-surface-3); stroke: var(--w-border-strong); stroke-width: 1; }
.bodysvg .bs-r { fill: var(--w-surface); stroke: var(--w-border-strong); stroke-width: 1.2; cursor: pointer; transition: fill .15s ease; }
.bodysvg .bs-r.is-plus { fill: var(--w-success); stroke: var(--w-success-strong); }
.bodysvg .bs-r.is-minus { fill: var(--w-danger); stroke: var(--w-danger-strong); }
.body__flip { justify-self: stretch; }
body.judge .body__flip .seg__btn { min-width: 0; min-height: 2.2rem; padding: 0 .5rem; font-size: .8rem; }
.body__chips { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; align-content: start; }
body.judge .body__chips .tag { justify-content: center; min-height: 2.35rem; padding: 0 .4rem; }
.body__chips:focus-within { outline: none; box-shadow: none; }
.body__hint { grid-column: 1 / -1; margin: .15rem 0 0; font-size: .72rem; color: var(--w-text-muted); }

/* Mini-Grafik in der Rangliste */
.minibody { display: inline-flex; gap: 1px; align-items: center; margin-right: .1rem; }
.bodysvg--mini { width: 1.1rem; }
.bodysvg--mini .bs-r, .bodysvg--mini .bs-n { stroke-width: 3; }
.bodysvg--mini .bs-r { fill: var(--w-surface-3); }
.bodysvg--mini .bs-r.is-plus { fill: var(--w-success); }
.bodysvg--mini .bs-r.is-minus { fill: var(--w-danger); }

/* --- Konsistenz-Hilfe ---------------------------------------------------- */
.rank-warn {
  margin: 0; padding: .4rem .7rem; border-radius: .7rem; font-size: .82rem; font-weight: 700;
  background: var(--w-warning-soft); color: var(--w-warning-strong); border: 1px solid var(--w-warning);
}
.rank-warn::before { content: "⚠ "; }
.rank-warn[hidden] { display: none; }
.rank__row.is-clash { border-color: var(--w-warning); background: var(--w-warning-soft); }
.rank__clash { font-size: .7rem; font-weight: 800; color: var(--w-warning-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review__warn { margin: 0 0 1rem; padding: .7rem .9rem; border-radius: .9rem; background: var(--w-warning-soft); color: var(--w-warning-strong); border: 1px solid var(--w-warning); }
.review__warn[hidden] { display: none; }
.review__warn-title { margin: 0 0 .3rem; font-weight: 800; }
.review__warn ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .15rem; }
.review__warn li { margin: 0; }

/* --- Athleten-Historie ----------------------------------------------------- */
.histdlg { padding: 1.2rem 1.3rem 1rem !important; width: min(32rem, 100%) !important; }
.hist { display: grid; gap: 1rem; }
.hist__head { display: flex; align-items: center; gap: .8rem; }
.hist__num { font-size: 2.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hist__name { margin: 0; font-size: 1.2rem; font-weight: 700; }
.hist__club { margin: 0; color: var(--w-text-muted); }
.hist__sec h3 { margin: 0 0 .45rem; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--w-text-muted); }
.hist__list, .hist__notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.hist__row { list-style: none; display: grid; grid-template-columns: 2.8rem 1fr; gap: .6rem; align-items: center; margin: 0; padding: .45rem .6rem; border-radius: .8rem; background: var(--w-surface-2); }
.hist__place { display: grid; place-items: center; height: 2.4rem; border-radius: .6rem; font-weight: 800; font-size: 1.15rem; background: var(--w-surface-3); font-variant-numeric: tabular-nums; }
.hist__place.is-gold { background: #fde68a; color: #713f12; }
.hist__place.is-silver { background: #e2e8f0; color: #334155; }
.hist__place.is-bronze { background: #fed7aa; color: #7c2d12; }
.hist__what { display: grid; min-width: 0; }
.hist__what small { color: var(--w-text-muted); }
.hist__notes li { list-style: none; margin: 0; padding: .5rem .7rem; border-radius: .8rem; background: var(--w-surface-2); border-left: 3px solid var(--w-primary-bg); }
.hist__notes small { color: var(--w-text-muted); }
.hist__notes p { margin: .15rem 0 0; white-space: pre-wrap; }
.hist__empty, .hist__loading { margin: 0; color: var(--w-text-muted); }
body.judge .histdlg__close { width: 100%; margin-top: 1rem; min-height: 3.2rem; border-radius: 1rem; font-weight: 700; background: var(--w-surface-2); border: 1px solid var(--w-border-strong); }

/* --- Vergleichs-Ansicht ---------------------------------------------------- */
.js-form.is-compare .ath:not(.is-called) { display: none; }
.js-form.is-compare .wb { grid-template-columns: minmax(0, 1fr); }
.js-form.is-compare .wb-rank { display: none; }
.js-form.is-compare .wb-list {
  grid-template-columns: repeat(var(--cmp-n, 3), minmax(15rem, 1fr)); overflow-x: auto; padding: .8rem .1rem .3rem;
  scroll-snap-type: x proximity;
}
.js-form.is-compare .ath { scroll-snap-align: start; align-content: start; }
.js-form.is-compare .ath .ath__callout { display: none; }
.js-form.is-compare .ath__num { font-size: 3.4rem; }
.js-form.is-compare .ath__name { white-space: normal; }
/* Mit Foto: Foto groß links, Nummer/Name/Platz rechts daneben */
body.judge .js-form.is-compare .ath__head:has(.ath__photo) {
  grid-template-columns: minmax(7.5rem, 42%) minmax(0, 1fr); grid-template-areas: "photo num" "photo name" "photo status" "photo .";
  grid-template-rows: auto auto auto 1fr; align-items: start; column-gap: .8rem; row-gap: .35rem;
}
.js-form.is-compare .ath__head:has(.ath__photo) .ath__photo {
  grid-area: photo; width: 100%; height: auto; max-width: none; aspect-ratio: 4 / 5; border-radius: .8rem; object-fit: cover;
}
.js-form.is-compare .ath__head:has(.ath__photo) .ath__num { grid-area: num; }
.js-form.is-compare .ath__head:has(.ath__photo) .ath__name { grid-area: name; font-size: 1.05rem; }
.js-form.is-compare .ath__head:has(.ath__photo) .ath__status { grid-area: status; justify-self: start; }
.js-form.is-compare .sl { grid-template-columns: 1fr 2.8rem; row-gap: 0; }
.js-form.is-compare .sl__name { grid-column: 1 / -1; }
.js-form.is-compare[data-group="pose"] .ath__notes { display: grid; }
.js-form.is-compare[data-group="pose"] .ath__notebar, .js-form.is-compare[data-group="pose"] .body { display: none; }

/* Duell: A | Knöpfe | B (quer), A B nebeneinander und Duell darunter (hoch) */
.js-form.is-duel .wb-list { grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem) minmax(0, 1fr); overflow: visible; }
.duel {
  order: 1; align-self: start; position: sticky; top: calc(var(--j-head-h) + 4.2rem);
  display: grid; gap: .55rem; padding: .8rem; border-radius: 1.1rem; background: var(--w-surface); border: 2px solid #f59e0b; box-shadow: var(--w-shadow-md);
}
.duel__head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.duel__kicker { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #b45309; }
.duel__vs { font-size: 1rem; }
.duel__vs b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.duel__row { display: grid; gap: .3rem; padding: .45rem .5rem .5rem; border-radius: .8rem; background: var(--w-surface-2); }
.duel__top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.duel__name { font-size: .85rem; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel__vals { font-variant-numeric: tabular-nums; white-space: nowrap; }
.duel__vals b { font-size: 1.05rem; }
.duel__vals i { font-style: normal; color: var(--w-text-muted); padding: 0 .2rem; }
.duel__btns { display: grid; grid-template-columns: 1fr auto 1fr; gap: .3rem; }
body.judge .duel__btn { min-height: 2.6rem; padding: 0 .45rem; border-radius: .6rem; font-size: .82rem; font-weight: 800; background: var(--w-surface); border: 1px solid var(--w-border-strong); white-space: nowrap; }
body.judge .duel__btn--eq { padding: 0 .7rem; color: var(--w-text-muted); }
body.judge .duel__btn:active { background: #fde68a; border-color: #f59e0b; transform: scale(.97); }
.duel__diff { text-align: center; font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums; border-radius: 999px; padding: .05rem .5rem; justify-self: center; }
.duel__diff.is-a, .duel__diff.is-b { background: #fde68a; color: #713f12; }
.duel__diff.is-eq { background: var(--w-surface-3); color: var(--w-text-muted); }
.duel__diff.is-open { color: var(--w-text-muted); font-weight: 600; }
.duel__sum { font-size: .88rem; text-align: center; padding-top: .2rem; font-variant-numeric: tabular-nums; }

@media not ((min-width: 900px) and (orientation: landscape)) {
  .js-form.is-duel .wb-list { grid-template-columns: 1fr 1fr; }
  .duel { order: 3; grid-column: 1 / -1; position: static; grid-template-columns: 1fr 1fr; }
  .duel__head, .duel__sum { grid-column: 1 / -1; }
  /* Hochformat: Foto oben über die ganze Kartenbreite, darunter Nummer, Platz, Name */
  body.judge .js-form.is-compare .ath__head:has(.ath__photo) {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "photo photo" "num status" "name name"; grid-template-rows: auto;
  }
  .js-form.is-compare .ath__head:has(.ath__photo) .ath__photo { aspect-ratio: auto; height: 13rem; }
  .js-form.is-compare .ath__head:has(.ath__photo) .ath__status { justify-self: end; align-self: center; }
  .js-form.is-compare .ath__top { align-items: flex-start; }
}
