/* Australian Powerball simulator styles. Everything is scoped to .pb-page and built from the
   site's colour tokens, so the page inherits the light and dark themes instead of inventing a
   second palette. The balls are drawn with CSS: no images, no canvas. */
.pb-page .pb-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
.pb-page .pb-fieldset { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.pb-page .pb-fieldset legend {
  padding: 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
}
.pb-page .pb-counter {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.pb-page .pb-counter.is-full { color: var(--ok-text); }

/* The pick grids. auto-fill keeps the balls round on a wide panel and still gives a comfortable
   tap target on a 360px screen, where the panel is about 270px wide inside its padding. */
.pb-page .pb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}
.pb-page .pb-ball-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--accent);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.pb-page .pb-ball-btn:hover { border-color: var(--primary); }
.pb-page .pb-ball-btn:focus-visible { outline: 3px solid var(--highlight); outline-offset: 2px; }
.pb-page .pb-ball-btn[aria-pressed="true"],
.pb-page .pb-ball-btn.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.pb-page .pb-ball-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.pb-page .pb-ball-btn-number { font-size: 0.95rem; line-height: 1.1; }
.pb-page .pb-ball-btn-tag {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0.85;
}
/* The Powerball grid is a rounded square rather than a circle, so the two barrels are told apart
   by shape and the PB tag, not only by colour. */
.pb-page .pb-ball-btn-powerball { border-radius: 10px; }

