:root {
  color-scheme: light;
  --blue: #1f4aa8;
  --blue-dark: #153a86;
  --red: #e60012;
  --green: #00aa10;
  --yellow: #f1db00;
  --gold: #d9a300;
  --purple: #7131c3;
  --teal: #20b47d;
  --pink: #c226b9;
  --ink: #1f2937;
  --muted: #7a7f8b;
  --line: #d9dce3;
  --soft: #f4f5f7;
  --panel: #ffffff;
  --page-bg: #f6f7fb;
  --shadow: 0 14px 36px rgba(30, 54, 96, .10);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, .07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0, #ffffff 142px, var(--page-bg) 142px, var(--page-bg) 100%);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1164px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid rgba(31, 74, 168, .08);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .04);
}

.brand {
  display: flex;
  align-items: center;
  min-height: 106px;
  padding: 8px 0 10px;
  text-decoration: none;
}

.brand-logo {
  width: 190px;
  height: 105px;
  object-fit: contain;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 5px solid var(--yellow);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.nav-link {
  min-height: 42px;
  border: 0;
  color: #fff;
  font-weight: 700;
  background: var(--blue);
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}

.nav-link:hover {
  filter: brightness(.96);
}

.nav-link.active {
  color: #fff200;
  transform: translateY(-1px);
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, .62);
}

.nav-home { background: var(--red); }
.nav-draw { background: #119ed8; }
.nav-video { background: var(--green); }
.nav-trend { background: var(--gold); }
.nav-api { background: var(--purple); }
.nav-picker { background: var(--teal); }
.nav-contact { background: var(--pink); }

.hidden-by-setting {
  display: none !important;
}

main {
  min-height: 980px;
  padding: 24px 0 52px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

h1,
h2,
h3 {
  margin: 0;
  color: #171717;
}

h1 {
  margin-bottom: 18px;
  font-size: 26px;
  font-weight: 700;
}

h2 {
  margin-bottom: 18px;
  padding-left: 9px;
  border-left: 4px solid var(--blue);
  font-size: 22px;
}

h3 {
  margin: 18px 0 12px;
  font-size: 18px;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-draw {
  overflow: hidden;
  border: 1px solid rgba(31, 74, 168, .14);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.draw-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, auto);
  gap: 28px;
  align-items: center;
  min-height: 238px;
  padding: 36px 44px;
  background:
    linear-gradient(120deg, rgba(31, 74, 168, .07), rgba(255, 255, 255, 0) 46%),
    var(--panel);
}

.issue {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 30px;
  color: #334155;
  font-size: 18px;
  font-weight: 700;
}

.issue strong,
.period-number {
  color: var(--red);
}

.balls-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.latest-line {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.ball-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 60px;
  padding: 2px 0;
}

.ball {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  color: #020617;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .10);
}

.ball.red { background-image: url("/static/sketch/red.png"); }
.ball.blue { background-image: url("/static/sketch/blue.png"); }
.ball.green { background-image: url("/static/sketch/green.png"); }

.ball-wrap.muted {
  opacity: .18;
  filter: grayscale(.85);
}

.ball-wrap.reveal {
  animation: ballReveal .34s ease both;
}

@keyframes ballReveal {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.82);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.zodiac {
  color: #101010;
  font-size: 24px;
  line-height: 1;
}

.plus {
  align-self: center;
  color: var(--red);
  font-size: 28px;
  line-height: 56px;
}

.simulate-btn {
  align-self: flex-start;
  min-width: 92px;
  height: 34px;
  margin-top: 1px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue-dark);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 74, 168, .18);
}

.draw-tools {
  display: grid;
  gap: 22px;
  justify-items: end;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfcff;
}

.close-time {
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 700;
}

.countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #000;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 400;
}

.timebox {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 58px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, .05);
}

.draw-filters {
  display: grid;
  gap: 10px;
  padding: 16px 18px 12px;
  border-top: 1px solid #dde7f5;
  background: #eef3fb;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.filter-chip {
  min-width: 54px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #222;
  background: #fff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
}

.filter-chip:not(.label):hover {
  color: #fff;
  background: #4169c1;
}

.filter-chip.label {
  flex: 0 0 72px;
  padding-left: 0;
  color: var(--blue-dark);
  background: transparent;
  box-shadow: none;
  cursor: default;
  font-weight: 800;
  text-align: left;
}

