:root {
  --page-background: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #edf3f7;
  --text: #17212b;
  --muted: #64717d;
  --border: #dbe2e8;

  --primary: #075985;
  --primary-dark: #0c4a6e;
  --primary-light: #e0f2fe;

  --green: #07833e;
  --green-light: #f1f9ef;

  --shadow: 0 10px 30px rgba(20, 35, 50, 0.08);
  --radius: 16px;
  --container: 1080px;
}

/* =========================================================
   基本設定
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page-background);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans TC",
    sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

img {
  max-width: 100%;
}

.container {
  width: min(calc(100% - 32px), var(--container));
  margin-inline: auto;
}

/* =========================================================
   頁首導覽
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(219, 226, 232, 0.9);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: #095aa4;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.main-nav a {
  padding: 22px 0 18px;
  border-bottom: 3px solid transparent;
  color: #172b46;
  font-size: 0.98rem;
  font-weight: 800;
  text-decoration: none;
}

.main-nav a:hover {
  color: #dc2626;
  border-bottom-color: #dc2626;
}

/* =========================================================
   首頁主視覺
   ========================================================= */

.hero {
  padding: 72px 0 64px;
  color: #ffffff;
  background:
    radial-gradient(
      circle at 82% 28%,
      rgba(92, 210, 255, 0.28),
      transparent 26%
    ),
    linear-gradient(135deg, #0560bd, #003f91);
}

.hero-inner {
  max-width: 1080px;
}

.hero h1 {
  max-width: 760px;
  margin: 10px 0 14px;
  font-size: clamp(2.15rem, 6vw, 4rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.hero-text {
  max-width: 700px;
  margin: 0;
  color: #ffe61a;
  font-size: clamp(1.05rem, 2.5vw, 1.55rem);
  font-weight: 800;
}

.hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #bae6fd;
  font-size: 1.35rem;
}

.button {
  min-height: 46px;
  padding: 10px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button-light {
  color: #ffffff;
  background: #ef2727;
}

.button-outline {
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #ffffff;
  background: transparent;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

/* =========================================================
   通用區塊
   ========================================================= */

.section {
  padding: 58px 0;
}

.section-alt {
  background: var(--surface-alt);
}

.section-heading {
  margin-bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.2;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* =========================================================
   最新開獎
   ========================================================= */

#latest {
  background: #ffffff;
}

#latest .container {
  width: min(calc(100% - 24px), 1160px);
}

#latest .section-heading {
  margin-bottom: 0;
  padding: 12px 18px;
  align-items: center;
  color: #ffffff;
  background: linear-gradient(90deg, #07833e, #079447);
  border-radius: 12px 12px 0 0;
}

#latest .section-heading .eyebrow {
  display: none;
}

#latest .section-heading h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.35rem;
}

#latest .section-heading h2::before {
  content: "★";
  margin-right: 9px;
}

#latest .status {
  color: rgba(255, 255, 255, 0.94);
  font-weight: 700;
}

.lottery-list {
  display: block;
  overflow: hidden;
  border: 1px solid #8cc899;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #ffffff;
}

.lottery-row {
  min-height: 126px;
  padding: 16px 22px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid #a7d2ae;
  background:
    linear-gradient(
      90deg,
      #ffffff 0%,
      #ffffff 64%,
      var(--green-light) 100%
    );
}

.lottery-row:last-child {
  border-bottom: 0;
}

/* 彩種標示 */

