/* 6Q集卡 · 和谐家庭日主题 */

.cards-app {
  --cards-pink-1: #ffd4dc;
  --cards-pink-2: #ffb8c8;
  --cards-pink-3: #ff8fab;
  --cards-orange: #ffc9a0;
  --cards-gold: #e8b84a;
  --cards-gray-border: #c8c4bc;
  --cards-card-w: 200px;
  --cards-card-art-h: 148px;
  --cards-card-foot-h: 76px;
  min-height: 100%;
  background:
    radial-gradient(ellipse 120% 40% at 50% 0%, #fff0e8 0%, transparent 55%),
    linear-gradient(180deg, #ffe8d6 0%, #ffd0dc 22%, #ffb8c8 48%, #ff9eb5 72%, #ffc0a8 100%);
  font-family: var(--q-font);
  position: relative;
}

/* ── 顶栏 ── */
.cards-header {
  position: relative;
  z-index: 3;
  padding: 4px 12px 0;
}

.cards-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
}

.cards-back {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e85a7a;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(196, 77, 106, 0.12);
}

.cards-header-pill {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #c44d6a;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(196, 77, 106, 0.1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cards-header-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.cards-header-actions span {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.38);
  padding: 3px 9px;
  border-radius: 999px;
  pointer-events: none;
  user-select: none;
  text-align: center;
}

.cards-header-hero {
  text-align: center;
  padding: 10px 8px 6px;
}

.cards-header-hero h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  color: #ff5c8a;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.65);
  letter-spacing: 1px;
  line-height: 1.15;
}

.cards-header-hero p {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #ff7a9a;
}

/* ── 六维库存横栏 ── */
.cards-inventory-strip {
  position: relative;
  z-index: 3;
  margin: 6px 10px 0;
  padding: 10px 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(232, 120, 150, 0.18);
}

.cards-mini-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cards-mini-bar::-webkit-scrollbar { display: none; }

.cards-mini-item {
  position: relative;
  flex: 1 1 0;
  min-width: 48px;
  max-width: 56px;
  border: none;
  background: none;
  padding: 4px 2px 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.cards-mini-item.is-active {
  transform: translateY(-2px);
}

.cards-mini-item.is-active .cards-mini-thumb {
  box-shadow: 0 0 0 2px #ff6b8a, 0 4px 10px rgba(255, 107, 138, 0.35);
}

.cards-mini-thumb {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  background: #eee;
}

.cards-mini-thumb .qcard-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cards-mini-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #c44d6a;
  text-align: center;
  margin-top: 5px;
  white-space: nowrap;
}

.cards-mini-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3d5c;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 17px;
  text-align: center;
  border: 1.5px solid #fff;
  z-index: 2;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 4px rgba(255, 61, 92, 0.4);
}

.cards-mini-item--rare .cards-mini-thumb {
  border-color: var(--cards-gold);
}

/* ── 我的奖品 ── */
.cards-prize-row {
  display: flex;
  justify-content: flex-end;
  padding: 6px 16px 2px;
  position: relative;
  z-index: 2;
}

.cards-prize-link {
  font-size: 12px;
  font-weight: 700;
  color: #ff5c8a;
  pointer-events: none;
  user-select: none;
}

/* ── 大卡轮播 ── */
.cards-carousel-wrap {
  position: relative;
  z-index: 2;
  padding: 4px 0 6px;
}

.cards-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 10px calc(50% - var(--cards-card-w) / 2) 14px;
  scrollbar-width: none;
}

.cards-carousel::-webkit-scrollbar { display: none; }

.cards-carousel-slide {
  flex: 0 0 var(--cards-card-w);
  width: var(--cards-card-w);
  scroll-snap-align: center;
}

.cards-carousel-slide .qcard-title {
  display: block;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #c44d6a;
  margin-bottom: 8px;
}

/* ── 卡面组件（统一尺寸） ── */
.qcard--large {
  width: 100%;
}

