/* Direction C — 白票紅印
   Paper-ticket object. Independent Mark Six Lucky brand.
   Off-white canvas, crimson rules, chop-like titles, gold only as stub accents.
   Not a velvet lounge, not a slot machine, not an eWin form clone.
*/

:root {
  color-scheme: light;
  --canvas: #fbf7f0;
  --card: #fffdf8;
  --paper: #fffdf8;
  --ink: #333333;
  --muted: #5c534c;
  --line: #ead9cc;
  --rule: #980b0b;
  --header: #980b0b;
  --active: #980b0b;
  --gold: #fecf13;
  --gold-deep: #e4960e;
  --rose: #cb7b7b;
  --ball-num: #4f4f4f;
  --ring-red: #d9716d;
  --ring-blue: #4b7185;
  --ring-green: #8bb16f;
  --fill-red: #c45a56;
  --fill-blue: #3d5f71;
  --fill-green: #5c8a48;
  --green: #980b0b;
  --lime: #e4960e;
  color: var(--ink);
  background: var(--canvas);
}

html,
body {
  background-color: var(--canvas);
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(152, 11, 11, 0.015) 0,
      rgba(152, 11, 11, 0.015) 1px,
      transparent 1px,
      transparent 4px
    );
  color: var(--ink);
  font-family: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-weight: 400;
}

h1,
h2,
h3 {
  color: var(--header);
  font-weight: 700;
}

h1 {
  letter-spacing: -0.02em;
}

p {
  color: var(--muted);
}

.small,
.hero .small {
  color: var(--muted);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
}

.skip {
  background: var(--header);
  color: #fff;
}

.preview {
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.site-header {
  background: transparent;
  border-bottom: 2px solid var(--rule);
  max-width: none;
  padding-left: max(32px, calc(50% - 588px));
  padding-right: max(32px, calc(50% - 588px));
}

.brand b {
  color: var(--header);
}

.brand small {
  color: var(--muted);
}

.brand-mark {
  background: transparent;
  color: var(--header);
  border: 2px solid var(--header);
  box-shadow: none;
  font-weight: 700;
}

.desktop-nav a {
  color: var(--ink);
  font-weight: 500;
}

.desktop-nav [aria-current] {
  color: var(--header);
  box-shadow: 0 2px var(--header);
  font-weight: 700;
}

.language summary {
  color: var(--ink);
}

.language > div {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(80, 30, 20, 0.1);
}

.language a:hover {
  background: #f4ebe0;
}

button,
.button {
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--header);
  border-radius: 3px;
  min-height: 36px;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: none;
  letter-spacing: 0.04em;
}

button:hover,
.button:hover {
  background: #f4ebe0;
  border-color: var(--header);
}

.primary,
.button.primary {
  background: var(--header);
  border: 2px solid var(--header);
  color: #fff;
  box-shadow: inset 0 0 0 1px #fff;
  outline: 1px solid var(--header);
  outline-offset: 2px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.primary:hover,
.button.primary:hover {
  background: #7a0909;
  border-color: #7a0909;
  color: #fff;
  outline-color: #7a0909;
}

#refreshBtn,
button[type="reset"] {
  background: transparent;
  border: 1px solid var(--rose);
  color: var(--header);
  box-shadow: none;
  outline: none;
}

#refreshBtn:hover,
button[type="reset"]:hover {
  background: var(--header);
  border-color: var(--header);
  color: #fff;
}

.actions {
  gap: 14px;
}

.hero {
  padding: 48px 0 40px;
  gap: 40px;
}

.hero h1 {
  color: var(--header);
  font-size: 48px;
  font-weight: 700;
  text-shadow: none;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero p {
  color: var(--muted);
}

.hero .small {
  color: #4a433c;
}

.eyebrow {
  color: var(--header);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 700;
}

.hero .eyebrow {
  display: inline-block;
  padding: 0;
  letter-spacing: 0.14em;
  border: 0;
}

.hero-art {
  height: 340px;
  background: var(--paper);
  border: 1px solid #d9c4b0;
  border-radius: 3px;
  box-shadow: 0 10px 28px rgba(80, 30, 20, 0.08);
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 92px;
  padding: 0;
}

.hero-art::before {
  content: none;
  display: none;
}

.ticket-face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px;
  border-right: 2px dashed #d9c4b0;
}

.orbit {
  display: none;
}

.lucky-label {
  position: static;
  left: auto;
  top: auto;
  width: auto;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  margin-top: 28px;
}

.vegas-sign {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  text-align: center;
  color: var(--ink);
  letter-spacing: 0.28em;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 10px;
}

.vegas-sign span {
  display: block;
  font-family: "Noto Sans TC", "Noto Sans CJK TC", sans-serif;
  font-size: 64px;
  letter-spacing: 0.08em;
  color: var(--header);
  text-shadow: none;
  margin-top: 6px;
  font-weight: 700;
}

.reel-balls {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
}

.reel-balls span,
.reel-balls span:nth-child(2),
.reel-balls span:nth-child(3) {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  border: 0;
  transform: none;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.28);
}

