/* ─────────────────────────────────────────────────────────
   SHIROHATO · DESTINY スワイプUI
   (スタンドアローン版: 基本スタイルを同梱し親ディレクトリ非依存)
   ───────────────────────────────────────────────────────── */

:root {
  --ink: #1a1019;
  --ink-soft: #4a3a47;
  --rose: #d4647a;
  --rose-light: #f5d4dd;
  --gold: #c9a449;
  --gold-light: #f4e4b0;
  --blush: #fdf6f8;
  --cream: #fffbf7;
  --shadow: 0 8px 32px rgba(60, 20, 40, 0.08);
  --shadow-strong: 0 14px 50px rgba(60, 20, 40, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #fff5f7 0%, #fff 50%),
    linear-gradient(180deg, #fffbf7 0%, #faeef0 100%);
  font-family: 'Noto Serif JP', 'Cormorant Garamond', 'Yu Mincho', serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.swipe-mode {
  overflow: hidden;
  height: 100vh;
  padding: 0;
}

/* Header */
.swipe-header {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(255,251,247,0.95) 0%, rgba(255,251,247,0) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.brand-mini {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  letter-spacing: 0.35em;
  color: var(--rose);
  text-decoration: none;
  font-weight: 500;
}
.header-right { display:flex; gap: 12px; align-items: center; }
.fav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid rgba(212, 100, 122, 0.3);
  border-radius: 100px;
  color: var(--rose);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 12px rgba(60,20,40,0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  font-family: inherit;
}
.fav-link:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(60,20,40,0.12); }
.fav-link .fav-heart {
  font-size: 14px;
  color: var(--rose);
}
.fav-link .fav-count {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 14px;
  min-width: 12px;
}

/* Main */
.swipe-main {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 58px;
}

.hint {
  position: absolute;
  top: 70px; left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hint.show { opacity: 1; }
.hint-text {
  font-family: 'Noto Serif JP', serif;
  font-size: 14px;
  color: var(--rose);
  letter-spacing: 0.12em;
}
.hint-sub {
  font-size: 11px;
  color: rgba(74, 58, 71, 0.55);
  letter-spacing: 0.08em;
  margin-top: 6px;
  font-family: 'Noto Serif JP', serif;
}

/* Card stack */
.card-stack {
  position: relative;
  width: min(92vw, 420px);
  aspect-ratio: 3/4.5;
  margin: 0 auto;
  perspective: 1200px;
}

.swipe-card {
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(60, 20, 40, 0.18), 0 6px 22px rgba(60, 20, 40, 0.06);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2),
              opacity 0.4s ease,
              box-shadow 0.3s ease;
}
.swipe-card.dragging {
  transition: none;
  cursor: grabbing;
}
.swipe-card.gone {
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.45s ease;
}

.swipe-card .card-image {
  width: 100%;
  height: 64%;
  background: var(--blush);
  position: relative;
  overflow: hidden;
}
.swipe-card .card-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.swipe-card .card-image::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 100%);
  pointer-events: none;
}

.swipe-card .card-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 18px 24px 24px;
  background: #fff;
  height: 36%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}
.card-body .c-cd {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(74, 58, 71, 0.55);
}
.card-body .c-brand {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.card-body .c-name {
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  margin: 4px 0 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .c-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
}
.card-body .c-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--rose);
  letter-spacing: 0.04em;
}
.card-body .c-price .yen {
  font-size: 13px;
  margin-right: 2px;
}
.card-body .c-price .tax {
  font-size: 9px;
  letter-spacing: 0.1em;
  margin-left: 4px;
  color: rgba(74, 58, 71, 0.55);
}
.card-body .c-cat {
  font-size: 10px;
  color: rgba(74, 58, 71, 0.55);
  font-family: 'Noto Serif JP', serif;
  letter-spacing: 0.06em;
}

/* Swipe indicators (LIKE / NOPE) */
.swipe-stamp {
  position: absolute;
  top: 28px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 8px 16px;
  border: 4px solid currentColor;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 5;
  font-style: italic;
}
.stamp-like {
  right: 24px;
  color: #2bb673;
  transform: rotate(-12deg);
}
.stamp-nope {
  left: 24px;
  color: #c93f5b;
  transform: rotate(12deg);
}

/* Controls */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin-top: 22px;
}
.btn-control {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 6px 20px rgba(60,20,40,0.15);
  cursor: pointer;
  font-size: 24px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s ease,
              background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-control:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 10px 30px rgba(60,20,40,0.2);
}
.btn-control:active {
  transform: translateY(-1px) scale(0.96);
}
.btn-nope { color: #c93f5b; }
.btn-like { color: var(--rose); font-size: 26px; }
.btn-info {
  width: 48px; height: 48px;
  font-size: 16px;
  font-style: italic;
  color: var(--gold);
}
.btn-help {
  width: 48px; height: 48px;
  font-size: 16px;
  color: var(--rose);
  font-family: 'Noto Serif JP', serif;
}
.btn-control:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Status */
.status {
  margin-top: 18px;
  font-size: 11px;
  color: rgba(74, 58, 71, 0.55);
  font-family: 'Cormorant Garamond', serif;
  letter-spacing: 0.18em;
  text-align: center;
  min-height: 18px;
  text-transform: uppercase;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  max-width: 360px;
}
.empty-state h2 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 32px;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.empty-state p {
  font-family: 'Noto Serif JP', serif;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
}
.empty-state .actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}
.empty-state .btn-primary {
  display: inline-block;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--rose) 0%, #b84f64 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 100px;
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  letter-spacing: 0.2em;
  box-shadow: 0 8px 24px rgba(212, 100, 122, 0.32);
  transition: transform 0.18s ease;
  border: none;
  cursor: pointer;
}
.empty-state .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(212, 100, 122, 0.4);
}
.empty-state .btn-secondary {
  display: inline-block;
  padding: 14px 28px;
  background: transparent;
  color: var(--rose);
  text-decoration: none;
  border-radius: 100px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.1em;
  border: 1px solid var(--rose);
  cursor: pointer;
}

