/* ---------- Kopf */
.top { display: flex; align-items: center; gap: 14px; margin: 4px 4px 22px; }
.top h1 { font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.02em; margin: 0; font-weight: 700; }
.top .crumbs { order: -1; }
.lock { margin-left: auto; color: var(--faint); position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; cursor: help; }
.lock:hover, .lock:focus { color: var(--ok); }
.lock::after {
  content: attr(data-tip); position: absolute; right: 0; top: 40px; width: 270px; padding: 12px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.45; color: var(--text); background: linear-gradient(180deg, var(--slab-top), var(--slab-bot));
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: 0 3px 0 -0.5px var(--thick), 0 14px 24px -12px var(--underlight); opacity: 0; pointer-events: none; transform: translateY(-4px); transition: .15s; z-index: 20;
}
.lock:hover::after, .lock:focus::after { opacity: 1; transform: none; }

/* ---------- Schritte */
.step { display: flex; gap: 16px; padding: 16px; margin-bottom: 18px; align-items: flex-start; }
.step .n {
  flex: 0 0 auto; width: 28px; height: 28px; margin-top: 10px; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px/1 var(--mono); color: #fff; background: var(--key-face); box-shadow: 0 3px 0 -1px var(--g3), 0 6px 12px -6px var(--g2);
}
.step > .drop, .step > .body { flex: 1; min-width: 0; }
.body { display: flex; flex-direction: column; gap: 12px; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 84px; padding: 16px;
  cursor: pointer; text-align: center; transition: background .15s, box-shadow .15s;
}
.drop[hidden] { display: none; }
.drop b { font-size: 16px; }
.drop small { color: var(--faint); font-size: 12.5px; letter-spacing: .02em; }
.drop:hover, .drop.over { background: color-mix(in srgb, var(--violet) 9%, var(--recess)); }
.drop .full { display: none; font: 600 14px/1.3 var(--mono); word-break: break-all; }
.drop.filled .empty { display: none; }
.drop.filled .full { display: inline-flex; align-items: center; gap: 8px; }
.drop.filled .full::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); flex: 0 0 auto; }

