:root{color-scheme:light;--header-height:72px;--ink:#42251a;--muted:#715141;--paper:#f8ead4;--line:#e1cdb2;--white:#fff8eb;font-family:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif;color:var(--ink);background:var(--paper);font-synthesis:none}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0}
[hidden]{display:none!important}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;cursor:pointer}
button:disabled{cursor:default}
:focus-visible{outline:2px solid #9c2d1b;outline-offset:4px}
.wrap{width:min(1120px,calc(100% - 72px));margin-inline:auto}
.site-header {
  padding-top: env(safe-area-inset-top);
  background: var(--paper);
}
.header-inner {
  width: min(780px, calc(100% - 44px));
  min-height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand {
  position: relative;
  display: inline-block;
  width: max-content;
  font-size: 38px;
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -.08em;
  padding: 3px 4px 11px;
  transform: rotate(-5deg);
}
.brand::after {
  position: absolute;
  left: 18%;
  right: 0;
  bottom: 3px;
  height: 5px;
  border-radius: 100%;
  background: #c7442b;
  content: "";
}
.factor-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #dfc3a4;
  border-radius: 99px;
  background: #fff5e5;
  font-size: 13px;
  font-weight: 800;
}
.slider-icon {
  position: relative;
  width: 16px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.slider-icon::before, .slider-icon::after {
  position: absolute;
  width: 3px;
  height: 3px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #fff5e5;
  content: "";
}
.slider-icon::before { top: -3px; left: 3px; }
.slider-icon::after { bottom: -3px; right: 3px; }
#factor-count, #saved-count {
  border-radius: 99px;
  padding: 2px 5px;
  background: #f4d7ba;
  color: var(--ink);
  font-size: 11px;
}
.button{display:inline-flex;justify-content:center;align-items:center;gap:9px;border:1px solid transparent;border-radius:10px;min-height:46px;padding:0 16px;font-weight:700;font-size:14px;white-space:nowrap;transition:background .18s,border-color .18s}
.button.small{min-height:38px;padding:0 13px}
.button.primary{background:var(--ink);color:white}
.button.primary:hover{background:#623825}
.button.outline{background:var(--white);border-color:#dfc9af}
.button.outline:not(:disabled):hover{background:#f7e7d2;border-color:#d2a783}
.button.outline:disabled{color:#58432d;background:#f3e5d0}
.section{scroll-margin-top:16px}
.section-head{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:15px}
h1,h2,h3,p{margin:0}
h2{font-size:26px;line-height:1.3;font-weight:900;letter-spacing:-.04em}
.section-head p,.note{font-size:13px;line-height:1.6;margin-top:6px;color:var(--muted)}
.issuer{display:inline-block;padding:4px 7px;border-radius:5px;font-size:11px;font-weight:750;line-height:1.2;color:#8a4039;background:#f6e5e1;vertical-align:middle;white-space:nowrap}
.issuer[data-issuer="体彩"]{color:#244c6e;background:#e1edf4}
.text-button{appearance:none;border:0;background:transparent;padding:4px 0;font-size:12px;font-weight:650;color:#744532}
.text-button:hover{text-decoration:underline}
.guide{margin-top:36px;margin-bottom:41px}
.filters{display:flex;gap:2px;border:1px solid var(--line);border-radius:8px;background:#f2e2cf;padding:3px}
.filters button{min-height:29px;padding:0 11px;background:none;border:1px solid transparent;border-radius:6px;color:var(--muted);font-size:12px;white-space:nowrap}
.filters button[aria-pressed="true"]{background:white;border-color:var(--line);color:var(--ink);font-weight:700}
.guide-table{overflow:auto;border:1px solid var(--line);border-radius:14px;background:var(--white)}
table{width:100%;border-collapse:collapse;min-width:715px;text-align:left;font-size:13px}
th,td{padding:12px 15px;border-bottom:1px solid var(--line)}
thead th{background:#f4e5d2;color:#53564c;font-size:12px;white-space:nowrap}
tbody tr:last-child>*{border-bottom:0}
tbody th{white-space:nowrap}
tbody td:nth-child(2) b{display:block;margin-bottom:2px;font-size:12px}
tbody td:nth-child(2) span{color:var(--muted);font-size:12px}
tbody td:not(:nth-child(2)){white-space:nowrap}
tbody td a,.table-game{color:#87422f;font-weight:700}
tbody td a:hover,.table-game:hover{text-decoration:underline}
.table-game{background:none;border:0;padding:0 3px 0 0;font-size:13px}
.table-odds{font-variant-numeric:tabular-nums}
.note{margin-top:9px}
.site-footer{border-top:1px solid var(--line)}
.footer-inner{min-height:77px;display:flex;align-items:center;justify-content:space-between;gap:18px}
.footer-inner p{font-size:12px;color:var(--muted)}
dialog{border:1px solid var(--line);border-radius:17px;width:min(500px,calc(100% - 32px));max-height:85dvh;background:var(--white);color:var(--ink);padding:22px;margin:auto;box-shadow:0 12px 40px #24251f30}
dialog::backdrop{background:#24251f62}
.dialog-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.close-button{width:34px;height:34px;border:1px solid var(--line);border-radius:8px;background:var(--paper);font-size:22px;line-height:1}
dialog p{font-size:14px;line-height:1.65;margin-top:12px;color:var(--muted)}
.empty,.saved-row{background:var(--paper);padding:12px;border-radius:8px}
.saved-row{margin-top:9px}
.saved-row h3{font-size:14px}
.saved-row p{margin:3px 0 7px}
.saved-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);z-index:10;background:var(--ink);color:#fff;border-radius:8px;padding:9px 14px;font-size:13px;max-width:calc(100vw - 24px);text-align:center}
@media(max-width:680px){
  .wrap{width:calc(100% - 28px)}
  .guide{margin-top:28px}
  h2{font-size:22px}
  .section-head{align-items:flex-start;gap:8px}
  .section-head p{font-size:12px}
  .footer-inner{padding:12px 0;flex-wrap:wrap}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;transition:none!important}
}
@media(max-width:680px){
  .guide-table{overflow:visible;border-radius:11px}
  table{min-width:0;display:block}
  thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  tbody{display:block}
  tbody tr{display:grid;grid-template-columns:1fr 1fr;gap:6px 10px;padding:12px;border-bottom:1px solid var(--line)}
  tbody tr:last-child{border-bottom:0}
  tbody th,tbody td{border:0;padding:0}
  tbody td:nth-child(2){grid-area:2/1/3/-1}
  tbody td:nth-child(2) b{display:inline;margin-right:5px}
  tbody td:nth-child(5){grid-area:1/2;justify-self:end}
  tbody td[data-label]::before{content:attr(data-label);display:block;font-size:11px;color:var(--muted);margin-bottom:2px}
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.draw-room {
  --ticket-width: clamp(175px, min(68vw, 36svh), 286px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: calc(100svh - var(--header-height) - env(safe-area-inset-top));
  padding: 12px 16px max(24px, env(safe-area-inset-bottom));
  scroll-margin-top: calc(var(--header-height) + env(safe-area-inset-top));
}
.draw-room::before, .draw-room::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}
.draw-room::before {
  inset: 0 0 auto auto;
  width: min(76%, 520px);
  height: 62%;
  background: url('./paper.webp'), #df5135;
  background-blend-mode: multiply;
  clip-path: polygon(54% 0, 100% 0, 100% 100%, 0 40%);
}
.draw-room::after {
  inset: auto auto 0 0;
  width: min(55%, 385px);
  height: 32%;
  background: url('./paper.webp'), #d7472e;
  background-blend-mode: multiply;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.draw-controls { width: min(100%, 300px); margin: 0 auto 20px; }
.draw-controls fieldset, .factor-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-group, .factor-options, .draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.choice-group {
  flex-wrap: nowrap;
  padding: 4px;
  border: 1px solid #fffaf0;
  border-radius: 99px;
  background: #fff4e2;
  box-shadow: 0 2px 6px #6b341a25;
}
.choice-group button, .factor-options button, .factor-options select {
  border-radius: 99px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.choice-group button {
  flex: 1;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
}
.choice-group button:hover { background: #f8e2c8; }
.choice-group button[aria-pressed="true"] { background: #bd3822; color: #fff9eb; }
.factor-options { margin-top: 14px; }
.factor-options button, .factor-options select {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid #d9b99e;
  background: #fff8eb;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
.factor-options button[aria-pressed="true"], .factor-options select.factor-active {
  background: #f6d8c3;
  border-color: #be624e;
}
.factor-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
#specific-game {
  margin: -12px 0 8px;
  padding: 0 8px;
  border-radius: 6px;
  background: #fff1dc;
  color: var(--ink);
  font-size: 13px;
}
#specific-game button { min-height: 36px; margin-left: 8px; }

.stage { display: grid; justify-items: center; width: min(100%, 355px); }
.carousel { display: grid; justify-items: center; width: 100%; }
.card-stack {
  position: relative;
  isolation: isolate;
  width: var(--ticket-width);
  aspect-ratio: 0.785;
}
.card-stack::before, .card-stack::after {
  position: absolute;
  z-index: -1;
  inset: 6% 0 1%;
  border: 1px solid #c4462d;
  border-radius: 16px;
  background: url('./paper.webp'), #de5c43;
  background-blend-mode: multiply;
  box-shadow: 0 10px 14px #5e221e38;
  content: "";
  pointer-events: none;
}
.card-stack::before { transform: translateX(-7%) rotate(-8deg); }
.card-stack::after { transform: translateX(7%) rotate(8deg); }
.slide {
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  transform: translateX(var(--drag, 0px));
  user-select: none;
}
.card-face {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 7px 6px #6f3a2352);
}
.card-face:has(button:focus-visible) {
  outline: 2px solid #9c2d1b;
  outline-offset: 6px;
}
.card-back, .card-front {
  --notch: 19px;
  --corner: 9px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 16px;
  border: 0;
  border-radius: 3px;
  background: url('./paper.webp'), linear-gradient(156deg, #fff6e7, #fce7ca);
  background-blend-mode: multiply;
  mask-image:
    radial-gradient(circle at top center, transparent var(--notch), #000 calc(var(--notch) + 1px)),
    radial-gradient(circle at bottom center, transparent var(--notch), #000 calc(var(--notch) + 1px)),
    radial-gradient(circle at top left, transparent var(--corner), #000 calc(var(--corner) + 1px)),
    radial-gradient(circle at top right, transparent var(--corner), #000 calc(var(--corner) + 1px)),
    radial-gradient(circle at bottom left, transparent var(--corner), #000 calc(var(--corner) + 1px)),
    radial-gradient(circle at bottom right, transparent var(--corner), #000 calc(var(--corner) + 1px));
  mask-composite: intersect;
  color: var(--ink);
}
.card-back { transform: rotate(-2deg); padding-bottom: 12%; }
.card-back::after {
  position: absolute;
  inset: auto 8% 17%;
  border-top: 2px dashed #633725;
  content: "";
}
.ticket-question {
  display: block;
  font: 900 min(calc(var(--ticket-width) * .75), 206px)/1 Georgia, serif;
  color: #c84228;
  transform: rotate(-5deg);
}
.card-back:hover .ticket-question { color: #a82d1a; }
.card-front { gap: 6px; padding: 20px 10px; }
.front-issuer, .front-play, .front-zoom, .front-format, .zone-label {
  color: var(--muted);
  font-size: 11px;
}
.front-issuer { font-weight: 800; letter-spacing: .08em; }
.card-front strong { font-size: clamp(24px, 8vw, 38px); line-height: 1.1; font-weight: 900; }
.front-format { max-width: 24ch; line-height: 1.45; text-wrap: balance; }
.front-zoom { text-decoration: underline; text-underline-offset: 3px; }
.ticket-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px 12px;
  padding-block: 5px;
}
.number-zone { display: grid; gap: 4px; justify-items: center; max-width: 100%; min-width: 0; }
.ball-group { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.card-front .ball-group:has(> .ball:nth-child(10)) { max-width: 135px; }
.ball {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  font: 750 11px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  background: #f0dbc1;
  color: #492d22;
  border: 1px solid #dec4a6;
}
.ball.green { background: #e9efdd; color: #3f5233; border-color: #d3e1c4; }
.ball.red { background: #fbe8e2; color: #8d372f; border-color: #f4d1c8; }
.ball.blue { background: #e2edf8; color: #25568b; border-color: #cddff1; }
.card-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 290px);
  margin: 13px 0 10px;
}
.arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 1px solid #fffaf1;
  border-radius: 50%;
  background: #fff0d9;
  box-shadow: 0 2px 5px #6b341a31;
  font: 28px/1 system-ui, sans-serif;
}
.arrow:hover { background: #fff9eb; }
.pips { display: flex; align-items: center; padding: 0 4px; border-radius: 99px; background: #fff0d9; }
.pips button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
}
.pips button::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ab8d74;
  content: "";
}
.pips button[aria-current="true"]::before { width: 11px; height: 11px; background: #bb3822; }
.reveal-button {
  width: min(100%, 300px);
  min-height: 58px;
  padding: 8px 20px;
  border: 2px solid #fff0d9;
  border-radius: 99px;
  background: #42251a;
  box-shadow: 0 5px 0 #832e20;
  color: #fff2d7;
  font-size: clamp(22px, 6vw, 27px);
  font-weight: 900;
  letter-spacing: .04em;
}
.reveal-button:hover { background: #563427; }
.reveal-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #832e20; }
.draw-lede {
  margin-top: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #fff0d9;
  font-size: 14px;
  font-weight: 750;
}
.draw-actions { justify-content: center; min-height: 58px; align-items: center; }
.draw-actions .button.small { min-height: 44px; }
.draw-foot {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 16px;
  padding-top: 8px;
}
.draw-foot .text-button { display: inline-flex; align-items: center; gap: 3px; min-height: 44px; }

@media (max-width: 680px) {
  #factor-dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    padding: 20px max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border-radius: 20px 20px 0 0;
  }
}
@media (max-height: 760px) and (max-width: 680px) {
  .draw-controls { margin-bottom: 15px; }
  .card-navigation { margin: 9px 0 7px; }
  .draw-lede { margin-top: 10px; }
}
@media (min-width: 681px) {
  .draw-room { min-height: min(710px, calc(100svh - var(--header-height))); }
}

#ticket-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(72px, calc(env(safe-area-inset-top) + 54px)) max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: white;
  box-shadow: none;
}
#ticket-dialog[open] { display: grid; place-items: safe center; }
html:has(#ticket-dialog[open]) { overflow: hidden; }
#enlarge, .card-front, .saved-actions button, .ticket-close button {
  -webkit-tap-highlight-color: transparent;
}
.ticket-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}
.ticket-close .close-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #555;
}
.ticket-close .close-button:hover { background: #f2f2f2; }
.ticket-sheet {
  width: min(100%, 640px);
  color: #171717;
  text-align: center;
}
.ticket-sheet h2 {
  font-size: clamp(32px, 10vw, 52px);
  letter-spacing: 0;
}
.ticket-sheet h2 span {
  display: block;
  margin-top: 5px;
  font-size: clamp(20px, 5.5vw, 28px);
  font-weight: 700;
}
.ticket-sheet .ticket-numbers {
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 22px;
  padding: 0;
  user-select: text;
}
.ticket-sheet .zone-label { color: inherit; font-size: 17px; font-weight: 700; }
.ticket-sheet .ball-group {
  gap: .14em;
  font-size: clamp(27px, 9vw, 56px);
}
.ticket-sheet .ball-group:has(> .ball:nth-child(10)) { max-width: 7em; }
.ticket-sheet .ball {
  width: 1.28em;
  height: auto;
  min-height: 1.36em;
  border-radius: .24em;
  font-size: inherit;
  line-height: 1.2;
}
#print-sheet { display: none; }
@media print {
  @page { margin: 18mm; }
  html, body { background: white; color: black; }
  body > * { display: none !important; }
  #print-sheet:not(:empty) { display: block !important; margin: 0 auto; }
  #print-sheet h2 { font-size: 32pt; }
  #print-sheet h2 span { font-size: 20pt; }
  #print-sheet .ball-group { gap: .13em; font-size: 34pt; }
  #print-sheet .ball {
    width: 1.24em;
    min-height: 0;
    border: 0;
    background: transparent;
    color: inherit;
  }
  dialog::backdrop { display: none !important; }
}
