:root {
  color-scheme: light;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f6f6f6;
  color: #111;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f5f5f5;
}

button {
  font: inherit;
}

.site-shell {
  width: min(100%, 375px);
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
}

.site-shell > h1 {
  height: 43px;
  margin: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  background: #fff;
}

.hero {
  height: 161px;
  overflow: hidden;
  background: #d84443;
}

.hero-topline {
  position: relative;
  height: 47px;
  display: flex;
  align-items: center;
  padding: 2px 15px 0 9px;
  color: #fff96b;
  background: linear-gradient(180deg, #e44c4c 0%, #cf3737 100%);
  text-shadow: 0 1px 1px rgb(83 22 0 / 70%);
}

.brand-mark {
  position: relative;
  width: 45px;
  height: 37px;
  margin-right: 7px;
  border: 2px solid #0d4568;
  border-radius: 50%;
  background: #103f61;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  inset: 5px 2px;
  border: 1px solid #ffdd22;
  border-radius: 50%;
}

.brand-mark::after {
  inset: 2px 10px;
}

.brand-mark span:nth-child(1) {
  inset: 14px -3px;
  border-radius: 0;
  border-width: 1px 0 0;
}

.brand-mark span:nth-child(2) {
  inset: -2px 20px;
  border-radius: 0;
  border-width: 0 0 0 1px;
}

.brand-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  transform: translateY(-1px);
}

.brand-copy strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 23px;
  line-height: 24px;
  letter-spacing: 5px;
  white-space: nowrap;
}

