/* =============================================
   GALLERY PAGE
   ============================================= */

.gallery-dashboard {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* Desktop: use the spare width so a strip shows 13 thumbnails across
   (13 x 80px + 12 x 8px gaps + strip/card/page padding = 1202px).
   Phones and narrow windows keep the 680px layout. */
@media (min-width: 900px) {
  .gallery-dashboard { max-width: 1202px; }
}

/* ---- Page header ---- */
.gallery-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.gallery-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #6B3F2A;
  letter-spacing: -0.01em;
}

.gallery-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-new-carousel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #6B3F2A;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.gallery-new-carousel-btn:hover { background: #4a2518; }

/* ---- Day cards container ---- */
.day-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Day card ---- */
.gallery-day-card {
  background: #fdf8f2;
  border: 1px solid #ddd0c0;
  border-radius: 16px;
  overflow: hidden;
}

.gallery-day-card.is-today {
  border-color: #6B3F2A;
  border-width: 1.5px;
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  gap: 10px;
}

.day-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #3a2518;
  min-width: 0;
}

.day-today-arrow {
  display: inline-block;
  font-size: 14px;
  flex-shrink: 0;
}

.day-future-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #ddd0c0;
  color: #6b5540;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.day-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f0e8dc;
  border: 1px solid #c9b49a;
  border-radius: 8px;
  cursor: pointer;
  color: #7a5c3a;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.day-add-btn:hover { background: #7a5c3a; color: #fff; border-color: #7a5c3a; }

.day-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.day-header-count {
  font-size: 12px;
  color: #8a6a4a;
  font-weight: 500;
  margin-left: 4px;
}

.day-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #ede0d0;
  border: 1px solid #c9b49a;
  border-radius: 8px;
  cursor: pointer;
  color: #6b5540;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.day-icon-btn:hover { background: #d8cabb; }