.lottery-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lottery-mark {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(145deg, #146fc2, #073b82);
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.lottery-name {
  color: #153c69;
  font-size: 1.35rem;
  font-weight: 900;
  white-space: nowrap;
}

.lottery-638 .lottery-mark {
  background: linear-gradient(145deg, #20ae62, #08743d);
}

.lottery-638 .lottery-name {
  color: #dc2626;
}

.lottery-539 .lottery-mark {
  background: linear-gradient(145deg, #ff9b18, #ed4c14);
}

.lottery-539 .lottery-name {
  color: #f05a16;
}

.lottery-4d .lottery-mark,
.lottery-3d .lottery-mark {
  border-radius: 18px;
  background: linear-gradient(145deg, #a95ce4, #6421b7);
}

.lottery-4d .lottery-name,
.lottery-3d .lottery-name {
  color: #6526a8;
}

/* 期數與日期 */

.lottery-content {
  min-width: 0;
}

.lottery-information {
  margin-bottom: 10px;
}

.lottery-period {
  color: #111827;
  font-size: 1.08rem;
  font-weight: 900;
}

.lottery-date {
  margin-top: 2px;
  color: #374151;
  font-size: 0.96rem;
}

/* =========================================================
   彩球
   ========================================================= */

.draw-numbers {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
}

.draw-number {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #101010;
  font-size: 1.07rem;
  font-weight: 900;
  box-shadow:
    inset 0 -5px 8px rgba(0, 0, 0, 0.08),
    0 3px 7px rgba(0, 0, 0, 0.12);
}

/* 01～09：粉紅紅色 */

.ball-01-09 {
  background:
    linear-gradient(
      145deg,
      #ff9fa8,
      #f26472
    );
}

/* 10～19：橘黃色 */

.ball-10-19 {
  background:
    linear-gradient(
      145deg,
      #ffd36d,
      #f4a52f
    );
}

/* 20～29：綠色 */

.ball-20-29 {
  background:
    linear-gradient(
      145deg,
      #7be477,
      #39bd4b
    );
}

/* 30～39：青藍色 */

.ball-30-39 {
  background:
    linear-gradient(
      145deg,
      #65e8ef,
      #20c3d9
    );
}

/* 40～49：紫色 */

.ball-40-49 {
  background:
    linear-gradient(
      145deg,
      #c7a7f8,
      #9369df
    );
}

.ball-default {
  background:
    linear-gradient(
      145deg,
      #d1d5db,
      #9ca3af
    );
}

.number-plus {
  flex: 0 0 auto;
  margin-inline: 2px;
  color: #111827;
  font-size: 1.55rem;
  font-weight: 900;
}

/* 星彩 */

.star-number {
  width: 55px;
  height: 55px;
  flex-basis: 55px;
  border-radius: 0;
  color: #fff337;
  background: linear-gradient(145deg, #b66aff, #6624d4);
  clip-path: polygon(
    50% 0%,
    61% 34%,
    98% 35%,
    68% 56%,
    79% 94%,
    50% 72%,
    21% 94%,
    32% 56%,
    2% 35%,
    39% 34%
  );
  box-shadow: none;
}

/* =========================================================
   數據分析
   ========================================================= */

#analysis .container {
  width: min(calc(100% - 24px), 1160px);
}

#analysis .section-heading {
  margin-bottom: 0;
  padding: 11px 18px;
  color: #ffffff;
  background: linear-gradient(90deg, #0758bd, #0565c9);
  border-radius: 12px 12px 0 0;
}

#analysis .section-heading .eyebrow {
  display: none;
}

#analysis .section-heading h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.3rem;
}

.analysis-panel {
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
  align-items: center;
  gap: 32px;
  border: 1px solid #9ec0ed;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background:
    linear-gradient(
      120deg,
      #ffffff,
      #edf5ff
    );
}

.analysis-copy h3 {
  margin: 10px 0;
  color: #0758bd;
  font-size: 1.65rem;
}

.analysis-copy p {
  max-width: 600px;
  margin: 0;
  color: #34465e;
}

.analysis-label {
  padding: 4px 10px;
  border-radius: 999px;
  color: #0758bd;
  background: #dbeafe;
  font-size: 0.78rem;
  font-weight: 900;
}

.period-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.period-options button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #377ee0;
  border-radius: 8px;
  color: #0758bd;
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.period-options button:hover {
  color: #ffffff;
  background: #0758bd;
}

.analysis-panel > .button {
  grid-column: 2;
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #0767cf, #004ba6);
}

/* =========================================================
   彩券分析程式
   ========================================================= */

#software .container {
  width: min(calc(100% - 24px), 1160px);
}

#software .section-heading {
  margin-bottom: 0;
  padding: 11px 18px;
  color: #ffffff;
  background: linear-gradient(90deg, #762bc0, #6320b4);
  border-radius: 12px 12px 0 0;
}

#software .section-heading .eyebrow {
  display: none;
}

#software .section-heading h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.3rem;
}

.software-intro {
  padding: 28px 30px;
  border: 1px solid #cbb8e8;
  border-top: 0;
  background:
    linear-gradient(
      120deg,
      #ffffff,
      #f3edff
    );
}

.software-copy {
  max-width: 820px;
}

.software-tag {
  padding: 5px 11px;
  display: inline-flex;
  border-radius: 999px;
  color: #6520b3;
  background: #eee2ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.software-copy h3 {
  margin: 10px 0 8px;
  color: #552099;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.software-copy p {
  margin: 6px 0;
  color: #4b5563;
}

.software-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  border: 1px solid #cbb8e8;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: #f8f4fd;
}

.info-card {
  position: relative;
  min-height: 225px;
  padding: 24px;
  border: 1px solid #d9dce2;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(25, 45, 70, 0.07);
}

