/* ===================================================
   TRAVELLER RYO-CHAN — modal.css
   Place detail modal overlay
   =================================================== */

/* ---------- Backdrop ---------- */
/* ── Undo toast (per-photo / pin delete) ─────────────────────────────── */
.rc-undo-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1C1C1C;
  color: #fff;
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  font-size: 0.92rem; font-weight: 600;
  max-width: 90vw;
}
.rc-undo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.rc-undo-msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-undo-btn {
  background: #FFD479; color: #1C1C1C;
  border: none; border-radius: 999px;
  padding: 6px 14px; font: inherit; font-weight: 800; font-size: 0.85rem;
  cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.rc-undo-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 28, 28, 0.6);
  /* Sit ABOVE the cluster gallery (1100) so place-modal opened from a
     cluster card is actually visible. */
  z-index: 1300;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: backdropIn 0.2s ease;
}
@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- Modal ---------- */
.place-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Above cluster-modal (1100) and modal-backdrop (1300) so the place
     detail is visible when launched from inside the cluster gallery. */
  z-index: 1400;
  width: min(600px, 94vw);
  max-height: 90vh;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.28s cubic-bezier(.17,.89,.32,1.1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -46%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ---------- Top-right action cluster (delete + close) ---------- */
.modal-actions {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 8px;
}
.modal-iconbtn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(28,28,28,.55);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  backdrop-filter: blur(4px);
}
.modal-iconbtn:hover {
  background: rgba(28,28,28,.85);
  transform: scale(1.1);
}
.modal-delete:hover {
  background: #c0392b;     /* red — destructive action */
}

[dir="rtl"] .modal-actions { right: auto; left: 14px; }

/* ---------- Modal inner scroll ---------- */
.modal-inner {
  overflow-y: auto;
  flex: 1;
}

/* ---------- Photo ----------
   We render the full frame (object-fit:contain) so the photo is never
   cropped — previously aspect-ratio 16/9 + cover zoomed portrait shots
   to fill the box and gave a "too close" feeling. Now the wrap flexes
   between a min-height (so there's always visual presence) and a max-
   height capped at 60vh. A soft dark backdrop acts as letter/pillarbox. */
.modal-photo-wrap {
  position: relative;
  width: 100%;
  min-height: 240px;
  max-height: min(60vh, 520px);
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-photo-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(60vh, 520px);
  object-fit: contain;   /* full frame, no crop */
}

.modal-photo-overlay {
  /* Soft vignette on the dark backdrop — keeps the old visual weight
     without darkening the photo itself. */
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(to top, rgba(0,0,0,.35), transparent);
  pointer-events: none;
}

