* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  background: #e6e6e6 url("assets/bg.jpg") center / cover fixed no-repeat;
}

body {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  overflow-x: hidden;
  color: #444;
  background: #e6e6e6 url("assets/bg.jpg") center / cover fixed no-repeat;
  font: 14px/1.5 tahoma, 微软雅黑, 宋体, arial, georgia, verdana, helvetica, sans-serif;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

button,
a {
  font: inherit;
}

.site-shell {
  width: 100%;
}

.box {
  width: 100%;
  margin: 0 0 1px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(180, 180, 180, 0.7);
}

.masthead {
  position: relative;
  aspect-ratio: 1494 / 639;
  overflow: hidden;
}

.carousel__track,
.carousel__slide {
  position: absolute;
  inset: 0;
}

.carousel__slide {
  z-index: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 350ms ease, visibility 350ms ease;
}

.carousel__slide.is-active {
  z-index: 1;
  opacity: 1;
  visibility: visible;
}

.carousel__slide a {
  display: block;
  width: 100%;
  height: 100%;
}

.masthead img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel__control {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 36px;
  height: 44px;
  padding: 0;
  color: #fff;
  border: 0;
  background: rgba(0, 0, 0, 0.34);
  font: 34px/40px Arial, sans-serif;
  cursor: pointer;
  transform: translateY(-50%);
}

.carousel__control--prev { left: 0; border-radius: 0 4px 4px 0; }
.carousel__control--next { right: 0; border-radius: 4px 0 0 4px; }
.carousel__control:hover,
.carousel__control:focus-visible { background: rgba(0, 0, 0, 0.58); outline: 2px solid #fff; outline-offset: -3px; }

.carousel__dots {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 8px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}

.carousel__dots button {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.carousel__dots button.is-active { background: #fff; }

.jump-nav {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 4px;
  color: #fff;
  background: #fff;
  font-size: 16px;
}

.jump-nav.is-fixed {
  position: fixed;
  inset: 0 0 auto;
  margin: auto;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.jump-nav__row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.jump-nav button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin: 0 4px;
  padding: 5px 2px;
  overflow: hidden;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 50px;
  background: #e83e7a;
  cursor: pointer;
}

.jump-nav button:hover,
.jump-nav button:focus-visible {
  background: #da183b;
  outline: none;
}

.lottery-panel {
  height: 210px;
  margin-top: 5px;
  overflow: hidden;
  color: #333;
}

.lottery-tabs {
  --tab-columns: 5;
  display: flex;
  height: 58px;
  padding: 5px 0 8px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 2px solid #fff;
  scrollbar-color: #aaa transparent;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.lottery-tabs::-webkit-scrollbar { height: 4px; }
.lottery-tabs::-webkit-scrollbar-thumb { background: #aaa; border-radius: 4px; }

.lottery-tabs button {
  display: flex;
  flex: 0 0 calc((100% / var(--tab-columns)) - 8px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 39px;
  margin-right: 8px;
  padding: 2px 4px;
  overflow: hidden;
  color: #333;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 4px;
  background: #eee;
  font-size: 16px;
  line-height: 18px;
  cursor: pointer;
  scroll-snap-align: start;
}

.lottery-tabs button span,
.lottery-tabs button small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lottery-tabs button small { font-size: 11px; font-weight: 400; line-height: 14px; }

.lottery-tabs button:nth-child(1).is-active { color: #fff; background: #1fb61d; }
.lottery-tabs button:nth-child(2).is-active { color: #fff; background: #e71607; }
.lottery-tabs button:nth-child(3).is-active { color: #fff; background: #2389e9; }
.lottery-tabs button:nth-child(4).is-active { color: #fff; background: #1fb61d; }
.lottery-tabs button:nth-child(5).is-active { color: #fff; background: #e71607; }

.draw-card {
  height: 130px;
  padding: 8px;
  font-size: 16px;
}

.draw-card__head,
.draw-card__foot {
  display: flex;
  align-items: center;
}

.draw-card__head {
  height: 17px;
  line-height: 17px;
  font-size: 17px;
}

.draw-card__head > div,
.draw-card__foot > div {
  flex: 1;
}

#countdown {
  flex: 1;
  text-align: center;
}

.history-link,
.red {
  color: #f00;
}

.history-link {
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.balls {
  display: flex;
  margin: 8px 0;
}

.ball {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 61px;
  margin-right: 6px;
  color: #fff;
  text-align: center;
  border-radius: 4px;
}

.ball--red { background: #f00; }
.ball--blue { background: #00f; }
.ball--green { background: #0eaf34; }
.ball--pending {
  color: #111;
  border: 3px solid #e6e6e6;
  background: #f7f7f7;
}

.ball.ball--pending strong {
  color: #111;
  font-size: 24px;
}

.ball--rolling {
  border-color: #f5b400;
  background: #fff7d6;
  animation: draw-ball-rolling 550ms ease-in-out infinite;
}

.ball--revealed {
  animation: draw-ball-revealed 420ms ease-out both;
}

#countdown.is-opening {
  font-size: 14px;
  font-weight: 600;
}

@keyframes draw-ball-rolling {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes draw-ball-revealed {
  0% { opacity: 0.25; transform: scale(0.82); }
  100% { opacity: 1; transform: scale(1); }
}

.ball strong {
  margin: 0;
  color: #fff;
  font: 900 28px/24px Tahoma, Geneva, sans-serif;
}

.ball span {
  display: inline-block;
  height: 19px;
  margin-top: 6px;
  padding: 0 6px;
  color: #333;
  border-radius: 2px;
  background: #fff;
  font-size: 14px;
  line-height: 19px;
  white-space: nowrap;
}

.ball span[hidden] { display: none; }

.balls .ball:last-child {
  margin-right: 0;
}

.plus {
  display: flex;
  align-items: center;
  margin-right: 8px;
  color: #111;
  font-size: 32px;
}

.draw-card__foot {
  font-size: 16px;
}

#refreshDraw {
  display: inline-block;
  width: 40px;
  height: 20px;
  padding: 0;
  color: #fff;
  border: 0;
  border-radius: 4px;
  background: #f90;
  line-height: 20px;
  cursor: pointer;
}

#refreshDraw:disabled {
  cursor: wait;
  opacity: 0.82;
}

body.history-open {
  overflow: hidden;
}

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

.history-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.history-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
}

.history-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid #d7d7d7;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
}

.history-dialog__head {
  display: flex;
  min-height: 46px;
  align-items: center;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
}

.history-dialog__head h2 {
  flex: 1;
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
}

.history-dialog__close {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #555;
  border: 0;
  background: transparent;
  font: 28px/32px Arial, sans-serif;
  cursor: pointer;
}

.history-dialog__close:hover,
.history-dialog__close:focus-visible {
  color: #f00;
  outline: 1px solid #aaa;
}

.history-dialog__status {
  padding: 30px 12px;
  color: #777;
  text-align: center;
}

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

.history-list {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-item {
  padding: 10px 12px 12px;
  border-bottom: 1px solid #ececec;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #555;
  font-size: 14px;
}

.history-item__head strong {
  color: #333;
  font-weight: 400;
}

.history-item__head strong span {
  color: #f00;
}

.history-item__head time {
  color: #888;
}

.history-balls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) 20px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}

.history-ball {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
}

.history-ball strong {
  display: flex;
  width: min(42px, 100%);
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 50%;
  font: 700 19px/1 Tahoma, Geneva, sans-serif;
}

.history-ball--red strong { background: #f00; }
.history-ball--blue strong { background: #00f; }
.history-ball--green strong { background: #0eaf34; }

.history-ball span {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: #444;
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-plus {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: #111;
  font: 26px/1 Arial, sans-serif;
}

.module-box {
  scroll-margin-top: 110px;
  overflow-anchor: none;
}

.module-box iframe {
  display: block;
  width: 100%;
  border: 0;
  overflow-anchor: none;
}

.site-note {
  padding: 0;
  color: #444;
  text-align: center;
}

.site-note,
.site-note * {
  box-sizing: content-box;
}

.site-note .cont {
  padding: 3px;
}

@media (max-width: 800px) {
  .jump-nav {
    padding: 2px;
    font-size: 13px;
  }

  .jump-nav__row {
    padding: 2px 0;
  }

  .jump-nav button {
    width: auto;
    margin: 0 2px;
    padding: 3px 1px;
  }
}

@media (max-width: 650px) {
  .lottery-tabs button {
    min-width: 82px;
    font-size: 12px;
  }

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

  .draw-card {
    font-size: 14px;
  }

  .draw-card__head,
  .draw-card__foot {
    font-size: 13px;
  }

  .ball {
    margin-right: 4px;
  }

  .ball strong {
    font-size: 24px;
  }

  .ball span {
    margin-top: 4px;
    padding: 0 2px;
    font-size: 12px;
  }

  .plus {
    margin-right: 4px;
    font-size: 24px;
  }

  .history-modal {
    align-items: stretch;
    padding: 0;
  }

  .history-dialog {
    max-height: 100vh;
    border-width: 0;
    border-radius: 0;
  }

  .history-dialog__head {
    min-height: 44px;
  }

  .history-dialog__head h2 {
    font-size: 16px;
  }

  .history-item {
    padding-right: 8px;
    padding-left: 8px;
  }

  .history-balls {
    grid-template-columns: repeat(6, minmax(0, 1fr)) 14px minmax(0, 1fr);
    gap: 3px;
  }

  .history-ball strong {
    width: min(38px, 100%);
    font-size: 16px;
  }

  .history-ball span {
    font-size: 10px;
  }

  .history-plus {
    height: 38px;
    font-size: 22px;
  }
}

@media (max-width: 350px) {
  .lottery-tabs button {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel__slide { transition: none; }
  .ball--rolling,
  .ball--revealed { animation: none; }
}
