/* ============================================================
   jdc.css — JDC Challenge page
   Self-contained styles; relies on style.css for vars/topbar.
   ============================================================ */

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ── Setup hero ───────────────────────────────────────────── */
.setup-hero {
  text-align: center;
  margin: 18px 0 28px;
}
.bot-icon-mark {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 64px; height: 64px;
  background: linear-gradient(135deg, rgba(153,35,26,0.18), rgba(153,35,26,0.18));
  border: 1px solid rgba(153,35,26,0.45);
  border-radius: 16px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: 1.6px;
  color: #99231a;
  margin-bottom: 14px;
}
.setup-hero h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px; letter-spacing: 2px;
  margin: 0 0 8px;
  color: #121517;
}
.setup-hero p {
  color: rgba(18,21,23,0.6);
  font-size: 14px; line-height: 1.55;
  max-width: 560px; margin: 0 auto;
}

/* ── Setup cards ──────────────────────────────────────────── */
.setup-card {
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
}
.setup-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 1.4px;
  color: #121517;
  margin: 0 0 16px;
}

/* ── Rules list ───────────────────────────────────────────── */
.jdc-rules { display: flex; flex-direction: column; gap: 14px; }
.rule-row { display: flex; gap: 14px; align-items: flex-start; }
.rule-num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: rgba(153,35,26,0.14);
  border: 1px solid rgba(153,35,26,0.35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  color: #99231a;
}
.rule-body { flex: 1; min-width: 0; }
.rule-title {
  font-weight: 700; font-size: 15px;
  color: #121517; margin-bottom: 4px;
}
.rule-text {
  font-size: 13px; line-height: 1.55;
  color: rgba(18,21,23,0.65);
}

