/* ==========================================================================
   彩券最前線 改版樣式（對應 ui/top-lottery-redesign 設計稿）
   色票 / 字體 / 號碼球規則見 ui/top-lottery-redesign/README.md
   ========================================================================== */

:root {
  --bg: #FFFFFF;
  --fill: #FAF7F0;  /* 卡片內的淺米色區塊（原頁面底色） */
  --card: #FFFFFF;
  --ink: #2A211B;
  --ink-2: #3D372E;
  --muted: #5E574B;
  --dark: #3B2C22;
  --dark-line: #5A4636;
  --gold: #A07D3B;
  --gold-text: #7D5F25;
  --gold-on-dark: #E2C58A;
  --text-on-dark: #E6D9C3;
  --line: #E6DFD0;
  --line-2: #F0EADD;
  --line-3: #D9CFBA;
  --soft: #F1ECE1;
  --amber: #A85D17;
  --mark: #C9972E;
  --hot: #A3242A;
  --inv: #46505C;   /* 統一發票專屬色（與九個彩種色都分得開） */

  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: -apple-system, 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --radius: 16px;
  --font-scale: 1.15;  /* 固定中字級（不開放使用者調整） */
  --bottom-nav-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; font-size: calc(17px * var(--font-scale)); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 1rem; line-height: 1.6; padding-bottom: var(--bottom-nav-h);
  /* 內容少時頁尾貼齊底部 */
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
a { color: var(--ink); }
a:hover { color: var(--hot); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: .06em; line-height: 1.3; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; border-radius: 4px; }
.num, time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--dark); color: #fff; padding: 8px 14px; border-radius: 8px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.main { display: flex; flex-direction: column; gap: 40px; padding-top: 24px; padding-bottom: 56px; }

/* ───────── 頁首 ───────── */
.site-header { border-bottom: 4px double var(--dark); background: var(--bg); }
.site-header__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand__logo { display: block; width: auto; height: 40px; }
.site-footer__logo { display: block; width: auto; height: 40px; align-self: flex-start; }  /* 頁尾區塊是直向 flex，不設會被撐滿寬度而變形 */
.brand__tag { display: none; font-size: 13px; letter-spacing: .2em; color: var(--gold-text); padding-left: 14px; border-left: 1px solid var(--line-3); }
.site-header__tools { display: flex; align-items: center; gap: 12px; }
.main-nav { display: none; gap: 2px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; text-decoration: none; }
.main-nav a.is-on { background: var(--dark); color: var(--bg); font-weight: 700; }
.font-size { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-3); border-radius: 999px; background: var(--card); }
.font-size button {
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--ink);
  font-family: var(--serif); font-weight: 700; cursor: pointer;
}
.font-size button:nth-child(1) { font-size: 13px; }
.font-size button:nth-child(2) { font-size: 16px; }
.font-size button:nth-child(3) { font-size: 19px; }
.font-size button[aria-pressed="true"] { background: var(--dark); color: var(--bg); }

/* 手機底部選單 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
  font-size: 12px; text-decoration: none; color: var(--muted);
}
.bottom-nav a[aria-current="page"] { color: var(--dark); font-weight: 700; }
.bottom-nav a[aria-current="page"] svg { stroke-width: 2.2; }
body { --bottom-nav-h: calc(60px + env(safe-area-inset-bottom)); }

/* 彩種切換列 */
.type-tabs { background: var(--card); border-bottom: 1px solid var(--line); }
.type-tabs__in { display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.type-tabs__in::-webkit-scrollbar { display: none; }
.type-tabs a {
  white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 52px;
  text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent;
}
.type-tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--c); }
.type-tabs .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ───────── 區塊標題 ───────── */
.block { display: flex; flex-direction: column; gap: 20px; }
.block__head { display: flex; flex-direction: column; gap: 10px; }
.block__head--row { flex-direction: row; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.block__head--row > div { display: flex; flex-direction: column; gap: 10px; }
.rule { display: block; width: 40px; height: 3px; background: var(--gold); }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.lead--sm { font-size: .95rem; color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 10px; }
.page-head__side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; background: var(--soft); border-radius: 999px; font-size: .9rem; }
.link-more { font-weight: 700; color: var(--hot); text-decoration: none; }

/* ───────── 按鈕 ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 10px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 0;
}
.btn--fill { background: var(--c, var(--dark)); color: #fff; }
.btn--dark { background: var(--dark); color: var(--bg); }
.btn--line { background: transparent; border: 1.5px solid var(--dark); color: var(--ink); font-weight: 500; }
.btn--accent { background: var(--hot); color: #fff; }
.btn--lg { min-height: 56px; padding: 0 28px; font-size: 1.05rem; }
.btn:hover { filter: brightness(1.08); color: inherit; }
.btn--fill:hover, .btn--dark:hover, .btn--accent:hover { color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row--center { justify-content: center; }
.btn-copy:not(.btn) {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-3);
  border-radius: 999px; background: var(--card); font: inherit; font-size: .85rem; color: var(--ink); cursor: pointer;
}

.pill { white-space: nowrap; padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill--hot { background: var(--hot); color: #fff; }
.pill--warm { background: #F6EBD3; color: #6B4F1A; }
.pill--soft { background: var(--soft); color: var(--muted); }
.pill--muted { background: #EEEAE2; color: var(--muted); font-weight: 500; }
.pill--xs { padding: 2px 8px; font-size: .7rem; margin-left: 6px; }

.note { padding: 12px 16px; background: #F6EBD3; border-radius: 10px; color: #6B4F1A; font-size: .95rem; }
.note--warn { background: #F8E3E1; color: #7A1F1F; }
.answer { font-size: 1.05rem; line-height: 1.8; color: var(--ink-2); }

/* ───────── 號碼球 ───────── */
.balls { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-end; }
.balls__zone { display: flex; flex-direction: column; gap: 10px; }
.balls__zone--sp { padding-left: 16px; border-left: 1px solid var(--line); }
.balls__label { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.balls__label small { font-size: .8rem; }
.balls__row { display: flex; flex-wrap: wrap; gap: 6px; }
.ball {
  --s: calc(42px * var(--font-scale)); width: var(--s); height: var(--s); flex: 0 0 var(--s); padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 700;
  font-size: calc(var(--s) * .4); font-variant-numeric: tabular-nums; line-height: 1;
  background: var(--c); color: #fff; border: 0; box-shadow: inset 0 -3px 0 rgba(0,0,0,.16);
  transition: box-shadow .15s;
}
.ball--sp { background: #fff; color: var(--c); border: 3px solid var(--c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.06); }
.ball--digit { border-radius: 8px; height: calc(var(--s) * 1.15); background: var(--bg); color: var(--c); border: 1.5px solid var(--c); box-shadow: none; font-size: calc(var(--s) * .52); }
.ball--ghost { background: #fff; color: var(--ink); border: 2px solid #8C8475; box-shadow: none; }
.ball--sm { --s: calc(34px * var(--font-scale)); }
.balls--md .ball { --s: calc(40px * var(--font-scale)); }
.balls--lg .ball { --s: calc(46px * var(--font-scale)); }
.balls--lg .ball--sp { border-width: 4px; }
button.ball { cursor: pointer; }
button.ball[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--mark); }
.draw-card--stale .ball { filter: saturate(.35); }

/* 圖例 */
.tip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; background: var(--soft); border-radius: 12px; font-size: .9rem; }
.tip__text { display: block; }
.tip__text svg { vertical-align: -4px; margin-right: 6px; color: var(--gold-text); }
.tip__legend { display: flex; gap: 16px; color: var(--muted); font-size: .85rem; }
.tip__legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-ball { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); display: inline-block; }
.lg-ball--sp { background: #fff; border: 3px solid var(--muted); }

/* ───────── 首頁：日曆 + 當日開獎面板 ───────── */
.week-wrap { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line-2); }
.week__day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px 12px;
  border: 0; border-left: 1px solid var(--line-2); background: transparent; font: inherit; color: var(--ink); cursor: pointer;
  transition: background-color .2s ease;
}
.week__day:first-child { border-left: 0; }
.week__day:hover { background: #FDFBF6; }
.week__day.is-past { color: var(--muted); }
.week__day.is-empty .week__md { color: #8C8475; }
.week__day[aria-selected="true"] { background: #FBF6EA; }
.week__day[aria-selected="true"]::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--dark); }
.week__day.is-today::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--hot); }
.week__wd { font-size: 12px; }
.week__md { font-family: var(--serif); font-weight: 700; font-size: 1rem; line-height: 1.2; white-space: nowrap; }
.week__tag { font-size: 11px; font-weight: 700; min-height: 15px; line-height: 15px; color: var(--muted); }
.is-today .week__tag { color: var(--hot); }
.is-next .week__tag { color: var(--gold-text); }
.week__dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; min-height: 7px; max-width: 46px; margin-top: 2px; }
.week__dots i { width: 7px; height: 7px; border-radius: 50%; }
.week__count { font-size: 11px; color: var(--muted); }
/* 日期顯示完整「月/日」與完整狀態字（短字版保留給未來窄版使用） */
.week__tag .sm { display: none; }
.week__md { font-size: 1.15rem; }
/* 手機：改成可左右滑動的橫幅，每格固定寬度不擠壓；兩側漸層提示可滑動 */
@media (max-width: 639px) {
  .week {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 24px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  }
  .week::-webkit-scrollbar { display: none; }
  .week__day { flex: 0 0 78px; scroll-snap-align: center; padding: 12px 4px 14px; }
  .week__day:first-child { margin-left: 10px; }
  .week__day:last-child { margin-right: 10px; }
  .week__dots { max-width: 56px; }
}
/* 手機歷史列表：號碼球縮小，6＋1 顆同一排 */
@media (max-width: 639px) {
  .draw-table .ball--sm { --s: 32px; }
}
/* 手機號碼球：第一區 6 顆同一排，特別號放右側分隔；排不下才換到第二排 */
@media (max-width: 639px) {
  .balls { gap: 10px 6px; }
  .balls__zone--sp { padding-left: 8px; }
  .balls__zone--sp .balls__label { width: 0; white-space: nowrap; }  /* 「第二區」標籤比球寬，不讓它撐開整區（文字可略超出球寬） */
  .balls__row { gap: 5px; }
  .balls--md .ball { --s: 38px; }
  .balls--lg .ball { --s: 40px; }
  .balls__zone--sp .balls__label small { display: none; }  /* 第二區標籤只留區名，避免標籤比球寬把整區擠到下一行 */
  .balls--lg .ball--sp { border-width: 3px; }
}
@media (max-width: 380px) {
  .balls--md .ball { --s: 34px; }
  .balls--lg .ball { --s: 35px; }
}

