:root {
  color-scheme: dark;
  --bg: #0b0e20;
  --surface: rgba(21, 25, 51, 0.88);
  --surface-solid: #151933;
  --surface-high: #1c2142;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f8f6ed;
  --muted: #a8adc6;
  --gold: #f4cf75;
  --gold-bright: #ffe8a6;
  --pink: #ff6b91;
  --purple: #a889ff;
  --cyan: #67d8d0;
  --blue: #68a7ff;
  --danger: #ff8099;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(133, 99, 230, 0.2), transparent 42%),
    linear-gradient(180deg, #0f1229 0%, var(--bg) 48%, #090b19 100%);
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(244, 207, 117, 0.62);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.12;
  pointer-events: none;
}
.ambient-one { top: 20%; left: -180px; background: var(--purple); }
.ambient-two { top: 54%; right: -190px; background: var(--pink); }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  padding: max(12px, env(safe-area-inset-top)) max(24px, calc((100vw - 1180px) / 2)) 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 32, 0.78);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(244, 207, 117, 0.55);
  border-radius: 50%;
  color: #171a34;
  background: var(--gold);
  box-shadow: 0 0 32px rgba(244, 207, 117, 0.16);
  font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: 0.18em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }

.desktop-nav {
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}
.nav-link {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  transition: 180ms ease;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: #161a33; background: var(--gold); font-weight: 700; }

.install-button {
  justify-self: end;
  padding: 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 88px;
}
[hidden] { display: none !important; }

.notice, .data-banner {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.notice { margin-bottom: 18px; padding: 16px; }
.notice.error { border-color: rgba(255, 107, 145, 0.35); color: #ffc1d0; }

.data-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 16px;
}
.data-banner-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #0f2d2b;
  background: var(--cyan);
  font-size: 13px;
  font-weight: 800;
}
.data-banner.loading .data-banner-icon { color: #2b2245; background: var(--purple); animation: pulse 1.4s infinite; }
.data-banner.error { border-color: rgba(255, 107, 145, 0.34); }
.data-banner.error .data-banner-icon { color: #3b1220; background: var(--danger); }
.data-banner strong { font-size: 13px; }
.data-banner > div:nth-child(2),
.hero-copy,
.hero-action,
.section-heading > div,
.page-heading > div,
.heat-panel-heading > div,
.ticket-grid,
.ticket-card,
.record-title {
  min-width: 0;
}
.data-banner p { margin: 3px 0 0; color: var(--muted); overflow-wrap: anywhere; font-size: 12px; }

.text-button {
  padding: 8px 10px;
  border: 0;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.text-button:disabled { opacity: 0.5; cursor: wait; }

.ios-install-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(104, 167, 255, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(104, 167, 255, 0.08);
}
.ios-install-card[hidden] { display: none; }
.ios-install-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: #151933; background: var(--gold); font-weight: 800; }
.ios-install-card strong { font-size: 13px; }
.ios-install-card p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.daily-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 30px;
  padding: 28px 30px;
  border: 1px solid rgba(244, 207, 117, 0.2);
  border-radius: var(--radius-lg);
  background: linear-gradient(112deg, rgba(28, 33, 66, 0.98), rgba(43, 29, 63, 0.94));
  box-shadow: var(--shadow);
}
.daily-copy { min-width: 0; }
.daily-copy h1 { margin-bottom: 7px; font-size: clamp(28px, 3.2vw, 42px); letter-spacing: -0.04em; }
.daily-copy > p { margin-bottom: 17px; color: #c3c6d7; font-size: 13px; line-height: 1.7; }
.daily-action { display: flex; min-width: 225px; flex-direction: column; align-items: center; gap: 9px; }
.daily-action small { max-width: 230px; color: var(--muted); text-align: center; font-size: 9px; line-height: 1.5; }
.strategy-inline { display: flex; flex-wrap: wrap; gap: 7px; }
.strategy-inline span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.strategy-inline b { margin-right: 2px; color: var(--text); font-family: 'Space Grotesk', sans-serif; }
.strategy-inline .pure b { color: var(--cyan); }
.strategy-inline .hot b { color: var(--pink); }
.strategy-inline .coverage b { color: var(--blue); }

.personal-numbers-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(19, 23, 47, 0.72);
}
.personal-numbers-card summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 17px 20px;
  cursor: pointer;
  list-style: none;
}
.personal-numbers-card summary::-webkit-details-marker { display: none; }
.personal-numbers-card summary::after { margin-left: 0; color: var(--gold); content: '＋'; }
.personal-numbers-card[open] summary::after { content: '－'; }
.personal-numbers-card summary > span:first-child { min-width: 0; flex: 1; }
.personal-numbers-card summary .eyebrow { margin-bottom: 4px; font-size: 9px; }
.personal-numbers-card summary strong { font-size: 15px; }
.personal-summary { color: var(--muted); font-size: 10px; text-align: right; }
.personal-numbers-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding: 20px;
  border-top: 1px solid var(--line);
}
.personal-controls { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.personal-mode { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.025); }
.personal-mode button { padding: 9px 8px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.personal-mode button.fixed.active { color: #171a34; background: var(--gold); font-weight: 700; }
.personal-mode button[data-pick-mode='preferred'].active { color: #fff; background: rgba(255, 107, 145, 0.72); font-weight: 700; }
.personal-controls > p { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.selection-legend { display: grid; gap: 7px; margin-top: 15px; color: var(--muted); font-size: 9px; }
.selection-legend span { display: flex; align-items: center; gap: 7px; }
.selection-legend i { width: 10px; height: 10px; border: 2px solid var(--gold); border-radius: 50%; }
.selection-legend i.preferred { border-color: var(--pink); }
.personal-controls .selection-warning.caution { color: var(--gold-bright); }
.clear-selection { margin-top: auto; padding: 12px 0 2px; }
.personal-number-grid { display: grid; grid-template-columns: repeat(10, minmax(32px, 1fr)); gap: 8px; align-content: start; }
.personal-number-button {
  display: grid;
  width: 100%;
  max-width: 44px;
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
}
.personal-number-button:hover { color: var(--text); border-color: rgba(244, 207, 117, 0.5); }
.personal-number-button.selected-fixed { color: #171a34; border-color: var(--gold-bright); background: var(--gold); box-shadow: 0 0 0 3px rgba(244, 207, 117, 0.13); }
.personal-number-button.selected-preferred { color: #fff; border-color: #ffabc1; background: rgba(255, 107, 145, 0.7); box-shadow: 0 0 0 3px rgba(255, 107, 145, 0.1); }

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid rgba(244, 207, 117, 0.2);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(112deg, rgba(28, 33, 66, 0.98) 0%, rgba(26, 27, 55, 0.94) 56%, rgba(43, 29, 63, 0.96) 100%);
  box-shadow: var(--shadow);
}
.hero-card::after {
  position: absolute;
  right: -70px;
  bottom: -150px;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(244, 207, 117, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 0 36px rgba(244, 207, 117, 0.03), 0 0 0 74px rgba(244, 207, 117, 0.02);
  content: '';
}
.hero-copy, .hero-action { position: relative; z-index: 1; }
.hero-copy { align-self: center; padding: 42px 44px; }
.eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--gold);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
.hero-copy h1, .page-heading h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}
.hero-copy p { max-width: 650px; margin-bottom: 24px; color: #c3c6d7; line-height: 1.8; }
.budget-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--gold-bright); font-size: 12px; font-weight: 600; }
.budget-line i { width: 3px; height: 3px; border-radius: 50%; background: rgba(244, 207, 117, 0.55); }

.hero-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 42px 42px 42px 10px;
}
.hero-action small { max-width: 210px; color: var(--muted); text-align: center; line-height: 1.6; }

.primary-button, .secondary-button {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.primary-button {
  border: 1px solid rgba(255, 239, 180, 0.65);
  color: #171a34;
  background: var(--gold);
  box-shadow: 0 12px 30px rgba(244, 207, 117, 0.18);
}
.primary-button:not(:disabled):hover, .secondary-button:not(:disabled):hover { transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.42; box-shadow: none; }
.secondary-button { border: 1px solid var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.035); }
.button-spark { margin-right: 7px; }

.strategy-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0 46px;
}
.strategy-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(19, 23, 47, 0.74);
}
.strategy-card::before { width: 4px; height: 38px; border-radius: 999px; background: var(--cyan); content: ''; }
.strategy-card.hot::before { background: var(--pink); }
.strategy-card.coverage::before { background: var(--blue); }
.strategy-count { color: var(--muted); font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.strategy-card strong, .strategy-card small { display: block; }
.strategy-card strong { font-size: 14px; }
.strategy-card small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.section-heading, .page-heading, .heat-panel-heading, .records-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.results-section { margin-top: 32px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2, .heat-panel-heading h2, .ranking-card h2 { margin-bottom: 0; font-size: 22px; }
.generated-time, .range-copy { color: var(--muted); font-size: 12px; }

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ticket-grid.empty { display: block; }
.empty-state {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  background: rgba(18, 22, 44, 0.44);
}
.empty-state > span { margin-bottom: 12px; color: var(--gold); font-family: 'Space Grotesk', sans-serif; font-size: 32px; }
.empty-state strong { color: var(--text); }
.empty-state p { margin: 7px 0 0; font-size: 12px; }
.empty-state.compact { min-height: 260px; }

.ticket-card {
  position: relative;
  overflow: hidden;
  padding: 19px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(25, 30, 59, 0.92), rgba(17, 21, 43, 0.92));
  animation: ticket-in 360ms both;
}
.ticket-card:nth-child(2) { animation-delay: 35ms; }
.ticket-card:nth-child(3) { animation-delay: 70ms; }
.ticket-card:nth-child(4) { animation-delay: 105ms; }
.ticket-card:nth-child(5) { animation-delay: 140ms; }
.ticket-card:nth-child(6) { animation-delay: 175ms; }
.ticket-card:nth-child(7) { animation-delay: 210ms; }
.ticket-card:nth-child(8) { animation-delay: 245ms; }
.ticket-card:nth-child(9) { animation-delay: 280ms; }
.ticket-card:nth-child(10) { animation-delay: 315ms; }
.ticket-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--cyan); content: ''; }
.ticket-card.hot::before { background: var(--pink); }
.ticket-card.coverage::before { background: var(--blue); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.ticket-number { color: var(--muted); font-family: 'Space Grotesk', sans-serif; font-size: 12px; }
.strategy-badge { padding: 5px 9px; border-radius: 999px; color: var(--cyan); background: rgba(103, 216, 208, 0.09); font-size: 10px; font-weight: 700; }
.ticket-card.hot .strategy-badge { color: #ff9ab4; background: rgba(255, 107, 145, 0.09); }
.ticket-card.coverage .strategy-badge { color: #9bc5ff; background: rgba(104, 167, 255, 0.09); }
.ticket-balls { display: flex; gap: 8px; }
.ticket-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 9px; }
.ticket-foot strong { color: var(--gold-bright); font-weight: 600; }
.number-ball {
  display: grid;
  width: clamp(36px, 4vw, 43px);
  height: clamp(36px, 4vw, 43px);
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #171a34;
  background: #f7f3e7;
  box-shadow: inset 0 -4px 8px rgba(21, 25, 51, 0.11), 0 5px 12px rgba(0, 0, 0, 0.17);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
}
.number-ball.fixed-number { outline: 3px solid var(--gold); outline-offset: 2px; }
.number-ball.preferred-number { outline: 3px solid var(--pink); outline-offset: 2px; }
.receipt-constraint-note { display: flex; flex-wrap: wrap; gap: 7px; margin: -6px 0 16px; color: var(--muted); font-size: 10px; }
.receipt-constraint-note span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; }
.receipt-constraint-note .fixed { color: var(--gold-bright); border-color: rgba(244, 207, 117, 0.3); }
.receipt-constraint-note .preferred { color: #ffabc1; border-color: rgba(255, 107, 145, 0.3); }

.portfolio-audit, .heat-summary, .records-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}
.portfolio-audit article, .heat-summary article, .records-summary article { padding: 17px 20px; background: var(--surface-solid); }
.portfolio-audit small, .heat-summary small, .records-summary small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.portfolio-audit strong, .heat-summary strong, .records-summary strong { font-family: 'Space Grotesk', sans-serif; font-size: 22px; }
.portfolio-audit span, .heat-summary span { margin-left: 3px; color: var(--muted); font-size: 11px; }
.receipt-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.seal-button { min-width: 190px; }

.page-heading { min-height: 145px; padding: 20px 2px 30px; }
.page-heading h1 { margin-bottom: 8px; }
.page-heading p { margin-bottom: 0; color: var(--muted); }

.heat-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
}
.segmented-control { display: flex; gap: 4px; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 14px; }
.segmented-control legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.segmented-control button { padding: 9px 14px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.segmented-control button.active { color: var(--text); background: var(--surface-high); box-shadow: inset 0 0 0 1px var(--line); }

.heat-summary { margin: 0 0 16px; }
.heat-panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.heat-panel-heading { align-items: center; margin-bottom: 22px; }
.heat-panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.legend span { width: 9px; height: 9px; margin-left: 8px; border-radius: 3px; }
.legend .cool { background: rgba(104, 167, 255, 0.68); }
.legend .neutral { background: rgba(255, 255, 255, 0.18); }
.legend .warm { background: rgba(255, 107, 145, 0.82); }

.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.heat-cell {
  position: relative;
  min-height: 84px;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.heat-cell::after { position: absolute; inset: auto 0 0; height: 10%; background: #a8adc6; opacity: 0.2; content: ''; }
.heat-cell.warm::after { background: #ff6b91; }
.heat-cell.cool::after { background: #68a7ff; }
.heat-cell.fill-20::after { height: 20%; }
.heat-cell.fill-30::after { height: 30%; }
.heat-cell.fill-40::after { height: 40%; }
.heat-cell.fill-50::after { height: 50%; }
.heat-cell.fill-60::after { height: 60%; }
.heat-cell.fill-70::after { height: 70%; }
.heat-cell.fill-80::after { height: 80%; }
.heat-cell.fill-90::after { height: 90%; }
.heat-cell.fill-100::after { height: 100%; }
.heat-cell-number, .heat-cell-count, .heat-cell small { position: relative; z-index: 1; display: block; }
.heat-cell-number { color: var(--muted); font-family: 'Space Grotesk', sans-serif; font-size: 11px; }
.heat-cell-count { margin-top: 5px; font-family: 'Space Grotesk', sans-serif; font-size: 22px; }
.heat-cell small { margin-top: 1px; color: var(--muted); font-size: 9px; }

.rankings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.ranking-card { padding: 23px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(19, 23, 47, 0.72); }
.ranking-card h2 { margin-bottom: 17px; }
.ranking-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.ranking-ball { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #191c36; background: var(--gold); font-family: 'Space Grotesk', sans-serif; font-size: 11px; font-weight: 700; }
.cold-ranking .ranking-ball { color: var(--text); background: #303758; }
.ranking-meter { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
.ranking-meter i { display: block; width: 10%; height: 100%; border-radius: inherit; background: var(--pink); }
.ranking-meter i.width-20 { width: 20%; }
.ranking-meter i.width-30 { width: 30%; }
.ranking-meter i.width-40 { width: 40%; }
.ranking-meter i.width-50 { width: 50%; }
.ranking-meter i.width-60 { width: 60%; }
.ranking-meter i.width-70 { width: 70%; }
.ranking-meter i.width-80 { width: 80%; }
.ranking-meter i.width-90 { width: 90%; }
.ranking-meter i.width-100 { width: 100%; }
.cold-ranking .ranking-meter i { background: var(--blue); }
.ranking-row strong { font-family: 'Space Grotesk', sans-serif; font-size: 12px; }

.records-heading { align-items: center; }
.records-summary { grid-template-columns: repeat(4, 1fr); margin: 0 0 16px; }
.record-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.storage-status { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; }
.storage-status.persistent { color: var(--cyan); border-color: rgba(103, 216, 208, 0.28); }
.strategy-performance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.performance-note { grid-column: 1 / -1; margin: 0 2px 2px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.performance-card { padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(19, 23, 47, 0.72); }
.performance-card small, .performance-card strong, .performance-card span { display: block; }
.performance-card small { color: var(--muted); font-size: 9px; }
.performance-card strong { margin: 7px 0 3px; font-size: 16px; }
.performance-card span { color: var(--muted); font-size: 10px; }
.performance-card span + span { margin-top: 4px; }
.performance-card.pure { border-color: rgba(168, 173, 198, 0.22); }
.performance-card.hot { border-color: rgba(255, 107, 145, 0.25); }
.performance-card.coverage { border-color: rgba(103, 216, 208, 0.24); }
.net-negative { color: var(--pink) !important; }
.net-positive { color: var(--cyan) !important; }
.records-list { display: grid; gap: 12px; }
.record-card { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.record-card.integrity-invalid { border-color: rgba(255, 107, 145, 0.5); }
.record-card summary { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 19px 21px; cursor: pointer; list-style: none; }
.record-card summary::-webkit-details-marker { display: none; }
.record-card summary::after { content: '＋'; color: var(--muted); }
.record-card[open] summary::after { content: '－'; }
.record-title strong, .record-title small { display: block; }
.record-title small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.record-status { margin-left: auto; padding: 6px 10px; border-radius: 999px; color: var(--gold); background: rgba(244, 207, 117, 0.08); font-size: 10px; }
.record-status.checked { color: var(--cyan); background: rgba(103, 216, 208, 0.08); }
.record-status.winner { color: var(--gold); background: rgba(244, 207, 117, 0.12); }
.record-body { padding: 0 21px 20px; border-top: 1px solid var(--line); }
.record-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 14px 0; color: var(--muted); font-size: 10px; }
.integrity-badge { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; }
.integrity-badge.valid { color: var(--cyan); border-color: rgba(103, 216, 208, 0.3); }
.integrity-badge.invalid { color: var(--pink); border-color: rgba(255, 107, 145, 0.45); }
.integrity-badge.legacy, .integrity-badge.unavailable { color: var(--muted); }
.record-ticket { display: grid; grid-template-columns: 28px 92px 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.055); }
.record-ticket .mini-balls { display: flex; gap: 5px; }
.mini-ball { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #171a34; background: #f1eddf; font-family: 'Space Grotesk', sans-serif; font-size: 9px; font-style: normal; font-weight: 700; }
.mini-ball.fixed-number { outline: 2px solid var(--gold); outline-offset: 1px; }
.mini-ball.preferred-number { outline: 2px solid var(--pink); outline-offset: 1px; }
.record-ticket small { color: var(--muted); font-size: 9px; }
.match-result { color: var(--gold); font-size: 10px; font-weight: 700; }
.match-result.won { color: var(--cyan); }
.official-caveat { margin: 16px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.7; }

.method-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.method-card { min-height: 240px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.method-card.featured { grid-column: span 2; min-height: 220px; background: linear-gradient(120deg, rgba(38, 41, 78, 0.95), rgba(28, 27, 59, 0.94)); }
.method-card.caution { border-color: rgba(244, 207, 117, 0.28); }
.method-index { display: grid; width: 38px; height: 38px; margin-bottom: 28px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); font-family: 'Space Grotesk', sans-serif; font-size: 11px; }
.method-card h2 { font-size: 22px; }
.method-card p { margin-bottom: 0; color: var(--muted); line-height: 1.85; }
.method-card code { display: block; margin-top: 18px; padding: 14px; border-radius: 12px; color: var(--gold-bright); background: rgba(0, 0, 0, 0.16); font-family: 'Space Grotesk', sans-serif; font-size: 12px; }

.mobile-nav { display: none; }

.seal-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  color: var(--text);
  background: #171b38;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
}
.seal-dialog::backdrop { background: rgba(5, 7, 17, 0.74); backdrop-filter: blur(7px); }
.seal-dialog form { padding: 30px; text-align: center; }
.dialog-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 18px; place-items: center; border: 1px solid rgba(244, 207, 117, 0.4); border-radius: 50%; color: var(--gold); font-size: 24px; }
.seal-dialog h2 { margin-bottom: 10px; }
.seal-dialog p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.dialog-facts { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.dialog-facts span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 13px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #252b51;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 200ms ease;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 107, 145, 0.45); }

@keyframes pulse { 50% { transform: scale(0.88); opacity: 0.7; } }
@keyframes ticket-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .desktop-nav { display: none; }
  .hero-card { grid-template-columns: 1fr; }
  .daily-card { grid-template-columns: 1fr; gap: 20px; }
  .personal-numbers-body { grid-template-columns: 250px 1fr; }
  .daily-action { min-width: 0; align-items: flex-start; }
  .daily-action small { max-width: none; text-align: left; }
  .hero-action { align-items: flex-start; padding: 0 40px 38px; }
  .hero-action small { text-align: left; }
  .ticket-grid { grid-template-columns: 1fr; }
  .number-ball { width: 42px; height: 42px; }
  .heat-grid { grid-template-columns: repeat(5, 1fr); }
  .mobile-nav {
    position: fixed;
    z-index: 40;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: rgba(19, 23, 47, 0.93);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 3px; padding: 6px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 9px; }
  .mobile-nav button span { font-family: 'Space Grotesk', sans-serif; font-size: 16px; }
  .mobile-nav button.active { color: var(--gold); background: rgba(244, 207, 117, 0.08); }
  .toast { right: 16px; bottom: 92px; left: 16px; max-width: none; }
}

@media (max-width: 640px) {
  .site-header { min-height: calc(66px + env(safe-area-inset-top)); padding: max(10px, env(safe-area-inset-top)) 16px 10px; }
  .brand-mark { width: 38px; height: 38px; }
  .install-button { padding: 7px 10px; font-size: 10px; }
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 14px; }
  .data-banner { grid-template-columns: auto 1fr; padding: 12px; }
  .data-banner .text-button { grid-column: 2; justify-self: start; padding: 2px 0; }
  .ios-install-card { grid-template-columns: auto 1fr; padding: 12px; }
  .ios-install-card .text-button { grid-column: 2; justify-self: start; padding: 2px 0; }
  .daily-card { padding: 24px 20px; }
  .personal-numbers-card summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 15px; }
  .personal-numbers-card summary::after { grid-column: 2; grid-row: 1; }
  .personal-summary { grid-column: 1 / -1; text-align: left; }
  .personal-numbers-body { grid-template-columns: 1fr; gap: 18px; padding: 16px 14px 18px; }
  .personal-number-grid { grid-template-columns: repeat(7, 1fr); gap: 7px; }
  .personal-number-button { max-width: 40px; }
  .daily-copy h1 { font-size: 32px; }
  .daily-action .primary-button { width: 100%; }
  .strategy-inline span { font-size: 9px; }
  .hero-copy { padding: 31px 24px 23px; }
  .hero-copy h1 { font-size: 35px; }
  .hero-copy p { font-size: 13px; }
  .hero-action { padding: 0 24px 28px; }
  .primary-button, .secondary-button { min-height: 46px; }
  .strategy-overview { grid-template-columns: 1fr; margin-bottom: 36px; }
  .strategy-card { padding: 12px 15px; }
  .section-heading { align-items: flex-start; }
  .generated-time { text-align: right; }
  .ticket-card { padding: 16px 15px; }
  .ticket-balls {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
  }
  .number-ball { width: 39px; height: 39px; justify-self: center; font-size: 13px; }
  .portfolio-audit, .heat-summary { grid-template-columns: 1fr 1fr; }
  .receipt-actions { position: sticky; z-index: 20; bottom: calc(84px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; padding: 9px; border: 1px solid var(--line-strong); border-radius: 17px; background: rgba(19, 23, 47, 0.94); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35); backdrop-filter: blur(16px); }
  .seal-button { min-width: 0; }
  .page-heading { align-items: flex-start; min-height: auto; padding: 22px 2px; }
  .page-heading h1 { font-size: 36px; }
  .range-copy { display: none; }
  .heat-controls, .segmented-control { width: 100%; }
  .segmented-control { display: grid; grid-template-columns: repeat(3, 1fr); }
  #window-control { grid-template-columns: repeat(4, 1fr); }
  #count-mode-control { grid-template-columns: 1fr 1fr; }
  .segmented-control button { padding: 9px 6px; font-size: 10px; }
  .heat-panel { padding: 17px 12px; }
  .heat-panel-heading { align-items: flex-start; }
  .legend { display: none; }
  .heat-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .heat-cell { min-height: 76px; padding: 10px; }
  .rankings-grid, .method-grid { grid-template-columns: 1fr; }
  .method-card.featured { grid-column: auto; }
  .method-card { min-height: 0; padding: 23px; }
  .method-index { margin-bottom: 20px; }
  .records-heading { align-items: flex-start; flex-direction: column; }
  .records-heading p { max-width: 220px; }
  .records-heading .secondary-button { padding: 10px 12px; font-size: 10px; }
  .record-tools { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .storage-status { width: 100%; }
  .records-summary { grid-template-columns: 1fr 1fr; }
  .strategy-performance { grid-template-columns: 1fr; }
  .record-card summary { padding: 16px; }
  .record-body { padding: 0 14px 16px; }
  .record-ticket { grid-template-columns: 1fr auto; }
  .record-ticket > small:first-child { display: none; }
  .record-ticket > small:nth-child(2) { grid-column: 1 / -1; display: block; }
  .mini-ball { width: 25px; height: 25px; }
}

@media (max-width: 380px) {
  .number-ball { width: 35px; height: 35px; font-size: 12px; }
  .mini-ball { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
