:root {
  color-scheme: light;
  --red: #e84b4f;
  --red-deep: #cf3339;
  --coral: #ff6b57;
  --ink: #26313d;
  --muted: #74808c;
  --paper: #ffffff;
  --canvas: #f3f5f7;
  --line: #e3e7eb;
  --navy: #263b5a;
  --green: #20a879;
  --orange: #f29b38;
  --site-width: 1180px;
  --mobile-nav: 68px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 112px; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
[hidden] { display: none !important; }
.site-width { width: min(calc(100% - 32px), var(--site-width)); margin-inline: auto; }

button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid rgba(232, 75, 79, .22);
  outline-offset: 2px;
}

.notice-bar { min-height: 36px; border-bottom: 1px solid #e8ebee; background: #fafbfc; color: #6e7781; font-size: .73rem; }
.notice-bar .site-width { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.notice-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(232, 75, 79, .1); }
.notice-bar time { margin-left: auto; color: #9099a2; font: 600 .7rem ui-monospace, Consolas, monospace; }

.site-header { position: sticky; z-index: 30; top: 0; background: var(--paper); box-shadow: 0 2px 14px rgba(32, 45, 57, .07); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 82px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 15px 15px 15px 4px;
  color: white;
  background: linear-gradient(145deg, var(--coral), var(--red-deep));
  font: 800 1.55rem "STKaiti", "KaiTi", serif;
  box-shadow: 0 8px 18px rgba(207, 51, 57, .23), inset 0 0 0 1px rgba(255,255,255,.2);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy b { color: #202b36; font-size: 1.45rem; letter-spacing: .05em; }
.brand-copy small { color: var(--red); font-size: .7rem; letter-spacing: .12em; }
.header-status { display: flex; align-items: center; gap: 16px; }
.live-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; }
.live-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(242,155,56,.13); }
.live-state.is-online i { background: var(--green); box-shadow: 0 0 0 4px rgba(32,168,121,.13); }
.header-status button, .history-toolbar button, .load-more {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #f0c7c9;
  border-radius: 8px;
  color: var(--red-deep);
  background: #fff7f7;
  font-weight: 700;
  font-size: .76rem;
}
.header-status button:hover, .history-toolbar button:hover, .load-more:hover { border-color: var(--red); background: #fff0f0; }

.main-nav { background: var(--red); color: white; }
.main-nav .site-width { display: flex; align-items: stretch; min-height: 48px; }
.main-nav a, .main-nav button {
  display: grid;
  place-items: center;
  min-width: 120px;
  padding: 0 22px;
  border: 0;
  color: white;
  background: transparent;
  font-weight: 700;
  font-size: .85rem;
}
.main-nav a:hover, .main-nav button:hover, .main-nav .is-active { background: var(--red-deep); }
.main-nav button:disabled { opacity: .65; cursor: default; }
.main-nav button span { margin-left: 5px; font-size: .72rem; transition: transform .18s ease; }
.main-nav button[aria-expanded="true"] span { transform: rotate(180deg); }
.lottery-mega-menu { position: absolute; z-index: 35; top: 100%; left: 0; right: 0; border-bottom: 3px solid var(--red); background: white; box-shadow: 0 16px 34px rgba(31,43,54,.17); }
.lottery-mega-menu .site-width { padding-block: 10px 14px; }
.mega-row { display: grid; grid-template-columns: 105px 1fr; align-items: start; border-bottom: 1px solid var(--line); }
.mega-row:last-child { border-bottom: 0; }
.mega-label { display: flex; align-items: center; gap: 8px; min-height: 48px; color: #4d5964; font-size: .78rem; font-weight: 800; }
.mega-label i { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: white; background: var(--red); font-style: normal; font-size: .68rem; }
.mega-items { display: flex; flex-wrap: wrap; gap: 0; padding: 5px 0; }
.mega-items button { min-width: 130px; min-height: 38px; padding: 5px 14px; border: 0; color: #4b5661; background: transparent; text-align: left; font-size: .73rem; }
.mega-items button:hover { color: var(--red); background: #fff4f4; }

main { padding: 20px 0 46px; }
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  align-items: center;
  min-height: 230px;
  overflow: hidden;
  border-radius: 14px;
  color: white;
  background:
    linear-gradient(112deg, rgba(38,59,90,.98) 0 53%, rgba(38,59,90,.72) 100%),
    radial-gradient(circle at 88% 40%, #ff8b70, transparent 38%);
  box-shadow: 0 16px 34px rgba(38,59,90,.16);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(120deg, transparent 0 36px, rgba(255,255,255,.025) 36px 37px);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; padding: 35px 44px; }
.hero-kicker { margin-bottom: 9px; color: #ffb6a7; font: 700 .69rem ui-monospace, Consolas, monospace; letter-spacing: .22em; }
.hero h1 { margin-bottom: 9px; font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.035em; }
.hero-copy > p:not(.hero-kicker) { margin-bottom: 20px; color: #d9e0e8; font-size: .88rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stats span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.19); border-radius: 7px; background: rgba(255,255,255,.08); font-size: .75rem; }
.hero-stats b { color: white; }
.hero-rail { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; padding-right: 36px; }
.hero-rail span {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-left: -10px;
  border: 5px solid rgba(255,255,255,.82);
  border-radius: 50%;
  color: white;
  background: var(--red);
  font: 800 1.2rem ui-monospace, Consolas, monospace;
  box-shadow: 0 8px 20px rgba(20,31,48,.28);
}
.hero-rail span:nth-child(2n) { transform: translateY(18px); background: #2f80c4; }
.hero-rail span:nth-child(3n) { background: #24a777; }

.content-section { margin-top: 20px; padding: 20px; border-radius: 12px; background: var(--paper); box-shadow: 0 4px 18px rgba(37,49,61,.06); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.section-heading > div:first-child > p { margin-bottom: 3px; color: var(--red); font: 700 .65rem ui-monospace, Consolas, monospace; letter-spacing: .19em; }
.section-heading h2 { margin-bottom: 0; color: #26313d; font-size: 1.2rem; }
.section-note { color: var(--muted); font-size: .72rem; }
.section-heading h2::after { content: ""; display: block; width: 34px; height: 3px; margin-top: 8px; border-radius: 2px; background: var(--red); }

.featured-grid { display: grid; gap: 12px; }
.draw-card { position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.draw-card:hover { transform: translateY(-2px); border-color: #f0c6c8; box-shadow: 0 10px 24px rgba(37,49,61,.09); }
.featured-card { display: grid; grid-template-columns: 205px minmax(0, 1fr) 220px; align-items: center; min-height: 126px; padding: 18px 18px 18px 20px; }
.card-title h3 { margin-bottom: 7px; font-size: 1rem; }
.card-title p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.issue-accent { color: var(--red); font-weight: 750; }
.draw-numbers { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 7px; min-width: 0; }
.ball-stack { display: grid; justify-items: center; gap: 4px; }
.ball-stack small { color: var(--muted); font-size: .62rem; }
.ball, .digit-ball {
  display: grid;
  place-items: center;
  min-width: 35px;
  height: 35px;
  padding: 0 7px;
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font: 800 .83rem ui-monospace, Consolas, monospace;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.digit-ball { border-radius: 7px; }
.plus-ball { display: grid; place-items: center; width: 21px; height: 35px; color: var(--muted); font-weight: 800; }
.wave-red { background: #e14a50; }
.wave-blue { background: #347fbd; }
.wave-green { background: #2b9b6c; }
.tone-0 { background: #dfb61c; }
.tone-1 { background: #2d82c6; }
.tone-2 { background: #58616c; }
.tone-3 { background: #ef7a24; }
.tone-4 { background: #28aaa7; }
.tone-5 { background: #7055c6; }
.tone-6 { background: #979fa6; }
.tone-7 { background: #d8453b; }
.tone-8 { background: #26313d; }
.tone-9 { background: #26a954; }
.card-side { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding-left: 20px; border-left: 1px dashed #d9dee3; }
.draw-summary span, .countdown span { display: block; color: var(--muted); font-size: .65rem; }
.draw-summary b { display: block; margin-top: 4px; color: var(--navy); font-size: 1.25rem; }
.countdown b { display: block; margin-top: 4px; color: var(--red); font: 800 .83rem ui-monospace, Consolas, monospace; }
.card-buttons { grid-column: 1 / -1; display: flex; gap: 7px; }
.card-buttons button {
  flex: 1;
  min-height: 34px;
  border: 1px solid #dfe4e8;
  border-radius: 6px;
  background: #f8f9fa;
  color: #5e6872;
  font-size: .7rem;
}
.card-buttons button:last-child { border-color: var(--red); color: white; background: var(--red); }

.hall-heading { align-items: center; }
.filter-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.filter-row button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; color: #64707c; background: #f8f9fa; font-size: .7rem; }
.filter-row button.is-active { border-color: var(--red); color: white; background: var(--red); }
.lottery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lottery-card { padding: 16px; }
.lottery-card .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.lottery-card h3 { margin-bottom: 4px; font-size: .92rem; }
.lottery-card .card-head p { margin: 0; color: var(--muted); font-size: .68rem; }
.live-badge { flex: 0 0 auto; padding: 5px 8px; border-radius: 11px; color: #187b5b; background: #e7f6f0; font-size: .62rem; font-weight: 800; }
.lottery-card .draw-numbers { min-height: 42px; margin-bottom: 13px; }
.lottery-card .ball, .lottery-card .digit-ball { min-width: 31px; height: 31px; font-size: .72rem; }
.lottery-card .ball-stack { gap: 0; }
.lottery-card .ball-stack small { display: none; }
.lottery-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 11px; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.lottery-meta span { color: var(--muted); font-size: .65rem; }
.lottery-meta b { display: block; margin-top: 3px; color: #40505f; font-size: .75rem; }
.lottery-card .card-buttons button { min-height: 32px; }
.loading-card, .empty-state { grid-column: 1 / -1; padding: 36px 18px; border: 1px dashed #d5dbe0; border-radius: 9px; color: var(--muted); background: #fafbfc; text-align: center; font-size: .8rem; }
.draw-error { color: #ad3d42; }

.history-toolbar { display: grid; grid-template-columns: auto minmax(180px, 320px) auto 1fr; align-items: center; gap: 10px; margin-bottom: 14px; }
.history-toolbar label { color: #596672; font-size: .75rem; font-weight: 700; }
.history-toolbar select { width: 100%; min-height: 40px; padding: 7px 34px 7px 12px; border: 1px solid #d5dbe0; border-radius: 8px; color: var(--ink); background: white; }
.history-table-head, .history-row { display: grid; grid-template-columns: 170px 130px minmax(0, 1fr) 115px 90px; align-items: center; gap: 12px; }
.history-table-head { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); color: #596672; background: #f5f6f8; font-size: .7rem; font-weight: 800; text-align: center; }
.history-list { border-inline: 1px solid var(--line); }
.history-row { min-height: 66px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.history-row:nth-child(even) { background: #fafbfc; }
.history-time { color: var(--muted); font-size: .66rem; text-align: center; }
.history-issue { color: #3c4955; font-size: .75rem; font-weight: 750; text-align: center; }
.history-row .draw-numbers { gap: 5px; }
.history-row .ball, .history-row .digit-ball { min-width: 28px; height: 28px; font-size: .68rem; }
.history-row .ball-stack { gap: 0; }
.history-row .ball-stack small { display: none; }
.history-result { color: var(--navy); font-size: .72rem; font-weight: 750; text-align: center; }
.history-source { color: var(--muted); font-size: .65rem; text-align: right; }
.load-more { display: block; min-width: 150px; margin: 16px auto 0; }

.site-footer { padding: 28px 0; color: #aab3bd; background: #293440; }
.site-footer .site-width { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.site-footer div > div { display: grid; gap: 4px; }
.site-footer b { color: white; }
.site-footer span, .site-footer p { font-size: .7rem; }
.site-footer p { max-width: 540px; margin: 0; text-align: right; line-height: 1.6; }
.mobile-nav { display: none; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 22px;
  max-width: calc(100% - 28px);
  padding: 11px 16px;
  border-radius: 8px;
  color: white;
  background: #26313d;
  font-size: .78rem;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .featured-card { grid-template-columns: 170px minmax(0, 1fr); }
  .featured-card .card-side { grid-column: 1 / -1; grid-template-columns: 1fr 1fr auto; padding: 12px 0 0; border-top: 1px dashed var(--line); border-left: 0; }
  .featured-card .card-buttons { grid-column: auto; }
  .hero { grid-template-columns: 1fr .7fr; }
  .hero-rail span { width: 56px; height: 56px; font-size: 1rem; }
}

@media (max-width: 680px) {
  html { scroll-padding-top: 76px; }
  body { padding-bottom: var(--mobile-nav); }
  .site-width { width: min(calc(100% - 22px), var(--site-width)); }
  .notice-bar { display: none; }
  .site-header { top: 0; }
  .header-inner { min-height: 66px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px 12px 12px 3px; font-size: 1.25rem; }
  .brand-copy b { font-size: 1.12rem; }
  .brand-copy small { font-size: .58rem; }
  .header-status .live-state { display: none; }
  .header-status button { min-height: 34px; padding-inline: 11px; }
  .main-nav { display: none; }
  .lottery-mega-menu { display: none !important; }
  main { padding-top: 11px; }
  .hero { grid-template-columns: 1fr; min-height: 186px; border-radius: 10px; }
  .hero-copy { padding: 25px 23px; }
  .hero h1 { font-size: 1.65rem; }
  .hero-copy > p:not(.hero-kicker) { font-size: .77rem; line-height: 1.55; }
  .hero-rail { position: absolute; right: -22px; bottom: 16px; padding: 0; opacity: .42; }
  .hero-rail span { width: 43px; height: 43px; border-width: 3px; font-size: .75rem; }
  .content-section { margin-top: 11px; padding: 14px; border-radius: 10px; }
  .section-heading { align-items: center; margin-bottom: 13px; padding-bottom: 11px; }
  .section-heading h2 { font-size: 1.05rem; }
  .section-note { font-size: .65rem; text-align: right; }
  .featured-card { display: block; min-height: 0; padding: 15px; }
  .featured-card .card-title { margin-bottom: 13px; }
  .featured-card .draw-numbers { margin-bottom: 13px; }
  .featured-card .card-side { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-top: 11px; }
  .featured-card .card-buttons { grid-column: 1 / -1; }
  .ball, .digit-ball { min-width: 32px; height: 32px; font-size: .74rem; }
  .ball-stack { gap: 3px; }
  .ball-stack small { font-size: .56rem; }
  .hall-heading { display: block; }
  .filter-row { justify-content: flex-start; margin-top: 11px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row button { flex: 0 0 auto; }
  .lottery-grid { grid-template-columns: 1fr; gap: 9px; }
  .lottery-card { padding: 14px; }
  .history-toolbar { grid-template-columns: 1fr auto; }
  .history-toolbar label { grid-column: 1 / -1; }
  .history-table-head { display: none; }
  .history-list { border-inline: 0; }
  .history-row { grid-template-columns: 1fr; gap: 8px; padding: 13px 4px; }
  .history-row:nth-child(even) { background: transparent; }
  .history-time, .history-issue, .history-result { text-align: left; }
  .history-issue::before { content: "期号："; color: var(--muted); font-weight: 400; }
  .history-result::before { content: "结果："; color: var(--muted); font-weight: 400; }
  .history-source { text-align: left; }
  .site-footer { padding: 24px 0; }
  .site-footer .site-width { display: block; }
  .site-footer p { margin-top: 12px; text-align: left; }
  .mobile-nav {
    position: fixed;
    z-index: 60;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: var(--mobile-nav);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #e2e6e9;
    background: rgba(255,255,255,.97);
    box-shadow: 0 -8px 20px rgba(31,43,54,.08);
    backdrop-filter: blur(16px);
  }
  .mobile-nav a, .mobile-nav button { display: grid; place-content: center; justify-items: center; gap: 3px; border: 0; color: #737f89; background: transparent; }
  .mobile-nav span { font-size: 1.1rem; line-height: 1; }
  .mobile-nav b { font-size: .66rem; }
  .mobile-nav a:first-child { color: var(--red); }
  .mobile-nav button:disabled { opacity: .6; }
  .toast { bottom: calc(var(--mobile-nav) + 14px); }
}

@media (max-width: 370px) {
  .site-width { width: calc(100% - 18px); }
  .header-status button { padding-inline: 9px; font-size: .7rem; }
  .hero-copy { padding-inline: 19px; }
  .hero-stats { gap: 7px; }
  .content-section { padding: 12px; }
  .draw-numbers { gap: 5px; }
  .ball, .digit-ball { min-width: 29px; height: 29px; padding-inline: 5px; font-size: .68rem; }
}

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