:root {
  --paper: #f4f1e9;
  --paper-deep: #ebe6da;
  --surface: #fffdf8;
  --ink: #17241f;
  --muted: #67716c;
  --line: #d9d5cb;
  --green: #173f34;
  --green-soft: #dce9e3;
  --red: #d64d45;
  --red-deep: #b83c36;
  --red-soft: #f8e1de;
  --blue: #366ca8;
  --blue-soft: #dfeaf5;
  --gold: #b6812b;
  --shadow: 0 14px 40px rgba(27, 44, 37, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --page: min(1180px, calc(100% - 40px));
  color-scheme: light;
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui,
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 63, 52, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 63, 52, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(54, 108, 168, 0.28);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: var(--page);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(23, 36, 31, 0.1);
  background: rgba(244, 241, 233, 0.94);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: var(--page);
  height: 72px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green);
  color: var(--surface);
}

.brand-mark svg {
  width: 28px;
  fill: currentColor;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.main-nav {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 28px;
}

.main-nav a {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.main-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.main-nav a:hover,
.main-nav a.is-active {
  color: var(--ink);
}

.main-nav a.is-active::after {
  transform: scaleX(1);
}

.data-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.66);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.data-status:hover {
  border-color: #aeb6b1;
  background: var(--surface);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(182, 129, 43, 0.14);
}

.data-status.is-loading .status-dot {
  animation: status-pulse 1.1s ease-in-out infinite;
}

.data-status.is-live .status-dot {
  background: #3a8a64;
  box-shadow: 0 0 0 4px rgba(58, 138, 100, 0.14);
}

.data-status.is-stale .status-dot,
.data-status.is-fallback .status-dot {
  background: var(--gold);
}

@keyframes status-pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.78);
  }
}

.hero {
  min-height: 332px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.75fr);
  align-items: end;
  gap: clamp(40px, 8vw, 110px);
  padding-top: 72px;
  padding-bottom: 56px;
}