/* Segment-Umschalter */
.seg { display: inline-flex; gap: 3px; padding: 4px; border-radius: 14px; background: var(--recess); box-shadow: inset 0 1px 0 var(--recess-edge); align-self: flex-start; flex-wrap: wrap; }
.seg button { border: 0; background: none; font: 600 14px/1 inherit; font-family: inherit; color: var(--muted); padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] {
  color: var(--text); background: linear-gradient(180deg, var(--slab-top), var(--slab-bot));
  box-shadow: 0 2px 0 -0.5px var(--thick), inset 0 1px 0 var(--edge-top), 0 6px 10px -8px var(--underlight);
}
.seg.small button { font-size: 12.5px; padding: 7px 11px; }
.seg code { font: 500 12px/1 var(--mono); white-space: nowrap; display: block; }
.seg code i { font-style: normal; opacity: .45; margin: 0 1px; }
#tpl button { padding: 10px 14px; }
.beta { font: 700 9.5px/1 var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .06em; padding: 3px 5px; border-radius: 5px; margin-left: 4px; color: #fff; background: var(--glow); vertical-align: 1px; }

textarea { width: 100%; min-height: 200px; resize: vertical; font: 13.5px/1.55 var(--mono); padding: 14px; color: var(--text); }
textarea[hidden] { display: none; }
textarea:focus, select:focus, input:focus { outline: none; box-shadow: inset 0 0 0 1.4px color-mix(in srgb, var(--violet) 70%, transparent); }
.pattern { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
select.recess, input.recess { font: 500 14px/1 inherit; font-family: inherit; color: var(--text); padding: 9px 12px; }
/* eigener Pfeil mit Abstand zum Rand */
select.recess {
  -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236D656C' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 11px 8px;
}
#flowPane { display: flex; flex-direction: column; }
#flowPane[hidden] { display: none; }
.info { margin: 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.info[hidden] { display: none; }
.info::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.info.err { color: var(--bad); } .info.err::before { background: var(--bad); }

/* ---------- Start-Zeile */
.go { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 26px 4px 30px; isolation: isolate; }
.go .key { margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; }
.switch[hidden] { display: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 24px; border-radius: 99px; background: var(--recess); box-shadow: inset 0 1px 0 var(--recess-edge), inset 0 -1px 0 rgba(255,255,255,.5); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(180deg, #fff, #ECE9F0); box-shadow: 0 2px 4px rgba(44,32,47,.25); transition: transform .2s cubic-bezier(.3,1.4,.6,1); }
.switch input:checked + .track { background: var(--glow); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid color-mix(in srgb, var(--violet) 70%, transparent); outline-offset: 2px; }
.switch:has(input:checked) { color: var(--text); }

.gear { position: relative; }
.gear summary { list-style: none; display: grid; place-items: center; width: 42px; height: 40px; padding: 0; color: var(--muted); }
.gear summary::-webkit-details-marker { display: none; }
.gear[open] summary { color: var(--text); }
.pop { position: absolute; top: 52px; left: -80px; z-index: 30; width: 270px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pop label:not(.switch) { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
#startTc { font-family: var(--mono); }

/* ---------- Fortschritt (Ring wie im Zeittracker) */
.progress { display: flex; align-items: center; gap: 14px; padding: 12px 22px 12px 14px; border-radius: 999px; width: fit-content; margin: 0 auto 24px; }
.progress[hidden] { display: none; }
.progress b { font-size: 15px; }
.progress #pct { color: var(--muted); font-size: 14px; min-width: 3ch; }
.ring { width: 38px; height: 38px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-bg { stroke: var(--recess); }
.ring-fg { stroke: url(#rg); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset .4s; }
.error { color: var(--bad); text-align: center; font-weight: 600; }

/* ---------- Ergebnis */
.results { padding: 18px 14px 18px; }
.results[hidden] { display: none; }
.res-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 6px 12px; }
.counts { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.counts span { display: inline-flex; align-items: center; gap: 7px; }
.counts b { color: var(--text); }

.speakers { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 6px 14px; }
.speakers[hidden] { display: none; }
.spk { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 12px; background: var(--recess); box-shadow: inset 0 1px 0 var(--recess-edge); }
.spk input { border: 0; background: transparent; font: 600 13.5px/1 inherit; font-family: inherit; color: var(--text); width: 9em; padding: 6px 2px; }
.spk input:focus { box-shadow: none; }

.rows { display: flex; flex-direction: column; gap: 4px; outline: none; }
.row {
  display: grid; grid-template-columns: 9.6em 30px minmax(0, 8em) minmax(0, 1fr) 16px; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 16px; cursor: pointer; position: relative; transition: background .12s, transform .12s;
}
.row:hover { background: color-mix(in srgb, var(--violet) 6%, transparent); }
.row .tc { font: 600 14px/1 var(--mono); letter-spacing: .01em; color: var(--text); white-space: nowrap; }
.row .tc .ph { color: var(--faint); }
.row.estimated .tc { font-style: italic; }
.row .who { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .txt { font-size: 13.5px; line-height: 1.4; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .st { justify-self: end; }
.row.confirmed .st { width: auto; height: auto; background: none; box-shadow: none; }
.row.confirmed .st::before { content: "✓"; color: var(--ok); font-weight: 800; font-size: 14px; }
.play {
  width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--muted);
  background: var(--recess); box-shadow: inset 0 1px 0 var(--recess-edge); padding: 0;
}
.play svg { width: 11px; height: 11px; }
.play:disabled { opacity: .3; cursor: default; }
.play.on { color: #fff; background: var(--glow); box-shadow: 0 4px 12px -4px var(--g2); }

/* aktive Zeile = dunkle Linse mit Lichtverlauf (Zeittracker-Auswahl) */
.row.active {
  background: var(--key-face); color: #fff; transform: scale(1.012); z-index: 1;
  box-shadow: inset 0 1.3px 0 rgba(255,255,255,.4), inset 0 -1.3px 0 color-mix(in srgb, var(--g2) 90%, transparent),
    0 5px 0 -1px color-mix(in srgb, var(--g3) 80%, transparent), 0 14px 26px -10px var(--g2);
}
.row.active .tc, .row.active .txt { color: #fff; }
.row.active .who { color: rgba(255,255,255,.65); }
.row.active .tc .ph { color: rgba(255,255,255,.4); }
.row.active .play:not(.on) { background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.row.editing .tc { color: #FFD7A8; }
.row.nudged .tc { color: #FFD7A8; }

.st { width: 9px; height: 9px; border-radius: 50%; }
.st.matched { background: var(--ok); color: var(--ok); } .st.check { background: var(--check); color: var(--check); }
.st.estimated { background: var(--est); color: var(--est); } .st.unmatched { background: var(--bad); color: var(--bad); }
.st:not(:empty), .st { box-shadow: 0 0 10px currentColor; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; padding: 0 6px; isolation: isolate; }
.actions .key > span { padding: 11px 20px; }
.actions .ghost { margin-left: auto; }
.actions [hidden] { display: none; }

/* Tastenleiste unten (wie im Zeittracker) */
.keys {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40;
  display: flex; gap: 14px; padding: 8px 14px; border-radius: 16px; font-size: 13px; color: var(--muted); white-space: nowrap;
}
.keys[hidden] { display: none; }
.keys span { display: inline-flex; align-items: center; gap: 4px; }
.keys span[hidden] { display: none; }
/* Tasten im Stil des PowderGuide-V5-Prototyps: kleine Taste mit dickerer Unterkante */
.keys kbd {
  display: inline-block; min-width: 20px; text-align: center; margin-right: 2px;
  font: 600 11px/1 var(--mono); color: var(--muted); padding: 3px 5px 2px; border-radius: 5px;
  background: var(--slab-top); border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent); border-bottom-width: 2px;
}
.keys span kbd:last-of-type { margin-right: 5px; }

#printHost { display: none; }
@media print {
  body.printing > *:not(#printHost) { display: none !important; }
  body.printing #printHost { display: block; }
  body.printing { background: #fff; }
  body.printing::before { display: none; }
}

@media (max-width: 640px) {
  .step { padding: 12px; gap: 12px; }
  .row { grid-template-columns: 8.4em 30px minmax(0, 1fr) 12px; }
  .row .who { display: none; }
  .row .tc { font-size: 12.5px; }
  .keys { display: none; }
  .go .key { margin-left: 0; width: 100%; }
  .go .key kbd { display: none; }
  .pop { left: 0; }
}

/* Dunkel: aktive Zeile als farbiges Glas (wie die Taste im Zeittracker-Dunkelmodus) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .row.active { background: linear-gradient(90deg, color-mix(in srgb, var(--g2) 62%, #120E15), color-mix(in srgb, var(--g3) 62%, #120E15)); box-shadow: inset 0 1.3px 0 rgba(255,255,255,.55), 0 14px 26px -10px var(--g2); }
}
:root[data-theme="dark"] .row.active { background: linear-gradient(90deg, color-mix(in srgb, var(--g2) 62%, #120E15), color-mix(in srgb, var(--g3) 62%, #120E15)); box-shadow: inset 0 1.3px 0 rgba(255,255,255,.55), 0 14px 26px -10px var(--g2); }

/* anonyme Statistik am Seitenfuß unter der Teilen-Leiste (share.js verschiebt sie in .tool-foot) */
.stats {
  margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; color: var(--faint); cursor: pointer; user-select: none; transition: opacity .4s, transform .4s;
}
.stats[hidden] { display: none; }
.stats.fade { opacity: 0; transform: translateY(4px); }
.stats i {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: var(--key-face); box-shadow: 0 2px 0 -1px var(--g3), 0 5px 10px -6px var(--g2);
}
.stats svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stats b { font-size: 12.5px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .stats { transition: none; } }
