/* Theme Preview Switcher Bar (A / B / C / D) */
.theme-bar {
  position: fixed;
  top: max(.55rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  padding: .2rem;
  border-radius: 999px;
  background: rgb(10 14 22 / .78);
  border: 1px solid rgb(255 255 255 / .16);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 8px 24px rgb(0 0 0 / .42);
}
.theme-bar button {
  border: 0;
  background: transparent;
  color: rgb(226 234 246 / .72);
  font-size: .74rem;
  font-weight: 600;
  padding: .24rem .62rem;
  min-height: 28px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.theme-bar button[aria-pressed="true"] {
  background: #fff;
  color: #000;
}
:root[data-theme="b"] .theme-bar,
:root[data-theme="c"] .theme-bar {
  background: rgb(255 255 255 / .88);
  border-color: rgb(0 0 0 / .14);
  box-shadow: 0 8px 24px rgb(0 0 0 / .12);
}
:root[data-theme="b"] .theme-bar button,
:root[data-theme="c"] .theme-bar button {
  color: #555;
}
:root[data-theme="b"] .theme-bar button[aria-pressed="true"],
:root[data-theme="c"] .theme-bar button[aria-pressed="true"] {
  background: #18181b;
  color: #fff;
}
:root[data-game="ssq"] main,
:root[data-game="dlt"] main {
  padding-top: max(3.1rem, calc(2.4rem + env(safe-area-inset-top)));
}

/* Click Spark particles (Theme A) */
.click-spark {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  transition: transform .48s cubic-bezier(.16, 1, .3, 1), opacity .48s ease;
}

/* ==========================================================================
   THEME B · 宣纸朱印手账票 (Looseleaf + Inkra Editorial Paper & Seal)
   ========================================================================== */
:root[data-theme="b"] {
  color-scheme: light;
  --bg: #f4efe4;
  --ink: #221c16;
  --muted: #6c6052;
  --faint: #8c7f6e;
  --border: #2a221b;
  --border-strong: #2a221b;
  --accent: #b82c2c;
  --accent-ink: #fcfaf4;
  --accent-soft: rgb(184 44 44 / .1);
  --accent-border: #b82c2c;
  --gold: #9a5d1c;
  --gold-soft: #f6ebd4;
  --gold-border: #b8823c;
  font-family: Georgia, "Songti SC", "Noto Serif CJK SC", "PingFang SC", serif;
}
:root[data-theme="b"][data-game="dlt"] {
  --accent: #1d4e7d;
  --accent-soft: rgb(29 78 125 / .1);
  --accent-border: #1d4e7d;
}
:root[data-theme="b"] body {
  background-color: #f4efe4;
  background-image: radial-gradient(rgb(42 34 27 / .08) 1px, transparent 0);
  background-size: 18px 18px;
}
:root[data-theme="b"] .ambient-bg,
:root[data-theme="b"] .hero-orbit,
:root[data-theme="b"] .draw-orbit,
:root[data-theme="b"] .flow-border::after,
:root[data-theme="b"] .sheen-btn::before {
  display: none;
}
:root[data-theme="b"] .home-hero {
  min-height: 11.5rem;
  margin-inline: 0;
  margin-top: 3.2rem;
  padding: 1.5rem 1.25rem;
  border-radius: 4px;
  background: #fcfaf4;
  border: 1.5px solid #2a221b;
  box-shadow: 4px 4px 0 #2a221b;
}
:root[data-theme="b"] .home-hero-art {
  opacity: .14;
  filter: grayscale(1) contrast(1.4);
  mix-blend-mode: multiply;
}
:root[data-theme="b"] .home-hero::after { display: none; }
:root[data-theme="b"] .home-hero-copy h2,
:root[data-theme="b"] #draw-title {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: #221c16;
}
:root[data-theme="b"] .hero-sub { color: #7a6d5c; }
:root[data-theme="b"] .game-card,
:root[data-theme="b"] .panel {
  background: #fcfaf4;
  border: 1.5px solid #2a221b;
  border-radius: 4px;
  backdrop-filter: none;
  box-shadow: 4px 4px 0 #2a221b;
}
:root[data-theme="b"] .game-card h3 { color: #221c16; }
:root[data-theme="b"] .draw {
  background: #fcfaf4;
  border: 1.5px solid #2a221b;
  border-radius: 4px;
  box-shadow: 4px 4px 0 #2a221b;
  padding: 1.8rem 1.15rem 1.5rem;
}
:root[data-theme="b"] .ball {
  background: #b82c2c;
  border: 1.5px solid #2a221b;
  color: #fcfaf4;
  text-shadow: none;
  box-shadow: 1.5px 1.5px 0 #2a221b;
}
:root[data-theme="b"] .ball.back {
  background: #1d4e7d;
  border-color: #2a221b;
  box-shadow: 1.5px 1.5px 0 #2a221b;
}
:root[data-theme="b"] .ball.miss {
  background: #ece5d8;
  border-color: #bfb5a3;
  color: #8c8070;
  box-shadow: none;
}
:root[data-theme="b"] .ball.hit {
  box-shadow: 0 0 0 2px #fcfaf4, 0 0 0 4px #b82c2c;
  animation: none;
}
:root[data-theme="b"] .ball.back.hit {
  box-shadow: 0 0 0 2px #fcfaf4, 0 0 0 4px #1d4e7d;
}
:root[data-theme="b"] .primary,
:root[data-theme="b"] .card-primary {
  background: var(--accent);
  color: #fcfaf4;
  border: 1.5px solid #2a221b;
  border-radius: 4px;
  box-shadow: 2.5px 2.5px 0 #2a221b;
}
:root[data-theme="b"] .secondary,
:root[data-theme="b"] .glass-pill {
  background: #fcfaf4;
  color: #221c16;
  border: 1.5px solid #2a221b;
  border-radius: 4px;
}
:root[data-theme="b"] .card-secondary { color: #221c16; border: 1.5px dashed #8c7f6e; border-radius: 4px; }
:root[data-theme="b"] .game-switch {
  background: #ece5d8;
  border: 1.5px solid #2a221b;
  border-radius: 4px;
}
:root[data-theme="b"] .game-switch a { border-radius: 2px; color: #5b4f41; }
:root[data-theme="b"] .game-switch a[aria-current="page"] { background: #2a221b; color: #fcfaf4; }
:root[data-theme="b"] .section-nav {
  background: #fcfaf4;
  border: 1.5px solid #2a221b;
  border-radius: 6px;
  box-shadow: 3px 3px 0 #2a221b;
}
:root[data-theme="b"] .section-nav a { color: #6c6052; border-radius: 4px; }
:root[data-theme="b"] .section-nav a[aria-current="page"] { background: #2a221b; color: #fcfaf4; box-shadow: none; }
:root[data-theme="b"] .tickets li,
:root[data-theme="b"] .method-choice,
:root[data-theme="b"] .method-desc,
:root[data-theme="b"] .mode-choices button,
:root[data-theme="b"] .freq-chip,
:root[data-theme="b"] .odds-grid > div,
:root[data-theme="b"] .ticket-draw-strip,
:root[data-theme="b"] .ticket-match-lines li {
  background: #f8f3e8;
  border: 1px dashed #9d8f7b;
  border-radius: 3px;
  color: #221c16;
}
:root[data-theme="b"] .method-choice:has(input:checked) {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  box-shadow: none;
}
:root[data-theme="b"] .fields input,
:root[data-theme="b"] .explore-controls :is(input, select),
:root[data-theme="b"] .ticket-numbers textarea {
  background: #fffdf8;
  border: 1.5px solid #2a221b;
  border-radius: 3px;
  color: #221c16;
}
:root[data-theme="b"] .blessing,
:root[data-theme="b"] #ticket-result,
:root[data-theme="b"] .tarot {
  background: #f9f1df;
  border: 1.5px solid #b82c2c;
  border-radius: 4px;
  color: #6b1d1d;
  box-shadow: none;
}
:root[data-theme="b"] .tarot-controls strong,
:root[data-theme="b"] #ticket-result h3 { color: #b82c2c; }
:root[data-theme="b"] .seal { border-color: #b82c2c; color: #b82c2c; box-shadow: none; animation: none; }
:root[data-theme="b"] .sticky-actions { background: rgb(252 250 244 / .95); border-top: 1.5px dashed #9d8f7b; border-radius: 0; }
:root[data-theme="b"] .step-dot { background: #fcfaf4; border-color: #2a221b; }
:root[data-theme="b"] .archive-list li,
:root[data-theme="b"] .frequency-table :is(th, td) { border-color: #d8cebd; }
:root[data-theme="b"] #ticket-awards,
:root[data-theme="b"] .audit ol,
:root[data-theme="b"] .explore h3 { color: #221c16; }

/* ==========================================================================
   THEME C · 苹果白瓷液态胶囊 (Apple Porcelain Minimal + Liquid Pill)
   ========================================================================== */
:root[data-theme="c"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --border: rgb(0 0 0 / .08);
  --border-strong: rgb(0 0 0 / .16);
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --accent-soft: rgb(0 113 227 / .1);
  --accent-border: rgb(0 113 227 / .32);
  --beam-a: rgb(0 113 227 / .55);
  --beam-b: rgb(160 205 255 / .45);
  --gold: #a56700;
  --gold-soft: rgb(245 180 60 / .14);
  --gold-border: rgb(185 130 30 / .32);
}
:root[data-theme="c"][data-game="ssq"] {
  --accent: #d92647;
  --accent-soft: rgb(217 38 71 / .1);
  --accent-border: rgb(217 38 71 / .3);
  --beam-a: rgb(217 38 71 / .5);
  --beam-b: rgb(255 182 194 / .45);
}
:root[data-theme="c"] body {
  background: #f5f5f7;
  color: #1d1d1f;
}
:root[data-theme="c"] .ambient-bg { opacity: .35; }
:root[data-theme="c"] .home-hero {
  min-height: 13rem;
  margin-inline: 0;
  margin-top: 3.1rem;
  border-radius: 1.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%);
  border: 1px solid rgb(0 0 0 / .05);
  box-shadow: 0 12px 32px rgb(0 0 0 / .06);
}
:root[data-theme="c"] .home-hero-art {
  opacity: .22;
  filter: saturate(.8) brightness(1.4);
}
:root[data-theme="c"] .home-hero::after {
  background: linear-gradient(180deg, rgb(255 255 255 / .3) 0%, rgb(255 255 255 / .88) 100%);
}
:root[data-theme="c"] .home-hero-copy h2,
:root[data-theme="c"] #draw-title {
  background: linear-gradient(180deg, #1d1d1f 0%, #515154 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root[data-theme="c"] .hero-sub { color: #6e6e73; }
:root[data-theme="c"] .hero-orbit,
:root[data-theme="c"] .draw-orbit { opacity: .45; }
:root[data-theme="c"] .orbit-ring::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
:root[data-theme="c"] .game-card,
:root[data-theme="c"] .panel {
  background: rgb(255 255 255 / .88);
  border: 1px solid rgb(0 0 0 / .06);
  box-shadow: 0 10px 30px rgb(0 0 0 / .06);
}
:root[data-theme="c"] .game-card h3 { color: #1d1d1f; }
:root[data-theme="c"] .ball {
  background: radial-gradient(circle at 32% 24%, #ff8fa2 0%, #e12645 55%, #b51530 100%);
  border-color: rgb(255 255 255 / .5);
  box-shadow: 0 8px 18px rgb(225 38 69 / .24), inset 0 2px 3px rgb(255 255 255 / .45);
}
:root[data-theme="c"] .ball.back {
  background: radial-gradient(circle at 32% 24%, #82c4ff 0%, #0071e3 55%, #004ea8 100%);
  border-color: rgb(255 255 255 / .5);
  box-shadow: 0 8px 18px rgb(0 113 227 / .24), inset 0 2px 3px rgb(255 255 255 / .45);
}
:root[data-theme="c"] .ball.miss {
  background: #eceef2;
  border-color: #dde0e6;
  color: #9b9fa8;
  box-shadow: none;
}
:root[data-theme="c"] .primary,
:root[data-theme="c"] .card-primary {
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 8px 20px rgb(0 0 0 / .14);
}
:root[data-theme="c"] .primary:hover:not(:disabled),
:root[data-theme="c"] .card-primary:hover { background: #000; }
:root[data-theme="c"] .secondary,
:root[data-theme="c"] .glass-pill {
  background: #fff;
  color: #1d1d1f;
  border: 1px solid rgb(0 0 0 / .1);
}
:root[data-theme="c"] .game-switch {
  background: #e8e8ed;
  border-color: transparent;
}
:root[data-theme="c"] .game-switch a { color: #515154; }
:root[data-theme="c"] .game-switch a[aria-current="page"] { background: #1d1d1f; color: #fff; }
:root[data-theme="c"] .section-nav {
  background: rgb(255 255 255 / .84);
  border: 1px solid rgb(0 0 0 / .07);
  box-shadow: 0 12px 32px rgb(0 0 0 / .12);
}
:root[data-theme="c"] .section-nav a { color: #6e6e73; }
:root[data-theme="c"] .section-nav a[aria-current="page"] { background: #1d1d1f; color: #fff; box-shadow: none; }
:root[data-theme="c"] .section-nav a[aria-current="page"] svg { color: #fff; }
:root[data-theme="c"] .tickets li,
:root[data-theme="c"] .method-choice,
:root[data-theme="c"] .method-desc,
:root[data-theme="c"] .mode-choices button,
:root[data-theme="c"] .freq-chip,
:root[data-theme="c"] .odds-grid > div,
:root[data-theme="c"] .ticket-draw-strip,
:root[data-theme="c"] .ticket-match-lines li {
  background: #f5f5f7;
  border: 1px solid rgb(0 0 0 / .06);
  color: #1d1d1f;
}
:root[data-theme="c"] .method-choice:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
:root[data-theme="c"] .fields input,
:root[data-theme="c"] .explore-controls :is(input, select),
:root[data-theme="c"] .ticket-numbers textarea {
  background: #fff;
  border: 1px solid rgb(0 0 0 / .14);
  color: #1d1d1f;
}
:root[data-theme="c"] .blessing,
:root[data-theme="c"] #ticket-result,
:root[data-theme="c"] .tarot {
  background: #fbf8f1;
  border: 1px solid rgb(185 130 30 / .28);
  color: #6b470c;
  box-shadow: 0 8px 24px rgb(0 0 0 / .05);
}
:root[data-theme="c"] .tarot-controls strong,
:root[data-theme="c"] #ticket-result h3 { color: #8c5500; }
:root[data-theme="c"] .sticky-actions { background: rgb(255 255 255 / .92); border-top-color: rgb(0 0 0 / .08); }
:root[data-theme="c"] .step-dot { background: #fff; border-color: rgb(0 0 0 / .18); }
:root[data-theme="c"] .archive-list li,
:root[data-theme="c"] .frequency-table :is(th, td) { border-color: rgb(0 0 0 / .08); }
:root[data-theme="c"] #ticket-awards,
:root[data-theme="c"] .audit ol,
:root[data-theme="c"] .explore h3 { color: #1d1d1f; }

/* ==========================================================================
   THEME D · 精密星仪 (hairline + ascii.rest Precision Instrument)
   ========================================================================== */
:root[data-theme="d"] {
  color-scheme: dark;
  --bg: #07090d;
  --ink: #e8edf5;
  --muted: #7f8b9d;
  --faint: #505b6d;
  --border: rgb(255 255 255 / .12);
  --border-strong: rgb(234 208 152 / .48);
  --accent: #ead098;
  --accent-ink: #07090d;
  --accent-soft: rgb(234 208 152 / .12);
  --accent-border: rgb(234 208 152 / .48);
  --beam-a: rgb(234 208 152 / .9);
  --beam-b: rgb(125 211 252 / .45);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, "PingFang SC", monospace;
}
:root[data-theme="d"] body {
  background-color: #07090d;
  background-image:
    linear-gradient(rgb(255 255 255 / .035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .035) 1px, transparent 1px);
  background-size: 28px 28px;
}
:root[data-theme="d"] .game-card,
:root[data-theme="d"] .panel,
:root[data-theme="d"] .section-nav,
:root[data-theme="d"] .game-switch,
:root[data-theme="d"] .primary,
:root[data-theme="d"] .secondary,
:root[data-theme="d"] .card-primary,
:root[data-theme="d"] .card-secondary,
:root[data-theme="d"] .method-choice,
:root[data-theme="d"] .tickets li,
:root[data-theme="d"] .freq-chip,
:root[data-theme="d"] .odds-grid > div,
:root[data-theme="d"] .blessing,
:root[data-theme="d"] #ticket-result,
:root[data-theme="d"] .tarot,
:root[data-theme="d"] .mode-choices button {
  border-radius: 3px;
}
:root[data-theme="d"] .game-card,
:root[data-theme="d"] .panel {
  background: rgb(9 12 18 / .84);
  box-shadow: none;
}
:root[data-theme="d"] .ball {
  background: rgb(255 78 108 / .12);
  border: 1px solid rgb(255 138 156 / .68);
  color: #ffa2b0;
  text-shadow: none;
  box-shadow: 0 0 12px rgb(255 78 108 / .22);
}
:root[data-theme="d"] .ball.back {
  background: rgb(56 178 248 / .12);
  border: 1px solid rgb(124 212 255 / .72);
  color: #8ad8ff;
  box-shadow: 0 0 12px rgb(56 178 248 / .24);
}
:root[data-theme="d"] .ball.hit {
  background: #ff4e6c;
  color: #000;
  border-color: #fff;
}
:root[data-theme="d"] .ball.back.hit {
  background: #58c0ff;
  color: #000;
  border-color: #fff;
}
:root[data-theme="d"] .primary,
:root[data-theme="d"] .card-primary {
  background: rgb(234 208 152 / .14);
  color: #f6e4bc;
  border: 1px solid rgb(234 208 152 / .7);
  box-shadow: 0 0 22px rgb(234 208 152 / .14);
  letter-spacing: .12em;
}
:root[data-theme="d"] .primary:hover:not(:disabled),
:root[data-theme="d"] .card-primary:hover {
  background: rgb(234 208 152 / .24);
}
:root[data-theme="d"] .game-switch a[aria-current="page"],
:root[data-theme="d"] .section-nav a[aria-current="page"] {
  background: rgb(234 208 152 / .16);
  color: #f4dfad;
  border: 1px solid rgb(234 208 152 / .42);
  border-radius: 2px;
}
