/* ========================================================
   环球影城专属二维码手机展示页 (深度复刻 ref1)
   集成：API 刷新、状态遮罩、全屏放大、倒计时与跑马灯
   ======================================================== */

:root {
  --theme-blue: #2d67d4;
  --royal-blue: #2d65d9;
  --card-white: #ffffff;
  --bulb-yellow: #f6db4d;
  --bulb-pink: #e960d7;
  --bulb-white: #ffffff;
  --text-dark: #1f2937;
  --text-muted: #6b7280;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--theme-blue); /* #2d67d4 统一 iOS 刘海与屏幕底色 */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: var(--text-dark);
}

/* 适合手机显示的统一容器 */
.mobile-screen {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh; /* 适配移动端动态视口高度 */
  background-color: var(--theme-blue);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
}

/* 顶部导航栏（适配 iOS 刘海与安全区） */
.nav-bar {
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.nav-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
}

.nav-title {
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  padding: 0 4px;
}

/* 微信小程序经典胶囊按钮 */
.capsule-btn {
  height: 32px;
  width: 86px;
  border-radius: 16px;
  border: 0.8px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
}

.capsule-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
}

.capsule-dots span {
  display: inline-block;
  width: 3.5px;
  height: 3.5px;
  background: #ffffff;
  border-radius: 50%;
  margin: 0 1.2px;
}

.capsule-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.22);
}

.capsule-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
}

.capsule-circle-outer {
  width: 15px;
  height: 15px;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capsule-circle-inner {
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
}

/* 卡片主区域 */
.card-wrapper {
  flex: 1;
  padding: 10px 18px 30px;
  display: flex;
  flex-direction: column;
}

/* 核心白色卡片 */
.ticket-card {
  background: var(--card-white);
  border-radius: 28px;
  box-shadow: 0 12px 35px rgba(0, 30, 90, 0.22);
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 22px 18px 32px;
}

/* 卡片顶部文案 */
.card-header {
  text-align: center;
  margin-bottom: 4px;
}

.coupon-header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 5px;
}

.crown-icon {
  flex-shrink: 0;
}

.coupon-title-text {
  font-size: 19px;
  font-weight: 800;
  color: var(--theme-blue);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/* 顶部图案展示区（使用 ref3.png） */
.skyline-art-box {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-top: 6px;
  margin-bottom: -1px; /* 与跑马灯框相接 */
  z-index: 1;
}

.skyline-img {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  object-fit: contain;
}

/* 经典跑马灯边框与二维码核心容器 */
.marquee-container {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  background: var(--royal-blue);
  border-radius: 26px;
  margin: 0 auto;
  overflow: hidden;
  z-index: 2;
}

/* 灯珠轨道：强制置于最顶层，杜绝被任何白底遮挡 */
.bulbs-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* 朴素灯珠圆点：从原图精准采样的三色实体圆点，无任何发光特效 */
.bulb-dot {
  position: absolute;
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* 原图精准采样三色：亮黄、纯白、粉红(红) */
.bulb-dot.color-yellow {
  background-color: var(--bulb-yellow); /* #f6db4d */
}

.bulb-dot.color-white {
  background-color: var(--bulb-white); /* #ffffff */
}

.bulb-dot.color-pink,
.bulb-dot.color-red {
  background-color: var(--bulb-pink); /* #e960d7 */
}

/* 二维码白底展示区：使用明确 inset，杜绝 iOS Safari 弹性伸缩溢出白边 */
.qr-inner-card {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 15px;
  right: 15px;
  background: #ffffff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  z-index: 2;
}

#qr {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr canvas {
  display: none !important;
}

#qr canvas:only-child {
  display: block !important;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

#qr img {
  display: block !important;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  image-rendering: pixelated;
}

/* 状态遮罩层 (qrmask) */
.qrmask {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 5;
  border-radius: 14px;
}

.qrmask.on {
  opacity: 1;
  pointer-events: auto;
}

.qrmask.used {
  background: rgba(243, 244, 246, 0.96);
}

.mtxt {
  font-size: 17px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: 0.5px;
}

.qrmask.used .mtxt {
  color: #9ca3af;
  font-size: 20px;
  border: 2.5px solid #d1d5db;
  padding: 6px 18px;
  border-radius: 8px;
  transform: rotate(-8deg);
  letter-spacing: 2px;
}

.btn-mask {
  background: var(--theme-blue);
  color: #ffffff;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(45, 103, 212, 0.3);
  transition: transform 0.15s;
}

.btn-mask:active {
  transform: scale(0.96);
}

/* 底部简洁文字刷新按钮 */
.refresh-action-bar {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-text-refresh {
  background: none;
  border: none;
  color: var(--theme-blue);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-text-refresh:active {
  opacity: 0.7;
  transform: scale(0.97);
}

.btn-text-refresh .refresh-icon {
  display: inline-block;
  transition: transform 0.4s ease;
}

.btn-text-refresh.loading .refresh-icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* 全屏放大出示 (qrfs) */
.qrfs {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.qrfs.on {
  opacity: 1;
  pointer-events: auto;
}

.qrfs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.qrfs-modal {
  position: relative;
  background: #ffffff;
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

.qrfs.on .qrfs-modal {
  transform: scale(1);
}

.qrfs-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qrfs-cap {
  font-size: 16.5px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
  text-align: center;
}

.qrfs-box {
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 10px;
}

#qrBig img,
#qrBig canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  image-rendering: pixelated;
}

.qrfs-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 16px;
  text-align: center;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s ease;
  z-index: 2000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