.card-number {
  width: 43px;
  height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: #22a447;
  font-size: 1.1rem;
  font-weight: 900;
}

.info-card:nth-child(2) .card-number {
  background: #1f97d4;
}

.info-card h3 {
  margin: 18px 0 8px;
  color: #172b46;
  font-size: 1.35rem;
}

.info-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.software-list,
.install-steps {
  margin: 16px 0 0;
  padding-left: 22px;
  color: #4b5563;
}

.software-list li,
.install-steps li {
  margin: 7px 0;
}

.trial-highlight {
  margin: 12px 0 16px !important;
  padding: 9px 14px;
  border-left: 5px solid #ef2727;
  color: #b91c1c !important;
  background: #fff1f1;
  font-size: 1.08rem;
  font-weight: 900;
}

.software-download-button {
  width: 100%;
  min-height: 50px;
  margin-top: 20px;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #ffffff;
  background:
    linear-gradient(
      90deg,
      #7029c4,
      #4e17a3
    );
  box-shadow: 0 8px 18px rgba(99, 32, 180, 0.22);
  font-weight: 900;
  text-decoration: none;
  pointer-events: auto;
}

/* =========================================================
   購買方式
   ========================================================= */

.purchase-section {
  margin-top: 18px;
  border: 1px solid #d6c3eb;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.purchase-title {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #ffffff;
  background: linear-gradient(90deg, #762bc0, #6320b4);
}

.purchase-number {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: #fb9800;
  font-size: 1.05rem;
  font-weight: 900;
}

.purchase-title h3 {
  margin: 0;
  font-size: 1.35rem;
}

.purchase-title p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.84);
}

.purchase-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  background: #faf8fd;
}

.purchase-grid .purchase-method {
  margin: 0;
  padding: 20px;
  border: 1px solid #ddd7e5;
  border-radius: 9px;
  background: #ffffff;
}

.purchase-grid .purchase-method strong {
  display: block;
  margin-bottom: 10px;
  color: #d62121;
  font-size: 1.05rem;
}

.purchase-grid .purchase-method p {
  margin: 5px 0;
  color: #374151;
}

.purchase-grid .purchase-method b {
  color: #ef1616;
  font-size: 1.05rem;
}

.purchase-phone a {
  padding: 0;
  border: 0;
  color: #ef1616;
  font-size: 1.15rem;
  font-weight: 900;
  text-decoration: none;
  pointer-events: auto;
}

/* =========================================================
   頁尾
   ========================================================= */

