/* /swipe/ (スワイプで探す) and /swipe/list/ (行きたいリスト). Loaded only on those pages (lib/swipe.php).
   Colours and radii come from the theme's ui.css variables. */
.swipe-page [hidden] { display: none !important; }
.ra-page.swipe-page { max-width: 560px; padding: 0 14px; box-sizing: border-box; }
.ra-page.swipe-list-page { max-width: 960px; }
.swipe-page > .ui-btn { margin: 0 0 10px; }

/* ---------- head: title + the list link with its counter ---------- */
.swipe-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.swipe-head .page-h1 { margin: 2px 0; }
.swipe-fav-link, .swipe-fav-link:link, .swipe-fav-link:visited {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-radius: 999px;
  border: 1px solid #f1c6d2; background: #fff5f7; color: var(--c-accent) !important; font-size: 12px; font-weight: 700; text-decoration: none; line-height: 1;
}
.swipe-fav-link b {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--c-accent); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
}
.swipe-fav-link b.bump { animation: swipe-bump .35s ease; }
@keyframes swipe-bump { 40% { transform: scale(1.45); } }
.swipe-lead { margin: 2px 0 8px; font-size: 13px; }

/* ---------- filters ---------- */
.swipe-filters { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; }
.swipe-select { position: relative; display: inline-flex; align-items: center; margin: 0; flex: 0 1 150px; min-width: 0; }
.swipe-select i { position: absolute; left: 11px; color: var(--c-accent); font-size: 13px; pointer-events: none; }
.swipe-select select {
  height: 34px; width: 100%; padding: 0 26px 0 28px; border: 1px solid #ccc; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--c-text);
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23777' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center;
}
.swipe-genres { display: flex; gap: 6px; flex: none; }
.swipe-genres .chip { cursor: pointer; min-height: 34px; padding: 0 11px; font-size: 12.5px; white-space: nowrap; }