.day-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 18px; animation: panel-in .25s ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.day-panel__when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.day-panel__rel { font-size: .85rem; font-weight: 700; color: var(--hot); }
.day-panel__when strong { font-family: var(--serif); font-size: 1.35rem; }
.day-panel__status { font-size: .95rem; color: var(--muted); }
.day-panel.is-upcoming .day-panel__status { color: var(--ink); font-weight: 700; }
.day-panel__count { display: flex; gap: 6px; font-size: .8rem; color: var(--muted); }
.day-panel__count span { display: inline-flex; align-items: baseline; gap: 2px; padding: 4px 8px; background: var(--fill); border-radius: 8px; }
.day-panel__count b { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-panel__games { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.day-panel__games a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 9%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff);
  color: var(--c); font-size: .9rem; font-weight: 700; text-decoration: none; transition: background-color .2s ease;
}
.day-panel__games a:hover { background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); }
.day-panel__games i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.day-panel__more { display: none; }
/* 手機首頁：面板收成一行（日期＋狀態＋「N 種彩種」），點開才看倒數與彩種；說明框改為第一次標記時提示 */
@media (max-width: 639px) {
  .hide-sm { display: none; }
  h1 { font-size: clamp(1.4rem, 6.6vw, 1.75rem); }
  .tip { display: none; }
  .day-panel { padding: 12px 16px; gap: 10px; }
  .day-panel__when { align-items: center; width: 100%; }
  .day-panel__when strong { font-size: 1.15rem; }
  .is-collapsible .day-panel__more {
    display: inline-flex; align-items: center; gap: 4px; margin-left: auto; min-height: 36px; padding: 0 12px;
    border: 1px solid var(--line-3); border-radius: 999px; background: var(--bg); font: inherit; font-size: .85rem; color: var(--ink); cursor: pointer;
  }
  .is-collapsible .day-panel__more svg { transition: transform .2s ease; }
  .is-open .day-panel__more svg { transform: rotate(180deg); }
  .is-collapsible:not(.is-open) .day-panel__count,
  .is-collapsible:not(.is-open) .day-panel__games { display: none; }
}