/* ── Grade pills ──────────────────────────────────────────── */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.grade-pill {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid rgba(18,21,23,0.08);
}
.grade-pill .grade-name { font-weight: 700; }
.grade-pill .grade-range { color: rgba(18,21,23,0.55); font-size: 12px; }
.grade-white  { background: rgba(18,21,23,0.06); color: #121517; }
.grade-purple { background: rgba(153,35,26,0.18); border-color: rgba(153,35,26,0.4); color: #99231a; }
.grade-yellow { background: rgba(168,115,12,0.16); border-color: rgba(168,115,12,0.4); color: #a8730c; }
.grade-green  { background: rgba(153,35,26,0.16);  border-color: rgba(153,35,26,0.4);  color: #99231a; }
.grade-blue   { background: rgba(153,35,26,0.16); border-color: rgba(153,35,26,0.4); color: #99231a; }
.grade-red    { background: rgba(213,55,42,0.16);  border-color: rgba(213,55,42,0.4);  color: #d5372a; }
.grade-black  { background: rgba(15,15,20,0.85);   border-color: rgba(18,21,23,0.18); color: #42535f; }

/* ── Form bits ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
  color: rgba(18,21,23,0.55); text-transform: uppercase;
}
.setup-select {
  width: 100%;
  background: rgba(18,21,23,0.04);
  border: 1px solid rgba(18,21,23,0.12);
  border-radius: 10px;
  padding: 12px 14px;
  color: #121517;
  font-size: 14px;
  font-family: inherit;
  appearance: none;
}
.setup-select:focus { outline: none; border-color: rgba(153,35,26,0.5); }
.setup-hint {
  font-size: 12px; color: rgba(18,21,23,0.45);
  margin: 6px 0 0; line-height: 1.5;
}

.seg-group {
  display: inline-flex; flex-wrap: wrap;
  gap: 4px;
  background: rgba(18,21,23,0.04);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 12px;
  padding: 4px;
}
.seg-btn {
  background: transparent; border: none;
  color: rgba(18,21,23,0.6);
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.seg-btn:hover { color: #121517; }
.seg-btn.active {
  background: rgba(153,35,26,0.18);
  color: #99231a;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary, .btn-primary-lg {
  background: linear-gradient(135deg, #99231a, #99231a);
  border: none; color: #ffffff;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s, filter .15s;
}
.btn-primary { padding: 12px 22px; font-size: 14px; }
.btn-primary-lg { padding: 16px 28px; font-size: 16px; letter-spacing: 0.6px; }
.btn-primary:hover, .btn-primary-lg:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:disabled, .btn-primary-lg:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.btn-secondary, .btn-secondary-lg {
  background: rgba(18,21,23,0.06);
  border: 1px solid rgba(18,21,23,0.14);
  color: #121517;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.btn-secondary    { padding: 12px 22px; font-size: 14px; }
.btn-secondary-lg { padding: 16px 28px; font-size: 16px; }
.btn-secondary:hover, .btn-secondary-lg:hover {
  background: rgba(18,21,23,0.1);
  border-color: rgba(18,21,23,0.22);
}

.btn-link {
  background: transparent; border: none;
  color: rgba(18,21,23,0.6);
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 12px;
  font-family: inherit;
}
.btn-link:hover { color: #121517; }
.btn-link-danger {
  background: transparent; border: none;
  color: rgba(213,55,42,0.75);
  cursor: pointer; font-size: 13px;
  padding: 10px;
  text-decoration: underline;
  display: block; margin: 24px auto 0;
  font-family: inherit;
}
.btn-link-danger:hover { color: #d5372a; }

.setup-actions {
  display: flex; flex-wrap: wrap;
  gap: 12px; justify-content: center;
  margin-top: 12px;
}

/* ── Locked screen ────────────────────────────────────────── */
.jdc-locked { padding-top: 60px; }
.locked-card {
  text-align: center;
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 18px;
  padding: 40px 30px;
  max-width: 500px; margin: 0 auto;
}
.locked-mark {
  display: inline-block;
  background: rgba(153,35,26,0.18);
  border: 1px solid rgba(153,35,26,0.45);
  color: #99231a;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.locked-card h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px; letter-spacing: 1.4px;
  margin: 0 0 12px;
}
.locked-card p {
  color: rgba(18,21,23,0.65);
  line-height: 1.6;
  margin: 0 0 24px;
}
.locked-cta {
  display: inline-block;
  padding: 12px 24px;
  background: rgba(153,35,26,0.18);
  border: 1px solid rgba(153,35,26,0.45);
  color: #99231a;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
}

/* ── Play screen ──────────────────────────────────────────── */
.play-progress {
  display: flex; gap: 8px;
  margin-bottom: 18px;
}
.pp-step {
  flex: 1;
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: rgba(18,21,23,0.55);
  font-weight: 600;
}
.pp-step .pp-num {
  width: 22px; height: 22px;
  background: rgba(18,21,23,0.06);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px;
}
.pp-step.active {
  background: rgba(153,35,26,0.14);
  border-color: rgba(153,35,26,0.45);
  color: #99231a;
}
.pp-step.active .pp-num {
  background: rgba(153,35,26,0.3);
  color: #ffffff;
}
.pp-step.done { color: rgba(153,35,26,0.85); border-color: rgba(153,35,26,0.3); }
.pp-step.done .pp-num { background: rgba(153,35,26,0.3); color: #ffffff; }

.play-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.pt-cell {
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.pt-cell.pt-total {
  background: rgba(153,35,26,0.12);
  border-color: rgba(153,35,26,0.4);
}
.pt-label {
  font-size: 11px; font-weight: 700;
  color: rgba(18,21,23,0.55);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 4px;
}
.pt-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  color: #121517;
}
.pt-cell.pt-total .pt-value { color: #99231a; }

/* ── Round panel ──────────────────────────────────────────── */
.round-panel {
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 18px;
  padding: 26px;
  margin-bottom: 18px;
}
.rp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap; gap: 10px;
}
.rp-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px; letter-spacing: 1.6px;
  color: #121517;
}
.rp-counter {
  font-size: 12px;
  color: rgba(18,21,23,0.55);
  font-weight: 600;
}
.rp-prompt {
  font-size: 14px;
  color: rgba(18,21,23,0.7);
  margin-bottom: 18px;
  line-height: 1.55;
}

/* SHANGHAI input row (Parts 1 & 3) — three dart slots, cycle M->S->D->T */
.sh-darts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.sh-dart {
  background: rgba(18,21,23,0.03);
  border: 2px solid rgba(18,21,23,0.1);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
  user-select: none;
}
.sh-dart:hover { transform: translateY(-1px); }
.sh-dart-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  color: rgba(18,21,23,0.45);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sh-dart-zone {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px; letter-spacing: 1.2px;
  color: rgba(18,21,23,0.55);
  margin-bottom: 4px;
}
.sh-dart-face {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  color: #121517;
  line-height: 1;
}
.sh-dart-pts {
  font-size: 12px;
  color: rgba(18,21,23,0.5);
  margin-top: 4px;
}
.sh-dart.sh-dart-miss   { border-color: rgba(213,55,42,0.3);  background: rgba(213,55,42,0.06); }
.sh-dart.sh-dart-miss   .sh-dart-zone { color: rgba(213,55,42,0.75); }
.sh-dart.sh-dart-miss   .sh-dart-face { color: rgba(213,55,42,0.6); }
.sh-dart.sh-dart-single { border-color: rgba(153,35,26,0.45); background: rgba(153,35,26,0.1); }
.sh-dart.sh-dart-single .sh-dart-zone { color: #99231a; }
.sh-dart.sh-dart-single .sh-dart-pts  { color: #99231a; }
.sh-dart.sh-dart-double { border-color: rgba(153,35,26,0.5);  background: rgba(153,35,26,0.12); }
.sh-dart.sh-dart-double .sh-dart-zone { color: #99231a; }
.sh-dart.sh-dart-double .sh-dart-pts  { color: #99231a; }
.sh-dart.sh-dart-triple { border-color: rgba(168,115,12,0.55); background: rgba(168,115,12,0.14); }
.sh-dart.sh-dart-triple .sh-dart-zone { color: #a8730c; }
.sh-dart.sh-dart-triple .sh-dart-pts  { color: #a8730c; }

.sh-counts {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
  color: rgba(18,21,23,0.5);
  font-weight: 600;
  letter-spacing: 0.4px;
}
.sh-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(18,21,23,0.04);
  border: 1px solid rgba(18,21,23,0.08);
}
.sh-count.on {
  background: rgba(153,35,26,0.14);
  border-color: rgba(153,35,26,0.4);
  color: #99231a;
}
.sh-round-score {
  margin-left: auto;
  color: rgba(18,21,23,0.65);
}
.sh-round-score strong { color: #99231a; font-size: 16px; }

.sh-shanghai-banner {
  background: linear-gradient(135deg, rgba(153,35,26,0.18), rgba(153,35,26,0.18));
  border: 1px solid rgba(153,35,26,0.5);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: #99231a;
  margin-top: 10px;
}

/* DOUBLE AROUND THE CLOCK input (Part 2 — single dart, hit/miss toggle) */
.dr-target {
  background: rgba(18,21,23,0.03);
  border: 2px solid rgba(18,21,23,0.1);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  margin-bottom: 14px;
}
.dr-target-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px; letter-spacing: 2px;
  color: #121517;
}
.dr-target-perdart {
  font-size: 13px;
  color: rgba(18,21,23,0.55);
  margin-top: 4px;
}
.dc-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.dc-btn {
  background: rgba(18,21,23,0.03);
  border: 2px solid rgba(18,21,23,0.12);
  border-radius: 14px;
  padding: 22px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px; letter-spacing: 2.5px;
  color: rgba(18,21,23,0.55);
  cursor: pointer;
  transition: all .15s;
  font-weight: 400;
  user-select: none;
}
.dc-btn:hover {
  border-color: rgba(18,21,23,0.25);
  color: #121517;
}
.dc-btn.hit {
  background: rgba(153,35,26,0.2);
  border-color: rgba(153,35,26,0.6);
  color: #99231a;
}
.dc-btn.miss {
  background: rgba(213,55,42,0.12);
  border-color: rgba(213,55,42,0.4);
  color: #d5372a;
}

.dr-round-score {
  text-align: center;
  font-size: 14px;
  color: rgba(18,21,23,0.65);
  margin-top: 10px;
}
.dr-round-score strong { color: #99231a; font-size: 18px; }

/* play actions */
.play-actions {
  display: flex; gap: 10px; justify-content: space-between;
  flex-wrap: wrap;
  /* iOS safe area — make sure the bar isn't sat under the home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.play-actions button {
  /* Bigger tap target — the previous min-height was the implicit padding only,
     which made Finish & Save fiddly to hit on phones. */
  min-height: 48px;
}
/* Make Finish more prominent so it's never confused with Next */
#btnFinish {
  flex: 1 1 220px;
  min-height: 56px;
  font-size: 16px;
}

/* In-page confirm dialog (replaces native confirm) */
.jdc-confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity .2s;
  padding: 20px;
}
.jdc-confirm-mask.show { opacity: 1; }
.jdc-confirm {
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.12);
  border-radius: 18px;
  padding: 24px;
  max-width: 420px; width: 100%;
  transform: translateY(8px);
  transition: transform .22s;
}
.jdc-confirm-mask.show .jdc-confirm { transform: translateY(0); }
.jdc-confirm-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: 1.4px;
  color: #121517;
  margin-bottom: 10px;
}
.jdc-confirm-body {
  color: rgba(18,21,23,0.65);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 20px;
}
.jdc-confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  flex-wrap: wrap;
}
.jdc-confirm-actions button {
  min-height: 44px;
  padding: 10px 22px;
  font-size: 14px;
}
.btn-danger {
  background: linear-gradient(135deg, #d5372a, #8c2622);
  border: none; color: #fff;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s, filter .15s;
}
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ── Result screen ────────────────────────────────────────── */
.result-hero {
  text-align: center;
  padding: 40px 24px;
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.rh-grade {
  display: inline-block;
  padding: 8px 22px;
  border-radius: 999px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: 2.5px;
  margin-bottom: 18px;
  border: 2px solid;
}
.rh-grade.grade-white  { background: rgba(18,21,23,0.06); border-color: rgba(18,21,23,0.4); color: #121517; }
.rh-grade.grade-purple { background: rgba(153,35,26,0.2);  border-color: rgba(153,35,26,0.6); color: #99231a; }
.rh-grade.grade-yellow { background: rgba(168,115,12,0.18); border-color: rgba(168,115,12,0.6); color: #a8730c; }
.rh-grade.grade-green  { background: rgba(153,35,26,0.18);  border-color: rgba(153,35,26,0.6);  color: #99231a; }
.rh-grade.grade-blue   { background: rgba(153,35,26,0.18); border-color: rgba(153,35,26,0.6); color: #99231a; }
.rh-grade.grade-red    { background: rgba(213,55,42,0.2);   border-color: rgba(213,55,42,0.6);  color: #d5372a; }
.rh-grade.grade-black  { background: rgba(0,0,0,0.7);       border-color: rgba(18,21,23,0.5); color: #121517; }

.rh-total-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 96px; line-height: 1;
  color: #121517;
  letter-spacing: 1px;
}
.rh-total-lbl {
  font-size: 13px; font-weight: 700;
  color: rgba(18,21,23,0.55);
  text-transform: uppercase; letter-spacing: 1px;
  margin-top: 4px;
}
.rh-pb {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 14px;
  background: rgba(168,115,12,0.18);
  border: 1px solid rgba(168,115,12,0.5);
  color: #a8730c;
  border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase;
  animation: pbPulse 1.4s ease-in-out infinite;
}
@keyframes pbPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

.result-card {
  background: linear-gradient(160deg, #fffefb 0%, #f2efe8 100%);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 18px;
}
.res-parts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.res-part {
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.res-part-lbl {
  font-size: 11px; font-weight: 700;
  color: rgba(18,21,23,0.55);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.res-part-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  color: #121517;
  margin-top: 6px;
}
.res-meta {
  font-size: 12px;
  color: rgba(18,21,23,0.45);
  text-align: center;
  border-top: 1px solid rgba(18,21,23,0.08);
  padding-top: 12px;
}

.result-actions {
  display: flex; flex-wrap: wrap;
  gap: 12px; align-items: center; justify-content: center;
}

/* ── History + leaderboards ───────────────────────────────── */
.hist-tabs {
  display: flex; gap: 4px;
  background: rgba(18,21,23,0.04);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}
.hist-tab {
  background: transparent; border: none;
  color: rgba(18,21,23,0.6);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.hist-tab.active {
  background: rgba(153,35,26,0.18);
  color: #99231a;
}

.hist-pane { display: none; }
.hist-pane.active { display: block; }

.hist-pb-card {
  background: linear-gradient(135deg, rgba(168,115,12,0.14), rgba(153,35,26,0.14));
  border: 1px solid rgba(168,115,12,0.35);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.hist-pb-label {
  font-size: 11px; font-weight: 800;
  color: #a8730c;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hist-pb-row {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.hist-pb-grade {
  padding: 4px 12px;
  border-radius: 999px;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1.4px;
  font-size: 14px;
  border: 1px solid;
}
.hist-pb-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  color: #121517;
}
.hist-pb-when {
  margin-left: auto;
  font-size: 12px;
  color: rgba(18,21,23,0.55);
}

.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 12px;
}
.hr-grade-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 12px; letter-spacing: 1.2px;
  border: 1px solid;
  flex-shrink: 0;
}
.hr-total {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  color: #121517;
  width: 70px;
  flex-shrink: 0;
}
.hr-parts {
  flex: 1;
  font-size: 12px;
  color: rgba(18,21,23,0.55);
  display: flex; flex-wrap: wrap; gap: 4px 12px;
}
.hr-when {
  font-size: 12px;
  color: rgba(18,21,23,0.45);
  flex-shrink: 0;
  text-align: right;
  min-width: 80px;
}
.hr-league {
  font-size: 11px;
  color: #99231a;
  margin-top: 2px;
}

.hist-empty, .lb-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(18,21,23,0.5);
  font-size: 14px;
}

/* leaderboards */
.lb-filters {
  display: flex; flex-direction: column;
  gap: 14px;
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.lb-filter-row {
  display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
}
.lb-filter-label {
  font-size: 12px; font-weight: 700;
  color: rgba(18,21,23,0.55);
  text-transform: uppercase; letter-spacing: 0.6px;
  min-width: 60px;
}
.lb-context {
  margin-bottom: 10px;
  font-size: 13px;
  color: rgba(18,21,23,0.55);
}
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(18,21,23,0.03);
  border: 1px solid rgba(18,21,23,0.08);
  border-radius: 10px;
}
.lb-row.is-you {
  background: rgba(153,35,26,0.12);
  border-color: rgba(153,35,26,0.4);
}
.lb-rank {
  width: 36px; flex-shrink: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px; letter-spacing: 1px;
  color: rgba(18,21,23,0.7);
  text-align: center;
}
.lb-row:nth-child(1) .lb-rank { color: #a8730c; }
.lb-row:nth-child(2) .lb-rank { color: #42535f; }
.lb-row:nth-child(3) .lb-rank { color: #a8730c; }
.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #99231a, #99231a);
  display: flex; align-items: center; justify-content: center;
  color: #ffffff; font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-name {
  flex: 1; min-width: 0;
  font-weight: 700;
  color: #121517;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-name-sub {
  font-size: 11px; font-weight: 500;
  color: rgba(18,21,23,0.45);
}
.lb-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: #121517;
  flex-shrink: 0;
}
.lb-grade-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 11px; letter-spacing: 1.2px;
  border: 1px solid;
  flex-shrink: 0;
}
.lb-you {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(153,35,26,0.1);
  border: 1px dashed rgba(153,35,26,0.4);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(18,21,23,0.7);
  text-align: center;
}
.lb-you strong { color: #99231a; }

.history-back {
  text-align: center;
  margin-top: 24px;
}

/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 22, 35, 0.95);
  border: 1px solid rgba(18,21,23,0.12);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px; font-weight: 600;
  color: #121517;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 1000;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: rgba(213,55,42,0.5); color: #d5372a; }
#toast.success { border-color: rgba(30,122,62,0.5); color: #145229; }

/* ── Mobile adjustments ───────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 16px 12px 60px; }
  .setup-hero h1 { font-size: 32px; }
  .play-totals { grid-template-columns: repeat(2, 1fr); }
  .play-progress { flex-direction: column; }
  .pp-step { font-size: 12px; }
  .res-parts { grid-template-columns: 1fr; }
  .rh-total-num { font-size: 72px; }
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
  .sh-darts { gap: 6px; }
  .sh-dart { padding: 12px 6px; }
  .sh-dart-face { font-size: 24px; }
  .sh-counts { font-size: 11px; gap: 6px; }
  .sh-round-score { margin-left: 0; width: 100%; }
  .play-actions { flex-direction: column; }
  .play-actions button { width: 100%; }
  .hist-row { flex-wrap: wrap; }
  .hr-when { width: 100%; text-align: left; }
  .dc-btn { padding: 18px; font-size: 22px; }
}