/* ---------- the deck ---------- */
.swipe-stage { position: relative; height: calc(100vh - 321px); height: calc(100dvh - 321px); min-height: 300px; max-height: 620px; margin: 0 0 14px; }
.swipe-deck { position: absolute; inset: 0; }
.swipe-card {
  position: absolute; inset: 0; margin: 0; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 6px 22px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
  touch-action: pan-y; -webkit-user-select: none; user-select: none; cursor: grab; will-change: transform;
  transition: transform .3s ease; --like: 0; --nope: 0;
}
.swipe-card.next { transform: scale(.95) translateY(10px); z-index: 1; pointer-events: none; }
.swipe-card.top { z-index: 2; }
.swipe-card.out { z-index: 3; pointer-events: none; }
.swipe-card.drag { transition: none; cursor: grabbing; }
/* photo on top (fills what the caption leaves), caption under it */
.swipe-photo { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #e9e9e9; }
.swipe-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.swipe-card.fit .swipe-img { object-fit: contain; }
.swipe-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(22px) brightness(.55); }
.swipe-credit { position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 10px; line-height: 1.3; pointer-events: none; }
.swipe-cap { flex: none; padding: 10px 14px 12px; background: #fff; pointer-events: none; }
.swipe-cap h2 {
  margin: 5px 0 2px; padding: 0; border: 0; background: none; color: var(--c-text); font-size: 18px; line-height: 1.35; font-weight: 700; letter-spacing: .02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.swipe-cap p { margin: 0; }
.swipe-pref { font-size: 12px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swipe-pref i { color: var(--c-accent); margin-right: 2px; }
.swipe-desc { margin-top: 5px !important; font-size: 12.5px; line-height: 1.6; color: #444; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.swipe-card.open .swipe-desc { -webkit-line-clamp: 9; }
.swipe-stamp {
  position: absolute; top: 20px; z-index: 1; padding: 4px 12px; border: 3px solid; border-radius: 8px; font-size: 20px; font-weight: 900; letter-spacing: .04em;
  background: rgba(0, 0, 0, .35); pointer-events: none;
}
.swipe-stamp.like { left: 16px; color: #ff7d9c; transform: rotate(-12deg); opacity: var(--like); }
.swipe-stamp.nope { right: 16px; color: #fff; transform: rotate(12deg); opacity: var(--nope); }

/* loading / finished / error, shown where the deck is when no card is left */
.swipe-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px;
  border: 1px dashed #ddd; border-radius: 16px; background: #fafafa; color: #555; font-size: 14px; text-align: center;
}
.swipe-state > i { font-size: 34px; color: var(--c-accent); }
.swipe-state p { margin: 0; line-height: 1.7; }
.swipe-state .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* first-visit hint over the deck */
.swipe-hint {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 16px; background: rgba(0, 0, 0, .62); color: #fff; text-align: center;
}
.swipe-hint-row { display: flex; gap: 26px; font-size: 16px; }
.swipe-hint-row span { display: inline-flex; align-items: center; gap: 8px; }
.swipe-hint-row span:last-child b { color: #ff9bb3; }
.swipe-hint p { margin: 0; font-size: 13px; color: #fff; opacity: .9; }
.swipe-toast {
  position: absolute; left: 50%; top: 12px; z-index: 6; transform: translate(-50%, -8px); padding: 7px 14px; border-radius: 999px; background: rgba(0, 0, 0, .78);
  color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.swipe-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- buttons under the deck: undo / skip / like / detail ---------- */
.swipe-actions { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 0 10px; }
.swipe-btn, .swipe-btn:link, .swipe-btn:visited {
  width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .16);
  display: inline-flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; cursor: pointer; text-decoration: none;
  transition: transform .12s; -webkit-tap-highlight-color: transparent;
}
.swipe-btn:active { transform: scale(.92); }
.swipe-btn.skip { color: #777 !important; }
.swipe-btn.like { color: #fff !important; background: var(--c-accent); }
.swipe-btn.undo, .swipe-btn.info { width: 44px; height: 44px; font-size: 16px; }
.swipe-btn.undo { color: #999 !important; }
.swipe-btn.info { color: #3b82c4 !important; }
.swipe-btn:disabled, .swipe-btn.off { opacity: .4; cursor: default; }
.swipe-note { margin: 0 0 14px; font-size: 11px; line-height: 1.6; color: var(--c-muted); text-align: center; }

@media (max-width: 599px) {
  .swipe-lead { display: none; } /* the hint over the deck says the same; the room goes to the photo */
}
@media (max-width: 1023px) {
  /* phones: the deck and its buttons fit one screen, so the page starts a little closer to the header */
  .ra-page.swipe-page:not(.swipe-list-page) { margin-top: -24px; }
}
@media (max-width: 374px) {
  .swipe-filters { gap: 6px; }
  .swipe-genres { gap: 4px; }
  .swipe-genres .chip { padding: 0 8px; }
  .swipe-select select { padding-left: 26px; padding-right: 22px; font-size: 12.5px; }
}
@media (min-width: 1024px) {
  .swipe-stage { height: calc(100vh - 420px); min-height: 420px; max-width: 440px; margin-left: auto; margin-right: auto; }
  .swipe-filters { justify-content: center; }
  .swipe-lead { text-align: center; }
}

/* ---------- /swipe/list/ ---------- */
.swipe-h1-heart { margin-right: 8px; color: var(--c-accent); font-size: .85em; }
.swipe-list-page .page-h1 small { margin-left: 10px; font-size: 13px; font-weight: 400; color: var(--c-muted); }
.swipe-list-tabs { justify-content: flex-start; }
.swipe-list-tabs .chip { cursor: pointer; }
.swipe-fav { position: relative; min-width: 0; }
.swipe-fav .card { height: 100%; box-sizing: border-box; }
.swipe-fav-del {
  position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.map-canvas.swipe-fav-map { height: 60vh !important; min-height: 360px; margin: 12px 0 6px; }
.swipe-empty { padding: 30px 10px 22px; text-align: center; color: #555; font-size: 14px; line-height: 1.8; }
.swipe-empty i { font-size: 44px; color: #f1c6d2; }
.swipe-empty p { margin: 10px 0 0; }
.swipe-pin, .swipe-pin:link, .swipe-pin:visited { display: grid; grid-template-columns: 56px 1fr; gap: 2px 10px; align-items: center; max-width: 220px; color: #222 !important; text-decoration: none; font-size: 13px; }
.swipe-pin img { grid-row: 1 / 3; border-radius: 6px; object-fit: cover; }
.swipe-pin span { color: var(--c-accent); font-size: 12px; font-weight: 700; }
