:root {
  --lottery-bg-top: #05070d;
  --lottery-bg-bottom: #0a1731;
  --lottery-text: #eaf2ff;
  --lottery-panel: rgba(8, 14, 24, 0.9);
  --lottery-line: rgba(124, 255, 203, 0.16);
  --lottery-muted: #a9b9d7;
  --lottery-green: #7cffcb;
  --lottery-gold: #ffd15f;
  --lottery-red: #ff6c7e;
  --lottery-blue: #6fd5ff;
  --lottery-violet: #a98bff;
  --lottery-font:
    "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--lottery-text);
  font-family: var(--lottery-font);
  background:
    radial-gradient(
      110% 130% at 82% 0%,
      rgba(255, 209, 95, 0.14),
      transparent 38%
    ),
    radial-gradient(
      90% 120% at 12% 14%,
      rgba(111, 213, 255, 0.13),
      transparent 30%
    ),
    linear-gradient(160deg, var(--lottery-bg-top), var(--lottery-bg-bottom));
}

button {
  font-family: inherit;
}

.page-wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 24px;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(8, 10, 23, 0.92);
  border-bottom: 1px solid rgba(126, 153, 255, 0.24);
  backdrop-filter: blur(8px);
}

.top-strip-inner {
  overflow-x: auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 58px;
  width: max-content;
  min-width: 100%;
  padding: 0.5rem 0;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.78rem;
  flex-shrink: 0;
  margin-left: auto;
}

.icon-button {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  flex-shrink: 0;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.icon-button img {
  width: clamp(168px, 26vw, 280px);
  height: auto;
  display: block;
  pointer-events: none;
}

.icon-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.top-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  flex-shrink: 0;
  min-width: max-content;
  white-space: nowrap;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.02rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.2);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-nav-link:hover {
  transform: translateY(-1px);
  background: rgba(31, 47, 84, 0.96);
  border-color: rgba(141, 176, 255, 0.5);
  box-shadow: 0 10px 24px rgba(5, 10, 24, 0.32);
}

.top-nav-link.is-active {
  background: linear-gradient(
    135deg,
    rgba(74, 117, 255, 0.92),
    rgba(42, 80, 186, 0.92)
  );
  border-color: rgba(198, 217, 255, 0.74);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(43, 77, 179, 0.28);
}

.top-lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.top-lang-switch::after {
  content: "▾";
  position: absolute;
  right: 0.9rem;
  color: #dbeafe;
  font-size: 0.9rem;
  pointer-events: none;
}

.top-lang-switch__select {
  min-height: 48px;
  padding: 0.7rem 2.25rem 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.24);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  appearance: none;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-lang-switch__select:hover {
  transform: translateY(-1px);
  background: rgba(31, 47, 84, 0.96);
  border-color: rgba(141, 176, 255, 0.5);
  box-shadow: 0 10px 24px rgba(5, 10, 24, 0.32);
}

.top-lang-switch__select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(198, 217, 255, 0.9);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
}

.game-stage,
.game-info {
  grid-column: 1;
}

.game-panel {
  background:
    linear-gradient(90deg, rgba(124, 255, 203, 0.05), transparent 34%),
    var(--lottery-panel);
  border: 1px solid var(--lottery-line);
  border-radius: 22px;
  color: #dde7f3;
  padding: 1rem 1.05rem;
  box-shadow: 0 18px 38px rgba(4, 10, 24, 0.34);
}

.game-stage {
  --game-frame-width: 1406px;
  --game-frame-height: 894px;
  --game-frame-gap: 14px;
  --game-frame-padding: 20px;
  --game-frame-surface-padding: 0px;
  padding: 8px;
  overflow: hidden;
}

.game-shell-lottery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.game-shell-lottery .game-shell__toolbar {
  position: relative;
  z-index: 12;
  grid-column: 1;
  align-items: center;
  min-height: 72px;
  height: 72px;
  padding: 10px 14px;
}

.game-shell-lottery .game-shell__toolbar-group {
  gap: 10px;
}

.game-shell-lottery .game-shell__button {
  min-height: 46px;
  padding: 0.72rem 1.18rem;
  font-size: 1.25rem;
}

.game-shell-lottery .game-shell__play {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 2;
  align-items: stretch;
  justify-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(9, 15, 29, 0.88);
}

.lottery-audio-toggle {
  min-width: 74px;
  padding-inline: 0.92rem;
}

.lottery-audio-toggle.is-muted {
  background: rgba(21, 32, 58, 0.92);
  border-color: rgba(164, 191, 255, 0.24);
  opacity: 0.88;
}

