*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scrollbar-color: var(--shell-accent) var(--shell-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Noto Sans TC", system-ui, sans-serif;
  caret-color: var(--shell-accent);
}

::selection {
  background: var(--shell-accent);
  color: var(--shell-accent-ink);
}

button,
input,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.shell-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 20px;
  background: var(--shell-bg);
  color: var(--shell-fg);
  border-bottom: 1px solid var(--shell-line);
}

.shell-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px 0 6px;
  border-radius: 999px;
  color: var(--shell-fg);
  text-decoration: none;
  font-size: 14px;
  transition: background-color 150ms ease;
}

.shell-back:hover {
  background: var(--shell-line);
}

.shell-back svg,
.shell-icon svg {
  width: 20px;
  height: 20px;
}

.shell-title {
  font-family: "Noto Serif TC", "Noto Sans TC", serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--shell-accent);
  white-space: nowrap;
}

.shell-spacer {
  flex: 1;
}

.shell-jackpot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid var(--shell-accent);
  font-size: 12px;
  color: var(--shell-muted);
  white-space: nowrap;
}

.shell-jackpot strong {
  font-size: 16px;
  color: var(--shell-accent);
  font-variant-numeric: tabular-nums;
}

.shell-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--shell-fg);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.shell-icon:hover {
  background: var(--shell-line);
}

.shell-user {
  font-size: 14px;
  color: var(--shell-muted);
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-balance {
  display: grid;
  justify-items: end;
  line-height: 1.15;
}

.shell-balance small {
  font-size: 11px;
  color: var(--shell-muted);
}

.shell-balance strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.shell-back:focus-visible,
.shell-icon:focus-visible {
  outline: 3px solid var(--shell-accent);
  outline-offset: 2px;
}

.shell-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--shell-fg);
  color: var(--shell-bg);
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
}

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

.shell-notice {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
  color: var(--shell-fg);
}

.shell-notice h1 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 28px;
  color: var(--shell-accent);
}

.shell-notice p {
  margin: 0;
  color: var(--shell-muted);
}

.shell-notice a {
  color: var(--shell-accent);
  text-underline-offset: 4px;
}

.jackpot-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  text-align: center;
  cursor: pointer;
  animation: jackpot-fade 300ms ease both;
}

.jackpot-overlay__title {
  font-family: "Noto Serif TC", serif;
  font-weight: 900;
  font-size: clamp(32px, 8vw, 64px);
  letter-spacing: 0.12em;
  color: var(--shell-accent);
  animation: jackpot-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.jackpot-overlay__amount {
  font-size: clamp(40px, 12vw, 96px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.jackpot-overlay__hint {
  margin-top: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

@keyframes jackpot-fade {
  from {
    opacity: 0;
  }
}

@keyframes jackpot-rise {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    filter: blur(6px);
  }
}

.reel-window {
  position: relative;
  overflow: hidden;
}

.reel-strip {
  will-change: transform;
}

.reel-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}

.reel-cell svg {
  width: 100%;
  height: 100%;
}

.reel-window.is-blurred .reel-strip {
  filter: blur(1.6px);
}

@media (max-width: 560px) {
  .shell-bar {
    gap: 8px;
    padding: 8px 12px;
  }

  .shell-user,
  .shell-back span {
    display: none;
  }

  .shell-back {
    padding: 0 6px;
  }

  .shell-title {
    font-size: 16px;
  }

  .shell-jackpot {
    padding: 4px 10px;
  }

  .shell-jackpot span {
    display: none;
  }
}

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

.stage-host {
  position: relative;
}

.stage-host--engine {
  overflow: hidden;
  border-radius: 18px;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  outline: none;
  transition: opacity 400ms ease;
}

.stage-host.is-live .stage-canvas {
  opacity: 1;
}

.stage-progress {
  position: absolute;
  left: 22%;
  right: 22%;
  top: calc(50% - 2px);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--shell-line);
}

.stage-progress__fill {
  display: block;
  height: 100%;
  background: var(--shell-accent);
  transform-origin: left center;
  transform: scaleX(0.04);
  transition: transform 200ms ease;
}

html.has-theme-bg body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--theme-bg) center / cover no-repeat;
  opacity: 0.45;
  pointer-events: none;
}

.theme-video {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}

.theme-video video {
  max-width: 100%;
  max-height: 100%;
}