.brand-copy span {
  color: #fff;
  font-size: 17px;
  line-height: 17px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.pinwheel {
  position: relative;
  width: 38px;
  height: 38px;
}

.pinwheel i {
  position: absolute;
  left: 17px;
  top: 17px;
  width: 19px;
  height: 8px;
  border-radius: 90% 10% 80% 20%;
  transform-origin: 1px 3px;
  background: #f5e900;
}

.pinwheel i:nth-child(2) { transform: rotate(72deg); background: #65c22a; }
.pinwheel i:nth-child(3) { transform: rotate(144deg); background: #13a7db; }
.pinwheel i:nth-child(4) { transform: rotate(216deg); background: #7557c9; }
.pinwheel i:nth-child(5) { transform: rotate(288deg); background: #f7941e; }

.hero-art {
  position: relative;
  height: 114px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 50%, #fff094 0 2%, transparent 3%),
    radial-gradient(circle at 24% 74%, #f04019 0 2%, transparent 3%),
    linear-gradient(110deg, #b51412 0%, #f08e15 24%, #24176d 47%, #092438 72%, #b6cab2 100%);
}

.light-rays {
  position: absolute;
  inset: -80px 175px -80px -90px;
  background: repeating-conic-gradient(from 15deg, rgb(255 231 77 / 65%) 0deg 7deg, transparent 7deg 15deg);
  filter: blur(1px);
  opacity: .8;
}

.lottery-cage {
  position: absolute;
  z-index: 2;
  left: 23px;
  top: 3px;
  width: 105px;
  height: 105px;
  border: 4px solid rgb(255 255 255 / 60%);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, rgb(255 255 255 / 75%), rgb(111 204 224 / 36%) 45%, rgb(19 74 105 / 75%) 73%);
  box-shadow: 0 0 0 4px #9a4b14, 0 0 18px #fff66c;
}

.cage-ring {
  position: absolute;
  inset: 9px;
  border: 2px dashed rgb(255 255 255 / 55%);
  border-radius: 50%;
  transform: rotate(-22deg);
}

.mini-ball {
  position: absolute;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 2px solid rgb(255 255 255 / 80%);
  border-radius: 50%;
  color: #171717;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 3px rgb(0 0 0 / 45%);
}

.ball-a { left: 14px; top: 21px; background: #ffe34c; }
.ball-b { left: 40px; top: 12px; background: #69d2ed; }
.ball-c { left: 66px; top: 27px; background: #f55d71; }
.ball-d { left: 25px; top: 52px; background: #f49532; }
.ball-e { left: 55px; top: 55px; background: #6ed64b; }
.ball-f { left: 42px; top: 76px; background: #eac6ff; }

.number-card {
  position: absolute;
  z-index: 1;
  width: 70px;
  height: 101px;
  display: grid;
  place-items: center;
  border: 1px solid #222;
  border-radius: 7px;
  color: #111;
  font: 700 44px Georgia, serif;
  background: linear-gradient(120deg, #edf2d9, #afc59d);
  box-shadow: 0 4px 8px rgb(0 0 0 / 45%);
}

.card-one { left: 155px; top: -17px; transform: rotate(-17deg); }
.card-two { left: 217px; top: 8px; transform: rotate(8deg); }
.card-three { left: 296px; top: -23px; transform: rotate(18deg); }

.hero-name {
  position: absolute;
  z-index: 4;
  left: 141px;
  top: 13px;
  width: 224px;
  color: #fff7b7;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
  text-align: center;
  transform: rotate(-4deg);
  text-shadow: 2px 2px 0 #0e385c, -1px -1px 0 #0e385c;
}

.hero-url {
  position: absolute;
  z-index: 5;
  right: 3px;
  bottom: 14px;
  padding: 4px 7px;
  border-radius: 16px 2px 2px 16px;
  color: #ec3a61;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 15px;
  font-weight: 700;
  background: #fff49b;
  box-shadow: 0 0 0 2px rgb(230 60 48 / 40%);
}

.hero-v2 {
  position: relative;
  isolation: isolate;
  background: #c90000;
}

.hero-banner-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.hero-brandbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 47px;
  display: flex;
  align-items: center;
  padding: 2px 11px 1px 8px;
  background: linear-gradient(180deg, rgb(221 54 50 / 96%), rgb(191 26 24 / 94%));
  border-bottom: 1px solid rgb(255 217 71 / 55%);
  box-shadow: 0 2px 5px rgb(74 0 0 / 28%);
}

.hero-brand-icon {
  width: 45px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 42%));
}

.hero-brand-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 7px;
  transform: translateY(-1px);
  text-shadow: 0 1px 1px rgb(66 0 0 / 70%);
}

.hero-brand-copy strong {
  color: #ffe84f;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 23px;
  font-weight: 700;
  line-height: 23px;
  letter-spacing: 5px;
  white-space: nowrap;
}

.hero-brand-copy span {
  color: #fff;
  font-size: 17px;
  line-height: 17px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.hero-spin-icon {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 28%));
}

.hero-main-title {
  position: absolute;
  z-index: 2;
  right: 23px;
  top: 58px;
  color: #fff5a4;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 33px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #143e78, -1px -1px 0 #7b1000, 0 2px 4px rgb(0 0 0 / 70%);
}

.hero-address {
  position: absolute;
  z-index: 2;
  right: 4px;
  bottom: 9px;
  padding: 3px 7px 4px 12px;
  border: 1px solid #ef7962;
  border-radius: 16px 3px 3px 16px;
  color: #ef3560;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  background: #fff5a4;
  box-shadow: 0 1px 3px rgb(0 0 0 / 35%);
}

.quick-links {
  height: 68px;
  padding: 7px 7px 5px;
  display: grid;
  grid-template-columns: repeat(5, max-content);
  grid-template-rows: repeat(2, 25px);
  align-content: start;
  justify-content: space-between;
  gap: 3px 0;
  background: #fff;
}

.quick-links button {
  height: 25px;
  padding: 0 6px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  font-size: 14px;
  line-height: 25px;
  white-space: nowrap;
  cursor: pointer;
  background: linear-gradient(#aa0804, #890300);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
}

.quick-links button:hover,
.quick-links button:focus-visible {
  background: #c71a10;
  outline: none;
}

.official-sites > h2 {
  height: 40px;
  margin: 0;
  display: grid;
  place-items: center;
  color: #ffff00;
  font-size: 18px;
  line-height: 1;
  background: #27789b;
}

.domain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #e3e3e3;
  gap: 1px;
}

.domain-grid button {
  height: 31px;
  padding: 0;
  border: 0;
  color: #f000a3;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: #ffff00;
}

.domain-grid button.active {
  color: #111;
}

.domain-grid button:hover,
.domain-grid button:focus-visible {
  filter: brightness(.93);
  outline: none;
}

.draw-card {
  padding: 7px 4px 5px;
  background: #fff;
}

.draw-card > h2 {
  height: 28px;
  margin: 0 0 16px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  background: #52c81c;
}

.draw-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px;
  font-size: 14px;
  white-space: nowrap;
}

.draw-meta > span:first-child {
  margin-right: auto;
}

.draw-meta button {
  padding: 0;
  border: 0;
  color: #0aad28;
  cursor: pointer;
  background: transparent;
}

.result-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 6px 10px 7px;
}

.result-item {
  min-width: 0;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 1px 3px;
  border: 1px solid #c9c9c9;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #fafafa);
  box-shadow: 0 2px 5px rgb(0 0 0 / 20%);
}

.result-ball {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 4px solid #df473d;
  border-radius: 50%;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  background: radial-gradient(circle at 38% 28%, #fff, #f6f6f6 72%, #e7e7e7);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 85%), 0 1px 2px rgb(0 0 0 / 22%);
}

.result-item small {
  min-height: 15px;
  color: #222;
  font-size: 12px;
  line-height: 15px;
  white-space: nowrap;
}

.result-ball.revealed {
  color: #111;
  background: radial-gradient(circle at 38% 28%, #fff, #f6f6f6 72%, #e7e7e7);
  text-shadow: none;
}

.result-ball.color-red { border-color: #ef4c43; }
.result-ball.color-blue { border-color: #2398d2; }
.result-ball.color-green { border-color: #45a942; }

.draw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 12px;
}

.draw-footer time {
  color: #005d9c;
}

.draw-footer button {
  padding: 3px 5px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  font-size: 15px;
  line-height: 20px;
  cursor: pointer;
  background: #ff5a00;
}

.archive-content {
  padding: 0 0 12px;
  background: #fff;
}

.archive-section {
  margin: 0;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  scroll-margin-top: 8px;
}

.archive-heading {
  min-height: 32px;
  margin: 0;
  padding: 5px 4px;
  display: grid;
  place-items: center;
  color: #111;
  font-size: 15px;
  line-height: 22px;
  text-align: center;
  background: #8296d0;
}

.archive-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 66px;
  align-items: start;
  min-height: 33px;
  padding: 4px 6px;
  border-bottom: 1px solid #f0bdbd;
  line-height: 24px;
}

.archive-row .issue {
  white-space: nowrap;
}

.archive-row .main-copy {
  text-align: center;
}

.archive-row .main-copy strong,
.red-copy {
  color: #ff1010;
}

.archive-row .result {
  text-align: right;
  white-space: nowrap;
}

.open-mark {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 3px;
  place-items: center;
  border: 1px solid #333;
  border-radius: 50%;
  color: #111;
  font-size: 12px;
  line-height: 1;
}

.result-value {
  color: #ff1515;
}

.detail-row {
  padding: 5px 7px 7px;
  border-bottom: 1px solid #cfcfcf;
  line-height: 25px;
}

.detail-row .detail-top {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 75px;
}

.detail-row .detail-top > span:last-child {
  text-align: right;
  white-space: nowrap;
}

.detail-row .detail-title {
  color: #ff1212;
  text-align: center;
}

.detail-row .detail-title .blue-copy {
  color: #224cff;
}

.detail-lines {
  padding-left: 48px;
  letter-spacing: .1px;
}

.detail-lines span {
  display: block;
}

.kill-grid-row {
  padding: 4px 5px;
  border-bottom: 1px solid #ccc;
}

.kill-grid-row .kill-values,
.kill-grid-row .kill-results {
  display: grid;
  grid-template-columns: 56px repeat(4, 1fr);
  gap: 3px;
  line-height: 22px;
  text-align: center;
}

.kill-grid-row .kill-values span {
  color: #ff1212;
}

.kill-grid-row .kill-values span:first-child,
.kill-grid-row .kill-results span:first-child {
  text-align: left;
}

.kill-grid-row .kill-results {
  color: #111;
}

.code-row .detail-lines {
  padding-left: 0;
}

.odd-row {
  display: grid;
  grid-template-columns: 58px 1fr 112px 64px;
  align-items: center;
  padding: 5px 6px;
  border-bottom: 1px solid #f0bdbd;
  line-height: 22px;
  text-align: center;
}

.odd-row .odd-name {
  color: #ff1212;
}

.odd-row .odd-value {
  white-space: pre-line;
}

.info-dialog {
  width: min(calc(100% - 28px), 350px);
  max-height: min(75vh, 520px);
  padding: 0;
  border: 0;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 12px 38px rgb(0 0 0 / 40%);
}

.info-dialog::backdrop {
  background: rgb(0 0 0 / 44%);
}

.dialog-titlebar {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 8px 0 14px;
  color: #fff;
  background: #9d0703;
}

.dialog-titlebar h2 {
  flex: 1;
  margin: 0;
  font-size: 17px;
}

.dialog-titlebar button {
  width: 32px;
  height: 32px;
  border: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  background: transparent;
}

.dialog-content {
  max-height: calc(75vh - 42px);
  padding: 13px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.65;
  background: #fff;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #eee;
}

.history-list strong {
  color: #8c0804;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 9px 14px;
  border-radius: 18px;
  color: #fff;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  background: rgb(0 0 0 / 78%);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: .18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Full-page history view */
.history-page {
  width: min(100%, 375px);
  min-height: 100vh;
  margin: 0 auto;
  color: #050505;
  background: #fff;
}

.history-page[hidden] {
  display: none;
}

.history-header {
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.history-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.history-back {
  position: absolute;
  left: 8px;
  top: 6px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: 0;
  cursor: pointer;
  background: transparent;
}

.history-back svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: #070707;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-toolbar {
  padding: 2px 9px 8px;
}

.history-toolbar h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 400;
  line-height: 30px;
}

.history-toolbar h2 span {
  color: #00b85c;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-actions button {
  min-width: 48px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid #a2a2a2;
  border-radius: 5px;
  color: #969696;
  font-size: 13px;
  line-height: 22px;
  cursor: pointer;
  background: #fff;
}

.history-actions .year-button.active {
  border-color: #00bd65;
  color: #00b95e;
}

.history-results {
  padding: 0 8px 18px;
}

.history-draw {
  margin: 0 0 10px;
}

.history-draw h3 {
  margin: 0;
  padding: 0 2px 5px;
  font-size: 18px;
  font-weight: 400;
  line-height: 30px;
}

.history-ball-row {
  display: grid;
  grid-template-columns: repeat(7, 41px);
  align-items: center;
  column-gap: 7px;
  height: 87px;
  padding: 6px 4px;
  border: 1px solid #00ce68;
  background: #fff;
}

.history-ball-card {
  width: 41px;
  height: 67px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 5px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff 0%, #fff 72%, #f9f9f9 100%);
  box-shadow: 0 2px 7px rgb(0 0 0 / 25%);
}

.history-ball-card.special {
  grid-column: auto;
}

.history-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 5px solid #ff4148;
  border-radius: 50%;
  color: #050505;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  background: radial-gradient(circle at 40% 28%, #fff 0 53%, #f2f2f2 76%, #ddd 100%);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 90%);
}

.history-number.color-red {
  border-color: #ff4148;
}

.history-number.color-blue {
  border-color: #159ee0;
}

.history-number.color-green {
  border-color: #43aa51;
}

.history-ball-card small {
  margin-top: 7px;
  color: #050505;
  font-size: 13px;
  line-height: 14px;
}

@media (max-width: 374px) {
  .quick-links {
    grid-template-columns: repeat(5, 1fr);
    column-gap: 2px;
  }

  .quick-links button {
    min-width: 0;
    padding-inline: 2px;
    font-size: clamp(11px, 3.7vw, 14px);
  }

  .result-row {
    gap: 5px;
    padding-inline: 8px;
  }

  .result-ball {
    width: 31px;
    height: 31px;
  }

  .history-actions {
    gap: 8px;
  }

  .history-ball-row {
    grid-template-columns: repeat(7, minmax(36px, 41px));
    column-gap: 5px;
    padding-inline: 3px;
  }

  .history-ball-card {
    width: 100%;
  }
}

/* Three-region lottery switch and synchronized source views */
.lottery-tabs {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid rgb(7 29 44 / 10%);
  background: rgb(247 250 249 / 94%);
  box-shadow: 0 7px 20px rgb(7 29 44 / 9%);
  backdrop-filter: blur(14px);
}

.lottery-tabs button {
  min-width: 0;
  height: 39px;
  padding: 0 6px;
  border: 1px solid #dbe5e3;
  border-radius: 11px;
  color: #5a6a73;
  font: 700 12px/37px "Microsoft YaHei", sans-serif;
  cursor: pointer;
  background: linear-gradient(180deg, #fff, #f3f6f5);
  transition: transform .18s ease, box-shadow .18s ease, color .18s ease;
}

.lottery-tabs button.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #0d8d77, #083f69);
  box-shadow: 0 7px 16px rgb(7 78 79 / 24%);
  transform: translateY(-1px);
}

body[data-lottery="hk"] .lottery-tabs button.active {
  background: linear-gradient(135deg, #d22f3f, #8d1428);
  box-shadow: 0 7px 16px rgb(151 26 48 / 25%);
}

body[data-lottery="mo"] .lottery-tabs button.active {
  background: linear-gradient(135deg, #b6284d, #5f214b);
  box-shadow: 0 7px 16px rgb(111 28 73 / 25%);
}

.source-panel {
  margin-bottom: 15px;
  overflow: hidden;
  border: 1px solid rgb(7 29 44 / 7%);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 11px 28px rgb(7 29 44 / 9%);
}

.source-history-panel > summary,
.history-draw > summary {
  list-style: none;
  cursor: pointer;
}

.source-history-panel > summary::-webkit-details-marker,
.history-draw > summary::-webkit-details-marker {
  display: none;
}

.source-history-panel > summary {
  position: relative;
  padding-right: 42px;
}

.source-history-panel > summary::after {
  content: "⌄";
  position: absolute;
  right: 15px;
  top: 50%;
  color: rgb(255 255 255 / 82%);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-55%);
  transition: transform .18s ease;
}

.source-history-panel[open] > summary::after {
  transform: translateY(-40%) rotate(180deg);
}

.source-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 14px 12px;
  color: #fff;
  background: linear-gradient(120deg, #0c3d5e, #087c68);
}

body[data-lottery="hk"] .source-panel-heading {
  background: linear-gradient(120deg, #8c1528, #d13a45);
}

body[data-lottery="mo"] .source-panel-heading {
  background: linear-gradient(120deg, #522044, #ad2a4f);
}

.source-panel-heading small {
  display: block;
  margin-bottom: 3px;
  color: rgb(255 255 255 / 65%);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.source-panel-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.source-panel-heading > span {
  flex: 0 0 auto;
  color: rgb(255 255 255 / 76%);
  font-size: 9px;
}

.source-recent-list {
  padding: 5px 10px 10px;
}

.recent-history-list {
  padding-top: 10px;
}

.recent-history-list .history-draw:last-child {
  margin-bottom: 0;
}

.history-draw > summary {
  position: relative;
}

.history-draw > summary h3 {
  padding-right: 42px;
}

.history-draw > summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  color: #fff;
  font-size: 18px;
  line-height: 22px;
  text-align: center;
  background: linear-gradient(135deg, var(--emerald), #0b6259);
  transform: translateY(-50%);
}

.history-draw[open] > summary::after {
  content: "−";
}

.source-draw-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 5px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f1;
}

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

.source-draw-title {
  color: #334750;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.source-ball-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.source-ball-row .history-ball-card {
  width: 100%;
  min-width: 0;
  height: 57px;
  border-radius: 8px;
  box-shadow: 0 3px 8px rgb(7 29 44 / 9%);
}

.source-ball-row .history-number {
  width: 30px;
  height: 30px;
  border-width: 4px;
  font-size: 12px;
}

.source-ball-row .history-ball-card small {
  margin-top: 3px;
  font-size: 9px;
  line-height: 12px;
  white-space: nowrap;
}

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

.source-gallery-card {
  min-width: 0;
  padding: 0 0 9px;
  overflow: hidden;
  border: 1px solid #e0e7e6;
  border-radius: 12px;
  color: #293d47;
  text-align: left;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 6px 15px rgb(7 29 44 / 7%);
}

.source-gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.35 / 1;
  object-fit: cover;
  background: #eef3f2;
}

.source-gallery-card span,
.source-gallery-card small {
  display: block;
  overflow: hidden;
  margin: 8px 9px 0;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.source-gallery-card span {
  font-size: 12px;
  font-weight: 800;
}

.source-gallery-card small {
  margin-top: 3px;
  color: #819097;
  font-size: 9px;
}

.source-disclaimer {
  margin: -4px 2px 20px;
  color: #869299;
  font-size: 9px;
  line-height: 1.65;
  text-align: center;
}

.gallery-dialog {
  width: min(calc(100vw - 18px), 430px);
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 15px;
  background: #101619;
  box-shadow: 0 25px 70px rgb(0 0 0 / 50%);
}

.gallery-dialog::backdrop {
  background: rgb(3 12 17 / 82%);
  backdrop-filter: blur(5px);
}

.gallery-dialog-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 10px 0 15px;
  color: #fff;
  background: rgb(10 20 25 / 94%);
  backdrop-filter: blur(12px);
}

.gallery-dialog-bar strong {
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gallery-dialog-bar button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  background: rgb(255 255 255 / 10%);
}

.gallery-dialog > img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 180px;
  object-fit: contain;
  background: #fff;
}

[hidden] {
  display: none !important;
}

@media (max-width: 374px) {
  .lottery-tabs {
    gap: 5px;
    padding-inline: 7px;
  }

  .lottery-tabs button {
    font-size: 11px;
  }

  .source-gallery-grid {
    gap: 7px;
    padding: 8px;
  }

  .source-recent-list {
    padding-inline: 7px;
  }

  .source-draw-row {
    grid-template-columns: 46px 1fr;
  }

  .source-ball-row {
    gap: 2px;
  }

  .source-ball-row .history-number {
    width: 27px;
    height: 27px;
    font-size: 11px;
  }
}

/* Premium typography and material refinement */
:root {
  --font-display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --font-number: Constantia, Georgia, "Times New Roman", serif;
}

html {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-smooth: always;
}

body,
button {
  font-family: var(--font-ui);
}

.site-shell,
.history-page {
  background-image:
    linear-gradient(120deg, rgb(255 255 255 / 22%) 0 1px, transparent 1px),
    radial-gradient(circle at 50% -100px, rgb(19 165 138 / 13%), transparent 360px);
  background-size: 18px 18px, auto;
}

.topbar-title > span:not(.topbar-gem) {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1.8px;
}

.topbar-title small {
  color: #a0803e;
  font-family: var(--font-number);
  font-size: 8px;
  letter-spacing: 2.8px;
}

.topbar-gem {
  border-color: rgb(238 210 145 / 74%);
  background:
    linear-gradient(135deg, rgb(255 255 255 / 18%), transparent 38%),
    linear-gradient(145deg, #061b2a, #0c8974);
  box-shadow:
    inset 0 0 0 3px rgb(255 255 255 / 7%),
    inset 0 0 12px rgb(215 182 107 / 18%),
    0 7px 16px rgb(7 29 44 / 20%);
}

.hero.hero-v2 {
  box-shadow:
    inset 0 0 0 1px rgb(242 221 170 / 14%),
    0 18px 38px rgb(7 29 44 / 26%);
}

.hero-v2::after {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: 1;
  border: 1px solid rgb(242 221 170 / 13%);
  border-radius: 15px 15px 19px 19px;
  pointer-events: none;
}

.hero-brand-copy strong {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 2.6px;
}

.hero-brand-copy span,
.hero-kicker,
.hero-address {
  font-family: var(--font-number);
}

.hero-kicker {
  color: #f1d795;
  letter-spacing: 2.8px;
  text-shadow: 0 2px 10px rgb(0 0 0 / 42%);
}

.hero-main-title {
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow:
    0 1px 0 rgb(255 255 255 / 25%),
    0 5px 18px rgb(0 0 0 / 48%);
}

.hero-main-title > span {
  color: #fff;
  background: linear-gradient(180deg, #fff 18%, #f8efd9 58%, #dfc17e 115%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-main-title small {
  font-family: var(--font-ui);
  font-weight: 400;
  letter-spacing: 4px;
}

.quick-links,
.official-sites,
.draw-card,
.archive-section,
.history-toolbar,
.history-draw {
  border-color: rgb(11 45 62 / 9%);
  box-shadow:
    0 1px 0 rgb(255 255 255 / 85%) inset,
    0 14px 34px rgb(7 29 44 / 9%);
}

.quick-links {
  background:
    linear-gradient(140deg, rgb(255 255 255 / 97%), rgb(247 250 249 / 94%));
}

.quick-links button {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .35px;
}

.quick-links button::before {
  height: 1px;
  background: linear-gradient(90deg, transparent, #c49a45, #0c8c76, transparent);
  box-shadow: 0 1px 5px rgb(215 182 107 / 32%);
}

.official-sites,
.draw-card {
  position: relative;
}

.official-sites::before,
.draw-card::before {
  content: "";
  position: absolute;
  inset: 0 18px auto;
  z-index: 3;
  height: 1px;
  background: linear-gradient(90deg, transparent, #f4d992 50%, transparent);
  opacity: .75;
}

.official-sites > h2,
.draw-card > h2,
.archive-heading,
.history-header h1,
.history-toolbar h2,
.history-draw h3 {
  font-family: var(--font-display);
}

.official-sites > h2,
.draw-card > h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-shadow: 0 2px 10px rgb(0 0 0 / 22%);
}

.official-sites > h2 small,
.draw-card > h2 small {
  font-family: var(--font-number);
  font-weight: 700;
  letter-spacing: 3px;
}

.domain-grid button {
  font-family: var(--font-number), var(--font-ui);
  font-size: 13px;
  letter-spacing: .35px;
  font-variant-numeric: tabular-nums;
}

.domain-grid button.active {
  color: #74561d;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 84%), transparent 46%),
    linear-gradient(145deg, #fffdf7, #f1dfb9);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 90%),
    0 5px 13px rgb(168 132 62 / 13%);
}

.draw-meta,
.draw-footer {
  letter-spacing: .15px;
}

.result-ball,
.history-number {
  font-family: var(--font-ui);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.result-ball {
  font-size: 15px;
  box-shadow:
    inset 0 1px 2px #fff,
    inset 0 -2px 4px rgb(7 29 44 / 8%),
    0 3px 7px rgb(7 29 44 / 16%);
}

.archive-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .8px;
  text-shadow: 0 2px 8px rgb(0 0 0 / 26%);
  box-shadow: inset 0 -1px 0 rgb(242 221 170 / 14%);
}

.archive-row,
.detail-row,
.kill-grid-row,
.odd-row {
  font-family: var(--font-ui);
  letter-spacing: .05px;
}

.archive-row .issue,
.detail-top > span:first-child,
.odd-row > span:first-child,
.result-value {
  font-family: var(--font-number), var(--font-ui);
  font-variant-numeric: tabular-nums;
}

.archive-row .main-copy strong,
.detail-row .detail-title,
.odd-row .odd-name {
  font-weight: 700;
}

.open-mark {
  font-family: var(--font-display);
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 70%),
    0 2px 5px rgb(168 132 62 / 12%);
}

.history-header {
  box-shadow:
    inset 0 -1px 0 rgb(242 221 170 / 18%),
    0 10px 26px rgb(7 29 44 / 22%);
}

.history-header h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgb(0 0 0 / 26%);
}

.history-toolbar h2 {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: .4px;
}

.history-draw h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
}

.history-ball-card {
  background:
    linear-gradient(140deg, rgb(255 255 255 / 96%), rgb(244 248 247 / 96%));
  box-shadow:
    inset 0 1px 0 #fff,
    0 6px 14px rgb(7 29 44 / 12%);
}

.history-ball-card.special {
  background:
    linear-gradient(140deg, rgb(255 255 255 / 94%), transparent 42%),
    linear-gradient(155deg, #fffdf6, #f2dfb8);
}

.history-number {
  font-size: 14px;
  box-shadow:
    inset 0 1px 2px #fff,
    inset 0 -2px 4px rgb(7 29 44 / 7%),
    0 2px 5px rgb(7 29 44 / 12%);
}

.back-to-top {
  font-family: var(--font-number);
  background:
    linear-gradient(140deg, rgb(255 255 255 / 10%), transparent 46%),
    linear-gradient(145deg, var(--navy), #165449);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 7%),
    0 11px 26px rgb(7 29 44 / 30%);
}

/* =========================================================
   Premium visual system
   ========================================================= */
:root {
  --ink: #0b1726;
  --ink-soft: #526172;
  --navy: #071d2c;
  --navy-2: #0b2d3e;
  --emerald: #087c68;
  --emerald-bright: #13a58a;
  --gold: #d7b66b;
  --gold-light: #f2ddaa;
  --paper: #ffffff;
  --canvas: #eef3f4;
  --line: #dbe4e5;
  --shadow: 0 12px 32px rgb(7 29 44 / 10%);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--canvas);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -100px, rgb(19 165 138 / 14%), transparent 340px),
    var(--canvas);
}

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

.site-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  overflow: hidden;
  background: var(--canvas);
  box-shadow: 0 0 45px rgb(7 29 44 / 12%);
}

.site-shell > .topbar-title {
  height: 62px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: 24px 15px;
  align-content: center;
  column-gap: 10px;
  place-items: initial;
  color: var(--ink);
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid rgb(7 29 44 / 7%);
}

.topbar-title > span:not(.topbar-gem) {
  align-self: end;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 22px;
}

.topbar-title small {
  grid-column: 2;
  color: #8c7442;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.2px;
  line-height: 13px;
}

.topbar-gem {
  position: relative;
  grid-row: 1 / 3;
  align-self: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgb(215 182 107 / 65%);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--navy-2), var(--emerald));
  box-shadow: inset 0 0 0 3px rgb(255 255 255 / 7%), 0 5px 12px rgb(7 29 44 / 15%);
  transform: rotate(45deg) scale(.72);
}

.topbar-gem::before,
.topbar-gem::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
}

.topbar-gem::after {
  inset: 12px 5px;
  border-width: 1px 0;
  border-radius: 0;
}

.hero.hero-v2 {
  position: relative;
  height: 210px;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 16px 32px rgb(7 29 44 / 22%);
}

.hero-v2::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 72%, rgb(215 182 107 / 20%), transparent 28%),
    linear-gradient(100deg, rgb(4 21 33 / 40%), rgb(4 21 33 / 88%) 68%, rgb(8 73 66 / 92%));
}

.hero-banner-image {
  filter: saturate(.48) brightness(.44) contrast(1.1);
  transform: scale(1.06);
  object-position: 42% center;
}

.hero-brandbar {
  height: 50px;
  padding: 4px 14px;
  background: linear-gradient(180deg, rgb(5 24 37 / 78%), rgb(5 24 37 / 38%));
  border: 0;
  box-shadow: none;
  backdrop-filter: blur(8px);
}

.hero-brand-icon {
  width: 37px;
  height: 34px;
  opacity: .92;
}

.hero-brand-copy {
  padding-left: 9px;
  text-shadow: none;
}

.hero-brand-copy strong {
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  line-height: 19px;
  letter-spacing: 2px;
}

.hero-brand-copy span {
  color: var(--gold-light);
  font-size: 10px;
  line-height: 13px;
  letter-spacing: 1.6px;
}

.hero-spin-icon {
  width: 30px;
  height: 30px;
  opacity: .78;
  filter: grayscale(.55) sepia(.3) drop-shadow(0 2px 3px rgb(0 0 0 / 25%));
}

.hero-kicker {
  position: absolute;
  z-index: 2;
  left: 18px;
  top: 70px;
  color: var(--gold-light);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2.4px;
}

.hero-main-title {
  left: 18px;
  right: auto;
  top: 91px;
  display: flex;
  flex-direction: column;
  color: #fff;
  font-family: inherit;
  font-size: 29px;
  letter-spacing: 2px;
  text-shadow: 0 5px 16px rgb(0 0 0 / 40%);
}

.hero-main-title small {
  margin-top: 7px;
  color: rgb(255 255 255 / 72%);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 3px;
}

.hero-address {
  left: 18px;
  right: auto;
  bottom: 19px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  background: transparent;
  box-shadow: none;
}

.quick-links {
  height: auto;
  margin: 14px 12px 0;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, 42px);
  gap: 8px 6px;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 16px;
  background: rgb(255 255 255 / 90%);
  box-shadow: var(--shadow);
}

.quick-links button {
  position: relative;
  height: 42px;
  min-width: 0;
  padding: 12px 3px 4px;
  border: 1px solid #dfe8e8;
  border-radius: 10px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(180deg, #fff, #f7faf9);
  box-shadow: none;
}

.quick-links button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--emerald));
  transform: translateX(-50%);
}

.quick-links button.active {
  border-color: rgb(215 182 107 / 72%);
  color: #fff;
  background: linear-gradient(145deg, var(--navy-2), #164c57);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 7%),
    0 6px 13px rgb(7 29 44 / 18%);
}

.quick-links button:not(.active):hover {
  border-color: rgb(8 124 104 / 30%);
  color: var(--emerald);
  background: #eef8f5;
  transform: translateY(-1px);
}

.quick-links button:focus-visible {
  outline: 2px solid rgb(215 182 107 / 72%);
  outline-offset: 2px;
}

.official-sites {
  margin: 12px;
  overflow: hidden;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.official-sites > h2 {
  height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  background: linear-gradient(120deg, var(--navy), var(--navy-2) 55%, var(--emerald));
}

.official-sites > h2 small {
  margin-bottom: 4px;
  color: var(--gold-light);
  font-size: 8px;
  letter-spacing: 2.4px;
}

.domain-grid {
  padding: 10px;
  gap: 8px;
  background: #fff;
}

.domain-grid button {
  height: 39px;
  border: 1px solid #dfe7e7;
  border-radius: 9px;
  color: #49606a;
  font-size: 13px;
  font-weight: 600;
  background: #f7faf9;
}

.domain-grid button.active {
  border-color: rgb(215 182 107 / 75%);
  color: #735c28;
  background: linear-gradient(145deg, #fffdf8, #f5ecd8);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 90%);
}

.draw-card {
  margin: 0 12px 14px;
  padding: 0 10px 10px;
  overflow: hidden;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.draw-card > h2 {
  height: 58px;
  margin: 0 -10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  background: linear-gradient(120deg, #086c60, var(--emerald-bright));
}

.draw-card > h2 small {
  margin-bottom: 4px;
  color: #d9fff6;
  font-size: 8px;
  letter-spacing: 2.4px;
}

.draw-meta {
  gap: 6px;
  padding: 0 2px 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.draw-meta > span:first-child {
  color: var(--ink);
  font-weight: 600;
}

.draw-meta button {
  padding: 4px 8px;
  border: 1px solid rgb(8 124 104 / 25%);
  border-radius: 999px;
  color: var(--emerald);
  font-size: 11px;
  background: #f0faf7;
}

.result-row {
  gap: 5px;
  padding: 4px 0 12px;
}

.result-item {
  min-height: 74px;
  gap: 4px;
  padding: 6px 1px 4px;
  border: 1px solid #dde6e6;
  border-radius: 10px;
  background: linear-gradient(160deg, #fff, #f5f8f7);
  box-shadow: 0 5px 12px rgb(7 29 44 / 10%);
}

.result-item:last-child {
  border-color: rgb(215 182 107 / 55%);
  background: linear-gradient(160deg, #fffefb, #f7eedc);
}

.result-ball {
  width: 35px;
  height: 35px;
  border-width: 4px;
  font-size: 14px;
  background: radial-gradient(circle at 36% 27%, #fff, #f7faf9 66%, #e2e9e7);
  box-shadow: inset 0 0 0 1px #fff, 0 2px 4px rgb(7 29 44 / 14%);
}

.result-item small {
  color: #53636e;
  font-size: 10px;
}

.draw-footer {
  padding: 9px 2px 0;
  border-top: 1px solid #edf1f1;
  color: var(--ink-soft);
  font-size: 11px;
}

.draw-footer time {
  color: var(--emerald);
  font-weight: 700;
}

.draw-footer button {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: linear-gradient(135deg, var(--gold), #a8843e);
  box-shadow: 0 5px 10px rgb(168 132 62 / 22%);
}

.archive-content {
  padding: 0 12px 28px;
  background: transparent;
}

.archive-section {
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 9px 24px rgb(7 29 44 / 8%);
  scroll-margin-top: 10px;
}

.archive-heading {
  min-height: 48px;
  padding: 8px 13px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: .2px;
  background:
    linear-gradient(90deg, var(--gold) 0 4px, transparent 4px),
    linear-gradient(120deg, var(--navy), var(--navy-2) 70%, #174b53);
}

.archive-row {
  grid-template-columns: 54px minmax(0, 1fr) 61px;
  min-height: 39px;
  padding: 7px 9px;
  border-bottom: 1px solid #edf1f1;
  color: #344651;
  font-size: 12px;
  line-height: 24px;
}

.archive-row:nth-child(odd),
.detail-row:nth-child(odd),
.kill-grid-row:nth-child(odd),
.odd-row:nth-child(odd) {
  background: #f8faf9;
}

.archive-row .issue,
.detail-top > span:first-child,
.odd-row > span:first-child {
  color: #6b7a83;
  font-weight: 600;
}

.archive-row .main-copy strong,
.red-copy,
.detail-row .detail-title,
.odd-row .odd-name {
  color: var(--emerald);
}

.open-mark {
  width: 21px;
  height: 21px;
  border-color: rgb(168 132 62 / 60%);
  color: #80662f;
  background: #fff9eb;
}

.result-value {
  color: #a77424;
  font-weight: 700;
}

.detail-row {
  padding: 8px 9px 9px;
  border-bottom: 1px solid #edf1f1;
  color: #344651;
  font-size: 12px;
  line-height: 23px;
}

.detail-row .detail-top {
  grid-template-columns: 46px minmax(0, 1fr) 68px;
  align-items: center;
}

.detail-row .detail-title .blue-copy {
  color: #34758e;
}

.detail-lines {
  padding: 5px 0 0 43px;
  color: #52636c;
  line-height: 21px;
  word-break: break-word;
}

.kill-grid-row {
  padding: 7px 9px;
  border-bottom: 1px solid #edf1f1;
  color: #44555f;
  font-size: 11px;
}

.kill-grid-row .kill-values,
.kill-grid-row .kill-results {
  grid-template-columns: 49px repeat(4, 1fr);
}

.kill-grid-row .kill-values span {
  color: var(--emerald);
}

.odd-row {
  grid-template-columns: 50px 1fr 100px 60px;
  padding: 8px 9px;
  border-bottom: 1px solid #edf1f1;
  color: #40515b;
  font-size: 11px;
}

.history-page {
  width: min(100%, 430px);
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -80px, rgb(19 165 138 / 16%), transparent 330px),
    var(--canvas);
  box-shadow: 0 0 45px rgb(7 29 44 / 12%);
}

.history-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 62px;
  color: #fff;
  background: linear-gradient(120deg, var(--navy), var(--navy-2) 60%, var(--emerald));
  box-shadow: 0 8px 22px rgb(7 29 44 / 18%);
}

.history-header h1 {
  font-size: 17px;
  letter-spacing: 1px;
}

.history-back {
  left: 9px;
  top: 13px;
}

.history-back svg {
  stroke: #fff;
}

.history-toolbar {
  margin: 14px 12px 12px;
  padding: 14px;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 15px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow);
}

.history-toolbar h2 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.history-toolbar h2 span {
  color: var(--emerald);
}

.history-actions {
  gap: 8px;
}

.history-year-buttons {
  min-width: 0;
  display: flex;
  flex: 1;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.history-year-buttons::-webkit-scrollbar {
  display: none;
}

.history-actions button {
  min-width: 54px;
  height: 30px;
  padding: 0 12px;
  border-color: #dbe4e4;
  border-radius: 8px;
  color: #687881;
  font-size: 12px;
  line-height: 28px;
  background: #f8faf9;
}

.history-actions .year-button.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald), #0b6259);
  box-shadow: 0 5px 12px rgb(8 124 104 / 22%);
}

.history-results {
  padding: 0 12px 28px;
}

.history-empty,
.system-loading {
  padding: 28px 18px;
  border: 1px solid rgb(7 29 44 / 7%);
  border-radius: 14px;
  color: #657680;
  font-size: 13px;
  text-align: center;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 10px 25px rgb(7 29 44 / 7%);
}

.system-loading {
  margin-bottom: 14px;
}

.history-draw {
  margin: 0 0 13px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(7 29 44 / 6%);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgb(7 29 44 / 8%);
}

.history-draw h3 {
  padding: 10px 12px 6px;
  color: #263945;
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
}

.history-ball-row {
  grid-template-columns: repeat(7, 43px);
  column-gap: 7px;
  height: 86px;
  padding: 7px 8px 10px;
  border: 0;
  border-top: 1px solid #edf1f1;
  background: linear-gradient(180deg, #fbfdfc, #f4f8f7);
}

.history-ball-card {
  width: 43px;
  height: 66px;
  border-color: #dce5e4;
  border-radius: 9px;
  box-shadow: 0 5px 11px rgb(7 29 44 / 11%);
}

.history-ball-card.special {
  border-color: rgb(215 182 107 / 65%);
  background: linear-gradient(160deg, #fff, #f8efdd);
}

.history-number {
  width: 33px;
  height: 33px;
  border-width: 4px;
  font-size: 13px;
}

.history-ball-card small {
  margin-top: 6px;
  color: #4b5d67;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
}

.toast {
  bottom: 24px;
  padding: 10px 16px;
  border: 1px solid rgb(242 221 170 / 22%);
  color: #fff;
  background: rgb(7 29 44 / 92%);
  box-shadow: 0 10px 28px rgb(7 29 44 / 30%);
  backdrop-filter: blur(8px);
}

.back-to-top {
  position: fixed;
  right: max(16px, calc(50% - 205px));
  bottom: 20px;
  z-index: 15;
  width: 42px;
  height: 42px;
  border: 1px solid rgb(242 221 170 / 45%);
  border-radius: 14px;
  color: var(--gold-light);
  font-size: 20px;
  cursor: pointer;
  background: linear-gradient(145deg, var(--navy), #164752);
  box-shadow: 0 9px 22px rgb(7 29 44 / 28%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 400px) {
  .history-ball-row {
    grid-template-columns: repeat(7, 40px);
    column-gap: 5px;
    padding-inline: 6px;
  }

  .history-ball-card {
    width: 40px;
  }
}

@media (max-width: 374px) {
  .quick-links {
    margin-inline: 8px;
    padding-inline: 7px;
    column-gap: 4px;
  }

  .quick-links button {
    font-size: 10px;
  }

  .official-sites,
  .draw-card {
    margin-inline: 8px;
  }

  .archive-content,
  .history-results {
    padding-inline: 8px;
  }

  .history-toolbar {
    margin-inline: 8px;
  }

  .history-ball-row {
    grid-template-columns: repeat(7, minmax(36px, 41px));
    column-gap: 5px;
    padding-inline: 6px;
  }

  .history-ball-card {
    width: 100%;
  }

  .back-to-top {
    right: 12px;
  }
}