.lottery-viewport {
  position: relative;
  width: 1366px;
  height: 768px;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(152, 192, 255, 0.44);
  background:
    radial-gradient(
      circle at 50% -15%,
      rgba(255, 209, 95, 0.16),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(6, 12, 27, 0.96), rgba(9, 19, 42, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 28px 54px rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(3, 10, 8, 0.28);
  user-select: none;
  touch-action: manipulation;
}

.lottery-stage {
  position: relative;
  display: grid;
  grid-template-columns: 166px minmax(0, 1fr) 258px;
  gap: 14px;
  width: 100%;
  height: 100%;
  padding: 14px;
  min-width: 0;
  min-height: 0;
}

.lottery-hud,
.lottery-controls {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  color: #eff6ff;
}

.lottery-controls {
  overflow: hidden;
}

.lottery-stat,
.lottery-control-group,
.lottery-history-panel {
  border-radius: 16px;
  border: 1px solid rgba(164, 191, 255, 0.18);
  background: rgba(7, 12, 26, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 20px rgba(0, 0, 0, 0.16);
}

.lottery-stat {
  display: grid;
  gap: 5px;
  padding: 12px 13px;
}

.lottery-stat__label {
  color: #9db3de;
  font-size: 0.85rem;
  font-weight: 800;
}

.lottery-stat__value {
  color: #ffffff;
  font-size: 1.34rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.lottery-board {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 209, 95, 0.24);
  background:
    radial-gradient(
      circle at 50% 45%,
      rgba(255, 209, 95, 0.15),
      transparent 32%
    ),
    linear-gradient(160deg, rgba(9, 27, 44, 0.96), rgba(5, 10, 23, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -26px 50px rgba(0, 0, 0, 0.22);
}

.lottery-track {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 18px;
}

.lottery-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(164, 191, 255, 0.2);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent),
    rgba(10, 18, 35, 0.84);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 16px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.lottery-cell::after {
  content: attr(data-multiplier);
  position: absolute;
  top: 7px;
  right: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.74rem;
  font-weight: 900;
}

.lottery-cell.is-active {
  border-color: rgba(255, 209, 95, 0.9);
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 235, 160, 0.28), transparent 52%),
    rgba(72, 40, 8, 0.86);
  box-shadow:
    0 0 0 3px rgba(255, 209, 95, 0.22),
    0 0 26px rgba(255, 209, 95, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lottery-cell.is-selected {
  border-color: rgba(124, 255, 203, 0.58);
  box-shadow:
    0 0 0 2px rgba(124, 255, 203, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.animal-sprite {
  width: clamp(42px, 4.7vw, 64px);
  aspect-ratio: 1;
  background-image: url("./assets/choices.png");
  background-repeat: no-repeat;
  background-size: 1000% 100%;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.36));
}

.lottery-cell__name {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  overflow: hidden;
  color: #edf4ff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.56);
}

.lottery-center {
  position: absolute;
  inset: 118px 120px;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 209, 95, 0.32);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 209, 95, 0.16), transparent 45%),
    linear-gradient(180deg, rgba(13, 24, 47, 0.9), rgba(7, 12, 26, 0.94));
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
}

.lottery-center__kicker,
.lottery-overlay__kicker {
  margin: 0;
  color: var(--lottery-green);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lottery-center h1 {
  max-width: 100%;
  margin: 0;
  color: #ffffff;
  font-size: 2.5rem;
  line-height: 1.08;
  text-wrap: balance;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.36);
}

.lottery-center__status {
  min-height: 48px;
  margin: 0;
  color: #d9e8ff;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.4;
}

.lottery-last-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  min-width: 220px;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 95, 0.28);
  background: rgba(5, 10, 22, 0.56);
  color: #ffffff;
  font-weight: 950;
}

.lottery-last-result__icon .animal-sprite {
  width: 38px;
}

.lottery-control-group,
.lottery-history-panel {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.lottery-control-group h2,
.lottery-history-panel h2 {
  margin: 0;
  color: #c9d7ef;
  font-size: 0.94rem;
  line-height: 1.2;
}

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

.lottery-pick,
.lottery-bet {
  min-width: 0;
  border: 1px solid rgba(164, 191, 255, 0.18);
  background: rgba(13, 24, 46, 0.74);
  color: #eef4ff;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease;
}

.lottery-pick {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 7px;
  border-radius: 12px;
  text-align: left;
}

.lottery-pick .animal-sprite {
  width: 34px;
}

.lottery-pick__name {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lottery-pick__meta {
  display: block;
  color: #9db3de;
  font-size: 0.72rem;
  font-weight: 800;
}

.lottery-pick:hover,
.lottery-bet:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 255, 203, 0.42);
  background: rgba(20, 38, 57, 0.86);
}