.reel-balls span {
  background: var(--fill-red);
}

.reel-balls span:nth-child(2) {
  background: var(--fill-blue);
}

.reel-balls span:nth-child(3) {
  background: var(--fill-green);
}

.art-note {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  text-align: center;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-size: 9px;
  margin-top: auto;
  margin-bottom: 20px;
}

.chop {
  position: absolute;
  right: 18px;
  top: 22px;
  width: 62px;
  height: 62px;
  border: 2px solid var(--header);
  border-radius: 50%;
  color: var(--header);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
  transform: rotate(-18deg);
  opacity: 0.88;
  background: rgba(255, 253, 248, 0.7);
}

.ticket-stub {
  background: var(--gold);
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 22px 8px;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  background-image:
    radial-gradient(circle at 0 10px, var(--canvas) 6px, transparent 7px);
  background-size: 14px 20px;
  background-repeat: repeat-y;
  background-position: left top;
  background-color: var(--gold);
}

.stub-serial {
  writing-mode: vertical-rl;
  letter-spacing: 0.2em;
  font-size: 12px;
}

.stub-frac {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.stub-note {
  font-size: 11px;
}

.card {
  background: var(--paper);
  border: 1px solid #d9c4b0;
  border-radius: 2px;
  box-shadow: 0 6px 16px rgba(80, 30, 20, 0.05);
  overflow: hidden;
}

.result-preview {
  border-top: 0;
}

.section-head {
  background: transparent;
  color: var(--header);
  padding: 8px 0;
  border-radius: 0;
  border-top: 2px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
  align-items: baseline;
}

.card > .section-head {
  margin: -26px -26px 22px;
  padding: 10px 26px;
}

.section-head h2 {
  color: var(--header);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0;
}

.section-head .textlink,
.section-head .eyebrow,
.section-head .small {
  color: var(--header);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.section-head .textlink {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.textlink {
  color: var(--header);
  font-weight: 700;
}

.empty-icon {
  color: var(--header);
}

.empty p {
  color: var(--muted);
}

.empty h3 {
  color: var(--ink);
}

.tool:before,
.tool:nth-child(2):before,
.tool:nth-child(3):before,
.tool:nth-child(4):before {
  height: 0;
  background: none;
}

.tool {
  border-top: 3px solid var(--rule);
}

.tool:hover,
.guide:hover {
  border-color: var(--header);
  box-shadow: 0 4px 14px rgba(152, 11, 11, 0.08);
}

.card-number,
.tool:nth-child(2) .card-number,
.tool:nth-child(3) .card-number,
.tool:nth-child(4) .card-number {
  border-color: var(--header);
  background: transparent;
  color: var(--header);
  font-variant-numeric: tabular-nums;
  border-radius: 0;
  letter-spacing: 0.08em;
}

.tool h3 {
  color: var(--ink);
}

.tool h3 span {
  color: var(--header);
}

.tool p,
.guide p {
  color: var(--muted);
}

.guide {
  border-top: 3px solid var(--rule);
}

.guide .eyebrow {
  color: var(--header);
}

.guide h3 {
  color: var(--ink);
}

.install-banner {
  background: var(--paper);
  border: 1px solid #d9c4b0;
  border-top: 3px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(80, 30, 20, 0.05);
  position: relative;
}

.install-banner::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  bottom: 0;
  background: var(--gold);
}

.install-banner h2 {
  color: var(--header);
}

.install-banner .eyebrow {
  color: var(--header);
}

.install-banner p {
  color: var(--muted);
}

.install-banner button {
  background: var(--header);
  color: #fff;
  border: 2px solid var(--header);
  box-shadow: inset 0 0 0 1px #fff;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.install-banner button:hover {
  background: #7a0909;
}

footer {
  border-top: 2px solid var(--rule);
  border-color: var(--rule);
  color: var(--muted);
}

footer strong {
  color: var(--header);
  letter-spacing: 0.08em;
}

footer a {
  color: var(--ink);
}

footer p {
  color: var(--muted);
}

footer p:nth-of-type(1) {
  color: var(--ink);
  font-weight: 500;
}

.mobile-nav {
  background: var(--paper);
  border-color: var(--rule);
  box-shadow: 0 -2px 12px rgba(80, 30, 20, 0.06);
}

.mobile-nav a {
  color: var(--muted);
}

.mobile-nav [aria-current] {
  color: var(--header);
  background: #f4ebe0;
}

.mobile-nav [aria-current] span {
  color: var(--header);
}

input,
select {
  background: #fff;
  border-color: #d9c4b0;
  color: var(--ink);
  accent-color: var(--header);
  font-variant-numeric: tabular-nums;
  border-radius: 2px;
}

input::placeholder {
  color: #8a8178;
}

input:focus,
select:focus {
  border-color: var(--header);
}

.chip {
  background: #fff;
  border-color: #d9c4b0;
  color: var(--ink);
  border-radius: 2px;
}

.chip:has(input:checked) {
  border-color: var(--header);
  background: #f8efe6;
}

.dot.red {
  color: var(--fill-red);
}

.dot.blue {
  color: var(--fill-blue);
}

.dot.green {
  color: var(--fill-green);
}

.ball,
.ball-checkbox {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ball-checkbox,
.ball-checkbox.red,
.ball-checkbox.blue,
.ball-checkbox.green {
  background: #fff;
  color: var(--ball-num);
  box-shadow: none;
  border: 2px solid;
}

.ball-checkbox.red {
  border-color: var(--ring-red);
}

.ball-checkbox.blue {
  border-color: var(--ring-blue);
}

.ball-checkbox.green {
  border-color: var(--ring-green);
}

.number-choice input:checked + .ball-checkbox {
  background: #f8efe6;
  color: #6a6a6a;
  box-shadow: none;
  text-decoration: line-through;
  border-width: 2px;
}

.number-choice input:checked + .ball-checkbox.red {
  border-color: var(--rose);
}

.number-choice input:checked + .ball-checkbox.blue {
  border-color: #8aa0ab;
}

.number-choice input:checked + .ball-checkbox.green {
  border-color: #b5c4a8;
}

.number-choice input:checked + .ball-checkbox::after {
  content: "×";
  position: absolute;
  right: -4px;
  top: -8px;
  font-size: 12px;
  color: #fff;
  border-radius: 50%;
  background: var(--header);
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.number-choice input:focus-visible + .ball-checkbox {
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
}

.ball,
.ball.red,
.ball.blue,
.ball.green {
  color: #fff;
  border: 0;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3);
}

.ball.red {
  background: var(--fill-red);
}

.ball.blue {
  background: var(--fill-blue);
}

.ball.green {
  background: var(--fill-green);
}

.generator-heading {
  max-width: 850px;
}

.generator-heading h1 {
  color: var(--header);
}

.generator-heading .eyebrow {
  color: var(--header);
  border: 0;
  padding: 0;
  letter-spacing: 0.18em;
}

.casino-machine {
  padding: 0 0 0 16px;
  overflow: hidden;
  border: 1px solid #d9c4b0;
  box-shadow: 0 10px 28px rgba(80, 30, 20, 0.07);
  border-radius: 2px;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 16px 8px, var(--canvas) 5px, transparent 6px),
    linear-gradient(var(--gold), var(--gold-deep));
  background-size: 16px 16px, 16px 100%;
  background-repeat: repeat-y, no-repeat;
  background-position: 0 0, 0 0;
  position: relative;
}

.machine-top {
  padding: 14px 24px 12px;
  background: transparent;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--header);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  border-bottom: 2px solid var(--rule);
  border-radius: 0;
}

.machine-top span:nth-child(2) {
  color: var(--gold-deep);
  letter-spacing: 0.28em;
}

.original-controls {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 24px;
  padding: 26px;
  background: transparent;
}

.control-panel {
  background: transparent;
  border: 1px solid #ead9cc;
  border-radius: 0;
  padding: 22px;
}

.control-panel h2 {
  font-size: 17px;
  color: var(--header);
  background: transparent;
  margin: 0 0 18px;
  padding: 0 0 8px;
  border-radius: 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.range-inputs > span {
  color: var(--muted);
}

.range-inputs input {
  font-size: 20px;
  font-weight: 700;
}

.selection-ticket {
  border: 1px solid var(--rule);
  padding: 20px;
  text-align: center;
  background: #fff;
  border-radius: 0;
  margin-top: 20px;
}

.selection-ticket strong {
  display: block;
  font-family: "Noto Sans TC", "Noto Sans CJK TC", sans-serif;
  font-size: 62px;
  color: var(--header);
  line-height: 1.2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.selection-ticket > span:last-of-type {
  font-size: 13px;
  color: var(--muted);
}

.selection-ticket .eyebrow {
  color: var(--header);
  letter-spacing: 0.16em;
}

.selection-ticket hr {
  border: 0;
  border-top: 1px dashed var(--rule);
  margin: 16px 0;
}

.selection-ticket p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.exclusion-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid #ead9cc;
  border-radius: 0;
}

.filtered-out {
  opacity: 0.28;
}

.grid-hint {
  text-align: center;
  margin: 12px 0 0;
}

#toggleNumberGrid {
  width: 100%;
  justify-content: space-between;
  font-size: 13px;
}

#toggleNumberGrid::after {
  content: "−";
}

