/* Dart-Zähler 21. Baut auf assets/style.css auf (Farben, Schriften, Buttons). */
.d21 { padding-block: 40px 72px; }
.d21-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.d21-head .eyebrow { margin-bottom: 6px; }
.d21-title { font-size: clamp(56px, 9vw, 88px); line-height: .9; letter-spacing: -0.04em; font-weight: 450; }
.d21-head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.d21-chip {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 980px; padding: 9px 16px; cursor: pointer;
}
.d21-chip:hover { border-color: var(--fg-soft); }
.d21-chip[data-armed] { color: var(--err); border-color: var(--err); }
.d21-rules { background: var(--bg-alt); border-radius: 18px; padding: 20px 24px; margin-bottom: 24px; font-size: 15px; }
.d21-rules ul { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; }
.d21-rules p { margin: 0; color: var(--fg-soft); }

/* Einrichtung */
.d21-setup { max-width: 560px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.d21-h2 { font-size: 30px; letter-spacing: -0.02em; }
.d21-add { display: flex; gap: 10px; }
.d21-add input {
  flex: 1; min-width: 0; width: 100%; font: inherit; font-size: 17px; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 980px; padding: 12px 18px;
}
.d21-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.d21-plist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); }
.d21-plist li { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-top: 1px solid var(--line); }
.d21-plist li:first-child { border-top: 0; }
.d21-num { width: 24px; color: var(--fg-soft); font-variant-numeric: tabular-nums; font-size: 14px; }
.d21-plist .d21-pname { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d21-icon { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bg-alt); color: var(--fg); font-size: 16px; cursor: pointer; }
.d21-icon:disabled { opacity: .3; cursor: default; }
.d21-hint { margin: 0; color: var(--fg-soft); font-size: 15px; }
.d21-options { display: grid; gap: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.d21-select { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; padding-top: 12px; }
.d21-select select { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.d21-start { justify-self: start; }
.d21-start:disabled { background: var(--line); color: var(--fg-soft); }

/* Spiel: links Spieler, rechts Eingabe */
.d21-game { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); grid-template-areas: "board pad" "history pad"; gap: 16px 32px; align-items: start; }
.d21-board { grid-area: board; }
.d21-pad { grid-area: pad; }
.d21-history { grid-area: history; }
.d21-board { display: grid; gap: 16px; min-width: 0; }
.d21-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.d21-player {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name last" "lives last";
  align-items: center; gap: 6px 10px; padding: 14px 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); color: var(--fg); transition: background .25s ease, color .25s ease;
}
.d21-player .d21-pname { grid-area: name; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d21-last { grid-area: last; font: 450 38px/1 var(--font-serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.d21-lives { grid-area: lives; display: flex; gap: 5px; }
.d21-lives i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .45; }
.d21-lives i.on { background: var(--err); border-color: var(--err); opacity: 1; }
.d21-player.is-current { background: var(--btn); border-color: var(--btn); color: #fff; }
.d21-player.is-current .d21-lives i.on { background: #fff; border-color: #fff; }
.d21-player.is-out { opacity: .45; }
.d21-player.is-out .d21-pname { text-decoration: line-through; }
.d21-out { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--err); }
.d21-player.is-out .d21-last { visibility: hidden; }
.d21-player.is-winner { background: var(--btn); border-color: var(--btn); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .d21-player.hit { animation: d21-shake .5s ease; }
  @keyframes d21-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
}

.d21-over { background: var(--bg-alt); border-radius: 18px; padding: 24px; }
.d21-over .eyebrow { margin-bottom: 6px; }
.d21-winner { margin: 0; font: 450 40px/1.05 var(--font-serif); letter-spacing: -0.03em; }
.d21-over .actions { margin-top: 20px; gap: 10px; }

.d21-history { border-top: 1px solid var(--line); padding-top: 8px; }
.d21-history summary { cursor: pointer; font-weight: 500; padding: 10px 0; color: var(--fg-soft); }
.d21-log { list-style: none; margin: 0; padding: 0; display: grid; font-size: 14px; font-variant-numeric: tabular-nums; }
.d21-log li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.d21-log .d21-pname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d21-ldarts { color: var(--fg-soft); }
.d21-lscore { font-weight: 600; }
.d21-lscore small { font-weight: 400; color: var(--fg-soft); }
.d21-log li.fail .d21-lscore { color: var(--err); }
.d21-log li.ok .d21-lscore { color: var(--ok); }
.d21-empty { color: var(--fg-soft); grid-template-columns: 1fr !important; }

/* Eingabe */
.d21-pad { display: grid; gap: 10px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); }
.d21-status { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: grid; gap: 6px; }
.d21-status-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 16px; }
.d21-need { color: var(--fg-soft); font-size: 15px; }
.d21-need b { font: 500 26px/1 var(--font-serif); color: var(--fg); letter-spacing: -0.02em; margin-left: 4px; font-variant-numeric: tabular-nums; }
.d21-prev { margin: 0; font-size: 13px; color: var(--fg-soft); }
.d21-status-darts { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.d21-slots { display: flex; gap: 6px; }
.d21-slot { min-width: 54px; text-align: center; padding: 8px 6px; border-radius: 10px; border: 1.5px dashed var(--line); color: var(--fg-soft); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.d21-slot.filled { border-style: solid; border-color: transparent; background: var(--bg-alt); color: var(--fg); }
.d21-slot.next { border-color: var(--accent); color: var(--accent); }
.d21-sum { font: 450 44px/1 var(--font-serif); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--fg); transition: color .2s ease; }
.d21-sum.reached { color: var(--ok); }
.d21-msg { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 500; text-align: center; }
.d21-msg.ok { color: var(--ok); }
.d21-msg.fail { color: var(--err); }

.d21-keys { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.key {
  grid-column: span 2; min-height: 54px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); font: inherit; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background .12s ease, transform .08s ease; -webkit-tap-highlight-color: transparent;
}
.key:active:not(:disabled) { transform: scale(.96); background: var(--bg-alt); }
.key:disabled { opacity: .35; cursor: default; }
.key.mod { grid-column: span 5; font-size: 16px; background: var(--bg-alt); border-color: transparent; }
.key.mod[aria-pressed="true"] { background: var(--clay); color: #fff; }
.key.clr, .key.ok, .key[data-base="25"], .key[data-base="0"], #d21-undo { font-size: 15px; }
.key.clr { color: var(--err); background: color-mix(in srgb, var(--err) 10%, var(--card)); border-color: transparent; }
.key.ok { background: var(--btn); border-color: var(--btn); color: #fff; font-size: 18px; }
.key.ok:active:not(:disabled) { background: var(--btn-hover); }
.key.ok.ready { box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 35%, transparent); }

@media (max-width: 860px) {
  .d21-game { grid-template-columns: 1fr; grid-template-areas: "board" "pad" "history"; gap: 14px; }
  .d21-pad { position: static; }
}
@media (max-width: 680px) {
  .d21 { padding-block: 16px 40px; }
  .d21-head { margin-bottom: 14px; }
  .d21-head .eyebrow { display: none; }
  .d21-title { font-size: 48px; }
  .d21-players { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .d21-player { padding: 10px 12px; border-radius: 14px; }
  .d21-player .d21-pname { font-size: 15px; }
  .d21-last { font-size: 30px; }
  .d21-status { padding: 12px 14px; }
  .d21-slot { min-width: 46px; font-size: 14px; padding: 7px 4px; }
  .d21-sum { font-size: 38px; }
  .key { min-height: 50px; font-size: 19px; border-radius: 11px; }
  .d21-keys { gap: 5px; }
  .d21-add .btn { padding-inline: 18px; }
  body:has(.d21-game:not([hidden])) footer { display: none; }
}
