*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --actions-bottom: 29%;
  --dl-btn-width: 41.5%;
  --dl-gap: 1.2%;
  --cs-top: 1.5%;
  --cs-right: 1%;
  --cs-width: 22%;
}

html,
body {
  width: 100%;
  min-height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  background: #120606;
}

.page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  background: radial-gradient(ellipse at center, #2a1010 0%, #120606 70%);
}

.page__frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
  max-height: 100dvh;
}

.page__poster {
  display: block;
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
}

/* 右上角 24小时客服（必须 absolute，否则会掉到海报下面看不见） */
.cs-corner-btn {
  position: absolute;
  top: var(--cs-top);
  right: var(--cs-right);
  z-index: 10;
  display: block;
  width: var(--cs-width);
  line-height: 0;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.cs-corner-btn__img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.cs-corner-btn:hover {
  filter: brightness(1.06);
  transform: scale(1.03);
}

.cs-corner-btn:active {
  transform: scale(0.97);
  filter: brightness(0.96);
}

.page__actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--actions-bottom);
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 0 8px;
  pointer-events: none;
}

.download-bar {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--dl-gap);
  width: calc(var(--dl-btn-width) * 2 + var(--dl-gap));
  max-width: 96%;
}

.dl-btn {
  flex: 0 0 var(--dl-btn-width);
  width: var(--dl-btn-width);
  display: block;
  line-height: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.dl-btn__img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.dl-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-2px);
}

.dl-btn:active {
  transform: translateY(1px);
  filter: brightness(0.96);
}

.dl-btn--pending {
  cursor: not-allowed;
  filter: saturate(0.82) brightness(0.9);
}

.dl-btn--pending:hover {
  transform: none;
  filter: saturate(0.82) brightness(0.9);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  z-index: 99;
  max-width: min(92vw, 360px);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: #fff8e8;
  background: rgba(20, 8, 8, 0.92);
  border: 1px solid rgba(240, 200, 100, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-aspect-ratio: 9/16) {
  :root {
    --actions-bottom: 29%;
    --cs-top: 0.5%;
    --cs-right: 0.8%;
    --cs-width: 21%;
  }
}

@media (max-width: 520px) {
  :root {
    --actions-bottom: 28%;
    --dl-btn-width: 41.8%;
    --dl-gap: 1%;
    --cs-top: 0.5%;
    --cs-right: 0.8%;
    --cs-width: 21%;
  }
}

@media (min-aspect-ratio: 1/1) {
  .page__poster {
    max-width: min(100vw, calc(100dvh * 0.588));
  }

  :root {
    --actions-bottom: 25%;
  }
}