#toggleNumberGrid[aria-expanded="false"]::after {
  content: "+";
}

.machine-actions {
  border-top: 2px solid var(--rule);
  background: transparent;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 22px 24px 26px;
}

.machine-actions .primary {
  min-width: 260px;
  font-size: 16px;
  padding: 8px 28px;
  min-height: 40px;
}

.casino-machine > .error {
  margin: 0 26px 16px;
}

.number-set {
  border-color: var(--line);
}

.number-set button {
  background: #fff;
  border-color: var(--rule);
  color: var(--header);
}

.number-set button:hover {
  background: #f4ebe0;
}

.luck-note {
  color: var(--header);
  text-align: center;
  margin: 22px 0 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.original-results {
  min-height: 0;
  margin-top: 24px;
  scroll-margin-top: 24px;
  border-top: 0;
}

.original-results .small {
  text-align: center;
}

.generated-set {
  padding: 18px 0;
  border-top: 1px dashed var(--rule);
}

.generated-set h3 {
  font-size: 15px;
  color: var(--header);
  margin: 0;
  letter-spacing: 0.08em;
}

.notice {
  background: #f8efe6;
  border-left-color: var(--header);
  color: var(--ink);
}

.notice p {
  color: var(--muted);
}

.error {
  color: var(--header);
  background: #f8efe6;
  border: 1px solid var(--rose);
  padding: 12px 16px;
  border-radius: 0;
}

.error:empty {
  display: none;
}

dialog {
  background: var(--paper);
  border-color: var(--rule);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(80, 30, 20, 0.16);
  border-radius: 2px;
}

dialog::backdrop {
  background: rgba(40, 28, 20, 0.45);
}

#toast {
  background: var(--header);
  color: #fff;
  box-shadow: 0 4px 20px rgba(80, 30, 20, 0.2);
  border-radius: 2px;
}

