/* Myトレカ — コレクトブック / 9ポケット・バインダー UI */

.binder-page {
  --binder-gap: 8px;
  --binder-radius: 10px;
  --binder-bg: #f3efe8;
  --binder-ring: rgba(120, 90, 60, 0.18);
}

.binder-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.binder-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  margin: 0 -2px;
}
.binder-chip-row::-webkit-scrollbar { display: none; }

.binder-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.72);
  color: #5b5266;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 8px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.binder-chip.is-on {
  color: #fff;
  background: linear-gradient(120deg, #f472b6, #a78bfa);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 6px 16px rgba(167, 139, 250, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.binder-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #6b6280;
  background: rgba(255, 255, 255, 0.7);
  border: 0.5px solid rgba(255, 255, 255, 0.85);
  -webkit-tap-highlight-color: transparent;
}
.binder-switch.is-on {
  color: #7c3aed;
  background: rgba(237, 233, 254, 0.95);
  border-color: rgba(167, 139, 250, 0.55);
}
.binder-switch input { display: none; }

.binder-progress-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.55)),
    #fff;
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.9);
}
.binder-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.binder-progress-title {
  font-size: 13px;
  font-weight: 800;
  color: #2f2a36;
}
.binder-progress-meta {
  font-size: 11px;
  font-weight: 700;
  color: #6b6280;
}
.binder-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.binder-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f9a8d4, #c4b5fd 55%, #67e8f9);
  transition: width 0.35s cubic-bezier(0.22, 0.8, 0.22, 1);
}
.binder-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #7c2d12;
  background: linear-gradient(120deg, #fde68a, #fbbf24 45%, #f59e0b);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7), 0 6px 16px rgba(245, 158, 11, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.75);
  animation: binderCompleteGlow 2.2s ease-in-out infinite;
}
@keyframes binderCompleteGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.binder-sheet {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.12)),
    var(--binder-bg);
  border: 1px solid var(--binder-ring);
  border-radius: 18px;
  padding: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 10px 28px rgba(90, 60, 30, 0.08);
}

.binder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--binder-gap);
}

.binder-pocket {
  position: relative;
  aspect-ratio: 55 / 85;
  border-radius: var(--binder-radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 0 0 1px rgba(120, 90, 60, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  contain: layout paint;
}
.binder-pocket > * {
  pointer-events: none;
}
.binder-pocket img,
.binder-pocket .binder-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 所持・未所持どちらもフルカラー（白黒・薄暗化なし） */
  filter: none !important;
  -webkit-filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}
.binder-pocket.is-owned {
  box-shadow:
    inset 0 0 0 1.5px rgba(16, 185, 129, 0.55),
    0 6px 14px rgba(16, 185, 129, 0.12);
}
.binder-pocket.is-want {
  box-shadow:
    inset 0 0 0 1.5px rgba(236, 72, 153, 0.5),
    0 6px 14px rgba(236, 72, 153, 0.1);
}
.binder-pocket.is-trade {
  box-shadow:
    inset 0 0 0 1.5px rgba(59, 130, 246, 0.55),
    0 6px 14px rgba(59, 130, 246, 0.12);
}
.binder-pocket.is-missing {
  /* 枠の差だけで未所持を示す（画像はカラーのまま） */
  box-shadow:
    inset 0 0 0 1px rgba(120, 90, 60, 0.14),
    0 4px 10px rgba(0, 0, 0, 0.05);
}
.binder-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(160deg, #fdf2f8, #f5f3ff);
  color: #9ca3af;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 6px;
}
.binder-count-pill {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: rgba(17, 17, 17, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.45);
  line-height: 1.3;
  text-align: center;
}
.binder-listing-tag {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: #f43f5e;
  padding: 3px 6px;
  border-bottom-right-radius: 8px;
}
.binder-watch-dot {
  position: absolute;
  bottom: 5px;
  left: 5px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: rgba(251, 191, 36, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.binder-member-chip {
  position: absolute;
  bottom: 5px;
  right: 5px;
  z-index: 2;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 999px;
}

#card-detail-modal {
  z-index: 99999 !important;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
}
#card-detail-modal .card-detail-dialog {
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.card-detail-dialog-header {
  position: sticky;
  top: -20px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -20px -20px 4px;
  padding: 10px 16px 6px;
  border-radius: 2rem 2rem 0 0;
  background: rgba(255, 255, 255, 0.94);
}
.binder-detail-image {
  position: relative;
  display: flex;
  width: min(78vw, 320px);
  height: auto;
  max-height: 44dvh;
  aspect-ratio: 55 / 85;
  flex-direction: column;
  padding: 0;
  touch-action: pan-y pinch-zoom;
  cursor: zoom-in;
}
.binder-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transition: transform 180ms ease;
}
#binder-holo-card img {
  object-fit: contain;
}
.binder-detail-image.is-zoomed img {
  transform: scale(1.7);
}
.binder-detail-image .binder-holo-sheen {
  pointer-events: none;
}

/* 詳細モーダル：ホログラム・シマー */
.binder-holo {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  isolation: isolate;
}
.binder-holo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.binder-holo-sheen {
  position: absolute;
  inset: -40%;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.08) 42%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(186, 230, 253, 0.28) 54%,
    rgba(244, 114, 182, 0.18) 58%,
    transparent 68%
  );
  mix-blend-mode: screen;
  transform: translate3d(var(--holo-x, -20%), var(--holo-y, -10%), 0) rotate(8deg);
  opacity: 0.85;
  transition: transform 0.08s linear;
  will-change: transform;
}
.binder-qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.binder-qty button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
}
.binder-qty .binder-qty-val {
  min-width: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: #111;
}

.binder-share-btn {
  width: 100%;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #111827, #374151);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .binder-complete-badge { animation: none; }
  .binder-holo-sheen { transition: none; }
}