.pb-page .pb-ticket {
  margin: 0 0 14px;
  padding: 12px;
  background: var(--accent);
  border-radius: 12px;
}
.pb-page .pb-ticket-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pb-page .pb-ticket-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pb-page .pb-ticket-ball,
.pb-page .pb-ticket-pb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 6px;
  border-radius: 17px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
}
.pb-page .pb-ticket-pb { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pb-page .pb-ticket-pb.is-empty { background: var(--card); border-color: var(--border); color: var(--muted); }
.pb-page .pb-ticket-empty { color: var(--muted); font-size: 0.85rem; }

/* The number picker is a native disclosure: open on wide screens, collapsed on phones so the
   ticket, Quick Pick, batch size and the run button all fit without scrolling past 55 balls. */
.pb-page .pb-numbers-disclosure { margin: 0 0 14px; }
.pb-page .pb-numbers-disclosure > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.pb-page .pb-numbers-disclosure > summary::-webkit-details-marker { display: none; }
.pb-page .pb-numbers-disclosure > summary::marker { content: ''; }
.pb-page .pb-numbers-disclosure > summary:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px;
}
.pb-page .pb-disclosure-title { font-size: 0.95rem; font-weight: 700; line-height: 1.35; }
.pb-page .pb-disclosure-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}
.pb-page .pb-disclosure-chevron {
  margin-left: auto;
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
.pb-page .pb-numbers-disclosure[open] > summary .pb-disclosure-chevron { transform: rotate(180deg); }
.pb-page .pb-numbers-disclosure-body { padding: 12px 2px 0; }
/* Shown by the script, and only below the phone breakpoint: with scripting off there is no dead
   button, and the native summary still closes the panel. */
.pb-page .pb-done-btn { display: none; margin-top: 4px; }

/* A ticket that is not ready keeps its button focusable, so pressing it can explain what is
   missing instead of doing nothing. */
.pb-page #simulate[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }

.pb-page .pb-pick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pb-page .pb-pick-actions .btn-secondary { flex: 1 1 auto; }
.pb-page .pb-ticket-main { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pb-page .pb-facts { display: grid; gap: 12px; margin-top: 14px; }
.pb-page .pb-limit {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}
.pb-page .pb-limit.is-error { color: var(--danger); }
.pb-page .pb-hint-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.pb-page .pb-progress { margin: 14px 0 0; }
.pb-page .pb-progress p { margin: 0 0 8px; font-size: 0.88rem; font-weight: 600; }
.pb-page .pb-progress progress {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  accent-color: var(--highlight);
}
.pb-page .pb-progress .btn-secondary { margin-top: 10px; }

/* ---------------------------------------------------------------- the result card ------------- */

/* The hero stays on the card colour rather than the site's navy panel: the drawn balls need a
   surface the ball colours read against in both themes. */
.pb-page .pb-hero {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
}
.pb-page .pb-hero .label { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pb-page .pb-hero .sub { margin-top: 10px; font-size: 0.95rem; font-weight: 600; }
.pb-page .pb-draw {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
}
.pb-page .pb-draw-empty { margin: 0; color: var(--muted); font-size: 0.9rem; }
.pb-page .pb-ball {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  padding: 2px 6px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--accent);
  color: var(--text);
  font-weight: 700;
  animation: pb-reveal 0.28s ease both;
}
.pb-page .pb-ball:nth-child(2) { animation-delay: 0.03s; }
.pb-page .pb-ball:nth-child(3) { animation-delay: 0.06s; }
.pb-page .pb-ball:nth-child(4) { animation-delay: 0.09s; }
.pb-page .pb-ball:nth-child(5) { animation-delay: 0.12s; }
.pb-page .pb-ball:nth-child(6) { animation-delay: 0.15s; }
.pb-page .pb-ball:nth-child(7) { animation-delay: 0.18s; }
.pb-page .pb-ball:nth-child(8) { animation-delay: 0.21s; }
.pb-page .pb-ball-number { font-size: 1rem; line-height: 1.1; }
/* A hit is marked three ways: the orange ring, the tick, and the screen-reader label. */
.pb-page .pb-ball.is-hit { border-color: var(--highlight); background: var(--card); }
.pb-page .pb-ball-mark {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--highlight);
  color: var(--on-primary);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}
/* The Powerball is a capsule carrying its own label, not a colour-only difference. */
.pb-page .pb-ball-powerball {
  min-width: 74px;
  border-radius: 23px;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}
.pb-page .pb-ball-powerball .pb-ball-tag {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0.9;
}
.pb-page .pb-ball-powerball.is-hit { border-color: var(--highlight); background: var(--card); color: var(--text); }
.pb-page .pb-division-label {
  margin: 12px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
}
.pb-page .pb-division-label.is-prize { color: var(--ok-text); }
.pb-page .pb-division-label.is-none { color: var(--muted); }

@keyframes pb-reveal {
  from { opacity: 0; transform: translateY(6px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.pb-page .pb-tiles .value { overflow-wrap: anywhere; }
.pb-page .pb-run-line {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.pb-page .pb-odds-card {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: var(--accent);
  border-left: 4px solid var(--highlight);
  border-radius: 0 12px 12px 0;
}
.pb-page .pb-odds-card h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.4; }
.pb-page .pb-odds-card p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

/* ---------------------------------------------------------------- the division table ---------- */

.pb-page .pb-table-wrap { overflow-x: auto; margin: 12px 0 0; }
.pb-page .pb-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.pb-page .pb-table caption {
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: left;
}
.pb-page .pb-table th,
.pb-page .pb-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: top;
}
.pb-page .pb-table thead th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pb-page .pb-table th:first-child,
.pb-page .pb-table td:first-child,
.pb-page .pb-table th:nth-child(2),
.pb-page .pb-table td:nth-child(2) { text-align: left; }
.pb-page .pb-table tbody th { font-weight: 700; white-space: nowrap; }
.pb-page .pb-table .pb-approx { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.pb-page .pb-table tr.pb-any-row th,
.pb-page .pb-table tr.pb-any-row td { background: var(--accent); font-weight: 700; }
.pb-page .pb-table tr.pb-none-row th,
.pb-page .pb-table tr.pb-none-row td { color: var(--muted); }
.pb-page .pb-division-note { margin: 10px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }

/* ---------------------------------------------------------------- the source links ------------ */

.pb-page .pb-sources { margin: 12px 0 0; padding-left: 20px; font-size: 0.88rem; line-height: 1.6; }
.pb-page .pb-sources li { margin-bottom: 4px; }
.pb-page .pb-disclaimer {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--accent);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}
.pb-page .pb-formula {
  margin: 12px 0;
  padding: 12px;
  overflow-wrap: anywhere;
  background: var(--accent);
  border-left: 3px solid var(--highlight);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------------------------------------------------------------- responsive ------------------ */

@media (max-width: 1000px) {
  .pb-page .pb-layout { grid-template-columns: minmax(0, 1fr); }
  .pb-page .pb-layout > .pb-results { margin-top: 18px; }
}
@media (max-width: 760px) {
  .pb-page .pb-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 7px; }
  .pb-page .pb-pick-actions .btn-secondary { flex: 1 1 100%; }
  .pb-page .pb-ticket { padding: 10px 12px; }
  .pb-page .pb-picker h2 { margin-bottom: 10px; }
}
@media (max-width: 767px) {
  .pb-page .pb-done-btn.is-shown { display: block; }
}
@media (min-width: 768px) {
  .pb-page .pb-numbers-disclosure > summary { display: none; }
  .pb-page .pb-numbers-disclosure { margin-bottom: 18px; }
  .pb-page .pb-numbers-disclosure-body { padding-top: 0; }
}
@media (max-width: 620px) {
  .pb-page .pb-hero { padding: 16px; }
  .pb-page .pb-ball { min-width: 42px; min-height: 42px; }
  .pb-page .pb-ball-powerball { min-width: 68px; }
  .pb-page .pb-table { font-size: 0.82rem; }
  .pb-page .pb-table th,
  .pb-page .pb-table td { padding: 7px 8px; }
}
@media (max-width: 430px) {
  .pb-page .pb-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
  .pb-page .pb-ticket-ball,
  .pb-page .pb-ticket-pb { min-width: 30px; min-height: 30px; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pb-page .pb-ball { animation: none; }
  .pb-page .pb-ball-btn { transition: none; }
  .pb-page .pb-disclosure-chevron { transition: none; }
}