.pop-in {
  animation: lucky-pop 0.35s both;
}

@keyframes lucky-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pop-in {
    animation: none !important;
  }
}

@media (max-width: 1000px) {
  .hero h1 {
    font-size: 40px;
  }

  .original-controls {
    grid-template-columns: 0.85fr 1.15fr;
    gap: 14px;
    padding: 18px;
  }

  .control-panel {
    padding: 17px;
  }

  .exclusion-grid {
    gap: 3px;
    padding: 8px;
  }

  .ball-checkbox {
    width: 33px;
    height: 33px;
  }
}

@media (max-width: 700px) {
  button,
  .button,
  .machine-actions .primary,
  .install-banner button {
    min-height: 44px;
    padding: 8px 18px;
  }

  .site-header {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero {
    padding: 28px 0;
    gap: 22px;
  }

  .hero h1 {
    font-size: 34px;
    line-height: 1.3;
    color: var(--header);
  }

  .hero-art {
    height: auto;
    min-height: 250px;
    margin: 0;
    grid-template-columns: 1fr 72px;
  }

  .vegas-sign span {
    font-size: 44px;
    margin-top: 4px;
  }

  .lucky-label {
    margin-top: 20px;
    font-size: 9px;
  }

  .reel-balls {
    margin-top: 16px;
    gap: 12px;
  }

  .reel-balls span,
  .reel-balls span:nth-child(2),
  .reel-balls span:nth-child(3) {
    height: 52px;
    width: 52px;
    font-size: 20px;
  }

  .art-note {
    margin-bottom: 16px;
  }

  .chop {
    width: 48px;
    height: 48px;
    font-size: 12px;
    right: 10px;
    top: 16px;
  }

  .card > .section-head {
    margin: -20px -20px 18px;
    padding: 10px 20px;
  }

  .section-head h2 {
    font-size: 16px;
  }

  .original-controls {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }

  .control-panel {
    padding: 17px;
  }

  .control-panel h2 {
    font-size: 16px;
  }

  .selection-ticket {
    padding: 12px 15px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 18px;
    align-items: center;
    text-align: left;
    margin-top: 0;
  }

  .selection-ticket .eyebrow {
    grid-column: 1 / -1;
    font-size: 9px;
  }

  .selection-ticket strong {
    grid-row: 2 / 4;
    font-size: 42px;
  }

  .selection-ticket hr {
    display: none;
  }

  .selection-ticket p {
    margin-top: 4px;
    max-height: 85px;
    overflow: auto;
  }

  .exclusion-grid {
    padding: 10px;
    gap: 3px;
  }

  .machine-top {
    padding: 12px 15px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .machine-actions {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
  }

  .machine-actions .primary {
    min-width: 0;
    width: 100%;
    font-size: 16px;
  }

  .generator-heading {
    padding: 28px 0 22px;
  }

  .generator-heading h1 {
    font-size: 30px;
  }

  .casino-machine > .error {
    margin: 0 14px 15px;
  }

  .install-banner::after {
    width: 10px;
  }

  footer {
    padding-bottom: 115px;
  }
}

@media (max-width: 360px) {
  .hero h1 {
    font-size: 30px;
  }

  .hero-art {
    grid-template-columns: 1fr 60px;
  }

  .reel-balls {
    gap: 10px;
  }

  .reel-balls span,
  .reel-balls span:nth-child(2),
  .reel-balls span:nth-child(3) {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }

  .control-panel {
    padding: 12px;
  }

  .original-controls {
    padding: 10px;
  }

  .exclusion-grid {
    padding: 5px;
    gap: 1px;
  }

  .ball-checkbox {
    width: 29px;
    height: 29px;
    font-size: 12px;
  }

  .chop {
    display: none;
  }
}


/* Layout rules that previously lived only in casino.css */
.number-choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-width: 0;
  min-height: 44px;
  cursor: pointer;
}

.number-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.ball-checkbox {
  height: 37px;
  width: 37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  pointer-events: none;
  box-sizing: border-box;
}

.range-field {
  margin-top: 24px;
}

.range-inputs {
  display: flex;
  gap: 12px;
  align-items: center;
}

.range-inputs label {
  flex: 1;
  min-width: 0;
}

.control-panel label[for="numberSets"] {
  margin-bottom: 9px;
}

#numberGrid[hidden] {
  display: none;
}

