/* 威力彩、大樂透：要買幾期才會中頭獎？ (Taiwan version of /kr/lotto/lotto.css)
   Layout: a betting slip you mark, then a receipt stamped by 閻羅王. Paper objects stay paper-colored in
   both themes; the counter around them follows the theme. Colors: 紅包 red and gold. */
:root {
  --slip: #c8102e;          /* 紅包 red print of the slip */
  --ink: #17191c;           /* marker / receipt print */
  --paper: #fbfbf8;
  --paper-line: #c9c9c2;
  --y: #f0a202; --b: #2f8fd8; --r: #e5484d; --g: #8d9196; --gr: #2fa36b; --v: #8a5cd0; --z2: #c8102e;
  /* light theme: a gold counter */
  --bg: #f2c14e; --muted: #5a3d0c; --line: rgba(23, 25, 28, 0.2);
  --display: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Noto Sans TC", ui-monospace, monospace;
}

.ball {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-family: var(--body); font-weight: 600; font-size: 16px; color: #fff;
  background: var(--c, #555);
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.14);
}
.ball.b0 { --c: var(--y); } .ball.b1 { --c: var(--b); } .ball.b2 { --c: var(--r); } .ball.b3 { --c: var(--gr); } .ball.b4 { --c: var(--v); }
.ball.z2 { --c: var(--z2); }
.ball.sp { box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.14), 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }

.actions { display: grid; gap: 10px; margin-top: 22px; }

/* ---------- intro ---------- */
.slip-head {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 10px; margin-top: 8px;
  background: var(--slip); color: #fff;
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
}
.intro-title { font-size: clamp(32px, 9.6vw, 44px); margin-top: 22px; }
.intro-title em { font-style: normal; color: var(--slip); }