.filter-chip.active {
  color: #fff;
  background: var(--blue);
}

.filter-summary {
  padding: 0 18px 16px 104px;
  color: #475467;
  background: #eef3fb;
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 14px;
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.section-head h3 {
  margin: 0;
}

.search {
  position: relative;
  width: 160px;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.search button {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  color: var(--red);
  background: transparent;
  font-size: 22px;
}

.results-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid #e1e6ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.results-table th {
  height: 44px;
  color: #334155;
  background: #eef3fb;
  font-weight: 700;
}

.results-table td {
  min-height: 94px;
  padding: 18px 12px;
  border-top: 1px solid #edf1f6;
  text-align: center;
  vertical-align: middle;
}

.results-table tbody tr:hover {
  background: #fbfcff;
}

.results-table .balls-row {
  justify-content: center;
  gap: 8px;
}

.results-table .ball-wrap {
  min-width: 44px;
  gap: 3px;
}

.results-table .ball {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.results-table .zodiac {
  font-size: 14px;
}

.replay {
  display: inline-grid;
  place-items: center;
  min-width: 86px;
  height: 34px;
  border: 1px solid #ad211e;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(#d73a34, #b81716);
  font-weight: 700;
  text-decoration: none;
}

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 18px;
}

.pager button {
  min-width: 34px;
  height: 34px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  color: #333;
  background: #fff;
}

.pager button.active {
  color: #fff;
  background: var(--blue);
}

.pager button:disabled {
  color: #999;
  cursor: not-allowed;
  background: #eee;
}

.status-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.chart-section,
.api-layout > div,
.api-endpoint,
.picker-layout > div,
.contact {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.chart-section {
  margin-bottom: 18px;
  padding: 22px 22px 28px;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.period-input {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #111;
  font-size: 14px;
}

.period-input input {
  width: 56px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid #aaa;
  border-radius: 6px;
}

.bar-chart {
  display: grid;
  grid-template-columns: 54px 1fr;
  min-height: 270px;
}

.axis-y {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  align-items: end;
  padding-right: 10px;
  color: #667085;
  font-size: 12px;
  text-align: right;
}

.bars {
  display: grid;
  grid-template-columns: repeat(var(--count), minmax(22px, 1fr));
  align-items: end;
  gap: 16px;
  min-height: 260px;
  padding: 0 18px;
  border-bottom: 1px solid #a9afb9;
  background: repeating-linear-gradient(to top, transparent, transparent 42px, #edf1f6 43px);
}

.bar-item {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 0;
}

.bar {
  width: 12px;
  height: calc(var(--value) * 1%);
  min-height: 14px;
  border-radius: 7px 7px 0 0;
  background: var(--blue);
}

.bar-label,
.bar-value {
  color: #4b5563;
  font-size: 12px;
  white-space: nowrap;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 240px minmax(220px, 1fr);
  align-items: center;
  justify-content: center;
  gap: 50px;
  max-width: 720px;
  margin: 0 auto;
}

.legend {
  display: grid;
  gap: 8px;
  color: #374151;
  font-size: 14px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.donut {
  position: relative;
  width: 210px;
  height: 210px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--donut);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 52px;
  border-radius: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 1px #edf1f6;
}

.video-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: start;
}

.video-stage {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(16, 54, 132, .92), rgba(10, 155, 92, .82)),
    radial-gradient(circle at 72% 30%, rgba(255, 255, 255, .42), transparent 30%);
  box-shadow: var(--shadow);
}

.play-button {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  font-size: 42px;
  text-indent: 7px;
}

.video-list {
  display: grid;
  gap: 12px;
}

.video-item {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.video-item h3 {
  margin-top: 0;
}

.thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, #e60012, #1f4aa8);
}

.api-layout {
  display: grid;
  gap: 22px;
}

.api-layout > div,
.api-endpoint {
  padding: 18px;
}

.api-layout > div h3:first-child {
  margin-top: 0;
}

.api-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
}

.api-row span[id$="ApiUrl"] {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #334155;
}

.api-endpoint {
  display: grid;
  gap: 12px;
}

.api-endpoint summary {
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.api-endpoint-body {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  font-weight: 400;
}

.method {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.copy {
  padding: 4px 10px;
  border: 1px solid rgba(31, 74, 168, .18);
  border-radius: 6px;
  color: var(--blue);
  background: #f4f7ff;
  font-weight: 700;
}

.code-panel {
  position: relative;
  min-height: 240px;
  overflow: auto;
  padding: 46px 26px 26px;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  background: #fbfcff;
}

.code-panel.empty-code,
.code-panel.api-param {
  min-height: 0;
  padding: 12px 14px;
  color: #334155;
  text-align: left;
}

.code-panel.empty-code {
  text-align: center;
}

.code-panel .copy {
  position: absolute;
  top: 12px;
  right: 18px;
}

pre {
  margin: 0;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.picker-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1fr);
  gap: 38px;
  align-items: start;
}

.picker-layout > div {
  padding: 22px;
}

.picker-output {
  min-height: 230px;
  padding: 16px;
  border: 1px solid #c9d8f3;
  border-radius: 8px;
  color: #111827;
  background: #fbfcff;
  font-size: 18px;
  line-height: 2;
}

.picker-output .balls-row {
  gap: 10px;
}

.picker-ball {
  width: 46px;
  height: 46px;
  font-size: 22px;
}

.picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.outline-btn {
  min-width: 54px;
  height: 32px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: var(--blue);
  background: #fff;
  font-weight: 700;
}

.picker-panel {
  display: grid;
  gap: 16px;
}

.picker-group {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.picker-group.wide {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.pick-btn {
  min-height: 38px;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.pick-btn.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.contact {
  display: grid;
  place-items: center;
  min-height: 560px;
  padding: 48px 24px;
  text-align: center;
}

.contact h1 {
  margin-bottom: 30px;
}

.contact p {
  max-width: 760px;
  margin: 0 0 84px;
  color: #333;
  line-height: 1.8;
}

.mail-icon {
  position: relative;
  width: 110px;
  height: 84px;
  margin: 0 auto 24px;
  border: 4px solid #27a2e7;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff, #e8f8ff);
  transform: rotate(-8deg);
}

.mail-icon::before,
.mail-icon::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 8px;
  left: 8px;
  height: 48px;
  border-bottom: 4px solid #27a2e7;
  transform: skewY(-26deg);
}

.mail-icon::after {
  transform: skewY(26deg);
}

.site-footer {
  padding: 14px 0 18px;
  border-top: 5px solid var(--yellow);
  color: #8b8f98;
  background: #fff;
  font-size: 14px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(18px);
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 24, 39, .92);
  padding: 9px 14px;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  .shell {
    width: min(100% - 24px, 760px);
  }

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

  .draw-card,
  .video-grid,
  .picker-layout {
    grid-template-columns: 1fr;
  }

  .draw-card {
    padding: 28px 18px;
  }

  .draw-tools {
    justify-items: start;
    width: 100%;
  }

  .latest-line {
    align-items: flex-start;
  }

  .countdown {
    flex-wrap: wrap;
  }

  .results-table,
  .results-table tbody,
  .results-table tr,
  .results-table td {
    display: block;
    width: 100%;
  }

  .results-table thead {
    display: none;
  }

  .results-table tr {
    border-top: 1px solid var(--line);
    padding: 14px 0;
  }

  .results-table td {
    border: 0;
    padding: 8px 12px;
  }

  .results-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .bars {
    gap: 10px;
    overflow-x: auto;
  }

  .picker-group {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }
}

@media (max-width: 560px) {
  .brand {
    min-height: 86px;
  }

  .brand-logo {
    width: 150px;
    height: auto;
  }

  main {
    min-height: 760px;
  }

  h1 {
    margin-bottom: 20px;
    font-size: 24px;
  }

  .ball {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

  .zodiac {
    font-size: 18px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .draw-filters {
    padding: 14px 12px 10px;
  }

  .filter-chip.label {
    flex-basis: 100%;
    padding-bottom: 0;
  }

  .filter-summary {
    padding: 0 12px 14px;
  }

  .api-layout > div,
  .api-endpoint,
  .picker-layout > div,
  .contact,
  .section-head {
    padding: 16px;
  }

  .code-panel {
    min-height: 220px;
    padding: 44px 14px 16px;
  }

  .search {
    width: 100%;
  }

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