.exclusion-grid input:focus {
  outline: 0;
}


/* Inner-page ticket-paper treatment (about, guides, results, statistics, saved, 404).
   Scoped so the existing homepage hero and generator machine are unchanged. */
.page-head:not(.generator-heading) {
  padding-top: 44px;
  padding-bottom: 22px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  max-width: 800px;
}

.page-head:not(.generator-heading) h1 {
  color: var(--header);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 14px;
}

.page-head:not(.generator-heading) p {
  color: var(--muted);
  margin-bottom: 0;
}

.page-head .textlink {
  display: inline-block;
  margin-bottom: 8px;
}

.article {
  color: var(--ink);
}

.article > p,
.article li {
  color: var(--muted);
}

.article h2 {
  color: var(--header);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

/* Avoid a double rule when the page-head already ends with a crimson line. */
.article > .page-head + h2 {
  border-top: 0;
  padding-top: 0;
  margin-top: 24px;
}


.article ul {
  padding-left: 1.3em;
  margin: 0 0 1.1em;
}

.article li {
  margin: 0 0 0.55em;
  line-height: 1.9;
}

.article .notice {
  margin: 30px 0;
}

.filters {
  border-top: 3px solid var(--rule);
  border-radius: 2px;
}

.filters label,
label,
legend {
  color: var(--ink);
}

.table-wrap {
  border: 1px solid #d9c4b0;
  background: var(--paper);
}

table {
  background: var(--paper);
}

th {
  color: var(--header);
  font-weight: 700;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--rule);
  background: #f8efe6;
}