/* ---------- slip (pick) ---------- */
.slip { background: var(--paper); color: var(--ink); margin: 8px 0 14px; padding-bottom: 12px; box-shadow: 0 1px 0 var(--paper-line), 0 10px 24px rgba(0, 0, 0, 0.12); }
.slip .slip-head { margin-top: 0; }
.slip-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 12px 12px 0; }
.slip-tabs button {
  position: relative; height: 40px; border: 1.5px solid var(--slip); background: transparent; color: var(--slip);
  font-family: var(--display); font-size: 18px; cursor: pointer; border-radius: 2px;
}
.slip-tabs button[aria-selected="true"] { background: var(--slip); color: #fff; }
.slip-tabs button .st { position: absolute; right: 3px; top: 1px; font-family: var(--body); font-size: 10px; font-weight: 600; }
.slip-tabs button:focus-visible, .slip-grid button:focus-visible, .check:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.slip-body { display: grid; grid-template-columns: 1fr 58px; gap: 10px; padding: 12px 12px 0; }
.slip-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px 4px; }
.slip-grid button {
  aspect-ratio: 3 / 4; max-width: 100%; padding: 0; cursor: pointer;
  border: 1.2px solid var(--slip); border-radius: 3px; background: transparent;
  color: var(--slip); font-family: var(--mono); font-size: 13px; font-weight: 600;
}
.slip-grid button.is-on {
  /* a hand-drawn marker fill */
  background: var(--ink); color: var(--paper); border-color: var(--ink);
  border-radius: 40% 46% 42% 48% / 46% 40% 48% 42%;
}
.slip-grid.is-auto button:not(.is-auto-on) { opacity: 0.45; }
.slip-grid button.is-auto-on { background: var(--slip); border-color: var(--slip); color: #fff; border-radius: 40% 46% 42% 48% / 46% 40% 48% 42%; }
.slip-side { display: flex; flex-direction: column; gap: 8px; }
.check {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0;
  background: none; border: 0; color: var(--slip); font-size: 12px; font-weight: 600; cursor: pointer;
}
.check .box { width: 26px; height: 32px; border: 1.2px solid var(--slip); border-radius: 3px; }
.check[aria-pressed="true"] .box { background: var(--ink); border-color: var(--ink); border-radius: 40% 46% 42% 48% / 46% 40% 48% 42%; }
.slip-note { margin: 12px 12px 0; font-size: 13px; color: var(--slip); font-weight: 600; }
.run-btn { margin-top: 16px; }

/* ---------- run ---------- */
.run-head { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.era {
  display: inline-block; padding: 4px 10px; border: 2px solid var(--slip); color: var(--slip);
  font-family: var(--display); font-size: 15px; transform: rotate(-2deg);
}
.skip { background: none; border: 0; color: var(--muted); font-size: 14px; text-decoration: underline; cursor: pointer; padding: 8px 0; }
.counter { display: grid; gap: 2px; margin-top: 20px; padding: 18px 16px 16px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); }
.counter-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: #6b6f75; }
.counter-num { font-family: var(--mono); font-weight: 600; font-size: clamp(38px, 12vw, 56px); line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter-sub { font-weight: 600; font-size: 17px; }
.run-draw { display: flex; gap: 6px; margin-top: 18px; min-height: 40px; flex-wrap: wrap; }
.run-draw .plus { align-self: center; color: var(--muted); font-weight: 700; }
.tiers { width: 100%; margin-top: 18px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tiers th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; padding: 0 0 4px; }
.tiers td { font-family: var(--mono); font-size: 20px; font-weight: 600; padding: 6px 0; border-top: 1.5px solid var(--fg); }
.run-spent { margin-top: 12px; color: var(--muted); }
.run-spent b { color: var(--fg); font-family: var(--mono); }
.jackpot .counter-num { color: var(--slip); }

/* ---------- result ---------- */
.detail { margin-top: 26px; padding: 16px; background: var(--paper); color: var(--ink); font-size: 14px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); }
.detail h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 20px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; padding-top: 10px; border-top: 1px dashed #8b8f95; }
.detail dt { color: #5d6268; }
.detail dd { margin: 0; text-align: right; font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; }
.detail p { color: #5d6268; margin: 14px 0 0; padding-top: 10px; border-top: 1px dashed #8b8f95; }

@media (max-width: 360px) {
  .ball { width: 34px; height: 34px; font-size: 14px; }
  .slip-body { grid-template-columns: 1fr 48px; }
}
.slip-note { display: grid; gap: 2px; font-family: var(--mono); font-size: 12.5px; color: #5d6268; white-space: pre; overflow-x: auto; }
.slip-note .on { color: var(--slip); }
.counter-odds { font-family: var(--mono); font-size: 13px; color: #6b6f75; margin-top: 4px; }
.friend-bar { display: grid; gap: 10px; padding: 6px 0 14px; }
.friend-bar p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- color pass (11-08: Robin wanted more color than black & white) ---------- */
.k-btn:not(.is-ghost) { background: var(--slip); color: #fff; box-shadow: 0 3px 0 #9e2a3f; }
.k-btn:not(.is-ghost):active { box-shadow: none; }
.k-top .k-brand { color: var(--fg); }
.intro-title em { color: var(--slip); background: linear-gradient(transparent 62%, rgba(255, 255, 255, 0.55) 62%); }
.era { background: var(--slip); color: #fff; border-color: var(--slip); }
.counter-quip { font-weight: 600; font-size: 15px; color: var(--slip); min-height: 1.5em; }
.ball.blank { --c: #c9c9c2; color: #fff; }
.tiers th:nth-child(1) { color: var(--r); } .tiers th:nth-child(2) { color: var(--b); }
.tiers th:nth-child(3) { color: var(--gr); } .tiers th:nth-child(4) { color: var(--fg); }
.tiers td:nth-child(1) { border-top-color: var(--r); } .tiers td:nth-child(2) { border-top-color: var(--b); }
.tiers td:nth-child(3) { border-top-color: var(--gr); } .tiers td:nth-child(4) { border-top-color: var(--slip); }
.tiers td { border-top-width: 4px; }
.detail .roast { margin: -4px 0 12px; padding: 0; border: 0; color: var(--slip); font-weight: 600; font-size: 15px; }

/* ---------- result: one object per item (11-08 v2) ---------- */
.detail { background: none; box-shadow: none; padding: 0; color: var(--fg); display: grid; gap: 16px; }
.detail .tile p, .detail .fine { border-top: 0; padding-top: 0; }
.tile { position: relative; overflow: hidden; padding: 18px; background: var(--paper); color: var(--ink); }
.t-k { display: block; font-size: 12.5px; font-weight: 600; color: #6b6f75; }
.t-big { margin: 2px 0 0; font-family: var(--display); font-size: 42px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.t-big span { font-size: 22px; margin-left: 4px; }
.t-big b { font-weight: 400; }
.detail .t-cap { margin: 10px 0 0; font-size: 14px; color: #4d5157; }
.t-cap b { color: inherit; }
.fine { margin: 0; font-size: 12.5px; color: var(--muted); }

/* verdict: a sticker with a speech bubble */
.t-type { background: #fff; transform: rotate(-0.8deg); margin: 4px 6px 4px 0; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.t-type h3 { margin: 2px 0 0; font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.2; color: var(--slip); }
.bubble { position: relative; display: inline-block; margin: 12px 0 0; padding: 8px 12px; background: var(--y); color: var(--ink); font-weight: 700; border-radius: 14px; }
.bubble::before { content: ""; position: absolute; left: 16px; top: -10px; width: 16px; height: 11px; background: var(--y); clip-path: polygon(0 100%, 30% 0, 100% 100%); }
.t-type { overflow: visible; }

/* tear-off calendar (일력) */
.t-cal { background: none; padding: 0; overflow: visible; }
.t-cal .rings { position: relative; z-index: 2; display: flex; justify-content: space-around; height: 26px; background: var(--slip); border-radius: 6px 6px 0 0; padding: 0 30px; }
.t-cal .rings i { width: 10px; height: 22px; margin-top: -10px; border-radius: 5px; background: #8d9196; box-shadow: inset -2px 0 0 rgba(0,0,0,.25); }
.t-cal .sheets { position: absolute; left: 0; right: 0; top: 26px; height: 80px; z-index: 3; pointer-events: none; }
.t-cal .sheets i { position: absolute; inset: 0; background: #fbfbf8; transform-origin: 50% 0; opacity: 0; border-bottom: 1px solid #ddd; }
.t-cal .page { position: relative; padding: 16px 18px 18px; background: var(--paper); text-align: left; box-shadow: 0 4px 0 #e2e0d8, 0 8px 0 #cfcdc4; }
.cal-year { margin: 2px 0 0; font-family: var(--display); font-size: 36px; line-height: 1.2; }
.cal-year b { font-weight: 400; }
.cal-gj { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; padding: 10px 12px; background: #fff4c7; border-radius: 10px; }
.cal-gj .emo { font-size: 46px; line-height: 1; }
.cal-gj b { display: block; font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.1; color: var(--slip); }
.cal-gj small { font-size: 15px; font-weight: 700; }

/* bankbook */
.t-bank { background: repeating-linear-gradient(#eef6ea 0 31px, #d3e4cc 31px 32px); border: 1px solid #c2d7b9; }
.t-bank .t-k { color: #4f7a43; }
.t-bank table { width: 100%; margin-top: 10px; border-collapse: collapse; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.t-bank th { text-align: left; font-family: var(--body); font-size: 11.5px; color: #4f7a43; font-weight: 600; padding: 4px 0; border-bottom: 2px solid #4f7a43; }
.t-bank td { padding: 7px 0; vertical-align: top; }
.t-bank td:nth-child(n+2), .t-bank th:nth-child(n+2) { text-align: right; }
.t-bank .out { color: var(--r); font-weight: 600; } .t-bank .in { color: #2b7bb9; font-weight: 600; }
.t-bank .sum td { border-top: 2px solid #4f7a43; font-family: var(--display); font-size: 22px; padding-top: 10px; }
.bank-stamp { position: absolute; right: 18px; top: 12px; padding: 2px 10px; border: 3px solid currentColor; border-radius: 6px; font-family: var(--display); font-size: 22px; transform: rotate(12deg); }
.bank-stamp.loss { color: var(--r); } .bank-stamp.gain { color: #2b7bb9; }

/* prize stickers */
.t-tiers { background: #fff; }
.stickers { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stickers li { display: grid; justify-items: center; align-content: center; aspect-ratio: 1; border-radius: 50%; color: #fff; min-width: 0; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.stickers li:nth-child(odd) { transform: rotate(-7deg); } .stickers li:nth-child(even) { transform: rotate(6deg) translateY(4px); }
.stickers em { font-style: normal; font-family: var(--display); font-size: 13px; line-height: 1; }
.stickers b { font-family: var(--mono); font-size: 13px; font-weight: 700; line-height: 1.3; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.stickers small { font-size: 10px; line-height: 1; opacity: .85; }
.stickers .r1 { background: var(--slip); } .stickers .r2 { background: #e0a400; } .stickers .r3 { background: var(--b); }
.stickers .r4 { background: var(--gr); } .stickers .r5 { background: var(--g); }

/* the queue of 100 */
.t-queue { background: #efe9ff; }
.t-queue .t-k { color: #5b45a8; }
.queue { display: grid; grid-template-columns: repeat(20, 1fr); gap: 7px 3px; margin-top: 14px; }
.queue i { position: relative; height: 16px; }
.queue i::before { content: ""; position: absolute; left: 50%; top: 0; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--pc, #b9b3cf); }
.queue i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 10px; height: 9px; margin-left: -5px; border-radius: 5px 5px 1px 1px; background: var(--pc, #b9b3cf); }
.queue i.done { --pc: #8f7bd6; }
.queue i.me { --pc: var(--slip); z-index: 1; }
.queue i.me { transform: scale(1.7); }

/* the winning slip */
.t-games { background: #fff; border-top: 8px solid var(--slip); }
.winrow { display: flex; gap: 4px; align-items: center; margin-top: 10px; }
.winrow .plus { color: #6b6f75; font-weight: 700; }
.winrow .ball { width: 34px; height: 34px; font-size: 14px; }
.games { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.games li { display: grid; grid-template-columns: 38px 1fr 30px; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; }
.games li.win { background: #ffe680; }
.games .g { font-family: var(--display); font-size: 17px; line-height: 1; display: grid; }
.games .g small { font-family: var(--body); font-size: 10px; color: #6b6f75; }
.games .bs { display: flex; gap: 3px; min-width: 0; }
.games .ball { width: 30px; height: 30px; font-size: 13px; }
.games .r { font-weight: 700; font-size: 13px; color: var(--slip); text-align: right; }
.ball.dim { background: color-mix(in srgb, var(--c) 22%, #fff); color: var(--ink); box-shadow: none; }

/* ---------- intro machine ---------- */
.machine-wrap { display: grid; justify-items: center; margin: 14px 0 0; }
.machine { width: 330px; max-width: 100%; height: auto; aspect-ratio: 330 / 352; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tile { opacity: 0; translate: 0 22px; transition: opacity .45s ease-out, translate .5s cubic-bezier(.2,1.3,.4,1); }
  .tile.in { opacity: 1; translate: 0 0; }

  .t-type.in h3 { animation: stampin .5s .15s cubic-bezier(.2,1.4,.4,1) both; }
  @keyframes stampin { from { transform: scale(1.9) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
  .t-type.in .bubble { animation: popin .4s .6s cubic-bezier(.2,1.6,.4,1) both; transform-origin: 20px 0; }
  @keyframes popin { from { transform: scale(0); } }

  /* calendar sheets get torn off */
  .t-cal.in .sheets i { animation: tear .7s cubic-bezier(.5,0,.8,.6) both; }
  .t-cal.in .sheets i:nth-child(2) { animation-delay: .25s; } .t-cal.in .sheets i:nth-child(3) { animation-delay: .5s; }
  @keyframes tear { 0% { opacity: 1; transform: none; } 30% { opacity: 1; transform: rotateX(-30deg) rotate(-4deg); } 100% { opacity: 0; transform: translate(60px, 160px) rotate(28deg); } }
  .t-cal.in .emo { animation: hop .6s 1s cubic-bezier(.3,1.6,.5,1) 2 both; display: inline-block; }
  @keyframes hop { 40% { transform: translateY(-14px) rotate(-8deg); } }

  /* bankbook: the stamp lands last */
  .t-bank .bank-stamp { opacity: 0; }
  .t-bank.in .bank-stamp { animation: thud .35s .9s cubic-bezier(.2,1.4,.4,1) both; }
  @keyframes thud { from { opacity: 0; transform: rotate(12deg) scale(2.4); } to { opacity: 1; transform: rotate(12deg); } }
  .t-bank tr { opacity: 0; transition: opacity .3s; }
  .t-bank.in tr { opacity: 1; } .t-bank.in tr:nth-child(2) { transition-delay: .15s; } .t-bank.in tr:nth-child(3) { transition-delay: .35s; } .t-bank.in tr:nth-child(4) { transition-delay: .6s; }

  /* stickers slap on */
  .stickers li { scale: 0; transition: scale .4s cubic-bezier(.2,1.7,.4,1); }
  .t-tiers.in .stickers li { scale: 1; }
  .stickers li:nth-child(2) { transition-delay: .1s; } .stickers li:nth-child(3) { transition-delay: .2s; }
  .stickers li:nth-child(4) { transition-delay: .3s; } .stickers li:nth-child(5) { transition-delay: .4s; }

  /* the queue walks in, I jump */
  .queue i { opacity: 0; translate: -30px 0; transition: opacity .3s, translate .4s ease-out; transition-delay: calc(var(--i) * 10ms); }
  .t-queue.in .queue i { opacity: 1; translate: 0 0; }
  .t-queue.in .queue i.me { animation: jump .5s 1.4s ease-out 4; }
  @keyframes jump { 50% { translate: 0 -8px; } }

  /* receipt comes out of a printer slot */
  .k-result-img.printing { animation: print 1.5s steps(14, end) both, settle .35s 1.5s ease-out; }
  @keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-14px); } to { clip-path: inset(0); transform: none; } }
  @keyframes settle { 40% { transform: rotate(-1.2deg) translateY(3px); } }

  /* run */
  .run-draw .ball.pop { animation: pop .16s ease-out; }
  @keyframes pop { from { transform: scale(.6) translateY(-6px); } }
  .counter-quip.bump { animation: bump .4s cubic-bezier(.2,1.6,.4,1); }
  @keyframes bump { from { transform: translateX(-8px); opacity: 0; } }
  .run-draw .ball.drop { animation: drop .6s var(--d, 0ms) cubic-bezier(.3,1.5,.5,1) both; }
  @keyframes drop { from { transform: translateY(-80px) scale(.6); opacity: 0; } }
  .jackpot .counter { animation: shake .5s ease-in-out; }
  @keyframes shake { 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(7px) rotate(1deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
  .jackpot::after { content: ""; position: fixed; inset: 0; background: #fff; pointer-events: none; animation: flash .7s ease-out forwards; z-index: 20; }
  @keyframes flash { from { opacity: .85; } to { opacity: 0; } }

  /* pick */
  .slip-grid button.mark { animation: mark .28s cubic-bezier(.2,1.6,.4,1); }
  @keyframes mark { from { transform: scale(1.35) rotate(-8deg); } }

  /* intro CTA shine */
  [data-screen="intro"] .k-btn:not(.is-ghost) { position: relative; overflow: hidden; }
  [data-screen="intro"] .k-btn:not(.is-ghost)::after { content: ""; position: absolute; inset: 0 auto 0 -40%; width: 30%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent); animation: shine 3.2s 1s ease-in-out infinite; }
  @keyframes shine { 0%, 60% { left: -40%; } 100% { left: 120%; } }
}
.bank-stamp { top: auto; bottom: 12px; right: 16px; font-size: 19px; }
.t-bank .t-cap { padding-right: 70px; }

/* 5th round: the bill after the jackpot, choice memo, bowl sign, friend comparison */
.run-net { display: grid; justify-items: center; gap: 2px; margin: 4px auto 0; padding: 12px 18px; max-width: 340px; background: #fbfbf8; color: var(--ink); border-radius: 12px; box-shadow: 0 4px 0 rgba(0,0,0,.18); transform: rotate(-1.5deg); }
.run-net .net-k { font-family: var(--mono); font-size: 13px; color: #6b6f75; }
.run-net b { font-family: var(--display); font-weight: 900; font-size: clamp(26px, 8vw, 38px); line-height: 1.1; }
.run-net b.loss { color: var(--slip); }
.run-net b.gain { color: #1f7fc0; }
.run-net small { font-weight: 600; font-size: 14px; text-align: center; }
.memo { margin: 12px 0 0; padding: 8px 10px; border: 2px dashed currentColor; border-radius: 8px; font-size: 14px; font-weight: 600; opacity: .9; }
.memo span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; opacity: .7; }
.compare { margin: 0 0 12px; padding: 12px 14px; background: #fbfbf8; color: var(--ink); border-radius: 12px; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.compare .t-k { color: var(--slip); }
.compare p { margin: 4px 0 0; font-weight: 700; font-size: 15px; line-height: 1.5; }
@media (prefers-reduced-motion: no-preference) {
  .run-net:not([hidden]) { animation: netin .5s cubic-bezier(.2,1.6,.4,1) both; }
  @keyframes netin { from { transform: scale(2.2) rotate(-8deg); opacity: 0; } to { transform: rotate(-1.5deg); opacity: 1; } }
  .compare:not([hidden]) { animation: popin .45s .2s cubic-bezier(.2,1.6,.4,1) both; }
}

/* one-line timeline: now -> the jackpot year, with this life marked at the start */
.cal-line { margin: 12px 0 2px; }
.cal-line .bar { position: relative; height: 10px; margin: 0 7px; background: #e6e2d4; border-radius: 5px; }
.cal-line .fill { position: absolute; inset: 0; border-radius: 5px; background: repeating-linear-gradient(90deg, var(--ink) 0 6px, transparent 6px 10px); opacity: .35; transform-origin: 0 50%; }
.cal-line .life { position: absolute; left: 0; top: -3px; bottom: -3px; width: var(--life); min-width: 6px; background: var(--b); border-radius: 5px; z-index: 1; }
.cal-line .end { position: absolute; right: -9px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; background: var(--slip); box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--slip); z-index: 2; }
.cal-line .lbl { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-top: 10px; font-family: var(--mono); font-size: 13px; }
.cal-line .lbl span, .cal-line .lbl strong { display: grid; line-height: 1.15; }
.cal-line .lbl small { font-family: var(--sans, sans-serif); font-size: 11px; font-weight: 700; opacity: .65; }
.cal-line .lbl em { flex: 1; font-style: normal; font-size: 11px; font-weight: 700; color: var(--b); }
.cal-line .lbl strong { text-align: right; font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--slip); }
@media (prefers-reduced-motion: no-preference) {
  .t-cal .cal-line .fill { opacity: 0; }
  .t-cal.in .cal-line .fill { animation: growx 1.4s 1.1s cubic-bezier(.4,0,.2,1) both; }
  .t-cal.in .cal-line .end { animation: popin .4s 2.4s cubic-bezier(.2,1.6,.4,1) both; }
  @keyframes growx { from { transform: scaleX(0); opacity: .35; } to { transform: scaleX(1); opacity: .35; } }
}

/* odds section on the intro */
.odds .odds-big { margin: 4px 0 8px; color: var(--fg); font-family: var(--display); font-size: 22px; }
.odds .odds-big b { font-weight: 400; font-size: 40px; color: var(--slip); }
.odds .odds-big span { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.odds-list { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; gap: 8px; }
.odds-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; background: var(--paper); color: var(--ink); border-radius: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.odds-list span { min-width: 0; font-weight: 700; color: var(--ink); word-break: keep-all; }
.odds-list small { font-weight: 400; color: #6b6f75; }
.odds-list em { font-style: normal; font-family: var(--mono); font-size: 13px; color: #6b6f75; grid-column: 1; }
.odds-list b { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 4px 8px; border-radius: 6px; font-size: 12px; background: #e6e2d4; color: var(--ink); white-space: nowrap; }
.odds-list b.easy { background: var(--b); color: #fff; }
.odds-list b.hard { background: var(--slip); color: #fff; }

/* bigger type on the result page (Robin 11-08: text too small) */
.friend-bar p { font-size: 16px; }
.t-k { font-size: 14px; }
.detail .t-cap { font-size: 16px; line-height: 1.55; }
.t-big { font-size: 48px; }
.t-big span { font-size: 24px; }
.t-type h3 { font-size: 36px; }
.bubble { font-size: 17px; }
.memo { font-size: 16px; }
.memo span { font-size: 12px; }
.cal-year { font-size: 40px; }
.cal-gj small { font-size: 16px; }
.cal-line .lbl { font-size: 15px; }
.cal-line .lbl em { font-size: 13px; }
.cal-line .lbl strong { font-size: 28px; }
.t-bank table { font-size: 15px; }
.t-bank th { font-size: 13px; }
.stickers em { font-size: 15px; }
.stickers b { font-size: 15px; }
.stickers small { font-size: 11px; }
.games .g { font-size: 19px; }
.games .g small { font-size: 12px; }
.games .ball { width: 34px; height: 34px; font-size: 15px; }
.games .r { font-size: 15px; }
.compare p { font-size: 17px; }
/* rounded dashed borders leave a gap at the corners in Chrome: draw the dashes as backgrounds on a square box */
.memo { border: 0; border-radius: 0; padding: 10px 12px;
  background:
    linear-gradient(90deg, currentColor 50%, transparent 0) top / 10px 2px repeat-x,
    linear-gradient(90deg, currentColor 50%, transparent 0) bottom / 10px 2px repeat-x,
    linear-gradient(0deg, currentColor 50%, transparent 0) left / 2px 10px repeat-y,
    linear-gradient(0deg, currentColor 50%, transparent 0) right / 2px 10px repeat-y; }
/* old-quote card under the drawing machine */
.quote { display: grid; grid-template-columns: 72px 1fr; gap: 4px 14px; align-items: center; margin: 4px 0 18px; padding: 14px 16px; background: #fbfbf8; color: var(--ink); border-radius: 4px; box-shadow: 0 3px 0 rgba(0,0,0,.15); transform: rotate(-.6deg); }
.quote img { grid-row: 1 / span 2; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; filter: sepia(.35) contrast(1.05); box-shadow: 0 0 0 3px #fbfbf8, 0 0 0 5px var(--ink); }
.quote blockquote { margin: 0; word-break: keep-all; font-family: var(--display); font-size: 21px; line-height: 1.3; text-wrap: balance; }
.quote figcaption { font-size: 14px; font-weight: 700; color: #6b6f75; }
.quote figcaption::before { content: "— "; }
.quote small { font-weight: 400; font-size: 12px; }

/* games a week: one row of OMR-style boxes, like the quantity column on a betting slip */
.k-pick { display: grid; gap: 8px; margin-top: 18px; padding: 12px; background: var(--paper); color: var(--ink); box-shadow: 0 1px 0 var(--paper-line), 0 6px 16px rgba(0,0,0,.08); }
.k-pick-label { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--slip); letter-spacing: .04em; }
.k-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.k-chips button { display: grid; place-items: center; gap: 1px; min-width: 0; padding: 7px 0 6px; border: 1.5px solid var(--slip); border-radius: 4px; background: transparent; color: var(--slip); cursor: pointer; font: inherit; transition: transform .12s; }
.k-chips button b { font-family: var(--mono); font-size: 17px; font-weight: 700; line-height: 1.1; }
.k-chips button small { font-size: 10.5px; font-weight: 600; opacity: .85; white-space: nowrap; }
.k-chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); border-radius: 40% 46% 42% 48% / 46% 40% 48% 42%; transform: rotate(-2deg); }
.k-chips button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.k-hint { margin: 0; font-size: 12.5px; font-weight: 600; color: #5d6268; word-break: keep-all; }
.k-pick.is-compact { margin: 4px 0 8px; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.k-pick.is-compact .k-hint { grid-column: 1 / -1; }
.k-pick.is-compact .k-chips button { padding: 5px 0 4px; }
.k-pick.is-compact .k-chips button b { font-size: 15px; }
.slip-note .more { color: var(--slip); }
.games li.more { display: block; padding: 6px 2px 0; font-size: 13px; color: #5d6268; font-weight: 600; word-break: keep-all; }
.home-btn { margin-top: 4px; }

/* ---------- Taiwan ---------- */
/* Noto Sans TC has no separate display face: the display role is its 900 weight. */
.k-display, .k-top .k-brand, .slip-tabs button, .era, .t-big, .t-big b, .t-type h3, .cal-year, .cal-year b, .cal-gj b,
.t-bank .sum td, .bank-stamp, .stickers em, .games .g, .odds .odds-big, .odds .odds-big b, .quote blockquote,
.cal-line .lbl strong, .g-tabs button, .detail h3 { font-weight: 900; }
body { word-break: normal; line-break: strict; }

/* game tabs on the intro: two slip colors */
.g-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.g-tabs button { min-height: 46px; border: 2px solid var(--ink); border-radius: 6px 6px 0 0; background: rgba(255, 255, 255, .35); color: var(--ink); font: inherit; font-size: 18px; cursor: pointer; }
.g-tabs button[aria-selected="true"] { background: var(--slip); border-color: var(--slip); color: #fff; box-shadow: 0 3px 0 #8a0b20; }
.g-tabs button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.g-tabs + .slip-head { margin-top: 0; }

/* 「上期頭獎槓龜」 line */
.jp { margin: 10px 0 0; padding: 10px 12px; background: var(--paper); color: var(--ink); border-left: 6px solid var(--slip); font-size: 15px; line-height: 1.5; box-shadow: 0 3px 0 rgba(0, 0, 0, .12); }
.jp b { font-weight: 700; }
.jp em { font-style: normal; font-weight: 900; color: var(--slip); font-size: 18px; }


/* slip: zone labels, 第2區 row */
.slip-body > div { min-width: 0; }
.zone-k { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--slip); }
.zone-k + .slip-grid { margin-bottom: 4px; }
#zone2-k { margin-top: 12px; }
.slip-grid.zone2 { grid-template-columns: repeat(8, 1fr); }
.slip-grid.zone2 button { aspect-ratio: 1; border-radius: 50%; }
.slip-grid.zone2 button.is-on, .slip-grid.zone2 button.is-auto-on { background: var(--z2); border-color: var(--z2); color: #fff; border-radius: 50%; }
.check { line-height: 1.2; text-align: center; }

/* run */
.run-draw .ball.z2 { --c: var(--z2); }
.tiers th:nth-child(4) { white-space: nowrap; }

/* share buttons */
.k-btn.sns { text-decoration: none; }
.k-btn.sns.line { box-shadow: inset 0 0 0 1.5px #06c755; color: var(--fg); }

/* 孟婆湯: a table of soup bowls, one a life; this life stands at the end holding a ticket */
.t-soup { background: linear-gradient(#2a1d3d, #46305e 80%, #5b3a26 80%); color: #f4ead8; padding-bottom: 14px; }
.t-soup .t-k { color: #c9b6e4; }
.t-soup .t-big, .t-soup .t-big b { color: #ffe9a8; }
.t-soup .t-cap { color: #ece2f4 !important; }
.bowls { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); justify-items: center; align-items: end; gap: 10px 2px; margin-top: 12px; padding: 12px 0 8px; border-bottom: 6px solid #5b3a26; }
.bowls i { position: relative; width: 26px; height: 22px; }
.bowls i::before { /* the bowl */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 13px;
  border-radius: 2px 2px 14px 14px / 2px 2px 13px 13px;
  background: linear-gradient(#f7f3ea 0 22%, #d9cfbd 22% 30%, #f7f3ea 30%); box-shadow: inset 0 -2px 0 #b9ad98;
}
.bowls i::after { /* soup surface + steam */
  content: ""; position: absolute; left: 3px; right: 3px; bottom: 11px; height: 4px; border-radius: 50%; background: #7a5a2c;
  box-shadow: -3px -7px 0 -1px rgba(255, 255, 255, .28), 4px -11px 0 -1px rgba(255, 255, 255, .2);
}
.bowls .me { position: relative; width: 26px; height: 28px; }
.bowls .me::before { content: ""; position: absolute; left: 50%; top: -2px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: #ffd9b3; box-shadow: 0 -2px 0 0 #2b2b2b; }
.bowls .me::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 12px; height: 18px; margin-left: -6px; border-radius: 6px 6px 2px 2px; background: var(--slip);
  box-shadow: 8px -4px 0 -3px #fff; }
.bowls .sign { position: relative; grid-column: span 5; justify-self: end; margin: 2px 4px 8px 0; padding: 3px 8px 4px; background: #b98a53; color: #2b1a08; font-size: 13px; font-weight: 700; border-radius: 3px; transform: rotate(4deg); box-shadow: 0 2px 0 #7a5530; }
.bowls .sign::after { content: ""; position: absolute; left: 50%; top: 100%; width: 5px; height: 10px; margin-left: -2.5px; background: #7a5530; }

/* floor plan: one cell a unit of 坪 */
.t-ping { background: #eef1f4; }
.t-ping .t-k { color: #2c5d8a; }
.plan { display: grid; grid-template-columns: repeat(10, 1fr); gap: 0; margin-top: 12px; padding: 6px; background: #fff; border: 4px solid #33414f; }
.plan i { position: relative; aspect-ratio: 1; border: 1px solid #b8c4cf; background: #fbe7b8; }
.plan i:nth-child(7n + 3) { background: #f6d993; }
.plan i[style*="--part"] { background: linear-gradient(90deg, #fbe7b8 calc(var(--part) * 100%), #fff 0); }

/* tier stickers: up to 10 */
.stickers .r1 { background: var(--slip); } .stickers .r2 { background: #e0a400; } .stickers .r3 { background: var(--b); }
.stickers .r4 { background: var(--gr); } .stickers .r5 { background: var(--v); } .stickers .r6 { background: var(--g); }
.stickers { row-gap: 10px; }
.stickers li:nth-child(n + 6) { transition-delay: .5s; }

/* the winning slip: 6 + 1 balls */
.winrow small { margin-left: 4px; font-size: 12px; font-weight: 700; color: #6b6f75; }
.games li { grid-template-columns: 34px 1fr 40px; }
.games .ball { width: 30px; height: 30px; font-size: 13px; }
.games .bs { gap: 2px; }
.games .bs .ball.z2 { margin-left: 4px; }
.games .r { font-size: 13px; }
@media (max-width: 380px) {
  .games .ball { width: 26px; height: 26px; font-size: 12px; }
  .winrow .ball { width: 30px; height: 30px; font-size: 13px; }
}
.odds-list li.note { display: block; background: transparent; box-shadow: none; padding: 2px 0; }
.odds-list li.note span { font-weight: 600; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .bowls i { transform: translateY(-40%); opacity: 0; transition: transform .4s cubic-bezier(.2,1.5,.4,1), opacity .2s; transition-delay: calc(var(--i) * 6ms + .2s); }
  .t-soup.in .bowls i { transform: none; opacity: 1; }
  .bowls .me { opacity: 0; transition: opacity .3s; transition-delay: calc(var(--i) * 6ms + .4s); }
  .t-soup.in .bowls .me { opacity: 1; animation: wobble .6s 2.2s ease-in-out 3; }
  @keyframes wobble { 25% { rotate: -8deg; } 75% { rotate: 8deg; } }
  .plan i { opacity: 0; scale: .4; transition: opacity .25s, scale .3s cubic-bezier(.2,1.5,.4,1); transition-delay: calc(var(--i) * 14ms + .2s); }
  .t-ping.in .plan i { opacity: 1; scale: 1; }
}
.intro-title em { white-space: nowrap; }
.odds .odds-big span { display: block; }
.t-bank table { font-size: 14px; }
.t-bank td:nth-child(n+2) { white-space: nowrap; padding-left: 8px; }
.t-bank .sum td { font-size: 20px; }
.slip-head { flex-wrap: wrap; }
/* review round 1 */
.detail { overflow-x: clip; }
.t-cal.in .sheets i { animation-fill-mode: backwards; }
.slip-grid.zone2 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slip-grid.zone2 button { aspect-ratio: auto; min-height: 42px; border-radius: 21px; font-size: 15px; }
.slip-grid.zone2 button.is-on, .slip-grid.zone2 button.is-auto-on { border-radius: 21px; }
.t-bank td:first-child { width: 46%; word-break: keep-all; }
.t-big .pre { margin: 0 4px 0 0; }
.k-hint .nw { white-space: nowrap; }

.machine-wrap { margin-top: 18px; }
.machine { width: 250px; }
.intro-title { margin-top: 18px; }

.k-hint .k-note { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--slip); }
.k-hint .nw { white-space: nowrap; }
/* Robin 11-09: the quote card keeps its portrait; the operator's punchline sits right under it */
.quote { margin: 18px 0 0; }
.quote-op { margin: 10px 4px 0; text-align: right; font-weight: 700; font-size: 16px; color: var(--fg); word-break: keep-all; }
.quote-op span { font-weight: 400; font-size: 13px; opacity: .7; white-space: nowrap; }