/* ---------- Body ---------- */
.modal-body {
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 50px;
  background: var(--gray-light);
  color: #555;
  letter-spacing: 0.04em;
}
.tag:first-child {
  background: rgba(139,232,156,.3);
  color: #1B4332;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.modal-edit-btn {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-mid);
  font-size: 16px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.modal-edit-btn:hover {
  background: rgba(139,232,156,.25);
  color: #1B4332;
  transform: rotate(-12deg);
}

/* ---------- Edit mode — inline editable fields ---------- */
[contenteditable="true"].modal-title,
[contenteditable="true"].modal-desc {
  outline: 2px dashed var(--green);
  outline-offset: 4px;
  border-radius: 6px;
  background: rgba(139,232,156,.08);
  padding: 4px 6px;
  cursor: text;
}
.tags-input {
  flex: 1;
  min-width: 180px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  border: 2px dashed var(--green);
  border-radius: 50px;
  background: rgba(139,232,156,.08);
  color: #333;
  outline: none;
}
.tags-input:focus { border-style: solid; }

.modal-edit-controls {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.btn-edit-save,
.btn-edit-cancel {
  padding: 8px 20px;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-edit-save {
  background: var(--green);
  color: #1B4332;
  box-shadow: 0 3px 10px rgba(139,232,156,.4);
}
.btn-edit-save:hover { background: #6BD880; transform: translateY(-1px); }
.btn-edit-cancel {
  background: var(--gray-light);
  color: #555;
}
.btn-edit-cancel:hover { background: #E0E0E0; }

.modal-desc {
  font-size: 14px;
  line-height: 1.7;
  color: #444;
}

/* ---------- YouTube link ---------- */
.btn-yt-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 10px 22px;
  background: var(--accent);
  color: var(--white);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(255,107,53,.35);
  transition: background var(--transition), transform var(--transition);
  margin-top: 4px;
}
.btn-yt-link:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

/* ---------- Ken Burns parallax pan on modal photo ----------
   Subtle slow scale + pan creates cinematic depth.
   Class .kb is added by modal.js once the image has loaded.
   Automatically disabled when prefers-reduced-motion is set. */
@keyframes kenburns {
  0%   { transform: scale(1.00) translate( 0.0%,  0.0%); }
  33%  { transform: scale(1.06) translate(-1.2%, -0.8%); }
  66%  { transform: scale(1.04) translate( 0.8%, -1.4%); }
  100% { transform: scale(1.00) translate( 0.0%,  0.0%); }
}
.modal-photo-wrap img.kb {
  animation: kenburns 20s ease-in-out infinite;
  transform-origin: center center;
  will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
  .modal-photo-wrap img.kb { animation: none; }
}

/* ---------- Dark mode overrides for modal ---------- */
[data-theme="dark"] .place-modal     { background: #1E1E1A; }
[data-theme="dark"] .modal-title     { color: var(--ink); }
[data-theme="dark"] .modal-desc      { color: #B8B4AA; }
[data-theme="dark"] .modal-date      { color: #78746F; }
[data-theme="dark"] .tag             { background: #2A2A26; color: #B8B4AA; }
[data-theme="dark"] .tag:first-child { background: rgba(139,232,156,.15); color: #8BE89C; }
[data-theme="dark"] .modal-edit-btn  { color: #78746F; }
[data-theme="dark"] .tags-input      { background: #2A2A26; color: var(--ink); border-color: #3A3A34; }
/* Cluster modal dark mode */
[data-theme="dark"] .cluster-modal-inner {
  background: #1E1E1A;
  border: 1px solid #2A2A26;
}
[data-theme="dark"] .cluster-modal-title  { color: var(--ink); }
[data-theme="dark"] .cluster-modal-head   { border-bottom-color: #2A2A26; }
[data-theme="dark"] .cluster-card         { background: #2A2A26; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
[data-theme="dark"] .cluster-card-title   { color: var(--ink); }
[data-theme="dark"] .cluster-card-date    { color: #78746F; }
[data-theme="dark"] .cluster-card-placeholder { color: #444; }
[data-theme="dark"] .cc-edit-form         { background: #2A2A26; }
[data-theme="dark"] .cc-edit-input,
[data-theme="dark"] .cc-edit-textarea     { background: #1E1E1A; color: var(--ink); border-color: #3A3A34; }

/* ---------- Photo placeholder ---------- */
.modal-photo-wrap.no-photo {
  background: linear-gradient(135deg, var(--green) 0%, var(--cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-photo-wrap.no-photo::after {
  content: "🚴";
  font-size: 64px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.2));
}

/* ---------- Gallery controls (multi-photo) ---------- */
.gallery-ctrl {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(28,28,28,.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .15s ease;
  backdrop-filter: blur(6px);
}
.gallery-ctrl:hover { background: rgba(28,28,28,.85); transform: translateY(-50%) scale(1.08); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }

.gallery-count {
  position: absolute;
  bottom: 12px;
  right: 14px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(28,28,28,.7);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  z-index: 10;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .modal-body { padding: 16px 16px 24px; }
  .modal-title { font-size: 1.15rem; }
  .gallery-ctrl { width: 34px; height: 34px; font-size: 22px; }
}

/* ========== SHARE BUTTON ========== */
.modal-share { font-size: 16px; }
.modal-share.flashed {
  background: #8BE89C !important;
  color: #0A4A1E !important;
  transform: scale(1.15);
}

/* ========== CLUSTER GALLERY (picker when multiple photos share a pin) ========== */
/* ── Selective Delete sub-modal (cluster gallery's "select photos to delete") ── */
.sd-overlay {
  position: fixed; inset: 0;
  z-index: 1500;
  background: rgba(10, 14, 20, 0.78);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: sdFade .2s ease;
}
@keyframes sdFade { from { opacity: 0; } to { opacity: 1; } }
.sd-card {
  background: #fff;
  border-radius: 18px;
  width: min(900px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  overflow: hidden;
}
.sd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #E8E4DA;
}
.sd-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: #1C1C1C; }
.sd-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: #F5F3EC; cursor: pointer;
  font-size: 1rem; font-weight: 800; color: #1C1C1C;
}
.sd-close:hover { background: #E8E4DA; }
.sd-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; padding: 16px 20px;
  background: #FAFAF7;
}
.sd-tile {
  position: relative;
  aspect-ratio: 1/1;
  border: 3px solid transparent; border-radius: 10px;
  background: #E8E4DA; padding: 0;
  overflow: hidden; cursor: pointer;
  transition: transform .12s ease, border-color .15s ease;
}
.sd-tile:hover { transform: scale(1.02); }
.sd-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: filter .2s ease, opacity .2s ease;
}
.sd-tile-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #aaa;
}
.sd-tile-check {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: transparent;
  transition: background .15s ease;
}
.sd-tile.selected {
  border-color: #E25A28;
}
.sd-tile.selected img { opacity: .55; filter: grayscale(.4); }
.sd-tile.selected .sd-tile-check {
  background: #E25A28; color: #fff;
}
.sd-tile.selected .sd-tile-check::after { content: "✓"; }
.sd-tile.selected::after {
  content: "削除"; position: absolute; left: 8px; bottom: 8px;
  padding: 3px 9px; border-radius: 6px;
  background: #E25A28; color: #fff; font-weight: 800; font-size: 0.78rem;
  letter-spacing: .04em;
}
.sd-footer {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid #E8E4DA;
  background: #fff;
}
.sd-count {
  font-size: 0.88rem; color: #6b6b6b; font-weight: 700;
  margin-right: auto;
}
.sd-btn {
  padding: 9px 16px; border: none; border-radius: 8px;
  font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.sd-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.sd-btn:disabled { opacity: .4; cursor: not-allowed; }
.sd-btn-cancel { background: #E8E4DA; color: #1C1C1C; }
.sd-btn-delete { background: linear-gradient(135deg,#FF6B35,#E25A28); color: #fff; }
.sd-btn-pin    { background: #1C1C1C; color: #fff; opacity: .7; }
.sd-btn-pin:hover { opacity: 1; }
@media (max-width: 600px) {
  .sd-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .sd-footer { flex-direction: column; align-items: stretch; }
  .sd-count { text-align: center; margin: 0 0 6px; }
  .sd-btn { width: 100%; }
}

.cluster-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(12, 16, 20, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: cluster-fade-in .25s ease;
}
@keyframes cluster-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cluster-modal-inner {
  background: #FAFAF7;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  width: min(1080px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cluster-pop .3s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes cluster-pop {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.cluster-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(28,28,28,.08);
}
.cluster-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1C1C1C;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-grid {
  padding: 18px 22px 24px;
  overflow-y: auto;
  /* Allow the grid to grow vertically and let the parent's flex layout
     constrain it — when many photos exist, the grid scrolls instead of
     shrinking the cards. */
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  /* Larger min so each card stays a comfortable size; many photos = more
     rows that scroll, never narrower cards. */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
@media (max-width: 600px) {
  .cluster-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

.cluster-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .18s ease, box-shadow .18s ease;
  text-align: left;
  color: inherit;
}
.cluster-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}
.cluster-card.editing {
  transform: none;
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}

/* Main clickable thumbnail+body area */
.cluster-card-main {
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.cluster-card-main:focus-visible {
  outline: 3px solid #8BE89C;
  outline-offset: -3px;
}

/* Floating ✏️ / 🗑 action buttons */
.cluster-card-actions {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 2;
}
.cluster-card:hover .cluster-card-actions,
.cluster-card:focus-within .cluster-card-actions,
.cluster-card.editing .cluster-card-actions {
  opacity: 1;
}
.cc-act {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .12s ease;
}
.cc-act:hover { background: #fff; transform: scale(1.08); }
.cc-act-delete:hover { background: #FFE5E0; }

/* Inline edit form (replaces card contents when ✏️ pressed) */
.cc-edit-form {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #FFFDF7;
}
.cc-edit-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #6b6b6b;
  text-transform: uppercase;
  margin-top: 4px;
}
.cc-edit-input,
.cc-edit-textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #D6D2C7;
  border-radius: 6px;
  font: inherit;
  font-size: .9rem;
  background: #fff;
  color: #1C1C1C;
  box-sizing: border-box;
  resize: vertical;
}
.cc-edit-input:focus,
.cc-edit-textarea:focus {
  outline: none;
  border-color: #8BE89C;
  box-shadow: 0 0 0 3px rgba(139,232,156,.3);
}
.cc-edit-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cc-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.cc-btn-save {
  background: #8BE89C;
  color: #1C1C1C;
}
.cc-btn-save:hover { background: #60D386; }
.cc-btn-cancel {
  background: #E8E4DA;
  color: #1C1C1C;
}
.cc-btn-cancel:hover { background: #D6D2C7; }

.cluster-card-thumb-wrap {
  position: relative;
  width: 100%;
  /* Force a usable square-ish thumbnail. Belt-and-braces: aspect-ratio
     for modern browsers PLUS an explicit min-height in case some parent
     container collapses height. */
  aspect-ratio: 1 / 1 !important;
  height: 220px !important;
  min-height: 220px !important;
  background: #E8E4DA;
  overflow: hidden;
  display: block !important;
}
.cluster-card-thumb {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.cluster-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cluster-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #AAA;
}
.cluster-card-count {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(28,28,28,.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}

.cluster-card-body {
  padding: 10px 12px 12px;
}
.cluster-card-title {
  font-size: .92rem;
  font-weight: 600;
  color: #1C1C1C;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cluster-card-date {
  margin-top: 4px;
  font-size: .78rem;
  color: #6b6b6b;
}

@media (max-width: 600px) {
  .cluster-modal { padding: 12px; }
  .cluster-modal-head { padding: 14px 16px; }
  .cluster-grid {
    padding: 14px 16px 20px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .cluster-modal-title { font-size: 1rem; }
}

/* ── Photo picker overlay (≥10-photo pins) ───────────────────────────── */
.photo-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 22, 28, 0.92);
  backdrop-filter: blur(8px);
  /* Above cluster-modal (1100) but below place-modal (1300/1400)
     so photo modal can still open on top of the picker. */
  z-index: 1200;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.photo-picker-overlay[hidden] { display: none; }
.photo-picker-overlay .pp-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; background: rgba(28,28,28,0.85);
  color: #fff; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.photo-picker-overlay .pp-title {
  margin: 0; font-size: 1.1rem; font-weight: 700;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-picker-overlay .pp-count {
  background: #FF6B35; padding: 4px 12px; border-radius: 12px;
  font-size: .82rem; font-weight: 700; flex-shrink: 0;
}
.photo-picker-overlay .pp-close {
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; width: 36px; height: 36px; border-radius: 50%;
  font-size: 1rem; cursor: pointer; transition: background .15s;
}
.photo-picker-overlay .pp-close:hover { background: rgba(255,255,255,0.25); }
.photo-picker-overlay .pp-grid {
  flex: 1; overflow-y: auto; padding: 16px;
  display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  align-content: start;
}
/* Bulletproof square cells: padding-top trick wins over any global
   <button> styling that might add min-height or break aspect-ratio. */
.photo-picker-overlay .pp-cell {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 0 !important;
  padding: 0 !important;
  padding-top: 100% !important;   /* height = width → perfect square */
  margin: 0 !important;
  background: #2a2a2a !important;
  border: none !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  cursor: pointer !important;
  font: inherit !important;
  color: inherit !important;
  box-shadow: none;
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 0 !important;
  min-width: 0 !important;
}
.photo-picker-overlay .pp-cell:hover {
  transform: scale(1.04); z-index: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.photo-picker-overlay .pp-cell img {
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  width: 100% !important; height: 100% !important;
  object-fit: cover !important; display: block !important;
}
.photo-picker-overlay .pp-num {
  position: absolute !important;
  top: 6px !important; left: 6px !important;
  background: rgba(28,28,28,0.75); color: #fff;
  padding: 2px 7px; border-radius: 8px;
  font-size: .68rem; font-weight: 700;
  pointer-events: none;
  z-index: 2;
}
@media (max-width: 768px) {
  .photo-picker-overlay .pp-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    padding: 10px; gap: 4px;
  }
  .photo-picker-overlay .pp-head { padding: 10px 14px; }
  .photo-picker-overlay .pp-title { font-size: .95rem; }
}

/* ── Cluster card drag-and-drop merge ───────────────────────────────── */
.cluster-card .cc-act-drag {
  background: rgba(255,255,255,.92);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cluster-card .cc-act-drag:hover { background: #FFE5C0; }
.cluster-card.dragging {
  opacity: 0.45;
  transform: scale(0.96);
  transition: opacity .12s ease, transform .12s ease;
}
.cluster-card.drop-target {
  outline: 3px dashed #FF6B35;
  outline-offset: 2px;
  background: linear-gradient(to bottom, #FFF8F0, #FFFFFF) !important;
}
.cluster-card.drop-target::after {
  content: "↔ ここに統合";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,107,53,.12);
  color: #B5391A; font-weight: 800; font-size: 1.05rem;
  pointer-events: none;
  border-radius: 12px;
  z-index: 5;
}

/* ── Pin-to-top button (📌) ──────────────────────────────────────────── */
.modal-pin {
  background: rgba(28,28,28,.55);
  transition: background var(--transition), transform var(--transition);
}
.modal-pin:hover { background: rgba(28,28,28,.85); transform: scale(1.1); }
.modal-pin.is-pinned {
  background: #FF6B35;
  box-shadow: 0 0 0 2px #FFD479, 0 4px 10px rgba(255,107,53,.5);
}
.modal-pin.is-pinned:hover { background: #E25A28; }

/* ── Per-pin comments thread ─────────────────────────────────────────── */
.modal-comments-slot { margin-top: 18px; padding-top: 16px;
                       border-top: 1px solid #E8E4DA; }
.rc-comments .rc-c-head { margin-bottom: 12px; }
.rc-c-title {
  margin: 0; font-size: 1.05rem; font-weight: 800;
  color: #1C1C1C; letter-spacing: -0.01em;
}
.rc-c-loading, .rc-c-empty {
  margin: 8px 0 16px; color: #888; font-size: .9rem; font-style: italic;
}
.rc-c-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.rc-c-item {
  background: #F9F7F1; border-radius: 12px;
  padding: 10px 14px 12px; position: relative;
}
.rc-c-item.rc-c-featured {
  background: linear-gradient(135deg, #FFF8E5 0%, #FFE5C8 100%);
  border-left: 4px solid #FF6B35;
}
.rc-c-feat-badge {
  position: absolute; top: 8px; right: 10px;
  background: #FF6B35; color: #fff;
  padding: 2px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 800; letter-spacing: .03em;
}
.rc-c-meta {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
}
.rc-c-name {
  font-weight: 700; color: #1C1C1C; font-size: .92rem;
}
.rc-c-date {
  font-size: .75rem; color: #888;
}
.rc-c-photo {
  display: block; max-width: 100%; max-height: 200px;
  border-radius: 8px; margin: 6px 0;
}
.rc-c-body {
  margin: 0; font-size: .92rem; line-height: 1.55;
  color: #333; white-space: pre-wrap; word-wrap: break-word;
}

.rc-c-form {
  display: flex; flex-direction: column; gap: 8px;
  background: #FFFDF7; padding: 12px;
  border-radius: 12px; border: 1px solid #E8E4DA;
}
.rc-c-input, .rc-c-textarea {
  padding: 8px 10px; border: 1px solid #D6D2C7;
  border-radius: 8px; font: inherit; font-size: .9rem;
  background: #fff; box-sizing: border-box; width: 100%;
  resize: vertical;
}
.rc-c-input:focus, .rc-c-textarea:focus {
  outline: none; border-color: #8BE89C;
  box-shadow: 0 0 0 3px rgba(139,232,156,.3);
}
.rc-c-charcount {
  font-size: .72rem; color: #888; align-self: flex-end;
}
.rc-c-form-row {
  display: flex; gap: 8px; align-items: center;
}
.rc-c-photo-btn {
  display: inline-block; padding: 7px 12px;
  background: #E8E4DA; color: #333;
  border-radius: 8px; cursor: pointer;
  font-size: .85rem; font-weight: 600;
  transition: background .15s ease;
}
.rc-c-photo-btn:hover { background: #D6D2C7; }
.rc-c-submit {
  margin-left: auto; padding: 8px 18px;
  background: #8BE89C; color: #1B4332;
  border: none; border-radius: 999px;
  font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.rc-c-submit:hover:not(:disabled) { background: #60D386; transform: translateY(-1px); }
.rc-c-submit:disabled { opacity: .5; cursor: wait; }
.rc-c-status {
  font-size: .82rem; color: #B5391A; min-height: 1em;
}
.rc-c-preview-wrap { display: flex; }
.rc-c-preview {
  max-width: 120px; max-height: 120px;
  border-radius: 8px; object-fit: cover;
}

/* ── Suggestion pin modal ────────────────────────────────────────────── */
.sugg-overlay {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(20,22,28,.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.sugg-overlay[hidden] { display: none; }
.sugg-card {
  background: #fff; border-radius: 18px;
  padding: 24px 22px; max-width: 480px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  animation: suggIn .25s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes suggIn {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.sugg-title { margin: 0 0 4px; font-size: 1.2rem; font-weight: 800; color: #1C1C1C; }
.sugg-sub { margin: 0 0 14px; font-size: .88rem; color: #777; }
.sugg-coords {
  display: inline-block; padding: 4px 10px; margin-bottom: 12px;
  background: #F5F3EC; border-radius: 999px;
  font-size: .82rem; color: #1C1C1C; font-weight: 600;
  font-family: ui-monospace, monospace;
}
.sugg-card input.sugg-name, .sugg-card textarea.sugg-msg {
  width: 100%; padding: 10px 12px;
  border: 1px solid #D6D2C7; border-radius: 10px;
  font: inherit; font-size: .95rem; box-sizing: border-box;
  background: #fff; margin-bottom: 10px;
}
.sugg-card .sugg-msg { resize: vertical; min-height: 90px; }
.sugg-card input.sugg-name:focus, .sugg-card textarea.sugg-msg:focus {
  outline: none; border-color: #8BE89C;
  box-shadow: 0 0 0 3px rgba(139,232,156,.3);
}
.sugg-photo-label {
  display: inline-block; padding: 8px 14px;
  background: #E8E4DA; border-radius: 10px;
  cursor: pointer; font-size: .88rem; font-weight: 600; color: #444;
  margin-bottom: 10px;
}
.sugg-photo-label:hover { background: #D6D2C7; }
.sugg-preview-wrap { margin-bottom: 10px; }
.sugg-preview {
  max-width: 140px; max-height: 140px;
  border-radius: 10px; object-fit: cover; display: block;
}
.sugg-row {
  display: flex; gap: 10px; margin-top: 14px;
}
.sugg-cancel, .sugg-submit {
  flex: 1; padding: 10px 16px; border: none; border-radius: 999px;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.sugg-cancel { background: #E8E4DA; color: #444; }
.sugg-cancel:hover { background: #D6D2C7; }
.sugg-submit { background: #FF6B35; color: #fff; }
.sugg-submit:hover:not(:disabled) { background: #E25A28; transform: translateY(-1px); }
.sugg-submit:disabled { opacity: .5; cursor: wait; }
.sugg-status {
  margin-top: 10px; font-size: .85rem; color: #B5391A; min-height: 1em;
}
.sugg-status.ok { color: #1B4332; }

/* Approved suggestion pin (rendered by maps in a later phase) */
.suggestion-pin {
  position: absolute; transform: translate(-50%, -100%);
  pointer-events: auto; cursor: pointer;
  z-index: 6;
}
.suggestion-pin .sp-marker {
  width: 22px; height: 22px; border-radius: 50%;
  background: #4A90E2; border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.suggestion-pin.fulfilled .sp-marker {
  background: #8BE89C;
  box-shadow: 0 4px 10px rgba(0,0,0,.35), 0 0 0 4px rgba(139,232,156,.4);
}
.suggestion-pin .sp-tooltip {
  position: absolute; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: #1C1C1C; color: #fff;
  padding: 6px 10px; border-radius: 8px;
  font-size: .78rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.suggestion-pin:hover .sp-tooltip { opacity: 1; }