td {
  color: var(--ink);
  border-bottom-color: var(--line);
}

caption {
  color: var(--header);
  letter-spacing: 0.06em;
}

.draw-row {
  border-bottom: 1px dashed var(--rule);
}

.draw-row h2 {
  color: var(--header);
  font-size: 16px;
  letter-spacing: 0.06em;
}

.picks-panel {
  background: var(--paper);
}

#saved-list p {
  color: var(--muted);
}

.page-404 .page-head {
  max-width: 640px;
}

.page-404 .actions {
  margin: 28px 0 48px;
}


/* 膽拖 (banker / legs) — draft feature, paper-ticket treatment */
.mode-switch,
.sub-switch {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rule);
}

.mode-switch {
  margin: 0 26px;
}

.sub-switch {
  margin: 0 0 16px;
}

.mode-tab,
.sub-tab {
  flex: 1;
  position: relative;
  margin: 0;
  cursor: pointer;
  text-align: center;
  display: block;
}

.mode-tab input,
.sub-tab input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.mode-tab span,
.sub-tab span {
  display: block;
  padding: 12px 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: transparent;
}

.sub-tab span {
  padding: 10px 8px;
  font-size: 14px;
  letter-spacing: 0.1em;
}

.mode-tab:has(input:checked) span,
.sub-tab:has(input:checked) span {
  color: var(--header);
  border-bottom-color: var(--header);
  background: #fff;
}

.mode-tab:focus-within span,
.sub-tab:focus-within span {
  outline: 3px solid var(--gold-deep);
  outline-offset: -3px;
}