.day-icon-btn--dark {
  background: #3a2518;
  color: #ede0d0;
  border-color: #3a2518;
}
.day-icon-btn--dark:hover { background: #1a120d; border-color: #1a120d; }
.day-icon-btn--copy {
  background: #f0e8dc;
  color: #7a6040;
  border-color: #c9b49a;
}
.day-icon-btn--copy:hover { background: #7a6040; color: #fff; border-color: #7a6040; }
.day-icon-btn--cal {
  background: #ede0d0;
  color: #4a2518;
  border-color: #c9a888;
}
.day-icon-btn--cal:hover { background: #4a2518; color: #fff; border-color: #4a2518; }
.day-icon-btn--dl {
  background: #2c1a10;
  color: #ede0d0;
  border-color: #2c1a10;
}
.day-icon-btn--dl:hover { background: #1a0e08; border-color: #1a0e08; }
.day-icon-btn--dl:disabled { opacity: 0.45; cursor: not-allowed; }
.day-icon-btn--dl.is-prefetching { cursor: wait; }
.day-icon-btn--dl.is-prefetching svg { animation: dl-pulse 1.1s ease-in-out infinite; }
@keyframes dl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.day-icon-btn--caption {
  background: #efe6f2;
  color: #6b4a7a;
  border-color: #d3bfda;
}
.day-icon-btn--caption:hover { background: #6b4a7a; color: #fff; border-color: #6b4a7a; }
.day-icon-btn--caption.is-generating { cursor: wait; }
.day-icon-btn--caption.is-generating svg { animation: caption-spin 0.9s linear infinite; }
@keyframes caption-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.day-icon-btn--danger {
  background: #fff0ee;
  color: #c0392b;
  border-color: #f5c6c2;
}
.day-icon-btn--danger:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.day-icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Strip color swatch (trigger button + popover) ---- */
.day-color-swatch-btn {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #c9b49a;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  background-color: #fff;
  transition: transform 0.12s ease;
}
.day-color-swatch-btn:hover { transform: scale(1.08); }
.day-color-swatch-btn.is-none {
  background-image: linear-gradient(45deg, transparent 46%, #cc3333 46%, #cc3333 54%, transparent 54%);
}

.day-color-swatch-popover {
  position: fixed;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #ddd0c0;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}
.day-color-swatch-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.day-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
  flex-shrink: 0;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.day-color-dot:hover { transform: scale(1.12); }
.day-color-dot.selected {
  border-color: #6B3F2A;
  box-shadow: 0 0 0 2px rgba(107,63,42,0.28);
}
.day-color-dot--none {
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 47%, #cc3333 47%, #cc3333 53%, transparent 53%);
}

/* ---- Photo strip ---- */
.day-photo-strip-wrap {
  position: relative;
}
.day-photo-strip-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: calc(100% - 6px); /* leave room for scrollbar */
  background: linear-gradient(to right, transparent, #fff9f4);
  pointer-events: none;
  border-radius: 0 12px 0 0;
}

/* Strip background tints -- same palette as the ticket color swatches */
.day-photo-strip-wrap.strip-color-1 { background-color: #b9c5c5; }
.day-photo-strip-wrap.strip-color-2 { background-color: #dcb6af; }
.day-photo-strip-wrap.strip-color-3 { background-color: #f9efe0; }
.day-photo-strip-wrap.strip-color-4 { background-color: #8e8e8e; }
.day-photo-strip-wrap.strip-color-5 { background-color: #8fac8f; }
.day-photo-strip-wrap.strip-color-1::after { background: linear-gradient(to right, transparent, #b9c5c5); }
.day-photo-strip-wrap.strip-color-2::after { background: linear-gradient(to right, transparent, #dcb6af); }
.day-photo-strip-wrap.strip-color-3::after { background: linear-gradient(to right, transparent, #f9efe0); }
.day-photo-strip-wrap.strip-color-4::after { background: linear-gradient(to right, transparent, #8e8e8e); }
.day-photo-strip-wrap.strip-color-5::after { background: linear-gradient(to right, transparent, #8fac8f); }
.day-photo-strip {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding: 0 16px 22px;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  min-height: 112px;
  align-items: flex-start;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #9a8070 #e0d4c4;
}
.day-photo-strip::-webkit-scrollbar { height: 0; width: 0; }
.day-photo-strip::-webkit-scrollbar-track { display: none; }
.day-photo-strip::-webkit-scrollbar-thumb { display: none; }

/* Custom scroll track */
.strip-scroll-track-wrap {
  margin-top: -18px;
  position: relative;
  z-index: 2;
  padding: 4px 16px 8px;
  touch-action: none;
  pointer-events: none;
}
.strip-scroll-track {
  position: relative;
  height: 5px;
  background: #e0d4c4;
  border-radius: 3px;
}
.strip-scroll-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #9a8070;
  border-radius: 3px;
  
}

.day-empty-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 90px;
  font-size: 13px;
  color: #9a8070;
  font-style: italic;
  border: 2px dashed #d8cabb;
  border-radius: 10px;
  padding: 16px;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.day-empty-hint:hover { border-color: #6B3F2A; color: #6B3F2A; }

/* ---- Photo card ---- */
.gallery-photo-card {
  flex-shrink: 0;
  width: 80px;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  border-radius: 8px;
  overflow: hidden;
  background: #ede0d0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.gallery-photo-card:active { cursor: grabbing; }

.gallery-photo-card.is-dragging {
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  opacity: 0.95;
  cursor: grabbing;
  transition: box-shadow 0.1s;
}

/* Card is armed for reorder (250 ms hold, not yet dragging) */
.gallery-photo-card.is-reorder-armed {
  transform: scale(1.06) translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  cursor: grabbing;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  z-index: 10;
}

/* Multi-select mode */
.gallery-photo-card.is-selectable {
  cursor: pointer;
}
.gallery-photo-card.is-selectable .photo-thumb {
  transition: opacity 0.12s ease;
}
.gallery-photo-card.is-selectable:not(.is-selected) .photo-thumb {
  opacity: 0.85;
}
.gallery-photo-card.is-selected {
  box-shadow: 0 0 0 3px #6B3F2A;
}
.photo-card-select-check {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(255,255,255,0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.gallery-photo-card.is-selected .photo-card-select-check {
  background: #6B3F2A;
  border-color: #6B3F2A;
}

.gallery-photo-card.shift-right { transform: translateX(88px); transition: transform 0.15s ease; }
.gallery-photo-card.shift-left  { transform: translateX(-88px); transition: transform 0.15s ease; }

.photo-thumb {
  width: 80px;
  height: 100px;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.photo-card-num {
  position: absolute;
  bottom: 4px;
  left: 5px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* photo-card-overlay, photo-delete-btn, photo-copy-single-btn removed —
   actions are now in the long-press context menu (.slide-menu-*) */

/* ---- Day card footer ---- */
.day-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.day-photo-count {
  font-size: 12px;
  color: #8a6a4a;
  font-weight: 500;
}

.day-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  background: #3a2518;
  color: #ede0d0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.day-download-btn:hover { background: #1a120d; }
.day-download-btn:disabled { background: #b8a090; cursor: not-allowed; }

.day-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: #ede0d0;
  border: 1px solid #c9b49a;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b5540;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
}
.day-copy-btn:hover { background: #d8cabb; }

/* =============================================
   MODALS (shared)
   ============================================= */

.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(40,24,12,0.72);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.gallery-modal.hidden { display: none; }

.gallery-modal-inner {
  background: #fdf8f2;
  border-radius: 18px;
  padding: 24px 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

/* ---- New canvas modal ---- */
.new-carousel-inner {
  max-width: 360px;
}
.new-carousel-title {
  font-size: 18px;
  font-weight: 700;
  color: #3a2518;
  margin-bottom: 5px;
}
.new-carousel-subtitle {
  font-size: 13px;
  color: #6b5540;
  margin-bottom: 16px;
}
.new-carousel-date-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #8a6a4a;
  border-radius: 10px;
  background: #fff;
  color: #3a2518;
  font-size: 15px;
  font-family: inherit;
  box-sizing: border-box;
  margin-bottom: 16px;
}
.new-carousel-date-input:focus { outline: none; border-color: #6B3F2A; }
.new-carousel-actions {
  display: flex;
  gap: 10px;
}
.new-carousel-confirm-btn {
  flex: 1;
  padding: 11px;
  background: #6B3F2A;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.new-carousel-confirm-btn:hover { background: #4a2518; }
.new-carousel-cancel-btn {
  flex: 1;
  padding: 11px;
  background: #ede0d0;
  color: #6b5540;
  border: 1px solid #c9b49a;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.new-carousel-cancel-btn:hover { background: #d8cabb; }

/* Mobile tweaks */
@media (max-width: 480px) {
  .gallery-photo-card { width: 76px; }
  .photo-thumb { width: 76px; height: 95px; }
  .gallery-page-header { flex-wrap: wrap; }
}

/* ---- Multi-version styles ---- */
.carousel-version-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 4px;
  border-top: 1px solid #e0d4c4;
  margin-top: 4px;
}
.carousel-version-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a6a4a;
}
.day-add-version-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background: #ede0d0;
  border: 1px solid #c9b49a;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b5540;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.day-add-version-btn:hover { background: #6B3F2A; color: #fff; border-color: #6B3F2A; }

.day-label-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 6px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b8a090;
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
  transition: color 0.12s, background 0.12s;
}
.day-label-delete-btn:hover { color: #c0392b; background: #fdf0ee; }

/* ---- Version picker bottom sheet ---- */
.version-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 24, 12, 0.45);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.version-picker-overlay.version-picker-visible { opacity: 1; }
.version-picker-overlay.version-picker-closing { opacity: 0; }

.version-picker-sheet {
  width: 100%;
  background: #fdf8f2;
  border-radius: 18px 18px 0 0;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(100%);
  transition: transform 0.18s ease;
}
.version-picker-visible .version-picker-sheet { transform: translateY(0); }
.version-picker-closing .version-picker-sheet { transform: translateY(100%); }

.version-picker-title {
  font-size: 13px;
  font-weight: 700;
  color: #8a6a4a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-align: center;
}
.version-picker-btn {
  width: 100%;
  padding: 14px 16px;
  background: #f2ebe0;
  border: 1px solid #ddd0c0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #3a2518;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}
.version-picker-btn:hover { background: #e0d4c4; }
.version-picker-btn--new {
  color: #6B3F2A;
  border-color: #6B3F2A;
  background: transparent;
  font-weight: 600;
}
.version-picker-btn--new:hover { background: #fdf0ee; }
.version-picker-cancel {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  color: #8a6a4a;
  cursor: pointer;
  font-family: inherit;
  margin-top: 2px;
  transition: color 0.12s;
}
.version-picker-cancel:hover { color: #3a2518; }

/* Desktop: this was designed as a mobile bottom sheet (full viewport width
   intentional there) but looked oversized stretched edge-to-edge on a wide
   screen -- cap the width and center it like the copy-picker/slide-menu
   modals above this breakpoint. */
@media (min-width: 640px) {
  .version-picker-overlay {
    align-items: center;
    justify-content: center;
  }
  .version-picker-sheet {
    width: 100%;
    max-width: 400px;
    border-radius: 18px;
  }
}

/* ---- Undo bar ---- */
.undo-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: #3a2518;
  border-radius: 10px;
  margin: 6px 16px 0;
  animation: undo-bar-in 0.18s ease;
}
@keyframes undo-bar-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.undo-bar-msg {
  flex: 1;
  font-size: 12px;
  color: #b8a090;
}
.undo-bar-btn {
  padding: 4px 10px;
  background: #6B3F2A;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.undo-bar-btn:hover { background: #4a2518; }
.undo-bar-dismiss {
  background: transparent;
  border: none;
  color: #6b5540;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.12s;
}
.undo-bar-dismiss:hover { color: #fff; }

/* ---- Selection bar (multi-select mode) ---- */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: #3a2518;
  border-radius: 10px;
  margin: 6px 16px 0;
  animation: undo-bar-in 0.18s ease;
}
.selection-bar-msg {
  flex: 1;
  font-size: 12px;
  color: #b8a090;
}
.selection-bar-delete {
  padding: 4px 10px;
  background: #b3382c;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.selection-bar-delete:hover:not(:disabled) { background: #8f2c22; }
.selection-bar-delete:disabled { opacity: 0.4; cursor: default; }
.selection-bar-copy {
  padding: 4px 10px;
  background: #6B3F2A;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.selection-bar-copy:hover:not(:disabled) { background: #52301f; }
.selection-bar-copy:disabled { opacity: 0.4; cursor: default; }
.selection-bar-cancel {
  background: transparent;
  border: none;
  color: #b8a090;
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
  transition: color 0.12s;
}
.selection-bar-cancel:hover { color: #fff; }

/* ---- Delete-undo toast (standalone, floats above everything) ---- */
.delete-undo-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #3a2518;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.delete-undo-toast.delete-undo-toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.delete-undo-toast-msg {
  flex: 1;
  font-size: 13px;
  color: #f0e6da;
}
.delete-undo-toast-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  background: #6B3F2A;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.delete-undo-toast-btn:hover { background: #4a2518; }

/* On mobile, show the undo bar and selection bar as a fixed toast at the
   bottom of the screen instead of inline along the thumbnail strip -- a
   drag-reorder (or a selection made further down the strip) can happen
   anywhere on the page, so anchoring it to a fixed, predictable spot is
   easier to notice and tap than wherever the strip happens to be scrolled to. */
@media (max-width: 768px) {
  .undo-bar,
  .selection-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    z-index: 1500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: undo-bar-in-mobile 0.2s ease;
  }
  @keyframes undo-bar-in-mobile {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* Copy picker date group */
.copy-picker-date-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 2px;
  border-top: 1px solid #e0d4c4;
  margin-top: 4px;
}
.copy-picker-date-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c9b49a;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #2c1a10;
  background: #fff;
  box-sizing: border-box;
  outline: none;
}
.copy-picker-date-input:focus { border-color: #6B3F2A; }
.copy-picker-today-hint {
  font-size: 12.5px;
  color: #8a6f56;
  font-weight: 500;
}

/* Copy picker -- compact centered modal (not a full-width bottom sheet) */
.copy-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 37, 24, 0.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.copy-picker-overlay.copy-picker-visible  { opacity: 1; }
.copy-picker-overlay.copy-picker-closing  { opacity: 0; }

.copy-picker-sheet {
  background: #fdf8f2;
  border-radius: 14px;
  padding: 20px 18px 16px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(58, 37, 24, 0.22);
  transform: scale(0.95);
  transition: transform 0.18s ease;
}
.copy-picker-visible .copy-picker-sheet { transform: scale(1); }
.copy-picker-closing .copy-picker-sheet { transform: scale(0.95); }

.copy-picker-sheet .version-picker-title {
  font-size: 13px;
  margin-bottom: 14px;
}
.copy-picker-sheet .version-picker-btn {
  font-size: 13px;
  padding: 10px 14px;
}
.copy-picker-sheet .version-picker-cancel {
  margin-top: 8px;
  font-size: 13px;
}

/* ---- Slide long-press context menu ---- */
.slide-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 24, 12, 0.45);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.slide-menu-overlay.slide-menu-visible  { opacity: 1; }
.slide-menu-overlay.slide-menu-closing  { opacity: 0; }

.slide-menu-sheet {
  width: 100%;
  background: #fdf8f2;
  border-radius: 18px 18px 0 0;
  padding: 20px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(100%);
  transition: transform 0.18s ease;
}
.slide-menu-visible .slide-menu-sheet { transform: translateY(0); }
.slide-menu-closing .slide-menu-sheet { transform: translateY(100%); }

.slide-menu-title {
  font-size: 13px;
  font-weight: 700;
  color: #8a6a4a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-align: center;
}

.slide-menu-btn {
  width: 100%;
  padding: 15px 16px;
  background: #f2ebe0;
  border: 1px solid #ddd0c0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #3a2518;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}
.slide-menu-btn:hover  { background: #e0d4c4; }
.slide-menu-btn:active { background: #d8cabb; }

.slide-menu-btn--delete {
  color: #c0392b;
  border-color: #e8c0bb;
  background: #fff5f4;
}
.slide-menu-btn--delete:hover  { background: #fde8e6; }
.slide-menu-btn--delete:active { background: #f8d5d2; }

.slide-menu-cancel {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  color: #8a6a4a;
  cursor: pointer;
  font-family: inherit;
  margin-top: 2px;
  transition: color 0.12s;
}
.slide-menu-cancel:hover { color: #3a2518; }

/* Desktop: these were designed as a mobile bottom sheet (full viewport
   width intentional there) but looked oversized stretched edge-to-edge on
   a wide screen -- cap the width and center it like the copy-picker
   modals above this breakpoint. */
@media (min-width: 640px) {
  .slide-menu-overlay {
    align-items: center;
    justify-content: center;
  }
  .slide-menu-sheet {
    width: 100%;
    max-width: 400px;
    border-radius: 18px;
  }
}

/* ---- Fullscreen image enlarge overlay ---- */
.slide-enlarge-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.slide-enlarge-overlay.slide-enlarge-visible { opacity: 1; }

.slide-enlarge-img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: block;
}

.slide-enlarge-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.slide-enlarge-close:hover { background: rgba(255,255,255,0.28); }

/* Dragging photos in from the desktop */
.day-photo-strip-wrap.desktop-drop-over { outline: 2px dashed #b5655a; outline-offset: 2px; border-radius: 10px; background: rgba(181,101,90,0.08); }

/* Planner version header: buttons in a grid, 4 across (two rows) */
.day-header-actions--grid {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  align-items: center;
  justify-items: stretch;
}
.day-header-actions--grid > * { margin: 0; }
.day-merge-btn { white-space: nowrap; }

/* Merge loader */
.merge-loader-overlay { position: fixed; inset: 0; background: rgba(60,40,25,.45); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.merge-loader-card { background: #fffaf3; border-radius: 16px; padding: 18px 26px 16px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.mc-stage { position: relative; display: flex; justify-content: center; width: 150px; height: 150px; margin: 0 auto 4px; }
.mc-stage svg { display: block; }
.mc-heart { position: absolute; left: 50px; top: -6px; width: 50px; height: 50px; opacity: 0; animation: mcHeart 2.2s ease-in-out infinite; }
.merge-loader-text { font-size: 14px; color: #6B3F2A; font-weight: 600; }
.mc-left  { animation: mcLeft 2.2s ease-in-out infinite; }
.mc-right { animation: mcRight 2.2s ease-in-out infinite; }
@keyframes mcLeft  { 0%{transform:translateX(-34px)} 45%,70%{transform:translateX(0)} 100%{transform:translateX(-34px)} }
@keyframes mcRight { 0%{transform:translateX(34px)}  45%,70%{transform:translateX(0)} 100%{transform:translateX(34px)} }
@keyframes mcHeart { 0%,44%{opacity:0;transform:scale(.3)} 55%,70%{opacity:1;transform:scale(1)} 85%,100%{opacity:0;transform:scale(.3)} }

/* Drag a thumbnail from one strip onto another to copy it */
.gallery-photo-card.is-copy-source { opacity: 0.35; }
.day-photo-strip.drop-target {
    outline: 3px dashed #e8a33d;
    outline-offset: -3px;
    background: rgba(232, 163, 61, 0.12);
}
.drag-copy-ghost {
    position: fixed;
    z-index: 100000;
    width: 76px;
    transform: translate(-50%, -60%) rotate(-3deg);
    pointer-events: none;
    opacity: 0.92;
    border-radius: 8px;
    overflow: visible;
    box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
.drag-copy-ghost img { width: 100%; display: block; border-radius: 8px; }
.drag-copy-ghost span {
    position: absolute; top: -9px; right: -9px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #e8a33d; color: #fff; font: 700 16px/22px sans-serif; text-align: center;
}

.copy-picker-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.copy-picker-sheet > .copy-picker-date-input { margin-top: 4px; }

/* Calendar + versions picker (calendar left, versions right; stacks on phones) */
.copy-picker-sheet.copy-picker-sheet--wide { max-width: 640px; }
.cp-body { display: grid; grid-template-columns: 292px 1fr; gap: 20px; align-items: start; }
.cp-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cp-cal-month { font-size: 14px; font-weight: 700; color: #3b2415; }
.cp-nav { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #6B3F2A; font-size: 22px; line-height: 1; cursor: pointer; }
.cp-nav:hover:not(:disabled) { background: #efe4d6; }
.cp-nav:disabled { color: #cdbfae; cursor: default; }
.cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cp-dow { font-size: 11px; font-weight: 600; color: #9a8070; padding: 4px 0; }
.cp-day { position: relative; aspect-ratio: 1 / 1; border: 0; border-radius: 50%; background: transparent; color: #2c1a10; font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.cp-day:hover:not(:disabled):not(.cp-day--sel) { background: #efe4d6; }
.cp-day:disabled { color: #cdbfae; cursor: default; }
.cp-day--today:not(.cp-day--sel) { box-shadow: inset 0 0 0 1.5px #6B3F2A; }
.cp-day--sel { background: #6B3F2A; color: #fff; font-weight: 700; }
.cp-day--has::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #c8873a; }
.cp-day--sel.cp-day--has::after { background: #fff; }
.cp-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cp-daylabel { font-size: 13px; font-weight: 700; color: #6B3F2A; padding-top: 4px; }
.cp-side .copy-picker-list { margin-top: 0; max-height: 260px; overflow-y: auto; }
@media (max-width: 600px) {
  .cp-body { grid-template-columns: 1fr; gap: 12px; }
  .cp-side .copy-picker-list { max-height: 200px; }
}

.drop-marker { position: absolute; top: 0; width: 4px; margin-left: -1px; border-radius: 2px; background: #e8a33d; box-shadow: 0 0 0 1px rgba(255,255,255,.7); pointer-events: none; z-index: 5; }

/* Video tiles: small play badge over the poster frame */
.photo-card-video-badge {
  position: absolute; left: 6px; bottom: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 10px; line-height: 22px; text-align: center; padding-left: 2px;
  pointer-events: none;
}
video.photo-thumb { object-fit: cover; background: #000; }
video.slide-enlarge-img { background: #000; }

/* ---- Note tiles (reminder tiles in a story strip) ---- */
.day-icon-btn--note {
  background: #fff3c4;
  color: #7a5c00;
  border-color: #e0c874;
}
.day-icon-btn--note:hover { background: #7a5c00; color: #fff; border-color: #7a5c00; }
.gallery-photo-card.note-card {
  background: #fff3c4;
  border: 1.5px dashed #d1b24f;
  box-sizing: border-box;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-card-body {
  padding: 6px 5px 14px;
  font-size: 9px;
  line-height: 1.25;
  font-weight: 600;
  color: #5a4600;
  text-align: center;
  overflow: hidden;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  pointer-events: none;
}
.note-card-tag {
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  text-align: center;
  font-size: 7px;
  letter-spacing: .12em;
  font-weight: 800;
  color: #a58a2a;
  pointer-events: none;
}
.note-editor-sheet { padding-bottom: 14px; }
.note-editor-title { font-size: 15px; font-weight: 700; color: #3a2518; margin: 2px 0 10px; text-align: center; }
.note-editor-text {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd0c0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 10px;
  resize: none;
  background: #fffdf5;
}

/* ---- Swipe arrow toggle + thumbnail preview ---- */
.day-icon-btn--arrow.is-on { background: #6B3F2A; color: #fff; border-color: #6B3F2A; }
.swipe-arrow-badge {
  position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; padding: 3px; box-sizing: border-box;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.3); pointer-events: none;
}