.lottery-pick.is-selected,
.lottery-bet.is-selected {
  border-color: rgba(124, 255, 203, 0.76);
  background:
    linear-gradient(180deg, rgba(124, 255, 203, 0.16), transparent),
    rgba(10, 29, 38, 0.9);
  box-shadow: 0 0 0 2px rgba(124, 255, 203, 0.14);
}

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

.lottery-bet {
  min-height: 40px;
  padding: 7px 5px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 950;
}

.lottery-bet:disabled,
.lottery-spin:disabled,
.lottery-pick:disabled {
  cursor: default;
  opacity: 0.48;
  transform: none;
}

.lottery-spin {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(135deg, var(--lottery-gold), #d78919);
  color: #241707;
  font-size: 1.25rem;
  font-weight: 1000;
  cursor: pointer;
  box-shadow:
    0 16px 26px rgba(0, 0, 0, 0.24),
    0 0 18px rgba(255, 209, 95, 0.18);
  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    box-shadow 0.18s ease;
}

.lottery-spin:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(255, 209, 95, 0.24);
}

.lottery-history-panel {
  min-height: 118px;
}

.lottery-history {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  overflow: hidden;
}

.lottery-history__item {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  aspect-ratio: 1;
  border-radius: 11px;
  border: 1px solid rgba(164, 191, 255, 0.18);
  background: rgba(10, 18, 35, 0.72);
}

.lottery-history__item .animal-sprite {
  width: 30px;
}

.lottery-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 9, 21, 0.62);
  backdrop-filter: blur(5px);
}

.lottery-overlay.is-hidden {
  display: none;
}

.lottery-overlay__panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(440px, 100%);
  padding: 1.6rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 209, 95, 0.32);
  background:
    radial-gradient(circle at top, rgba(255, 209, 95, 0.15), transparent 44%),
    linear-gradient(160deg, rgba(13, 24, 47, 0.98), rgba(7, 12, 26, 0.96));
  text-align: center;
  box-shadow: 0 28px 60px rgba(0, 5, 16, 0.42);
}

.lottery-overlay__panel h2 {
  margin: 0;
  color: #ffffff;
  font-size: 2rem;
  line-height: 1.1;
}

.lottery-overlay__panel p {
  margin: 0;
  color: #dce9fb;
  font-weight: 800;
  line-height: 1.55;
}

.lottery-overlay__panel button {
  min-height: 46px;
  min-width: 170px;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.25rem;
  background: linear-gradient(135deg, var(--lottery-gold), #d78919);
  color: #241707;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.game-info__panel {
  display: grid;
  gap: 0.12rem;
}

.game-kicker {
  margin: 0 0 0.35rem;
  color: var(--lottery-green);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-info__lead {
  color: #c8d6e7;
  font-size: 1.05rem;
  font-weight: 700;
}

.game-info h2 {
  margin: 0 0 0.5rem;
  color: #ffffff;
}

.game-info p {
  margin: 0.35rem 0;
  line-height: 1.7;
}

.game-info h3 {
  margin: 1.2rem 0 0.5rem;
  color: #c4d0e8;
}

.site-footer {
  border-top: 1px solid rgba(177, 198, 233, 0.28);
  padding: 1rem 0 1.5rem;
  color: #d5e2ff;
}

.site-footer a {
  color: #eaf2ff;
}

@media (max-width: 768px) {
  .page-wrap {
    padding-inline: 16px;
  }

  .top-bar {
    gap: 0.9rem;
    padding: 0.45rem 0;
  }

  .top-bar-actions,
  .top-nav-links {
    gap: 0.5rem;
  }

  .top-nav-link,
  .top-lang-switch__select {
    min-height: 40px;
    font-size: 0.95rem;
  }

  .top-nav-link {
    padding: 0.52rem 0.82rem;
  }

  .top-lang-switch__select {
    padding-inline: 0.9rem 2rem;
  }

  .game-shell-lottery .game-shell__toolbar-group {
    flex-wrap: wrap;
  }

  .game-shell-lottery .game-shell__button {
    min-height: 40px;
    padding: 0.56rem 0.82rem;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .icon-button img {
    width: 128px;
  }

  .game-shell-lottery .game-shell__toolbar-group {
    gap: 8px;
  }

  .game-shell-lottery .game-shell__button {
    min-height: 38px;
    padding: 0.48rem 0.7rem;
    font-size: 0.92rem;
  }
}

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