#generator[data-mode="banker"] .random-only {
  display: none;
}

#generator[data-mode="banker"] .range-field {
  margin-top: 0;
}

.banker-leg-panel {
  padding: 8px 26px 4px;
}

.banker-subpanel {
  margin-bottom: 12px;
}

.banker-grid,
.custom-banker-grid {
  margin-top: 10px;
}

.banker-cell.ball-checkbox,
.custom-cell.ball-checkbox {
  pointer-events: auto;
}

.banker-cell,
.custom-cell {
  appearance: none;
  -webkit-appearance: none;
  height: 37px;
  width: 37px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  box-sizing: border-box;
  cursor: pointer;
  padding: 0;
  font-variant-numeric: tabular-nums;
  justify-self: center;
}

.banker-cell:disabled,
.custom-cell:disabled {
  cursor: not-allowed;
}

.banker-cell[data-state="banker"],
.custom-cell[data-state="banker"] {
  background: var(--header);
  color: var(--paper);
  border: 2px solid var(--header);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--header);
}

.banker-cell[data-state="leg"] {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep);
}

.banker-cell[data-state="banker"]::after,
.banker-cell[data-state="leg"]::after,
.custom-cell[data-state="banker"]::after,
.pick-chip.banker::after,
.ball.ball-banker::after {
  content: attr(data-mark);
  position: absolute;
  right: -5px;
  top: -7px;
  min-width: 14px;
  height: 14px;
  padding: 0 2px;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0;
  border-radius: 7px;
  color: var(--paper);
  background: var(--header);
  box-shadow: 0 0 0 1px var(--paper);
}

.banker-cell[data-state="leg"]::after {
  background: var(--gold-deep);
  color: #fffdf8;
}

.banker-cell:focus-visible,
.custom-cell:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
}

.banker-summary,
.banker-result-head {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--rule);
}

.banker-result-head {
  margin-bottom: 8px;
}

.banker-result-head h3 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.summary-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 10px;
}

.summary-label {
  flex: 0 0 3.5em;
  font-weight: 700;
  color: var(--header);
  letter-spacing: 0.08em;
  padding-top: 6px;
}

.pick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  align-items: center;
  min-height: 32px;
}

.pick-chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.pick-chip.banker {
  background: var(--header);
  color: var(--paper);
  border: 2px solid var(--header);
}

.pick-chip.leg {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep);
}