.eyebrow,
.section-kicker {
  margin-bottom: 11px;
  color: var(--red-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 720px;
  margin-bottom: 22px;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(38px, 5.1vw, 66px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero-description {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.probability-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px 0 4px 18px;
  border-left: 2px solid var(--gold);
}

.note-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-family: serif;
  font-size: 14px;
  font-weight: 800;
}

.probability-note strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.probability-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.workspace {
  scroll-margin-top: 88px;
  overflow: hidden;
  border: 1px solid rgba(23, 36, 31, 0.12);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-toolbar {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}

.workspace-toolbar .section-kicker,
.section-heading .section-kicker,
.result-header .section-kicker {
  margin-bottom: 5px;
}

.workspace-toolbar h2,
.section-heading h2 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.2;
}

.game-tabs {
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}

.game-tab {
  min-width: 112px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.game-tab:hover {
  color: var(--ink);
}

.game-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(23, 36, 31, 0.09);
}

.tab-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.tab-dot.red {
  background: var(--red);
}

.tab-dot.blue {
  background: var(--blue);
}

.generator-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
}

.control-panel {
  padding: 26px 30px 30px;
  border-right: 1px solid var(--line);
  background: #fbf9f4;
}

fieldset {
  min-width: 0;
  margin: 0 0 27px;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.strategy-option {
  position: relative;
  min-height: 76px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.strategy-option:hover {
  border-color: #aeb6b1;
  transform: translateY(-1px);
}

.strategy-option.is-active {
  border-color: var(--green);
  background: var(--green-soft);
}

.strategy-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  font-weight: 800;
}

.strategy-option strong,
.strategy-option small {
  display: block;
}

.strategy-option strong {
  font-size: 13px;
  line-height: 1.35;
}

.strategy-option small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-mark {
  position: absolute;
  top: 5px;
  right: 7px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
}

.strategy-option.is-active .check-mark {
  opacity: 1;
}

.quantity-control {
  height: 46px;
  display: grid;
  grid-template-columns: 48px minmax(80px, 1fr) 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.quantity-control button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  cursor: pointer;
}

.quantity-control button:hover {
  color: var(--ink);
  background: var(--paper);
}

.quantity-control button:first-child {
  border-right: 1px solid var(--line);
  border-radius: 10px 0 0 10px;
}

.quantity-control button:last-child {
  border-left: 1px solid var(--line);
  border-radius: 0 10px 10px 0;
}

.quantity-control output {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
}

.filter-list {
  display: grid;
  gap: 2px;
}

.filter-row {
  min-height: 53px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.filter-row > span:first-child {
  min-width: 0;
}

.filter-row strong,
.filter-row small {
  display: block;
}

.filter-row strong {
  font-size: 13px;
}

.filter-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.filter-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 auto;
  margin-left: auto;
  border-radius: 999px;
  background: #c9cdc9;
  transition: background 160ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.filter-row input:checked + .switch {
  background: var(--green);
}

.filter-row input:checked + .switch::after {
  transform: translateX(16px);
}

.filter-row input:focus-visible + .switch {
  outline: 3px solid rgba(54, 108, 168, 0.28);
  outline-offset: 3px;
}

.primary-action {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(23, 63, 52, 0.19);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-action:hover {
  background: #0f332a;
  transform: translateY(-1px);
}

.primary-action:active {
  transform: translateY(1px);
}

.strategy-disclaimer {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.principle-details {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.principle-details summary {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  list-style-position: inside;
}

.principle-details div {
  padding: 13px 2px 0;
}

.principle-details p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.62;
}

.principle-details p:last-child {
  margin-bottom: 0;
  color: var(--red-deep);
}

.principle-details strong {
  color: var(--ink);
}

.result-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 30px 24px;
}

.result-header {
  min-height: 49px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.result-header h3 {
  margin-bottom: 0;
  font-size: 21px;
}

.text-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.text-button:hover {
  background: var(--green-soft);
}

.text-button.danger {
  color: var(--red-deep);
}

.text-button.danger:hover {
  background: var(--red-soft);
}

.result-list {
  min-height: 380px;
  display: grid;
  align-content: start;
  gap: 9px;
}

.ticket {
  min-height: 68px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 13px;
  padding: 9px 10px 9px 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffefa;
  animation: ticket-enter 260ms ease both;
}

@keyframes ticket-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.ticket-index {
  display: grid;
  place-items: center;
  color: #969c98;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.ticket-balls {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ticket-balls::-webkit-scrollbar {
  display: none;
}

.ball {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--red);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.11);
}

.ball.special {
  background: var(--blue);
}

.ball-divider {
  width: 1px;
  height: 23px;
  flex: 0 0 auto;
  margin: 0 3px;
  background: var(--line);
}

.ticket-meta {
  min-width: 78px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  text-align: right;
}

.ticket-meta strong {
  display: block;
  color: var(--ink);
  font-size: 11px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--red);
  background: var(--red-soft);
}

.icon-button.is-saved {
  color: white;
  background: var(--red);
}

.odds-strip {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
  padding: 10px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--paper);
  font-size: 10px;
}

.odds-strip strong {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.odds-strip span + span::before {
  content: "·";
  margin-right: 12px;
}

.insights,
.saved {
  scroll-margin-top: 88px;
  padding-top: 82px;
}

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

.demo-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #d7c49e;
  border-radius: 999px;
  color: #806225;
  background: #f6edd9;
  font-size: 11px;
  font-weight: 700;
}

.insight-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.range-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.range-tab {
  min-height: 28px;
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.range-tab:hover {
  color: var(--ink);
}

.range-tab.is-active {
  color: white;
  background: var(--green);
}

.demo-badge.is-live {
  border-color: #adcfbd;
  color: #286746;
  background: #e1f0e7;
}

.demo-badge.is-stale,
.demo-badge.is-fallback {
  border-color: #d7c49e;
  color: #806225;
  background: #f6edd9;
}

.latest-draw {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.latest-content {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 30px;
}

.latest-heading {
  min-width: 128px;
}

.latest-heading span,
.latest-heading strong {
  display: block;
}

.latest-game {
  margin-bottom: 6px;
  color: var(--red-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.latest-heading strong {
  font-size: 16px;
}

.latest-balls {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.latest-balls .ball {
  width: 37px;
  height: 37px;
}

.latest-placeholder {
  color: var(--muted);
  font-size: 12px;
}

.latest-meta {
  min-width: 125px;
  display: grid;
  justify-items: end;
  gap: 5px;
}

.latest-meta time {
  color: var(--muted);
  font-size: 11px;
}

.latest-meta a {
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
}

.latest-meta a:hover {
  text-decoration: underline;
}

.latest-meta .text-button {
  min-height: 28px;
  padding-block: 4px;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(210px, 0.6fr));
  gap: 16px;
}

.frequency-panel,
.number-summary {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.frequency-panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.panel-heading h3,
.number-summary h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--red);
}

.frequency-chart {
  height: 174px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  padding-top: 12px;
  border-bottom: 1px solid var(--line);
}

.bar-item {
  height: 100%;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 7px;
}

.bar-value {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
}

.bar {
  width: min(30px, 72%);
  min-height: 12px;
  border-radius: 6px 6px 0 0;
  background: var(--red);
  transition: height 260ms ease;
}

.bar-number {
  margin-bottom: -17px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  transform: translateY(19px);
}

.number-summary {
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.number-summary::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -25px;
  width: 100px;
  height: 100px;
  border: 18px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
}

.hot-summary {
  background: #f8e6e2;
}

.cold-summary {
  background: #e4edf4;
}

.summary-symbol {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  margin-bottom: 29px;
  border-radius: 9px;
  color: white;
  background: var(--red);
  font-weight: 900;
}

.cold-summary .summary-symbol {
  background: var(--blue);
}

.summary-balls {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 21px 0 19px;
}

.summary-balls span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 36, 31, 0.13);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.number-summary p {
  position: relative;
  z-index: 1;
  max-width: 210px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.saved {
  padding-bottom: 88px;
}

.empty-saved {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 30px;
  border: 1px dashed #bfc2bc;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.48);
  text-align: center;
}

.empty-saved strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 15px;
}

.empty-saved p {
  margin: 0;
  font-size: 12px;
}

.saved-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.saved-ticket {
  min-width: 0;
  min-height: 75px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.saved-ticket .ticket-balls {
  flex: 1 1 auto;
}

.saved-game {
  width: 42px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.saved-ticket .ball {
  width: 30px;
  height: 30px;
  font-size: 10px;
}

.site-footer {
  border-top: 1px solid rgba(23, 36, 31, 0.12);
  color: var(--muted);
  background: var(--paper-deep);
}

.footer-inner {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(23, 36, 31, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 48px;
  }

  .generator-layout {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .control-panel,
  .result-panel {
    padding-inline: 22px;
  }

  .ticket {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }

  .ticket-meta {
    display: none;
  }

  .ball {
    width: 31px;
    height: 31px;
    font-size: 11px;
  }

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

  .frequency-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  :root {
    --page: min(100% - 24px, 620px);
  }

  .header-inner {
    height: 62px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand small,
  .main-nav {
    display: none;
  }

  .data-status {
    font-size: 10px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 28px;
    padding-top: 50px;
    padding-bottom: 38px;
  }

  .hero h1 {
    margin-bottom: 18px;
    font-size: clamp(35px, 11vw, 51px);
  }

  .hero-description {
    font-size: 14px;
  }

  .probability-note {
    padding-top: 3px;
  }

  .workspace {
    width: 100%;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .workspace-toolbar {
    min-height: auto;
    display: grid;
    padding: 20px 16px;
  }

  .game-tabs {
    width: 100%;
  }

  .game-tab {
    min-width: 0;
    flex: 1 1 0;
  }

  .generator-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    padding: 22px 16px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-panel {
    padding: 23px 12px 20px;
  }

  .result-list {
    min-height: 0;
  }

  .ticket {
    grid-template-columns: 25px minmax(0, 1fr) 32px;
    gap: 6px;
    padding-right: 5px;
  }

  .ticket-balls {
    gap: 4px;
  }

  .ball {
    width: 30px;
    height: 30px;
    font-size: 10px;
  }

  .ball-divider {
    margin-inline: 1px;
  }

  .odds-strip {
    flex-wrap: wrap;
    margin-top: 18px;
  }

  .insights,
  .saved {
    padding-top: 61px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .insight-actions {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

  .range-tabs {
    flex: 1 1 auto;
  }

  .range-tab {
    flex: 1 1 0;
  }

  .latest-draw {
    align-items: stretch;
    flex-direction: column;
    gap: 17px;
    padding: 18px 16px;
  }

  .latest-content {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .latest-heading {
    min-width: 0;
  }

  .latest-balls {
    width: 100%;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .latest-balls::-webkit-scrollbar {
    display: none;
  }

  .latest-balls .ball {
    width: 34px;
    height: 34px;
  }

  .latest-meta {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    justify-items: start;
  }

  .latest-meta a {
    max-width: 240px;
    grid-column: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .latest-meta .text-button {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-left: 0;
  }

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

  .frequency-panel {
    grid-column: auto;
    padding: 20px 14px;
  }

  .frequency-chart {
    gap: 3px;
  }

  .number-summary {
    min-height: 245px;
  }

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

  .saved-ticket {
    padding-inline: 8px;
  }

  .saved-ticket .ball {
    width: 27px;
    height: 27px;
    font-size: 9px;
  }

  .footer-inner {
    min-height: 94px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .strategy-grid {
    grid-template-columns: 1fr;
  }

  .strategy-option {
    min-height: 65px;
  }

  .ticket-index {
    display: none;
  }

  .ticket {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .ball {
    width: 28px;
    height: 28px;
  }
}

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