/* Loading shimmer card */
.shimmer-card {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #faeef0 0%, #fff5f7 50%, #faeef0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loader (初回読込み中の表示) */
.loader-inner {
  text-align: center;
}
.loader-heart {
  font-size: 46px;
  color: var(--rose);
  animation: loaderHeartbeat 1.2s ease-in-out infinite;
}
.loader-text {
  margin-top: 14px;
  color: var(--rose);
  font-size: 15px;
  letter-spacing: 0.18em;
  font-weight: 500;
}
.loader-sub {
  margin-top: 6px;
  color: #c99;
  font-size: 11px;
  letter-spacing: 0.1em;
}
@keyframes loaderHeartbeat {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.22); opacity: 1; }
}

/* Modal: detail / favorites */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(40, 16, 28, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-backdrop.show { opacity: 1; }
.modal-card {
  background: #fff;
  border-radius: 16px;
  max-width: 440px;
  width: calc(100vw - 32px);
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 32px 80px rgba(60,20,40,0.3);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-backdrop.show .modal-card { transform: translateY(0); }
.modal-card h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 12px;
}
.modal-card .m-catch {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--rose);
  margin-bottom: 12px;
  font-size: 15px;
}
.modal-card dl {
  margin: 16px 0;
  font-size: 13px;
  font-family: 'Noto Serif JP', serif;
}
.modal-card dl div {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--blush);
}
.modal-card dt { width: 100px; color: rgba(74, 58, 71, 0.55); }
.modal-card dd { flex: 1; color: var(--ink); }
.modal-card .m-close {
  display: block;
  margin: 20px auto 0;
  padding: 12px 32px;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

/* Favorites panel (swipe内蔵版) */
.fav-panel h3 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  color: var(--rose);
  letter-spacing: 0.08em;
  margin: 0 0 16px;
}
.fav-list { display: flex; flex-direction: column; gap: 12px; }
.fav-item {
  display: flex; gap: 14px; align-items: center;
  padding: 10px;
  border: 1px solid var(--rose-light);
  border-radius: 12px;
  background: var(--blush);
}
.fav-item img {
  width: 64px; height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}
.fav-item .fi-body { flex: 1; min-width: 0; }
.fav-item .fi-name {
  font-family: 'Noto Serif JP', serif;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fav-item .fi-brand {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 11px;
  color: var(--gold);
}
.fav-item .fi-price {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  color: var(--rose);
  margin-top: 2px;
}
.fav-item .fi-actions {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  flex-shrink: 0;
}
.fav-item .fi-link {
  font-size: 11px;
  color: var(--rose);
  text-decoration: none;
  border: 1px solid var(--rose);
  border-radius: 100px;
  padding: 4px 10px;
  white-space: nowrap;
}
.fav-item .fi-remove {
  background: none; border: none; cursor: pointer;
  color: rgba(74, 58, 71, 0.45);
  font-size: 14px;
  padding: 2px 6px;
}
.fav-empty {
  text-align: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 24px 0;
  line-height: 1.9;
}

/* 画像ポップアップ (js/popup.js) */
.img-popup-backdrop {
  position: fixed; inset: 0;
  background: rgba(40, 16, 28, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.img-popup-backdrop.show { opacity: 1; }
.img-popup {
  position: relative;
  max-width: calc(100vw - 24px);
  max-height: var(--pop-maxh, 80vh);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(60, 20, 40, 0.3);
  overflow: hidden;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.img-popup-backdrop.show .img-popup { transform: none; }
.img-popup img {
  display: block;
  width: 100%;
  height: auto;
  max-height: var(--pop-maxh, 80vh);
  object-fit: contain;
}
.img-popup.fixed-h img { height: 100%; }
.img-popup-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(60, 20, 40, 0.22);
  z-index: 2;
}
.img-popup-close:hover { background: #fff; color: var(--rose); }

/* Mobile */
@media (max-width: 640px) {
  .card-stack { width: 94vw; }
  .btn-control { width: 56px; height: 56px; font-size: 22px; }
  .btn-info { width: 44px; height: 44px; font-size: 14px; }
  .btn-help { width: 44px; height: 44px; font-size: 14px; }
  .controls { gap: 22px; margin-top: 18px; }
  .swipe-stamp { font-size: 36px; padding: 6px 12px; }
}