.bet-summary {
  margin: 8px 0 0;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.spend-note {
  margin: 12px 0 4px;
  color: var(--muted);
}

.banker-warning {
  margin: 12px 0;
  padding: 12px 14px;
  background: #f8efe6;
  border-left: 3px solid var(--header);
}

.banker-warning p,
.banker-warning-inline {
  margin: 0 0 8px;
  color: var(--ink);
}

.banker-warning-inline {
  padding: 12px 14px;
  background: #f8efe6;
  border-left: 3px solid var(--header);
}

.confirm-expand {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  color: var(--header);
  cursor: pointer;
  margin: 0;
}

.confirm-expand input {
  width: 18px;
  height: 18px;
  accent-color: var(--header);
}

.banker-counts {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.banker-counts label {
  flex: 1;
  min-width: 120px;
}

.custom-bankers-field {
  margin: 0;
  border: 1px solid #ead9cc;
  padding: 14px;
}

.ball.ball-banker {
  position: relative;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 0 0 2px var(--paper), 0 0 0 4px var(--header);
}

.sets-field label {
  margin-bottom: 9px;
}

@media (max-width: 1000px) {
  .mode-switch,
  .banker-leg-panel {
    margin-left: 0;
  }
  .mode-switch {
    margin: 0 18px;
  }
  .banker-leg-panel {
    padding: 8px 18px 4px;
  }
}

@media (max-width: 700px) {
  .mode-switch {
    margin: 0 14px;
  }
  .mode-tab span,
  .sub-tab span {
    padding: 11px 4px;
    letter-spacing: 0.06em;
    font-size: 14px;
  }
  .banker-leg-panel {
    padding: 8px 14px 4px;
  }
  .banker-cell,
  .custom-cell {
    width: 34px;
    height: 34px;
  }
  .summary-label {
    flex-basis: 3em;
    font-size: 13px;
  }
  .banker-counts {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .mode-tab span,
  .sub-tab span {
    font-size: 13px;
    letter-spacing: 0.04em;
  }
  .banker-cell,
  .custom-cell {
    width: 29px;
    height: 29px;
    font-size: 12px;
  }
}

/* results official batch 2026-12-02 */
.cms-note {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}
.draw-latest-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
  margin-bottom: 12px;
}
.draw-latest-meta p,
.draw-latest-meta .draw-no,
.draw-latest-meta .draw-date {
  margin: 0;
  color: var(--ink);
}
.draw-no {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--header);
  font-size: 18px;
}
.rollover-tag {
  display: inline-block;
  border: 1px solid var(--rule);
  background: #f8efe6;
  color: var(--header);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  margin: 0;
}
.draw-latest-numbers,
.mains-block,
.special-block {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 22px;
}
.mains-block,
.special-block {
  gap: 6px 10px;
  flex-direction: column;
  align-items: flex-start;
}
.ball-caption {
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--header);
}
.draw-links {
  margin: 16px 0 0;
}
.history-table .balls,
.history-table .ball {
  flex-wrap: nowrap;
}
.history-table .ball {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.history-table th,
.history-table td {
  vertical-align: middle;
}
.prize-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 0 0 22px;
}
.prize-meta dt {
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--header);
  margin: 0;
}
.prize-meta dd {
  margin: 4px 0 0;
  color: var(--ink);
}
.stat-table th .ball {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.stat-sample {
  margin-top: 16px;
  font-size: 13px;
}
@media (max-width: 700px) {
  .prize-meta {
    grid-template-columns: 1fr;
  }
  .history-table .ball {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

.prize-policy {
  margin: 1.1rem 0 0;
  max-width: 40rem;
}
.filter-hint {
  margin: 0 0 0.8rem;
  font-size: 0.92em;
}
#results-more-wrap {
  margin: 1rem 0 0;
}

/* Statistics table sort controls only */
.stat-sort-hint {
  margin: 0 0 0.7rem;
  font-size: 13px;
  color: var(--muted);
}
.stat-table .stat-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 6px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: left;
  cursor: pointer;
}
.stat-table .stat-sort:hover {
  background: #f3e6d6;
}
.stat-table .stat-sort:focus-visible {
  outline: 3px solid #b47b28;
  outline-offset: 2px;
}
.stat-sort-ind {
  flex: none;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 700;
}
.stat-table th[aria-sort="ascending"] .stat-sort-ind,
.stat-table th[aria-sort="descending"] .stat-sort-ind {
  color: #980b0b;
}
.stat-table th[aria-sort="none"] .stat-sort-ind::before {
  content: "↕";
  opacity: 0.5;
}
.stat-table th[aria-sort="ascending"] .stat-sort-ind::before {
  content: "▲";
}
.stat-table th[aria-sort="descending"] .stat-sort-ind::before {
  content: "▼";
}

/* Statistics date-range control */
.stat-range {
  margin: 0 0 1rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--line);
}
.stat-range-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
}
.stat-range-preset,
.stat-range-date {
  flex: 1 1 10rem;
  margin: 0;
  min-width: 0;
}
.stat-range select,
.stat-range input[type="date"] {
  min-height: 44px;
}
.stat-range select:focus-visible,
.stat-range input:focus-visible {
  outline: 3px solid #b47b28;
  outline-offset: 2px;
}
.stat-range-error {
  margin: 8px 0 0;
}
.stat-range-empty {
  margin: 0 0 1rem;
}
.stat-pending {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
@media (max-width: 700px) {
  .stat-range-preset,
  .stat-range-date {
    flex: 1 1 100%;
  }
}