.site-footer {
  padding: 24px 0;
  color: #d5e2ea;
  background: linear-gradient(90deg, #062948, #001d3a);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.site-footer p {
  margin: 0;
}

/* =========================================================
   錯誤訊息
   ========================================================= */

.error-message {
  padding: 20px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #991b1b;
  background: #fef2f2;
}

/* =========================================================
   平板
   ========================================================= */

@media (max-width: 820px) {
  .analysis-panel {
    grid-template-columns: 1fr;
  }

  .analysis-panel > .button {
    grid-column: auto;
  }

  .software-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   手機
   ========================================================= */

@media (max-width: 720px) {
  .container {
    width: min(calc(100% - 20px), var(--container));
  }

  .header-inner {
    min-height: 60px;
  }

  .brand {
    font-size: 1.35rem;
  }

  .main-nav {
    gap: 14px;
  }

  .main-nav a {
    padding: 18px 0 14px;
    font-size: 0.82rem;
  }

  .hero {
    padding: 48px 0 44px;
  }

  .hero h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero-text {
    font-size: 1.02rem;
  }

  .section {
    padding: 42px 0;
  }

  #latest .container,
  #analysis .container,
  #software .container {
    width: min(calc(100% - 12px), 1160px);
  }

  #latest .section-heading {
    padding: 10px 12px;
  }

  #latest .section-heading h2 {
    font-size: 1.12rem;
  }

  #latest .status {
    font-size: 0.75rem;
  }

  .lottery-row {
    min-height: 122px;
    padding: 12px 10px;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .lottery-identity {
    display: block;
    text-align: center;
  }

  .lottery-mark {
    width: 43px;
    height: 43px;
    min-width: 43px;
    margin: 0 auto;
    font-size: 0.66rem;
  }

  .lottery-name {
    margin-top: 4px;
    display: block;
    font-size: 0.77rem;
  }

  .lottery-information {
    margin-bottom: 8px;
  }

  .lottery-period {
    font-size: 0.82rem;
  }

  .lottery-date {
    font-size: 0.74rem;
  }

  .draw-numbers {
    width: 100%;
    gap: 4px;
  }

  .draw-number {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    font-size: 0.76rem;
  }

  .number-plus {
    margin-inline: 0;
    font-size: 0.9rem;
  }

  .star-number {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .analysis-panel {
    padding: 22px;
    gap: 22px;
  }

  .period-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .software-intro {
    padding: 22px 18px;
  }

  .purchase-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .purchase-title {
    padding: 15px 16px;
  }

  .purchase-grid .purchase-method {
    padding: 17px;
  }

  .purchase-phone a {
    font-size: 1rem;
  }

  .footer-inner {
    text-align: center;
    flex-direction: column;
    gap: 4px;
  }
}

/* =========================================================
   較窄手機
   ========================================================= */

@media (max-width: 430px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
  }

  .main-nav a {
    white-space: nowrap;
  }

  .lottery-row {
    grid-template-columns: 70px minmax(0, 1fr);
    padding-inline: 6px;
    gap: 5px;
  }

  .lottery-mark {
    width: 37px;
    height: 37px;
    min-width: 37px;
    font-size: 0.59rem;
  }

  .lottery-name {
    font-size: 0.68rem;
  }

  .lottery-period {
    font-size: 0.72rem;
  }

  .lottery-date {
    font-size: 0.65rem;
  }

  .draw-numbers {
    gap: 3px;
  }

  .draw-number {
    width: 27px;
    height: 27px;
    flex-basis: 27px;
    font-size: 0.67rem;
  }

  .number-plus {
    font-size: 0.78rem;
  }

  .star-number {
    width: 33px;
    height: 33px;
    flex-basis: 33px;
  }

  .period-options {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   極窄手機
   ========================================================= */

@media (max-width: 350px) {
  .lottery-row {
    grid-template-columns: 60px minmax(0, 1fr);
    padding-inline: 4px;
    gap: 3px;
  }

  .lottery-mark {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .lottery-name {
    font-size: 0.62rem;
  }

  .draw-numbers {
    gap: 2px;
  }

  .draw-number {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    font-size: 0.59rem;
  }

  .number-plus {
    font-size: 0.68rem;
  }

  .star-number {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
}
/* =========================================================
   彩券官方圖示
   ========================================================= */

.lottery-logo {
  width: 76px;
  height: auto;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

@media (max-width: 720px) {
  .lottery-logo {
    width: 66px;
    margin: 0 auto;
  }
}

@media (max-width: 430px) {
  .lottery-logo {
    width: 62px;
  }
}

@media (max-width: 350px) {
  .lottery-logo {
    width: 55px;
  }
}
/* =========================================================
   彩券 GIF Logo
   ========================================================= */

.lottery-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.lottery-logo {
  width: 150px;
  height: auto;
  max-height: 92px;
  display: block;
  object-fit: contain;
}

.lottery-name {
  display: block;
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.15;
  font-weight: 900;
}

/* 大樂透 GIF 本身已有名稱，避免重複 */

.lottery-649 .lottery-name {
  display: none;
}

@media (max-width: 720px) {
  .lottery-row {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .lottery-logo {
    width: 112px;
    max-height: 72px;
  }

  .lottery-name {
    font-size: 0.82rem;
  }
}

@media (max-width: 430px) {
  .lottery-row {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .lottery-logo {
    width: 90px;
    max-height: 62px;
  }

  .lottery-name {
    font-size: 0.72rem;
  }
}

@media (max-width: 350px) {
  .lottery-row {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .lottery-logo {
    width: 78px;
    max-height: 54px;
  }

  .lottery-name {
    font-size: 0.66rem;
  }
}
/* GIF 已包含彩券名稱，隱藏額外文字 */

.lottery-name {
  display: none !important;
}
/* =========================================================
   今彩539 數據分析卡
   ========================================================= */

.analysis-card {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.analysis-card-header {
  margin-bottom: 28px;
}

.analysis-card-header h3 {
  margin: 10px 0 6px;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.analysis-card-header p {
  margin: 0;
  color: var(--muted);
}

.analysis-highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.analysis-highlight {
  display: flex;
  min-height: 220px;
  padding: 28px;
  border-radius: 20px;
  background: var(--background);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.analysis-metric-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.analysis-hot-number,
.analysis-percent {
  display: block;
  margin: 12px 0 6px;
  line-height: 1;
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 900;
}

.analysis-hot-number {
  font-variant-numeric: tabular-nums;
}

.analysis-percent {
  font-size: clamp(2.8rem, 7vw, 5rem);
}

.analysis-metric-value {
  color: var(--muted);
  font-size: 1rem;
}

.analysis-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.analysis-detail {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.analysis-detail span,
.analysis-detail strong {
  display: block;
}

.analysis-detail span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.analysis-detail strong {
  font-size: 1.15rem;
}

.analysis-explanation {
  padding: 22px;
  border-radius: 16px;
  background: var(--background);
  line-height: 1.8;
}

.analysis-explanation p {
  margin: 0;
}

.analysis-judgement {
  display: flex;
  margin-top: 18px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.analysis-judgement span {
  color: var(--muted);
  font-weight: 700;
}

.analysis-judgement strong {
  font-size: 1.2rem;
}

.analysis-notice {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .analysis-card {
    padding: 22px;
  }

  .analysis-highlight-grid {
    grid-template-columns: 1fr;
  }

  .analysis-highlight {
    min-height: 190px;
  }

  .analysis-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .analysis-card {
    padding: 18px;
    border-radius: 18px;
  }

  .analysis-highlight {
    min-height: 170px;
    padding: 22px 16px;
  }

  .analysis-detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .analysis-detail {
    padding: 14px;
  }

  .analysis-judgement {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* =========================================================
   數據分析頁籤
   ========================================================= */

.analysis-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.analysis-tab {
  flex: 0 0 auto;
  padding: 11px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.analysis-tab:hover {
  color: var(--text);
}

.analysis-tab.is-active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.analysis-tab:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 430px) {
  .analysis-tabs {
    margin-inline: -4px;
    padding: 4px;
  }

  .analysis-tab {
    padding: 10px 17px;
    font-size: 0.9rem;
  }
}  }
}
/* =========================================================
   Two-level lottery analysis tabs
   ========================================================= */

.analysis-lottery-tabs {
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

@media (min-width: 431px) {
  .analysis-lottery-tabs {
    margin-top: 18px;
    margin-bottom: 18px;
  }
}

.analysis-lottery-tab {
  min-width: 112px;
  border-radius: 12px;
  color: var(--primary-dark);
}

.analysis-lottery-tab.is-active {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.analysis-topic-tabs {
  margin-bottom: 18px;
}

.analysis-topic-tabs[hidden] {
  display: none !important;
}

.analysis-topic-tabs .analysis-tabs {
  margin-bottom: 0;
}

.analysis-tabs {
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
}

.analysis-tab {
  scroll-snap-align: start;
}

/* Position-frequency cards */
.position-frequency-card .analysis-highlight-grid {
  grid-template-columns: minmax(0, 3fr) minmax(190px, 1fr);
  align-items: stretch;
}

.position-frequency-panel {
  min-height: 220px;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
}

.position-frequency-list {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.position-frequency-item {
  display: flex;
  min-height: 132px;
  padding: 14px 10px;
  border: 1px solid #cfe0f5;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #edf5ff);
  box-shadow: 0 8px 20px rgba(7, 88, 189, 0.08);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.position-frequency-name {
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcecff;
  color: #0758bd;
  font-size: 0.82rem;
  font-weight: 800;
}

.position-frequency-digit {
  margin: 8px 0 4px;
  color: #102033;
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.position-frequency-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.position-frequency-expectation {
  border: 1px solid #c8dcf5;
  background: linear-gradient(145deg, #f4f9ff, #dcecff);
}

.position-frequency-expected-value {
  display: block;
  margin: 18px 0 8px;
  color: #0758bd;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.position-frequency-loading {
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 620px) {
  .position-frequency-card .analysis-highlight-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .position-frequency-panel,
  .position-frequency-expectation {
    min-height: 0;
  }

  .position-frequency-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #analysis-3d-position .position-frequency-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .position-frequency-item {
    min-height: 116px;
  }
}
@media (max-width: 430px) {
  .analysis-lottery-tabs {
    margin-bottom: 8px;
    padding: 4px;
  }

  .analysis-lottery-tabs,
  .analysis-topic-tabs .analysis-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow-x: hidden;
    scrollbar-width: none;
  }

  .analysis-lottery-tabs::-webkit-scrollbar,
  .analysis-topic-tabs .analysis-tabs::-webkit-scrollbar {
    display: none;
  }

  .analysis-tab {
    width: 100%;
    min-width: 0;
    padding: 9px 3px;
    font-size: clamp(0.68rem, 2.8vw, 0.8rem);
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .analysis-lottery-tab {
    min-width: 0;
  }

  .analysis-topic-tabs {
    margin-inline: 0;
  }
}