.qcard-frame {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.qcard--large .qcard-frame {
  border-radius: 16px;
  height: calc(var(--cards-card-art-h) + var(--cards-card-foot-h));
}

.qcard--normal .qcard-frame {
  border: 3px solid var(--cards-gray-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qcard--rare .qcard-frame {
  border: 3px solid var(--cards-gold);
  box-shadow:
    0 0 16px rgba(232, 184, 74, 0.65),
    0 4px 14px rgba(0, 0, 0, 0.12);
  animation: qcard-glow 2.2s ease-in-out infinite;
}

@keyframes qcard-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(232, 184, 74, 0.5), 0 4px 12px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 0 22px rgba(232, 184, 74, 0.85), 0 4px 16px rgba(0, 0, 0, 0.12); }
}

.qcard--unknown .qcard-frame {
  border: 3px solid #b8b4ac;
}

.qcard-art {
  line-height: 0;
  background: #eee;
  height: var(--cards-card-art-h);
  flex-shrink: 0;
  overflow: hidden;
}

.qcard-art .qcard-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.qcard-foot {
  background: var(--qcard-foot, #888);
  padding: 10px 8px;
  text-align: center;
  color: #fff;
  height: var(--cards-card-foot-h);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.qcard-foot strong {
  display: block;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.1;
}

.qcard-foot p {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0.95;
  max-height: 2.6em;
  overflow: hidden;
}

.qcard-foot--unknown {
  background: linear-gradient(180deg, #e8e4dc 0%, #d8d4cc 100%);
  color: #999;
}

.qcard-foot--unknown strong {
  font-size: 28px;
  color: #bbb;
}

.qcard-foot--unknown p {
  color: #aaa;
}

.qcard--modal .qcard-foot strong { font-size: 26px; }
.qcard--modal .qcard-foot p { font-size: 12px; }

.qcard--grid .qcard-foot {
  padding: 4px 4px 6px;
  height: auto;
  min-height: 28px;
}

.qcard--grid .qcard-foot strong {
  font-size: 13px;
}

.qcard--grid .qcard-foot p {
  display: none;
}

/* ── 抽卡区 ── */
.cards-draw-area {
  position: relative;
  z-index: 2;
  padding: 0 20px 16px;
  text-align: center;
}

.cards-remain-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 16px;
  border-radius: 999px;
  background: #e8f8e8;
  border: 1.5px solid #8fd4a0;
  font-size: 12px;
  font-weight: 800;
  color: #2d8a45;
}

.cards-remain-badge strong {
  font-size: 14px;
  color: #1a6b32;
}

.cards-btn-draw {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 16px 20px;
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #ff9eb5 0%, #ff6b8a 40%, #ff4d78 100%);
  box-shadow:
    0 4px 0 #e03d62,
    0 8px 20px rgba(255, 77, 120, 0.38);
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.cards-btn-draw:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #e03d62, 0 4px 12px rgba(255, 77, 120, 0.32);
}

.cards-btn-draw--ten {
  margin-top: 10px;
  font-size: 15px;
  padding: 12px 20px;
  background: linear-gradient(180deg, #ffc978 0%, #ff9f43 100%);
  box-shadow: 0 3px 0 #d97a20, 0 6px 16px rgba(255, 150, 50, 0.35);
}

.cards-btn-draw--ten:active:not(:disabled) {
  box-shadow: 0 1px 0 #d97a20, 0 3px 10px rgba(255, 150, 50, 0.3);
}

.cards-draw-area.is-exhausted .cards-btn-draw,
.cards-btn-draw.is-disabled,
.cards-btn-draw:disabled {
  filter: grayscale(0.55) saturate(0.6);
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: 0 2px 0 #999, 0 4px 10px rgba(0, 0, 0, 0.12);
  transform: none;
}

.cards-zero-hint {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: #c44d6a;
}

.cards-zero-hint a {
  color: #ff3d66;
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: auto;
  cursor: pointer;
}

/* ── 集卡换好礼 ── */
.cards-exchange {
  position: relative;
  z-index: 1;
  padding: 8px 10px 32px;
  pointer-events: none;
  user-select: none;
}

.cards-exchange-panel {
  position: relative;
  margin-bottom: 14px;
  padding: 28px 12px 14px;
  background: linear-gradient(180deg, #ffd0dc 0%, #ffc0d0 100%);
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 18px rgba(232, 100, 130, 0.2);
}

.cards-exchange-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  padding: 7px 18px 7px 14px;
  background: linear-gradient(90deg, #ff6b8a, #ff8fab);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  border-radius: 18px 0 14px 0;
  box-shadow: 0 2px 8px rgba(255, 77, 120, 0.3);
  letter-spacing: 0.5px;
}

.cards-exchange-block {
  margin-bottom: 14px;
}

.cards-exchange-block:last-child {
  margin-bottom: 0;
}

.cards-exchange-rule {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: #c44d6a;
}

.cards-exchange-rule-icon {
  font-size: 16px;
  line-height: 1;
}

.cards-exchange-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cards-redeem-card {
  background: #fff;
  border-radius: 12px;
  padding: 10px 8px 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(196, 77, 106, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 168px;
}

.cards-redeem-thumb {
  width: 72px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7ec8e8 0%, #5eb0d8 100%);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.cards-redeem-name {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  color: #333;
  line-height: 1.35;
  min-height: 2.7em;
}

.cards-redeem-price {
  margin: 4px 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: #e85a7a;
}

.cards-redeem-btn {
  display: inline-block;
  margin-top: auto;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.cards-redeem-btn.is-done {
  background: #f0ebe0;
  color: #b8b0a0;
  border: 1px solid #e8e0d4;
}

.cards-redeem-btn.is-active {
  background: linear-gradient(180deg, #ff9eb5, #ff5c7a);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255, 92, 122, 0.35);
}

/* 集齐六张 */
.cards-exchange-panel--legend {
  padding-top: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

.cards-exchange-legend-head {
  padding: 12px 14px;
  background: linear-gradient(135deg, #7eb8f0 0%, #a8c8f8 50%, #c8d8ff 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 1px 3px rgba(60, 100, 180, 0.3);
  border-radius: 16px 16px 0 0;
  letter-spacing: 0.5px;
}

.cards-exchange-legend-star {
  margin-right: 4px;
  opacity: 0.9;
}

.cards-exchange-legend-rule {
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #ff6b8a;
  background: linear-gradient(180deg, #ffd8e4 0%, #ffc8d8 100%);
  line-height: 1.45;
  text-align: center;
}

.cards-exchange-legend-body {
  padding: 12px;
  background: linear-gradient(180deg, #e8e0f8 0%, #ddd4f0 100%);
  border-radius: 0 0 16px 16px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top: none;
}

.cards-redeem-card--legend {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(180, 160, 220, 0.35);
}

/* ── 弹层 ── */
.cards-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(30, 20, 30, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.cards-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cards-modal {
  width: 100%;
  max-width: 300px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.28s ease;
}

.cards-overlay.is-open .cards-modal {
  transform: scale(1);
}

.cards-modal h2 {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  letter-spacing: 2px;
}

.cards-modal-card-slot {
  margin: 0 auto 16px;
  max-width: 220px;
}

.cards-modal-card-slot .qcard--modal .qcard-frame {
  border-radius: 16px;
  height: auto;
}

.cards-modal-card-slot .qcard-art {
  height: auto;
  aspect-ratio: 6 / 5;
}

.cards-modal-actions {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cards-btn-confirm {
  min-width: 160px;
  padding: 12px 32px;
  border: 2.5px solid #fff;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.cards-modal-remain {
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 8px;
  background: #e8f8e8;
  border: 1.5px solid #8fd4a0;
  font-size: 10px;
  font-weight: 800;
  color: #2d8a45;
}

.cards-overlay--flip {
  cursor: pointer;
}

.draw-flip-hint {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.draw-flip-stage {
  perspective: 900px;
  max-width: 220px;
  margin: 0 auto;
}

.draw-flip-card {
  width: 100%;
  aspect-ratio: 6 / 5;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.draw-flip-card.is-flipped {
  transform: rotateY(180deg);
}

.draw-flip-card--auto.is-shuffle {
  animation: draw-shuffle 0.5s ease;
}

@keyframes draw-shuffle {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: scale(1.06) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.draw-flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.draw-flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
}

.draw-flip-face--back {
  border: 3px solid #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.draw-flip-face--back .qcard-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draw-flip-face--front {
  transform: rotateY(180deg);
}

.cards-modal--wide {
  max-width: 340px;
}

.ten-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.ten-grid-item {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.15s ease;
}

.ten-grid-item:active {
  transform: scale(0.95);
}

.ten-grid-item .qcard--grid .qcard-frame {
  border-width: 2px;
}

body.cards-modal-open {
  overflow: hidden;
}

.ios-screen .cards-overlay {
  position: absolute;
  border-radius: 34px;
}
