/* ========== Reset & Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #f5f5f5;
  color: #333;
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ========== App 容器（全屏，无外壳） ========== */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  height: 100svh;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ========== Nav Bar ========== */
.nav-bar {
  flex-shrink: 0;
  height: 44px;
  padding: 0 8px 0 4px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #fff;
  position: relative;
  z-index: 20;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-right {
  display: flex;
  justify-content: flex-end;
}

.nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a1a;
  border-radius: 50%;
}

.nav-icon:active {
  background: rgba(0, 0, 0, 0.05);
}

.nav-title {
  font-size: 17px;
  font-weight: 500;
  color: #1a1a1a;
  text-align: center;
}

.nav-pill {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  gap: 0;
  color: #333;
  font-size: 14px;
  line-height: 1;
}

.nav-pill .dots {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 15px;
  padding: 0 4px;
  transform: translateY(-1px);
}

.nav-pill .divider {
  width: 1px;
  height: 14px;
  background: #e0e0e0;
  margin: 0 6px;
}

.nav-pill .target {
  font-size: 13px;
  opacity: 0.85;
}

/* ========== Pages ========== */
.page {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  background: #f5f5f5;
  overflow: hidden;
}

.page.active {
  display: flex;
}

/* ========== Tabs ========== */
.tabs {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  background: #fff;
  padding: 4px 24px 0;
  border-bottom: 1px solid transparent;
}

.tab {
  position: relative;
  flex: 1;
  max-width: 100px;
  padding: 12px 0 14px;
  font-size: 15px;
  color: #666;
  text-align: center;
}

.tab + .tab::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background: #e8e8e8;
}

.tab.active {
  color: #1a1a1a;
  font-weight: 500;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 28px;
  height: 2.5px;
  background: #2c2c2c;
  border-radius: 2px;
}

/* ========== Card List ========== */
.card-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 96px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.card-list::-webkit-scrollbar {
  display: none;
}

.card-item {
  margin-bottom: 18px;
}

/* VIP Card Visual */
.vip-card {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.vip-card-face {
  position: relative;
  height: 172px;
  padding: 24px 20px 16px;
  background:
    linear-gradient(152deg,
      #8ec5d6 0%,
      #74abbf 28%,
      #5f9aad 55%,
      #4d8b9e 78%,
      #3f7a8e 100%);
  color: #fff;
  overflow: hidden;
}

/* ENJOY YOUR LIFE watermark */
.vip-card-face::before {
  content: "ENJOY YOUR LIFE";
  position: absolute;
  top: 20px;
  left: 16px;
  right: 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.14);
  white-space: nowrap;
  pointer-events: none;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

/* VIP watermark */
.vip-card-face::after {
  content: "VIP";
  position: absolute;
  right: -4px;
  bottom: -22px;
  font-size: 118px;
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.13);
  letter-spacing: -6px;
  pointer-events: none;
  font-family: "Helvetica Neue", Arial, sans-serif;
  transform: scaleY(1.08);
}

.vip-card-name {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
  opacity: 0.95;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.vip-card-number {
  position: relative;
  z-index: 1;
  /* 对照原图：卡号约 20px、常规字重，不宜过粗过大 */
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
  font-family: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  opacity: 0.98;
}

.vip-card-bottom {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 16px;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.badge-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  color: #5a9bb0;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 6px;
  font-weight: 500;
}

.badge-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
}

.vip-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  font-size: 13px;
  color: #666;
}

.vip-card-foot .remain {
  color: #666;
}

.vip-card-foot .remain em {
  color: #c45a3a;
  font-style: normal;
  font-weight: 500;
}

/* Action buttons under card */
.card-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 14px 0 4px;
}

.action-btn {
  min-width: 80px;
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  color: #555;
  border: 1px solid #d0d0d0;
  border-radius: 16px;
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.action-btn:active {
  background: #f0f0f0;
}

.action-btn.primary {
  color: #1a1a1a;
  border-color: #333;
  font-weight: 500;
}

.action-btn.primary:active {
  background: #f5f5f5;
}

.empty-tip {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 60px 20px;
}

/* ========== Detail Page ========== */
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 96px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.detail-scroll::-webkit-scrollbar {
  display: none;
}

.panel {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 12px;
}

.qr-panel {
  padding: 28px 20px 22px;
  text-align: center;
}

.qr-box {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  position: relative;
}

/* 隐藏 qrcodejs 默认的红色占位图 */
.qr-box > img[src^="data:image/gif"] {
  display: none !important;
}

.qr-box img,
.qr-box canvas {
  width: 200px !important;
  height: 200px !important;
  image-rendering: pixelated;
}

.otp-code {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 6px;
  color: #333;
  font-variant-numeric: tabular-nums;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

.otp-hint {
  margin-top: 10px;
  font-size: 13px;
  color: #888;
}

.qr-meta {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: #999;
  flex-wrap: wrap;
}

.qr-meta em {
  font-style: normal;
  color: #666;
}

.qr-meta .accent {
  color: #c45a3a;
}

.photo-panel {
  padding: 28px 20px 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
}

.portrait {
  width: 168px;
  height: auto;
  object-fit: cover;
  object-position: center top;
}

/* Info panel */
.info-panel {
  padding: 16px 16px 8px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.section-title .bar {
  display: block;
  width: 3px;
  height: 14px;
  background: #e07050;
  border-radius: 1px;
  flex-shrink: 0;
}

.info-list {
  margin: 0;
}

.info-row {
  display: flex;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  line-height: 1.5;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  flex-shrink: 0;
  color: #b5b5b5;
  white-space: nowrap;
}

/* 两字标签：名 称 / 卡 号 / 姓 名 … 两端对齐 */
.info-label.spread {
  display: inline-flex;
  width: 56px;
  justify-content: space-between;
  align-items: baseline;
}

.info-label.spread span {
  display: inline-block;
}

.info-label.colon {
  color: #b5b5b5;
  margin-right: 6px;
  flex-shrink: 0;
}

.info-label.fixed {
  width: auto;
  margin-right: 6px;
}
.info-value {
  color: #333;
  word-break: break-all;
}

.info-row-extra {
  display: flex;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
  gap: 0 10px;
}

.info-row-extra .link {
  color: #5b8fd9;
  white-space: nowrap;
  text-decoration: none;
  font-size: 14px;
}

.info-row-extra .link:active {
  opacity: 0.7;
}

/* ========== CS FAB ========== */
.cs-fab {
  position: absolute;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: transform 0.15s;
}

.cs-fab:active {
  transform: scale(0.94);
}

/* ========== Modal ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

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

.modal {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px 16px;
  text-align: center;
}

.modal h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
}

.modal-body {
  min-height: 40px;
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  word-break: break-all;
}

.modal-body .barcode {
  font-family: "Libre Barcode 39", "Courier New", monospace;
  font-size: 42px;
  letter-spacing: 2px;
  color: #111;
  line-height: 1.2;
  margin: 8px 0;
}

.modal-body .barcode-num {
  font-size: 13px;
  letter-spacing: 2px;
  color: #333;
  margin-top: 4px;
}

.modal-close {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  background: #f5f5f5;
  font-size: 15px;
  color: #333;
}

.modal-close:active {
  background: #ebebeb;
}

/* Page transition subtle */
.page {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