/* ───────── 首頁：卡片 ───────── */
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.draw-card {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 2px 0 rgba(30,27,22,.03);
}
.draw-card { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.draw-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(59,44,34,.08); border-color: var(--line-3); }
/* 整張卡片可點進內頁：透明連結鋪滿卡片，功能性元素疊在上層 */
.draw-card__cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.draw-card .fav, .draw-card .btn-copy, .draw-card .balls, .draw-card .btn-clear, .draw-card__actions, .draw-card__name a { position: relative; z-index: 2; }
.draw-card--stale { background: #FBFAF6; border: 1px dashed var(--line-3); box-shadow: none; }
.draw-card--stale .lt-logo { filter: grayscale(.7); opacity: .7; }
.draw-card--stale .btn--fill { background: #6F685C; }
.draw-card.is-fav { border-color: var(--mark); box-shadow: 0 0 0 1px var(--mark); }
.draw-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.draw-card__logo { display: block; width: 120px; height: 70px; flex: 0 0 auto; }
.lt-logo { box-sizing: border-box; width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.draw-card__badges { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; min-width: 0; }
.draw-card__badges .pill { white-space: normal; }  /* 窄螢幕上「資料停在…」長標籤可換行，不擠壓標誌 */
.draw-card__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fav { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.fav svg { fill: none; stroke: var(--line-3); stroke-width: 1.8; }
.fav[aria-pressed="true"] svg { fill: var(--mark); stroke: var(--mark); }
.draw-card__meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.draw-card__meta > span { display: flex; flex-direction: column; gap: 2px; }
.draw-card__meta small { font-size: 12px; letter-spacing: .15em; color: var(--gold-text); }
.draw-card__meta time { font-weight: 500; }
.draw-card__meta .num { font-size: .85rem; color: var(--muted); }
.draw-card__hint { display: flex; justify-content: space-between; align-items: center; min-height: 28px; margin-top: -4px; font-size: .85rem; color: var(--muted); }
.mark-count { display: inline-flex; align-items: center; gap: 8px; }
.mark-count strong { color: var(--gold-text); }
.btn-clear { min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--soft); font: inherit; font-size: .8rem; cursor: pointer; }
.draw-card__hint:has(> span:first-child:empty):has(.mark-count[hidden]) { display: none; }
.draw-card__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.draw-card__next { display: flex; justify-content: space-between; align-items: baseline; font-size: .9rem; }
.draw-card__next span { color: var(--muted); }
.draw-card__next strong { font-family: var(--serif); }
.draw-card__actions { display: flex; gap: 8px; }
.draw-card__actions .btn { flex: 1; padding: 0 8px; }


.services { display: grid; grid-template-columns: 1fr; gap: 16px; }
.service { display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: var(--radius); background: var(--soft); text-decoration: none; }
.service strong { font-family: var(--serif); font-size: 1.35rem; }
.service span { color: var(--muted); line-height: 1.7; text-wrap: pretty; }  /* 避免最後一行只剩一兩個字 */
.service em { font-style: normal; font-weight: 700; color: var(--hot); }
.service--dark { background: var(--dark); color: var(--bg); }
.service--dark span { color: var(--text-on-dark); }
.service--dark em { color: var(--gold-on-dark); }
.service--dark:hover { color: var(--bg); }
.service-links { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.service-links a { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.service-links strong { font-family: var(--serif); font-size: 1.15rem; }
.service-links span { flex: 1 1 12em; color: var(--muted); font-size: .92rem; }
.service-links em { font-style: normal; font-weight: 700; color: var(--hot); }
.service-links a:hover strong { color: var(--hot); }

/* ───────── 彩種頁 ───────── */
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: '›'; margin-right: 8px; }
.crumbs a { color: var(--muted); }
.hero-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.hero-card {
  flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 20px; padding: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
}
.hero-card__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.hero-card__head time { color: var(--muted); }
.hero-card__id { display: flex; gap: 16px; align-items: center; }
.hero-card__id > div { display: flex; flex-direction: column; gap: 4px; padding-left: 16px; border-left: 1px solid var(--line); }
.hero-card__id .num { color: var(--muted); }
.lt-logo--lg { width: 160px; height: 70px; }
.hero-card__balls { padding: 20px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.facts { margin: 0; display: grid; gap: 10px; }
.facts div { display: flex; gap: 16px; }
.facts dt { flex: 0 0 5em; color: var(--muted); }
.facts dd { margin: 0; }

.next-panel {
  flex: 1 1 300px; display: flex; flex-direction: column; gap: 18px; padding: 26px 24px; border-radius: 20px;
  background: var(--dark); color: var(--bg);
}
/* 金色細框＋四角幾何角飾（角飾為同一形狀鏡像；只用在這個深色側欄與分享圖） */
.next-panel { position: relative; padding: 34px 30px; }
.next-panel::before {
  content: ""; position: absolute; inset: 10px; pointer-events: none;
  border: 1px solid rgba(226, 197, 138, .28);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='none' stroke='%23E2C58A'%3E%3Cg transform=''%3E%3Cpath d='M1 29V1h28' stroke-width='2'/%3E%3Cpath d='M7 22V7h15'/%3E%3Cpath d='M13 10l3 3-3 3-3-3z' fill='%23E2C58A' stroke='none'/%3E%3C/g%3E%3C/svg%3E") left top / 30px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='none' stroke='%23E2C58A'%3E%3Cg transform='matrix(-1 0 0 1 30 0)'%3E%3Cpath d='M1 29V1h28' stroke-width='2'/%3E%3Cpath d='M7 22V7h15'/%3E%3Cpath d='M13 10l3 3-3 3-3-3z' fill='%23E2C58A' stroke='none'/%3E%3C/g%3E%3C/svg%3E") right top / 30px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='none' stroke='%23E2C58A'%3E%3Cg transform='matrix(1 0 0 -1 0 30)'%3E%3Cpath d='M1 29V1h28' stroke-width='2'/%3E%3Cpath d='M7 22V7h15'/%3E%3Cpath d='M13 10l3 3-3 3-3-3z' fill='%23E2C58A' stroke='none'/%3E%3C/g%3E%3C/svg%3E") left bottom / 30px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='none' stroke='%23E2C58A'%3E%3Cg transform='matrix(-1 0 0 -1 30 30)'%3E%3Cpath d='M1 29V1h28' stroke-width='2'/%3E%3Cpath d='M7 22V7h15'/%3E%3Cpath d='M13 10l3 3-3 3-3-3z' fill='%23E2C58A' stroke='none'/%3E%3C/g%3E%3C/svg%3E") right bottom / 30px no-repeat;
}
.next-panel__eyebrow { font-size: .9rem; letter-spacing: .2em; color: var(--gold-on-dark); }
.next-panel__date { font-family: var(--serif); font-size: 1.5rem; }
.next-panel__note { font-size: .9rem; color: var(--text-on-dark); line-height: 1.7; }
.next-panel__facts { margin: 0; padding-top: 16px; border-top: 1px solid var(--dark-line); display: grid; gap: 10px; }
.next-panel__facts:empty { display: none; }
.next-panel__facts div { display: flex; justify-content: space-between; gap: 12px; }
.next-panel__facts dt { color: #CDBFA8; white-space: nowrap; }
.next-panel__facts .nowrap { white-space: nowrap; }
.next-panel__facts dd { margin: 0; text-align: right; }
.next-panel__links { display: flex; flex-wrap: wrap; gap: 10px; }
.next-panel__links .btn { flex: 1 1 120px; gap: 6px; padding: 0 12px; white-space: nowrap; }
.btn--gold { background: var(--gold-on-dark); color: var(--dark); }
.btn--gold:hover { color: var(--dark); }
.btn--ghost-dark { background: transparent; border: 1.5px solid var(--dark-line); color: var(--bg); font-weight: 500; }
.btn--ghost-dark:hover { color: var(--bg); border-color: var(--gold-on-dark); }
#push { scroll-margin-top: 20px; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.countdown span { border: 1px solid var(--dark-line); border-radius: 12px; padding: 12px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.countdown b { font-family: var(--serif); font-size: 1.8rem; font-variant-numeric: tabular-nums; line-height: 1; }
.countdown small { font-size: 12px; color: #CDBFA8; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card { flex: 1 1 340px; display: flex; flex-direction: column; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-card__head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; }
.stat-card__head span { font-size: .85rem; color: var(--muted); }
.stat-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.bar { flex: 1; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; display: flex; }
.bar i { background: var(--c); border-radius: 5px; }
.stat-card--cold .bar i { background: #8C8475; }
.stat-row__c { width: 4.5em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.spec { margin: 0; padding: 4px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.spec > div { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 4px 16px; padding: 16px 0; border-top: 1px solid var(--line-2); }
.spec > div:first-child { border-top: 0; }
.spec dt { font-weight: 700; color: var(--gold-text); }
.spec dd { margin: 0; line-height: 1.8; color: var(--ink-2); }
.spec dd small { display: block; margin-top: 4px; font-size: .88rem; color: var(--muted); }
@media (max-width: 639px) { .spec > div { grid-template-columns: minmax(0, 1fr); padding: 14px 0; } }

.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; overflow: hidden; transition: border-color .25s ease, box-shadow .25s ease; }
.faq details[open] { border-color: var(--line-3); box-shadow: 0 4px 14px rgba(59,44,34,.06); }
.faq summary { min-height: 52px; display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; margin-left: auto; padding-left: 12px; font-size: 1.4rem; line-height: 1; color: var(--gold); transition: transform .3s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 16px; line-height: 1.8; color: var(--ink-2); }
.faq details.is-opening p { animation: faq-in .3s ease both; }
@keyframes faq-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ───────── 歷史表格（手機改卡片） ───────── */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.draw-table { width: 100%; border-collapse: collapse; }
.draw-table thead { display: none; }
.draw-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 16px; border-top: 1px solid var(--line-2); }
/* 固定兩行：第一行期號＋日期，第二行號碼（用 0 高度的換行元素，不依寬度猜測） */
.draw-table tr::before { content: ''; order: 3; flex-basis: 100%; height: 0; }
.draw-table tr > th { order: 1; flex: 1 1 auto; min-width: 0; }
.draw-table tr > td { order: 4; }
.draw-table tr > td[data-label="開獎日期"] { order: 2; white-space: nowrap; }
.draw-table tbody tr:first-child { border-top: 0; }
.draw-table tr.is-latest { background: #FBF6EA; }
.draw-table th, .draw-table td { padding: 0; text-align: left; font-weight: 400; }
.draw-table th a { font-weight: 700; }
.draw-table td[data-label="開獎日期"] { margin-left: auto; text-align: right; color: var(--muted); font-size: .9rem; }
.draw-table td:nth-child(3) { flex-basis: auto; }
.draw-table td:nth-child(n+4) { padding-left: 10px; border-left: 1px solid var(--line); }

.search { display: flex; flex-direction: column; gap: 8px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.search label { font-weight: 700; }
.search__row { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line-3); border-radius: 10px; font: inherit; background: var(--bg); }
.search__msg { color: #7A1F1F; font-size: .9rem; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pager a, .pager span {
  min-width: 44px; min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; font-weight: 700; text-decoration: none; background: var(--card); border: 1px solid var(--line);
}
.pager .is-on { background: var(--dark); color: var(--bg); border-color: var(--dark); }
.pager .is-disabled { color: #B5AC9C; }
.pager .gap { border: 0; background: none; min-width: 20px; padding: 0; }
.pager .pager__now { display: none; }
.pager > [rel], .pager > .is-disabled { gap: 4px; }
.pager .pager__txt { display: inline; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; font-weight: inherit; }
/* 手機：一排「上一頁｜第 N 頁 ▾ ／共 M 頁｜下一頁」，不再擠成兩行 */
@media (max-width: 639px) {
  .pager { flex-wrap: nowrap; align-items: center; }
  .pager > a:not([rel]), .pager > .is-on, .pager > .gap { display: none; }
  .pager { gap: 8px; }
  .pager > [rel], .pager > .is-disabled { flex: 0 0 auto; padding: 0 10px; }
  .pager .pager__now { display: inline-flex; flex: 1 1 auto; min-width: 0; justify-content: center; padding: 0; border: 0; background: none; font-weight: 400; }
  .pager__now select {
    min-height: 44px; padding: 0 30px 0 12px; border: 1px solid var(--line-3); border-radius: 10px; font: inherit; font-weight: 700; color: var(--ink);
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E574B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none; appearance: none; cursor: pointer; min-width: 0; max-width: 100%; text-overflow: ellipsis;
  }
}
/* 很窄的手機：上一頁／下一頁只留箭頭（文字改為螢幕閱讀器專用） */
@media (max-width: 380px) {
  .pager .pager__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pager > [rel], .pager > .is-disabled { min-width: 44px; padding: 0; font-size: 1.2rem; }
}

.prevnext { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.prevnext a { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-weight: 700; }
.prevnext a[rel="next"] { text-align: right; }
.prevnext small { font-weight: 400; font-size: .75rem; color: var(--muted); }
.prevnext__mid { align-items: center; }
.prevnext small + small { margin-top: -2px; }
/* 手機上下期導覽：缺一邊時另一邊撐滿，「全部歷史」放下一行（須放在 .prevnext 基本樣式之後才會生效） */
@media (max-width: 639px) {
  .prevnext { display: flex; flex-wrap: wrap; }
  .prevnext > span:empty { display: none; }
  .prevnext a[rel] { flex: 1 1 0; }
  .prevnext__mid { flex: 1 0 100%; order: 3; min-height: 44px; }
}

/* ───────── 文章 ───────── */
.post-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
.post-card a { display: flex; flex-direction: column; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; }
.post-card__media { aspect-ratio: 16 / 9; background: var(--soft); display: block; }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 900; font-size: 1.6rem; color: var(--c); background: linear-gradient(135deg, var(--soft), #fff); }
.post-card__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 20px; }
.post-card__body time { font-size: .8rem; color: var(--muted); }
.post-card__body strong { font-family: var(--serif); font-size: 1.1rem; line-height: 1.5; }
.post-card__des { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius); }

.article { max-width: 820px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.article__head { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.article__cover { margin: 0; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.article__cover img { width: 100%; height: 100%; object-fit: cover; }
.article__draw { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.article__body { line-height: 1.9; display: flex; flex-direction: column; gap: 16px; }
.article__body img { border-radius: 10px; }
.article__body table { border-collapse: collapse; width: 100%; }
.article__body td, .article__body th { border: 1px solid var(--line); padding: 6px 10px; }
.article__body tr > :first-child { white-space: nowrap; }  /* 舊文章資訊表左欄（開獎期號等）不換行 */
.article--text { gap: 14px; }
.article--text h2 { font-size: 1.2rem; letter-spacing: .04em; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.article--text .article__head + h2 { margin-top: 4px; padding-top: 0; border-top: 0; }
.article--text p { font-size: .95rem; line-height: 1.9; color: var(--ink-2); }

/* ───────── 模擬搖獎 ───────── */
.rand { display: flex; flex-direction: column; gap: 24px; }
.rand__games { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rand__games legend { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; margin-bottom: 14px; }
.rand__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.game-btn {
  display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); font: inherit; color: var(--ink); cursor: pointer; text-align: left;
}
.game-btn[aria-pressed="true"] { border: 2px solid var(--c); box-shadow: 0 0 0 3px var(--cl); font-weight: 700; }
/* 彩種標誌等面積縮放：框固定（文字位置不跳），圖高 = --logo-s ÷ √長寬比、上下補白置中，各標誌面積都是 --logo-s² */
.game-btn { --logo-s: 44px; }
.game-btn__logo { box-sizing: border-box; width: 90px; height: 38px; object-fit: contain; flex: 0 0 90px; }
@supports (height: calc(1px / sqrt(2))) {
  .game-btn__logo { padding-block: max(0px, calc((38px - var(--logo-s) / sqrt(var(--ar, 2))) / 2)); }
}
.rand__stage { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 28px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.rand__caption { display: flex; flex-direction: column; gap: 4px; }
.rand__caption strong { font-family: var(--serif); font-size: 1.5rem; }
.rand__caption span { color: var(--muted); }
.rand__plays { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 999px; }
.rand__plays button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.rand__plays button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(59,44,34,.12); }
.rand__balls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 64px; }
.rand__balls .ball { --s: calc(56px * var(--font-scale)); }
.rand__balls .ball.is-empty { background: transparent; border: 2px dashed var(--muted); color: #8C8475; box-shadow: none; }
.rand__balls .ball--sp { margin-left: 12px; }
.rand__balls .ball.pop { animation: pop .35s ease-out both; }
.ball.pop { animation: pop .35s ease-out both; }
.ball.spin { animation: pop .35s ease-out both, spin-in .5s ease-out; }
@keyframes spin-in { from { rotate: -200deg; } to { rotate: 0deg; } }

/* 玩法分頁 */
.rand__step { display: flex; flex-direction: column; gap: 14px; }
.rand__step-title { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.mode-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tabs button {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.mode-tabs button small { font-size: .75rem; color: var(--muted); }
.mode-tabs button[aria-selected="true"] { background: var(--dark); border-color: var(--dark); color: var(--bg); }
.mode-tabs button[aria-selected="true"] small { color: var(--text-on-dark); }
.mode-panel { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 20px; animation: panel-in .25s ease both; }

/* 仿真搖獎機 */
.machine { position: relative; width: 100%; max-width: 560px; border-radius: 18px;
  background: radial-gradient(ellipse at 50% 35%, #fffaf0 0%, #f4ecdb 55%, #e9dec8 100%); overflow: hidden; }
.machine__canvas { display: block; width: 100%; height: auto; }
.machine__fallback { padding: 12px; font-size: .85rem; color: var(--muted); }
.machine--flat { background: none; }
.rand__stage { position: relative; }
.rand__stage .rand__caption { padding: 0 40px; }
.btn-sound { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1px solid var(--line-3); border-radius: 50%; background: var(--card); color: var(--muted); cursor: pointer; }
.btn-sound[hidden] { display: none; }
.btn-sound[aria-pressed="true"] { color: var(--hot); border-color: currentColor; }
.btn-sound[aria-pressed="true"] .btn-sound__off, .btn-sound[aria-pressed="false"] .btn-sound__on { display: none; }
.tray {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 76px; width: 100%; max-width: 560px;
  padding: 12px; border-radius: 999px; background: linear-gradient(#3b2c22, #4a382b); box-shadow: inset 0 3px 8px rgba(0,0,0,.35);
}
.tray .ball { --s: calc(46px * var(--font-scale)); }
.tray__gap { width: 10px; }

/* 星座生肖 */
.lucky-kind { display: inline-flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 999px; }
.lucky-kind button { min-height: 40px; padding: 0 22px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.lucky-kind button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(59,44,34,.12); }
.lucky-signs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 640px; }
.sign-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font: inherit; cursor: pointer; }
.sign-btn span { font-family: var(--serif); font-size: 1.4rem; line-height: 1.2; color: var(--gold-text); }
.sign-btn small { font-size: .75rem; color: var(--muted); }
.sign-btn[aria-pressed="true"] { border-color: var(--mark); box-shadow: 0 0 0 2px var(--mark); }
.tarot-wrap { perspective: 1200px; width: 100%; display: flex; justify-content: center; }
.tarot { position: relative; width: min(100%, 340px); aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.3,.7,.2,1); cursor: pointer; }
.tarot.is-flipped { transform: rotateY(180deg); }
.tarot__face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 22px; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.tarot__back {
  color: var(--gold-on-dark); border: 2px solid var(--mark);
  background: radial-gradient(circle at 50% 40%, rgba(226,197,138,.25), transparent 55%), repeating-conic-gradient(from 0deg, #3b2c22 0 10deg, #34261d 10deg 20deg);
  box-shadow: inset 0 0 0 8px #3b2c22, inset 0 0 0 9px rgba(226,197,138,.55), 0 14px 30px rgba(59,44,34,.25);
}
.tarot__back span { font-family: var(--serif); font-size: 4.2rem; line-height: 1; text-shadow: 0 0 18px rgba(226,197,138,.6); animation: glow 2.4s ease-in-out infinite; }
.tarot__back small { font-size: .85rem; letter-spacing: .15em; }
@keyframes glow { 50% { text-shadow: 0 0 30px rgba(226,197,138,.95); transform: scale(1.04); } }
.tarot__front { transform: rotateY(180deg); background: linear-gradient(160deg, #fffdf7, #f6eedc); border: 2px solid var(--mark); box-shadow: 0 14px 30px rgba(59,44,34,.2); text-align: center; }
.tarot__title { font-family: var(--serif); font-weight: 900; font-size: 1.35rem; color: var(--c, var(--ink)); }
.tarot__date { font-size: .8rem; letter-spacing: .1em; color: var(--muted); }
.tarot__balls { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tarot__balls .ball { --s: calc(40px * var(--font-scale)); }
.tarot__words { font-size: .9rem; color: var(--ink-2); line-height: 1.7; }
.ball--gap { margin-left: 10px; }

/* 刮刮樂 */
.ticket { position: relative; width: min(100%, 520px); padding: 18px 20px 14px; border-radius: 14px; background: linear-gradient(135deg, #fffaf0, #f3e7cf); border: 2px dashed var(--c); box-shadow: 0 10px 24px rgba(59,44,34,.15); overflow: hidden; }
.ticket__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.ticket__head span { font-family: var(--serif); font-weight: 900; font-size: 1.3rem; color: var(--c); }
.ticket__head small { font-size: .75rem; color: var(--muted); }
.ticket__area { position: relative; border-radius: 10px; overflow: hidden; background: #fff; }
.ticket__nums { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; min-height: 120px; padding: 20px 12px; }
.ticket__cover { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .6s ease; }
.ticket__cover.is-gone { opacity: 0; pointer-events: none; }
.ticket__foot { margin-top: 10px; font-size: .85rem; color: var(--muted); text-align: center; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: confetti 1.6s ease-in forwards; }
@keyframes confetti { to { transform: translate(var(--dx), 360px) rotate(var(--rot)); opacity: 0; } }

/* 電腦包牌 */
.pack { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pack__na { color: var(--muted); }
.pack__opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pack__opts label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pack__opts select { min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line-3); border-radius: 10px; background: var(--bg); font: inherit; }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.slot {
  width: 52px; height: 64px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px;
  background: linear-gradient(#fff, #efe7d6); border: 2px solid var(--line-3); font-family: var(--serif); font-weight: 900; font-size: 1.5rem;
  color: var(--muted); box-shadow: inset 0 -4px 0 rgba(0,0,0,.06); font-variant-numeric: tabular-nums;
}
.slot--sp { border-color: var(--c); }
.slot.is-rolling { color: var(--ink); animation: roll .12s linear infinite; }
.slot.is-set { color: #fff; background: var(--c); border-color: var(--c); animation: pop .3s ease-out; }
.slot--sp.is-set { color: var(--c); background: #fff; border-width: 3px; }
@keyframes roll { 50% { transform: translateY(-3px); filter: blur(.6px); } }
.pack__sum { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pack__sum > div { display: flex; align-items: baseline; gap: 6px; padding: 10px 18px; border-radius: 12px; background: var(--fill); }
.pack__sum small { color: var(--muted); }
.pack__sum b { font-family: var(--serif); font-size: 1.8rem; color: var(--hot); font-variant-numeric: tabular-nums; }
.combos { list-style: none; margin: 0; padding: 0; width: 100%; max-height: 360px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; text-align: left; counter-reset: combo; }
.combos li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 6px 10px; border-radius: 10px; background: var(--fill); counter-increment: combo; animation: fly-in .35s ease-out both; }
.combos li::before { content: counter(combo); min-width: 2.2em; font-size: .75rem; color: var(--muted); }
.combos li em { font-style: normal; font-size: .75rem; color: var(--muted); }
.combos .combos__more { grid-column: 1 / -1; justify-content: center; color: var(--muted); font-size: .85rem; }
.combos .combos__more::before { content: none; }
@keyframes fly-in { from { opacity: 0; transform: translateX(-16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ───────── 兌獎 ───────── */
.reward-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.reward { display: flex; flex-direction: column; gap: 18px; padding: 26px 22px; border-radius: 20px; }
.reward--small { background: var(--card); border: 1px solid var(--line); }
.reward--big { background: var(--dark); color: var(--bg); }
.reward h2 { font-size: 2.6rem; }
.reward h2 small { font-size: 1.1rem; }
.eyebrow { font-size: .9rem; letter-spacing: .2em; color: var(--gold-text); }
.reward--big .eyebrow { color: var(--gold-on-dark); }
.reward__facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reward__facts div { padding: 16px; background: var(--fill); border-radius: 12px; display: flex; flex-direction: column; gap: 4px; }
.reward__facts dt { font-size: .85rem; color: var(--muted); }
.reward__facts dd { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; gap: 14px; }
.steps__no { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--gold-on-dark); color: var(--dark); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.steps li div { display: flex; flex-direction: column; gap: 2px; }
.steps li span { color: var(--text-on-dark); font-size: .92rem; line-height: 1.7; }
.reward__bring { display: grid; grid-template-columns: 1fr; gap: 12px; }
.reward__bring > div { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--dark-line); border-radius: 12px; }
.reward__bring ul { margin: 0; padding-left: 20px; color: var(--text-on-dark); }
.big-num { font-family: var(--serif); font-size: 1.6rem; color: var(--gold-on-dark); }

/* ───────── 其他 ───────── */
.ad-slot { min-height: 280px; display: flex; flex-direction: column; gap: 6px; }
.ad-slot__label { font-size: 12px; color: var(--muted); letter-spacing: .1em; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 48px 0; }
.empty-state__code { font-family: var(--serif); font-weight: 900; font-size: 4rem; color: var(--gold); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-nav-h) + 16px); transform: translateX(-50%); z-index: 60;
  background: var(--dark); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.install-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom-nav-h) + 12px); z-index: 55;
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line-3); box-shadow: 0 12px 32px rgba(59,44,34,.22);
}
.install-bar.is-in { animation: bar-in .4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes bar-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.install-bar img { flex: 0 0 auto; border-radius: 10px; }
.install-bar__text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .85rem; line-height: 1.4; }
.install-bar__text strong { font-size: .95rem; }
.install-bar__text span { color: var(--muted); }
.install-bar__go { flex: 0 0 auto; min-height: 40px; padding: 0 16px; }
.install-bar__close { flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--soft); font-size: 1.2rem; line-height: 1; color: var(--muted); cursor: pointer; }
.install-guide { width: min(92vw, 440px); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--ink); }
.install-guide::backdrop { background: rgba(42,33,27,.55); }
.install-guide__body { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.install-guide__body h2 { font-size: 1.35rem; }
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.install-steps li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--fill); }
.install-steps li > span:last-child { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.install-steps svg { color: #0a84ff; }
.install-steps__no { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--dark); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.install-guide__note { font-size: .85rem; color: var(--muted); }
.install-guide__list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; line-height: 1.7; }
.install-guide__close { align-self: stretch; }
.site-footer__install { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--dark-line); border-radius: 999px; background: transparent; color: var(--gold-on-dark); font: inherit; cursor: pointer; }
.site-footer__install:hover { background: rgba(255,255,255,.06); }
@media (min-width: 900px) { .install-bar { left: auto; right: 24px; width: 420px; } }
/* 回到頁首：捲過約一個半畫面才出現；手機在底部選單上方，安裝提示出現時往上讓位 */
.to-top {
  position: fixed; right: 16px; bottom: calc(var(--bottom-nav-h) + 16px); z-index: 50;
  display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; padding: 0;
  border: 1px solid var(--dark-line); border-radius: 50%; background: var(--dark); color: var(--gold-on-dark); cursor: pointer;
  box-shadow: 0 6px 18px rgba(59,44,34,.25); opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease;
}
.to-top[hidden] { display: none; }
.to-top.is-on { opacity: 1; transform: none; }
.to-top:hover { background: #4a382b; }
@media (max-width: 899px) { .to-top { right: 10px; width: 40px; height: 40px; } .to-top svg { width: 19px; height: 19px; } }
body:has(.install-bar:not([hidden])) .to-top { bottom: calc(var(--bottom-nav-h) + 112px); }
@media (min-width: 900px) {
  .to-top { right: 24px; bottom: 24px; width: 50px; height: 50px; }
  body:has(.install-bar:not([hidden])) .to-top { bottom: 124px; }
}

/* 頁尾 */
.site-footer { background: var(--dark); color: var(--text-on-dark); }
.site-footer__in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-top: 40px; padding-bottom: 40px; font-size: .9rem; }
.site-footer__brand { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.site-footer a { color: var(--text-on-dark); text-decoration: none; transition: color .2s ease; }
.site-footer a:hover { color: var(--gold-on-dark); }
.site-footer__nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.site-footer__nav a { min-height: 44px; display: inline-flex; align-items: center; }


/* 開獎推播訂閱卡 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.push-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.push-card.is-on { border-color: var(--mark); box-shadow: 0 0 0 1px var(--mark); }
.push-card__head { display: flex; gap: 14px; align-items: flex-start; }
.push-card__icon { flex: 0 0 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--dark); color: var(--gold-on-dark); }
.push-card.is-on .push-card__icon { animation: ring 1.2s ease-in-out 1; }
@keyframes ring { 20%, 60% { transform: rotate(-12deg); } 40%, 80% { transform: rotate(12deg); } }
.push-card__head h2 { font-size: 1.3rem; }
.push-card__head p { color: var(--muted); font-size: .92rem; line-height: 1.7; }
.push-card__types { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.push-card__types label { cursor: pointer; }
.push-card__types input { position: absolute; opacity: 0; pointer-events: none; }
.push-card__types span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line-3); background: var(--bg); font-size: .9rem; font-weight: 700; color: var(--muted); transition: all .2s ease;
}
.push-card__types i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.push-card__types input:checked + span { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 9%, #fff); }
.push-card__types input:focus-visible + span { outline: 3px solid var(--mark); outline-offset: 2px; }
.push-card__msg { font-size: .88rem; color: var(--ink-2); padding: 10px 14px; border-radius: 10px; background: var(--soft); }
.push-help { border: 1px dashed var(--line-3); border-radius: 12px; background: #FFFCF5; font-size: .88rem; }
.push-help summary { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px; font-weight: 700; color: var(--gold-text); cursor: pointer; list-style: none; }
.push-help summary::-webkit-details-marker { display: none; }
.push-help summary::before { content: '?'; flex: 0 0 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--mark); color: #fff; font-size: .8rem; }
.push-help__body { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 14px; line-height: 1.75; color: var(--ink-2); }
.push-help__body ol, .push-help__body ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.push-help__sub { font-weight: 700; color: var(--ink); }

/* ───────── 電腦版模擬搖獎：玩法選單放在顯示區右側 ───────── */
.rand__play { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 900px) {
  .rand__play { display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-areas: "stage modes"; gap: 20px; align-items: start; }
  .rand__play > .rand__step { grid-area: modes; position: sticky; top: 20px; }
  .rand__play > .rand__stage { grid-area: stage; }
  .rand__play .mode-tabs { flex-direction: column; overflow: visible; }
  .rand__play .mode-tabs button { width: 100%; min-height: 64px; padding: 10px 16px; }
  .rand__play .mode-tabs button strong { font-size: 1.05rem; }
}

/* ───────── 手機（< 640px）：彩種頁標題與 logo 上下排、搖獎按鈕 logo 在上 ───────── */
@media (max-width: 639px) {
  .hero-card__id { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero-card__id > div { padding-left: 0; border-left: 0; }
  .hero-card__id .lt-logo--lg { width: 150px; height: 64px; object-position: left center; }
  .game-btn { flex-direction: column; justify-content: center; gap: 6px; min-height: 92px; text-align: center; }
  .game-btn { --logo-s: 56px; }
  .game-btn__logo { flex: 0 0 auto; width: 110px; height: 42px; }
  @supports (height: calc(1px / sqrt(2))) {
    .game-btn__logo { padding-block: max(0px, calc((42px - var(--logo-s) / sqrt(var(--ar, 2))) / 2)); }
  }
  .lucky-signs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mode-tabs button { min-height: 52px; padding: 6px 14px; }
  .slot { width: 44px; height: 56px; font-size: 1.3rem; }
  .tray { border-radius: 20px; }
}

/* ───────── ≥ 640px ───────── */
@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rand__grid { grid-template-columns: repeat(3, 1fr); }
  .reward__bring { grid-template-columns: 1fr 1fr; }
  .services { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 28px; }
}

/* ───────── ≥ 900px（桌機） ───────── */
@media (min-width: 900px) {
  body { --bottom-nav-h: 0px; }
  .bottom-nav { display: none; }
  .wrap { padding-left: 40px; padding-right: 40px; }  /* 只改左右，避免蓋掉頁首頁尾的上下間距 */
  .main { gap: 56px; padding-top: 32px; padding-bottom: 72px; }
  h1 { font-size: 2.3rem; }
  h2 { font-size: 1.75rem; }
  .brand__tag, .main-nav { display: flex; }
  .brand__logo { height: 48px; }
  .card-grid { gap: 20px; }
  .draw-card { padding: 24px; gap: 18px; }
  .draw-card__logo { width: 136px; height: 76px; }
  .week__day { padding: 14px 6px 16px; gap: 3px; }
  .week__md { font-size: 1.35rem; }
  .week__wd, .week__count { font-size: 13px; }
  .week__dots { max-width: 70px; }
  .week__dots i { width: 8px; height: 8px; }
  .day-panel { padding: 18px 24px; }
  .day-panel__games { width: auto; margin-left: auto; justify-content: flex-end; }
  .hero-card { padding: 36px 40px; gap: 26px; }
  .lt-logo--lg { width: 224px; height: 106px; }
  .hero-card__id > div { padding-left: 24px; }
  .balls--lg .ball { --s: calc(72px * var(--font-scale)); }
  .balls--lg .ball--sp { border-width: 5px; }
  .next-panel { padding: 34px 30px; align-self: flex-start; position: sticky; top: 20px; }
  .draw-table thead { display: table-header-group; }
  .draw-table thead th { padding: 14px 20px; font-size: .9rem; color: var(--muted); background: var(--fill); font-weight: 500; }
  .draw-table tr { display: table-row; }
  .draw-table tr::before { display: none; }
  .draw-table th, .draw-table td { padding: 12px 20px; border-top: 1px solid var(--line-2); }
  .draw-table td[data-label="開獎日期"] { text-align: left; }
  .draw-table td:nth-child(n+4) { padding-left: 20px; border-left: 0; }
  .draw-table tbody tr:nth-child(even):not(.is-latest) { background: #FDFBF7; }
  .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rand__grid { grid-template-columns: repeat(4, 1fr); }
  .rand__balls .ball { --s: calc(72px * var(--font-scale)); }
  .reward-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .reward { padding: 36px; }
  .toast { bottom: 24px; }
}

/* 窄手機（≤ 400px）防擁擠（須放在 .hero-card／.facts／.next-panel 基本樣式之後）：深色側欄與資訊列內距縮小、卡片內按鈕平均撐滿一列 */
@media (max-width: 400px) {
  .next-panel { padding: 30px 22px; }
  .hero-card { padding: 20px 18px; }
  .facts div { gap: 12px; }
  .facts dt { flex-basis: 4em; }
  .facts dd { font-size: .94rem; }
}
@media (max-width: 639px) {
  .hero-card .btn-row .btn { flex: 1 1 auto; padding: 0 14px; }
}
/* 首頁卡片在雙欄、三欄時：號碼球縮小讓第二區同一排 */
@media (min-width: 640px) {
  .draw-card .balls--md .ball { --s: 36px; }
  .draw-card .balls { gap: 8px 10px; }
  .draw-card .balls__zone--sp { padding-left: 10px; }
  .draw-card .balls__row { gap: 5px; }
}
/* 最後一列只剩一張卡時，改成橫向寬卡撐滿整列（雙欄看單數、三欄看「除以 3 餘 1」） */
@media (min-width: 640px) and (max-width: 1139px) {
  .card-grid > .draw-card:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 280px);
    grid-template-areas: "top meta foot" "balls balls foot" "hint hint foot"; align-items: center; gap: 12px 28px; }
  .card-grid > .draw-card:last-child:nth-child(odd) > .draw-card__top { grid-area: top; }
  .card-grid > .draw-card:last-child:nth-child(odd) > .draw-card__meta { grid-area: meta; padding-bottom: 0; border-bottom: 0; }
  .card-grid > .draw-card:last-child:nth-child(odd) > .balls { grid-area: balls; }
  .card-grid > .draw-card:last-child:nth-child(odd) > .draw-card__hint { grid-area: hint; margin-top: 0; }
  .card-grid > .draw-card:last-child:nth-child(odd) > .draw-card__foot { grid-area: foot; align-self: stretch; justify-content: center; margin-top: 0; padding: 0 0 0 28px; border-top: 0; border-left: 1px dashed var(--line); }
}
@media (min-width: 1140px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid > .draw-card:last-child:nth-child(3n+1) { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 280px);
    grid-template-areas: "top meta foot" "balls balls foot" "hint hint foot"; align-items: center; gap: 12px 28px; }
  .card-grid > .draw-card:last-child:nth-child(3n+1) > .draw-card__top { grid-area: top; }
  .card-grid > .draw-card:last-child:nth-child(3n+1) > .draw-card__meta { grid-area: meta; padding-bottom: 0; border-bottom: 0; }
  .card-grid > .draw-card:last-child:nth-child(3n+1) > .balls { grid-area: balls; }
  .card-grid > .draw-card:last-child:nth-child(3n+1) > .draw-card__hint { grid-area: hint; margin-top: 0; }
  .card-grid > .draw-card:last-child:nth-child(3n+1) > .draw-card__foot { grid-area: foot; align-self: stretch; justify-content: center; margin-top: 0; padding: 0 0 0 28px; border-top: 0; border-left: 1px dashed var(--line); }
}

/* ───────── 統一發票（/invoice*、首頁發票卡）：號碼用數字方格，末三碼實心（對發票都從末三碼開始） ───────── */
.inv-pill { align-self: flex-start; background: #E7E9EC; color: #33404D; }
.inv-no { display: inline-flex; }
.inv-no__d { display: inline-flex; gap: 4px; }
.inv-no b {
  width: 1.55em; height: 1.95em; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--inv); border-radius: 8px; background: var(--bg); color: var(--inv);
  font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}
.inv-no b.is-hi { background: var(--inv); color: #fff; }
.inv-no--sm .inv-no__d { gap: 3px; }
.inv-no--sm b { font-size: .82rem; border-width: 1px; border-radius: 6px; }

.inv-hero__id { display: flex; flex-direction: column; gap: 8px; }
.inv-prizes { margin: 0; display: flex; flex-direction: column; }
.inv-prizes > div { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 16px 0; border-top: 1px solid var(--line-2); }
.inv-prizes > div:last-child { border-bottom: 1px solid var(--line-2); }
.inv-prizes dt { flex: 0 0 6em; display: flex; flex-direction: column; }
.inv-prizes dt strong { font-family: var(--serif); font-size: 1.1rem; }
.inv-prizes dt span { font-size: .85rem; color: var(--muted); }
.inv-prizes dd { margin: 0; flex: 1 1 280px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.inv-prizes dd small { flex-basis: 100%; color: var(--muted); font-size: .85rem; }

/* 快速對獎小表單（邊打邊對） */
.inv-quick { display: flex; flex-direction: column; gap: 8px; }
.inv-quick label { font-weight: 700; }
.inv-quick__row { display: flex; gap: 8px; }
.inv-quick input {
  flex: 1; width: 0; min-width: 0; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line-3); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 1.3rem; font-weight: 700; letter-spacing: .2em; font-variant-numeric: tabular-nums;
}
.inv-quick .btn { min-height: 52px; }
/* 結果區固定預留高度（最常見的兩行結果約 115px），輸入前顯示提示，出結果時卡片不會突然被撐高 */
.inv-quick__msg { min-height: 6rem; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: .92rem; line-height: 1.6; }
.inv-quick__msg:empty::before { content: "輸入第 3 碼就會自動對獎"; color: var(--muted); }
.inv-quick--dark .inv-quick__msg:empty::before { color: #B9A88F; }
.inv-quick__msg.is-win { background: #F6EBD3; color: #5A3F0E; box-shadow: inset 0 0 0 1.5px var(--mark); }
.inv-quick__msg.is-maybe { background: #FBF6EA; }
.inv-quick__msg > strong, .inv-hit strong { font-size: 1rem; }
.inv-hit { display: flex; flex-direction: column; gap: 2px; }
.inv-quick__msg .nowrap, .inv-pad__msg .nowrap { white-space: nowrap; }  /* 期別名稱（115 年 7–8 月）不拆開 */
.inv-quick--dark label { color: var(--bg); }
.inv-quick--dark input { border-color: transparent; background: var(--fill); }
.inv-quick--dark .inv-quick__msg { background: #4A3A2E; color: var(--text-on-dark); }
.inv-quick--dark .inv-quick__msg.is-win { color: var(--bg); box-shadow: inset 0 0 0 1.5px var(--gold-on-dark); }
.inv-quick--dark .inv-quick__msg.is-win strong { color: var(--gold-on-dark); }

/* 首頁發票卡 */
.inv-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 22px; background: var(--card); border: 1px solid #C9CDD3; border-radius: 18px; }
.inv-card__id { display: flex; flex-direction: column; gap: 6px; }
.inv-card__id h2 { font-size: 1.35rem; }
.inv-card__id h2 a { text-decoration: none; }
.inv-card__more { font-weight: 700; color: var(--inv); font-size: .95rem; }
.inv-card__nos { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.inv-card__nos > div { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.inv-card__nos dt { flex: 0 0 5.2em; color: var(--muted); font-size: .92rem; }
.inv-card__nos dd { margin: 0; }
.inv-card__tails { display: flex; gap: 18px; font-size: 1.2rem; font-weight: 700; color: var(--inv); font-variant-numeric: tabular-nums; }
.inv-card .inv-quick { padding: 16px; background: var(--soft); border-radius: 14px; }

/* 「對中幾碼」獎金圖解：以頭獎號碼示範，標亮的末幾碼＝要相同的位數（數字只是示意） */
.inv-ladder { list-style: none; margin: 0; padding: 4px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.inv-ladder li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "no txt amt"; align-items: center; gap: 8px 24px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.inv-ladder li:first-child { border-top: 0; }
.inv-ladder--top { margin-top: 12px; }
.inv-ladder__no { grid-area: no; display: inline-flex; gap: 3px; }
.inv-ladder__no b {
  width: 1.55em; height: 1.95em; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
  border: 1px solid var(--line-3); background: var(--bg); color: #8C8475; font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
}
.inv-ladder__no b.is-hi { border-color: var(--inv); background: var(--inv); color: #fff; }
.inv-ladder__no--extra { gap: 12px; }
.inv-ladder__no--extra > span { display: inline-flex; gap: 3px; }
.inv-ladder__txt { grid-area: txt; display: flex; flex-direction: column; }
.inv-ladder__txt strong { font-family: var(--serif); font-size: 1.05rem; }
.inv-ladder__txt small { color: var(--muted); font-size: .85rem; }
.inv-ladder__amt { grid-area: amt; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.inv-ladder__amt small { font-weight: 400; font-size: .85rem; color: var(--muted); }
@media (max-width: 639px) {
  .inv-ladder { padding: 4px 16px; }
  .inv-ladder li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "no no" "txt amt"; gap: 8px 12px; }
}

/* 快速兌獎頁：鍵盤（整疊發票逐張輸入末三碼） */
.inv-pad-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.inv-pad { flex: 1 1 340px; max-width: 460px; display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 20px; background: var(--dark); color: var(--text-on-dark); }
.inv-pad__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.inv-pad__top strong { font-family: var(--serif); font-size: 1.2rem; color: var(--bg); }
.inv-pad__top span { font-size: .85rem; }
.inv-pad__slots { display: flex; justify-content: center; gap: 10px; }
.inv-pad__slots span {
  width: 64px; height: 76px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px;
  background: #33261D; border: 2px solid var(--dark-line); color: #8C7B66; font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.inv-pad__slots span.is-on { background: var(--fill); border-color: var(--gold-on-dark); color: var(--ink); }
/* 結果區固定預留高度（最高的單一結果「沒中＋兩期名稱」手機約 123px），按鍵時鍵盤不會上下跳 */
.inv-pad__msg { min-height: 6.4rem; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: #33261D; border: 1px solid var(--dark-line); font-size: .9rem; line-height: 1.6; }
.inv-pad__msg strong { color: var(--bg); font-size: 1.05rem; }
.inv-pad__msg.is-win { background: #4A3A2E; border-color: var(--gold-on-dark); }
.inv-pad__msg.is-win strong { color: var(--gold-on-dark); }
.inv-pad__keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inv-pad__keys button {
  min-height: 58px; border: 0; border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; touch-action: manipulation;
  font: inherit; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.inv-pad__keys button:active { background: var(--soft); }
.inv-pad__keys [data-key="clr"], .inv-pad__keys [data-key="del"] { background: var(--line); font-size: 1rem; }
.inv-pad-side { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.inv-mini { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.inv-mini__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.inv-mini__head h2 { font-size: 1.2rem; }
.inv-mini__head a { text-decoration: none; }
.inv-mini .inv-prizes > div:last-child { border-bottom: 0; }
.inv-mini .inv-no b { font-size: .95rem; }

/* 各期資訊 */
.inv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.inv-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 18px 20px; border-top: 1px solid var(--line-2); }
.inv-list li:first-child { border-top: 0; }
.inv-list__term { flex: 0 0 11em; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.inv-list__term strong { font-family: var(--serif); font-size: 1.1rem; }
.inv-list__term span { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.inv-list__term:hover strong { color: var(--hot); }
.inv-list__nos { margin: 0; flex: 1 1 400px; display: flex; flex-wrap: wrap; gap: 10px 24px; }
.inv-list__nos > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.inv-list__nos dt { font-size: .82rem; color: var(--muted); }
.inv-list__nos dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; }

/* 常見問題：領獎方式（淺色底版的步驟） */
.inv-ways { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.inv-ways .steps__no { background: var(--inv); color: #fff; }
.inv-ways li span { color: var(--ink-2); }
.inv-bring { margin: 0; padding: 18px 20px 18px 40px; display: grid; gap: 8px; line-height: 1.7; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

@media (min-width: 900px) {
  .inv-card { grid-template-columns: 190px minmax(0, 1fr) 300px; align-items: center; gap: 28px; padding: 26px 28px; }
  .inv-card__nos { padding-left: 28px; border-left: 1px dashed var(--line-3); }
}
@media (max-width: 639px) {
  .inv-no b { font-size: .95rem; }
  .inv-no__d { gap: 3px; }
  .inv-prizes dt { flex-basis: 100%; flex-direction: row; justify-content: space-between; align-items: baseline; }
  .inv-pad { max-width: none; padding: 18px 16px; }
  .inv-list li { padding: 16px; }
  .inv-list__term { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
}

/* 彩種標誌等面積縮放（首頁卡片、彩種頁大標誌）：框寬給最寬的標誌留空間，
   圖高 = --lt-s ÷ √長寬比、上下補白置中，靠左對齊；各彩種面積都是 --lt-s²，39 樂合彩不再只有大樂透的一半大。
   不支援 sqrt() 的瀏覽器維持框內等比縮放。 */
@supports (height: calc(1px / sqrt(2))) {
  .lt-logo { padding-block: max(0px, calc((var(--lt-h) - var(--lt-s) / sqrt(var(--ar, 2))) / 2)); }
  .draw-card__logo { --lt-h: 70px; --lt-s: 70px; width: auto; }
  .draw-card__logo .lt-logo { width: calc(var(--lt-s) * sqrt(var(--ar, 2))); }  /* 寬度也照等面積算，標誌不參與縮放 */
  .hero-card__id { --lt-h: 70px; --lt-s: 80px; }
  @media (max-width: 639px) { .hero-card__id { --lt-h: 64px; --lt-s: 74px; } }
  @media (min-width: 900px) {
    .draw-card__logo { --lt-h: 76px; --lt-s: 80px; }
    .hero-card__id { --lt-h: 106px; --lt-s: 117px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .site-header, .bottom-nav, .site-footer, .ad-slot, .type-tabs, .btn-row, .fav { display: none !important; }
}

/* ───────── 獎金分配（手機兩行卡片列，≥ 640px 表格） ───────── */
.prize-lead { padding: 14px 18px; border-left: 4px solid var(--c); background: var(--fill); border-radius: 0 10px 10px 0; font-weight: 700; line-height: 1.7; }
.prize-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.prize-table thead { display: none; }
.prize-table tr { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; grid-template-areas: "name cond cond" "name win per"; gap: 2px 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); }
.prize-table--plain tr { grid-template-areas: "name cond cond" "name per per"; }
.prize-table tbody tr:first-child { border-top: 0; }
.prize-table th, .prize-table td { padding: 0; text-align: left; font-weight: 400; }
.prize-table tbody th { grid-area: name; font-family: var(--serif); font-weight: 900; color: var(--c); }
.prize-table__cond { grid-area: cond; font-size: .9rem; color: var(--ink-2); }
.prize-table__win { grid-area: win; font-size: .85rem; color: var(--muted); }
.prize-table .prize-table__per { grid-area: per; text-align: right; font-weight: 700; white-space: nowrap; }
.prize-table--plain .prize-table__per { text-align: left; }
.prize-table__per small { display: block; font-size: .78rem; font-weight: 400; color: var(--muted); }
.prize-table tr.is-top { background: #FBF6EA; }
@media (min-width: 640px) {
  .prize-table thead { display: table-header-group; }
  .prize-table thead th { padding: 12px 18px; font-size: .85rem; color: var(--muted); background: var(--fill); font-weight: 500; }
  .prize-table tr { display: table-row; }
  .prize-table th, .prize-table td { padding: 12px 18px; border-top: 1px solid var(--line-2); }
  .prize-table thead th:nth-child(n+3), .prize-table .prize-table__win, .prize-table .prize-table__per { text-align: right; }
  .prize-table--plain .prize-table__per { text-align: right; }
  .prize-table__win { font-size: .95rem; color: var(--ink-2); }
}

/* ───────── 我的號碼對獎 ───────── */
.checker__card { display: flex; flex-direction: column; gap: 20px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.checker__zone { display: flex; flex-direction: column; gap: 10px; }
.checker__zone--sp { padding-top: 16px; border-top: 1px dashed var(--line-3); }
.checker__zone-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 700; }
.checker__count { font-weight: 400; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
@media (min-width: 640px) {
  .pick-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); max-width: 560px; }
  .pick-grid--sp { grid-template-columns: repeat(8, minmax(0, 1fr)); max-width: 448px; }
}
.pick {
  min-height: 44px; padding: 0; border: 1.5px solid var(--line-3); border-radius: 50%; aspect-ratio: 1; background: var(--bg);
  font: inherit; font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}
@media (hover: hover) { .pick:hover { border-color: var(--c); } }
.pick[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.pick--sp[aria-pressed="true"] { background: #fff; color: var(--c); border-width: 3px; }
.pick.is-hit { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--mark); }
.checker__digits { display: flex; gap: 10px; flex-wrap: wrap; }
.checker__digit { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.checker__digit input {
  width: 56px; height: 64px; border: 1.5px solid var(--line-3); border-radius: 10px; background: var(--bg); text-align: center;
  font: inherit; font-size: 1.6rem; font-weight: 700; color: var(--c);
}
.checker__digit input:focus { border-color: var(--c); outline: none; box-shadow: 0 0 0 3px var(--soft); }
.checker__digit input.is-hit { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--mark); }
.checker__foot { display: flex; gap: 12px; align-items: stretch; }
.checker__result { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; background: var(--fill); }
.checker__result strong { font-size: 1.05rem; }
.checker__result span { color: var(--ink-2); font-size: .92rem; }
.checker__result small { color: var(--muted); font-size: .82rem; }
.checker__result.is-win { background: var(--c); color: #fff; }
.checker__result.is-win strong { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .04em; }
.checker__result.is-win span, .checker__result.is-win small { color: #fff; opacity: .92; }
.checker__result.is-maybe { background: #F6EBD3; color: #6B4F1A; }
.checker__result.is-miss strong { color: var(--muted); }
.checker__clear { flex: 0 0 auto; }
@media (max-width: 639px) {
  .checker__card { padding: 16px; gap: 16px; }
  .checker__foot { flex-direction: column; }
  .checker__clear { min-height: 44px; }
}
@media (max-width: 380px) { .checker__digit input { width: 48px; height: 58px; } }
/* 桌機：左邊選號、右邊結果，結果不用拉滿整列 */
@media (min-width: 900px) {
  .checker__card { display: grid; grid-template-columns: minmax(0, 560px) minmax(240px, 1fr); gap: 20px 32px; align-items: start; }
  .checker__card > :not(.checker__foot) { grid-column: 1; }
  .checker__foot { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; }
  .checker__result { min-height: 132px; justify-content: center; }
  .checker__clear { min-height: 44px; }
}

/* ───────── 文章分享與相關文章 ───────── */
.share { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line-2); }
.share__label { font-weight: 700; font-size: .9rem; }
.share__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.share__btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line-3);
  border-radius: 999px; background: var(--card); font: inherit; font-size: .9rem; font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer;
}
.share__btn:hover { border-color: var(--dark); color: var(--ink); }
.share__btn--line { background: #06C755; border-color: #06C755; color: #fff; }
.share__btn--line:hover { color: #fff; filter: brightness(1.05); border-color: #06C755; }
.share__btn--fb { background: #1877F2; border-color: #1877F2; color: #fff; }
.share__btn--fb:hover { color: #fff; filter: brightness(1.05); border-color: #1877F2; }
@media (max-width: 639px) { .share__btns { width: 100%; } .share__btn { flex: 1 1 40%; padding: 0 10px; } }
.article-more { max-width: 820px; width: 100%; margin: 0 auto; }
@media (min-width: 640px) { .post-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
