/* Photo Dedication (054): the saved-game editor, the live bar, the
   moderation surface, the album and the download states. Scoped to pd-*
   classes plus a few db-* extensions; the approved app shell (base.css)
   owns the header, sidebar, workspace and shared buttons. */

/* =====================================================================
   Editor: How Photo Dedication works + settings
   ===================================================================== */
.pd-editor { display: flex; flex-direction: column; gap: 1.1rem; width: 100%; }
.pd-panel {
  background: #FFFFFF;
  border: 1px solid #E9E2DA;
  border-radius: 18px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 4px 14px rgba(32, 36, 44, 0.05);
}
.pd-h2 { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 800; color: #20242C; letter-spacing: -0.01em; }
.pd-sub { margin: 0 0 1rem; color: rgba(32, 36, 44, 0.62); line-height: 1.5; }
/* Owner 2026-10-23: match the activity-template gap below How it works.
   .pd-editor already contributes its 1.1rem row gap, so 2.4rem here makes
   the visible How-to-hint distance 56px, the same as Guess the Price. */
.pd-setup-hint { margin: 2.4rem 0 0; color: rgba(32, 36, 44, 0.66); font-size: 0.95rem; font-weight: 700; line-height: 1.45; }
.pd-how-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 0.9rem; }
.pd-how-step { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; text-align: center; }
.pd-how-art {
  width: 142px; height: 132px; flex: none; overflow: hidden;
}
.pd-how-art img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.pd-how-share img { object-position: 0% 50%; }
.pd-how-approve img { object-position: 50% 50%; }
.pd-how-live img { object-position: 100% 50%; }
.pd-how-step h3 { margin: 0 0 0.2rem; font-size: 1.02rem; font-weight: 800; color: #20242C; }
.pd-how-step p { margin: 0; max-width: 15rem; font-size: 0.84rem; line-height: 1.45; color: rgba(32, 36, 44, 0.62); }
.pd-settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.7fr); gap: 1.1rem; align-items: start; }
.pd-fields { display: grid; gap: 1rem; }
.pd-label { display: block; margin-bottom: 0.4rem; font-weight: 800; color: #20242C; }
.pd-textarea, .pd-select {
  width: 100%; box-sizing: border-box;
  border: 1px solid #D9D0C5; border-radius: 12px; background: #FFFFFF; color: #20242C;
  padding: 0.7rem 0.85rem; min-height: 48px; font: inherit;
}
.pd-textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
.pd-help { margin: 0.35rem 0 0; font-size: 0.78rem; color: rgba(32, 36, 44, 0.58); }
.pd-note {
  display: flex; align-items: flex-start; gap: 0.6rem;
  background: #F4F1EE; border-radius: 14px; padding: 0.95rem 1rem;
  color: rgba(32, 36, 44, 0.66); line-height: 1.45; font-size: 0.86rem; height: fit-content;
}
.pd-note strong { display: block; color: #20242C; margin-bottom: 0.15rem; }
.pd-note > div span { display: block; }
.pd-note .pd-note-mark {
  width: 22px; height: 22px; border-radius: 999px; flex: none;
  display: grid; place-items: center; background: #E7F5EF; color: #247858;
  padding: 0; margin: 0; line-height: 1;
  font-weight: 900; font-size: 0.8rem;
}
@media (max-width: 860px) {
  .pd-how-grid { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .pd-settings-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Photo-specific title chrome and ended event summary */
.db-photo-title-help { margin: 0.45rem 0 0; font-size: 0.82rem; line-height: 1.45; color: rgba(32, 36, 44, 0.6); }
.db-photo-title-count { margin: 0.2rem 0 0; font-size: 14px; color: rgba(32, 36, 44, 0.52); }
.pd-ended-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center;
  background: #FFF7F2; border: 1px solid #EAD9CF; border-radius: 17px;
  padding: 1rem 1.2rem; margin: 0.2rem 0 1.1rem;
}
.pd-ended-label { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.2rem;
  color: #B94E31; font-size: 0.78rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.pd-ended-head h3 { margin: 0 0 0.15rem; font-size: 1.1rem; font-weight: 850; color: #20242C; }
.pd-ended-head p { margin: 0; color: rgba(32, 36, 44, 0.62); font-size: 0.9rem; }
.pd-ended-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
@media (max-width: 600px) {
  .pd-ended-head { grid-template-columns: minmax(0, 1fr); }
  .pd-ended-actions { justify-content: flex-start; }
}

/* =====================================================================
   Live bar (Home, Discover Activities, Saved Activities) + live card badge
   ===================================================================== */
.db-live-bar {
  --db-live-coral: #E67455;
  --db-live-coral-edge: #D16445;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.9rem; align-items: center;
  background: #FFD43B; color: #20242C;
  border-radius: 16px; padding: 0.9rem 1rem;
  box-shadow: 0 8px 18px rgba(32, 36, 44, 0.16);
}
.db-live-flag { display: inline-flex; align-items: center; gap: 0.45rem; align-self: center; font-size: 13px; line-height: 16px; font-weight: 900; letter-spacing: 0.08em; }
.db-live-dot { width: 9px; height: 9px; border-radius: 999px; background: #FFFFFF; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18); }
.db-live-bar .db-live-dot { background: #FF2D2D; box-shadow: 0 0 0 4px rgba(255, 45, 45, 0.18); }
.db-live-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.db-live-activity {
  font-family: var(--font-body); font-weight: 800;
  font-size: 24px; line-height: 28px;
  color: #20242C;
}
.db-live-title {
  margin-top: 0.1rem; font-weight: 800; color: #20242C;
  font-size: 19px; line-height: 23px;
  white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere;
}
.db-live-meta { margin-top: 0.2rem; font-size: 15px; line-height: 20px; }
.db-live-actions { display: flex; align-items: center; gap: 0.45rem; }
.db-live-actions .btn { min-height: 40px; border-radius: 11px; padding: 0.45rem 0.75rem; font-size: 0.86rem; }
#db-live-slot .db-live-actions .db-photo-moderate,
#pd-live-slot .db-live-actions .db-photo-moderate,
#db-live-slot .db-live-actions .db-photo-project,
#pd-live-slot .db-live-actions .db-photo-project { width: 95px; height: 40px; flex: 0 0 95px; }
.db-live-actions .btn.primary { background: var(--db-live-coral); color: #FFFFFF; border-color: var(--db-live-coral); box-shadow: 0 3px 0 var(--db-live-coral-edge); }
.db-live-actions .btn.primary:active { box-shadow: 0 1px 0 var(--db-live-coral-edge); }
#db-live-slot .db-live-actions .db-photo-moderate,
#pd-live-slot .db-live-actions .db-photo-moderate,
#db-live-slot .db-live-actions .db-photo-moderate:active,
#pd-live-slot .db-live-actions .db-photo-moderate:active { box-shadow: none; }
.db-live-actions .btn.ghost { background: #FFFFFF; color: var(--db-live-coral); border: 1px solid var(--db-live-coral); }
#db-live-slot .db-live-actions .btn.ghost,
#pd-live-slot .db-live-actions .btn.ghost { background: #FFFFFF; color: var(--db-live-coral); border: 1px solid var(--db-live-coral); }
.photo-project-btn {
  background: #FFF7ED !important; color: #E67455 !important;
  border: 1.5px solid #E67455 !important; box-shadow: none !important;
}
#db-live-slot .db-live-actions a.db-photo-project,
#pd-live-slot .db-live-actions a.db-photo-project,
#db-view .db-card-actions a.db-photo-project { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#db-live-slot .db-live-actions a.db-photo-project:focus-visible,
#pd-live-slot .db-live-actions a.db-photo-project:focus-visible,
#db-live-slot .db-live-actions .db-photo-project-retry:focus-visible,
#pd-live-slot .db-live-actions .db-photo-project-retry:focus-visible,
.photo-project-btn:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
.db-live-actions .db-more { width: 40px; height: 40px; border-radius: 11px; background: #FFFFFF; color: #20242C; border: 1px solid var(--color-border-strong); }
.db-live-actions .db-more:hover { border-color: #C9BFB2; }
.db-live-actions .db-more:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
.db-live-bar .db-more-menu {
  position: fixed; z-index: 96; min-width: 10.5rem;
  background: #FFFFFF; border: 1px solid #E9E2DA; border-radius: 10px;
  box-shadow: 0 10px 26px rgba(32, 36, 44, 0.14); padding: 0.3rem;
  display: flex; flex-direction: column;
}
.db-live-bar .db-more-menu button {
  text-align: left; background: transparent; border: none; border-radius: 7px;
  padding: 0.55rem 0.65rem; font: inherit; font-size: 0.9rem; font-weight: 600;
  color: #20242C; cursor: pointer; min-height: 40px;
}
.db-live-bar .db-more-menu button:hover { background: #FFF4EA; }
.db-live-bar .db-more-menu button.db-photo-end { color: #20242C; }
@media (max-width: 900px) {
  .db-live-activity { font-size: 22px; line-height: 26px; }
  .db-live-title { font-size: 18px; line-height: 22px; }
  .db-live-meta { font-size: 14px; line-height: 19px; }
  .db-live-flag { font-size: 13px; line-height: 16px; }
}
@media (max-width: 820px) {
  .db-live-bar { grid-template-columns: auto minmax(0, 1fr); }
  .db-live-actions { grid-column: 1 / -1; flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .db-live-activity { font-size: 20px; line-height: 24px; }
  .db-live-title { font-size: 16px; line-height: 20px; }
  .db-live-meta { font-size: 14px; line-height: 19px; }
  .db-live-flag { font-size: 12px; line-height: 16px; }
}
.db-card-live {
  position: absolute; right: 0.7rem; top: 0.7rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: #FFD43B; color: #20242C; border-radius: 999px;
  padding: 0.22rem 0.5rem; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.06em;
}
.db-card-live .db-live-dot { width: 7px; height: 7px; background: #FF2D2D; box-shadow: none; }
.db-card-live-title { font-weight: 850; }
.db-live-card-actions .btn.primary { background: #C9482C; border-color: #C9482C; color: #FFFFFF; }

/* =====================================================================
   Moderation page shell extras
   ===================================================================== */
.pd-page { display: flex; flex-direction: column; gap: 0.9rem; width: 100%; padding-bottom: 96px; }
@media (max-width: 900px) {
  .pd-page { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}
.pd-back { align-self: flex-start; background: none; border: 0; padding: 0; color: #B94E31; font-weight: 800; font-size: 0.9rem; cursor: pointer; }
.pd-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.pd-page-title { margin: 0; font-family: var(--font-body); font-size: 1.85rem; line-height: 1.15; font-weight: 850; color: #20242C; letter-spacing: -0.02em; }
.pd-live-event-title { margin: 0; font-family: var(--font-body); font-weight: 800; font-size: clamp(1.25rem, 1.7vw, 1.45rem); line-height: 1.15; color: #20242C; overflow-wrap: anywhere; }
.pd-title-line { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; min-width: 0; min-height: 44px; margin-top: 0.1rem; }
.pd-title-display { cursor: pointer; }
.pd-title-line:hover .pd-title-display, .pd-title-line:focus-within .pd-title-display { text-decoration: underline; text-decoration-color: #E67455; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.pd-title-edit-trigger { width: 44px; height: 44px; flex: 0 0 44px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 9px; background: transparent; color: rgba(32, 36, 44, 0.42); cursor: pointer; }
.pd-title-edit-trigger:hover, .pd-title-edit-trigger:focus-visible { color: #E67455; }
.pd-title-edit-trigger:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
.pd-title-inline-input { flex: 1 1 0; min-width: 0; max-width: 100%; margin: 0; padding: 0 0.1rem; border: 0; border-bottom: 2px solid #E67455; border-radius: 0; background: rgba(255, 255, 255, 0.7); color: #20242C; }
.pd-title-inline-input:focus { outline: 3px solid #21C4F3; outline-offset: 2px; }
.pd-title-inline-action { width: 44px; height: 44px; flex: 0 0 44px; display: inline-grid; place-items: center; padding: 0; border: 1px solid #E9E2DA; border-radius: 9px; background: #FFFFFF; color: #20242C; font-size: 1.15rem; font-weight: 900; line-height: 1; cursor: pointer; }
.pd-title-inline-action:hover { border-color: #E67455; color: #E67455; }
.pd-title-inline-action:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
.pd-title-helper { max-width: 64ch; margin-top: 0.3rem; }
.pd-title-edit-help { margin: 0; color: rgba(32, 36, 44, 0.65); font-size: 0.8rem; line-height: 1.4; }
#pd-title-error:empty { display: none; }
.pd-page-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin: 0.35rem 0 0; color: rgba(32, 36, 44, 0.65); font-size: 0.9rem; }
.pd-live-pill { display: inline-flex; align-items: center; gap: 0.3rem; background: #FBE9E7; color: #B93F35; border-radius: 999px; padding: 0.22rem 0.5rem; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.07em; }
.pd-live-pill .db-live-dot { width: 6px; height: 6px; background: #EF6B52; box-shadow: none; }
.pd-page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.pd-page-actions #pd-end,
.pd-page-actions .pd-project-link,
.pd-page-actions .photo-project-btn { width: 107px; height: 44px; flex: 0 0 107px; }
.pd-project-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.pd-project-link:focus-visible, .pd-project-retry:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
.pd-status-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.pd-pill { display: inline-flex; align-items: center; gap: 0.3rem; background: #F4F1EE; color: rgba(32, 36, 44, 0.68); border-radius: 999px; padding: 0.28rem 0.55rem; font-size: 0.74rem; font-weight: 800; }
.pd-pill.good { background: #E7F5EF; color: #247858; }
.pd-pill.warn { background: #FFF8DA; color: #7A5B00; }

/* Buttons used on the photo surfaces */
.pd-btn { min-height: 44px; border-radius: 10px; padding: 0.55rem 0.9rem; font: inherit; font-weight: 850; cursor: pointer; border: 1px solid #E9E2DA; background: #FFFFFF; color: #20242C; }
.pd-btn:hover { border-color: #C9BFB2; }
.pd-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pd-btn-primary { background: #EF6B52; border-color: #EF6B52; color: #FFFFFF; }
.pd-btn-primary:hover { background: #D95840; border-color: #D95840; }
.pd-btn-approve { background: #EF6B52; border-color: #EF6B52; color: #FFFFFF; }
.pd-btn-reject { background: #FFFFFF; border-color: #E6A9A2; color: #B93F35; }
.pd-btn-remove { background: #FFFFFF; border-color: #E6A9A2; color: #B93F35; }
.pd-btn-restore { background: #EF6B52; border-color: #EF6B52; color: #FFFFFF; }
.pd-btn-danger { background: #B93F35; border-color: #B93F35; color: #FFFFFF; }
.pd-btn-quiet { background: #FFFFFF; border-color: #E9E2DA; color: #20242C; }

/* =====================================================================
   Tabs, toolbar, cards
   ===================================================================== */
.pd-tabs { display: flex; gap: 0.55rem; flex-wrap: wrap; border-bottom: 1px solid #E9E2DA; padding-bottom: 0.55rem; }
.pd-tab { min-height: 44px; background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(32, 36, 44, 0.6); font: inherit; font-weight: 850; padding: 0.45rem 0.2rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.pd-tab[aria-selected="true"] { color: #B94E31; border-color: #EF6B52; }
.pd-count { display: inline-flex; min-width: 1.3rem; justify-content: center; border-radius: 999px; background: #F4F1EE; color: rgba(32, 36, 44, 0.65); padding: 0.06rem 0.35rem; font-size: 0.72rem; font-weight: 850; }
.pd-tab[aria-selected="true"] .pd-count { background: #FBE9DF; color: #B94E31; }
.pd-album-tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid #E9E2DA; padding-bottom: 0.55rem; }
.pd-state-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.pd-toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.8rem;
  background: #FFFFFF; border: 1px solid #E9E2DA; border-radius: 12px; padding: 0.6rem 0.75rem;
}
.pd-select-all { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 800; color: #20242C; cursor: pointer; min-height: 40px; }
.pd-selected { color: #B94E31; font-weight: 850; font-size: 0.8rem; white-space: nowrap; }
.pd-bulk-actions { display: grid; grid-template-columns: repeat(2, minmax(140px, 180px)); gap: 0.45rem; }
.pd-bulk-actions .pd-btn { min-height: 40px; }
.pd-toolbar-note { color: rgba(32, 36, 44, 0.6); font-size: 0.8rem; font-weight: 700; }
@media (max-width: 900px) {
  .pd-toolbar { grid-template-columns: minmax(0, 1fr); }
  .pd-bulk-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pd-toolbar { position: sticky; bottom: 0; z-index: 25; box-shadow: 0 -8px 20px rgba(32, 36, 44, 0.08); border-radius: 14px 14px 0 0; padding-bottom: calc(0.6rem + env(safe-area-inset-bottom)); }
}

.pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.pd-ded {
  position: relative; display: grid; grid-template-columns: 45% 55%;
  min-width: 0; min-height: 190px; background: #FFFFFF;
  border: 1px solid #E9E2DA; border-radius: 13px; overflow: hidden;
  box-shadow: 0 3px 10px rgba(32, 36, 44, 0.04);
}
.pd-ded.is-selected { border: 3px solid #EF6B52; }
.pd-ded.is-busy { opacity: 0.75; }
.pd-ded[data-state="pending"] { cursor: pointer; }
.pd-media { display: grid; gap: 4px; background: #F1E6DC; min-width: 0; min-height: 0; }
.pd-media[data-count="1"] { grid-template-columns: 1fr; }
.pd-media[data-count="2"] { grid-template-columns: 1fr 1fr; }
.pd-media[data-count="3"] { grid-template-columns: 1.15fr 0.85fr; grid-template-rows: 1fr 1fr; }
.pd-media[data-count="3"] .pd-photo:first-child { grid-row: 1 / 3; }
.pd-photo {
  position: relative; margin: 0; display: flex; align-items: center; justify-content: center;
  aspect-ratio: var(--ar, 4 / 3);
  overflow: hidden; background: #EEE3DA; min-width: 0; min-height: 0;
}
.pd-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pd-photo-loading, .pd-photo-broken {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center;
  font-size: 0.72rem; font-weight: 750; color: rgba(32, 36, 44, 0.55); padding: 0.4rem;
  background: #F1E6DC;
}
.pd-photo img.is-loading + .pd-photo-loading { display: grid; }
.pd-photo.is-failed .pd-photo-broken { display: grid; z-index: 2; }
.pd-photo.is-failed img { visibility: hidden; }
.pd-select-mark { position: absolute; top: 9px; left: 9px; z-index: 3; }
.pd-check-wrap { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.pd-check {
  position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; cursor: pointer;
}
.pd-check-box {
  width: 24px; height: 24px; border-radius: 6px; border: 2px solid #AEB7C4; background: #FFFFFF;
  display: inline-grid; place-items: center; color: transparent; font-weight: 900; font-size: 0.8rem;
}
.pd-check:checked + .pd-check-box { background: #EF6B52; border-color: #EF6B52; color: #FFFFFF; }
.pd-check:focus-visible + .pd-check-box { outline: 3px solid #21C4F3; outline-offset: 2px; }
.pd-copy { display: flex; flex-direction: column; padding: 0.85rem 0.85rem 0.75rem; min-width: 0; }
.pd-msg { margin: 0; font-size: 1.02rem; line-height: 1.35; font-weight: 750; color: #20242C; overflow-wrap: anywhere; }
.pd-sender { margin-top: 0.4rem; color: rgba(32, 36, 44, 0.62); font-size: 0.8rem; font-weight: 700; overflow-wrap: anywhere; }
.pd-time { margin-left: 0.35rem; font-weight: 600; }
.pd-status { display: inline-flex; align-self: flex-start; margin-top: 0.55rem; border-radius: 999px; padding: 0.22rem 0.45rem; font-size: 0.62rem; font-weight: 900; letter-spacing: 0.05em; }
.pd-status-approved { background: #E7F5EF; color: #247858; }
.pd-status-rejected { background: #FBE9E7; color: #B93F35; }
.pd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: auto; padding-top: 0.7rem; }
.pd-actions.single { display: flex; justify-content: flex-end; }
.pd-actions .pd-btn { min-height: 38px; font-size: 0.8rem; padding: 0.35rem 0.55rem; }
.pd-actions .pd-reject { order: 1; }
.pd-actions .pd-approve { order: 2; }

.pd-empty { grid-column: 1 / -1; background: #FFFFFF; border: 1px dashed #CFD6DF; border-radius: 13px; padding: 2rem 1rem; text-align: center; }
.pd-empty strong { display: block; font-size: 1.05rem; color: #20242C; }
.pd-empty span { display: block; margin-top: 0.3rem; color: rgba(32, 36, 44, 0.6); font-size: 0.84rem; }

@media (max-width: 1000px) { .pd-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .pd-ded { grid-template-columns: minmax(0, 1fr); }
  .pd-media { min-height: 205px; max-height: 260px; }
  .pd-media[data-count="1"] { min-height: 165px; }
  .pd-media[data-count="2"] { min-height: 140px; }
  .pd-msg { font-size: 0.95rem; }
  .pd-actions .pd-btn { min-height: 44px; }
  .pd-bulk-actions .pd-btn, .pd-toolbar .pd-btn { min-height: 44px; }
  .pd-settings-row .pd-btn, .pd-settings-row select { min-height: 44px; }
}

/* The live settings row (slideshow speed / end event) */
.pd-settings-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; background: #FFFFFF; border: 1px solid #E9E2DA; border-radius: 12px; padding: 0.7rem 0.85rem; }
.pd-settings-row label { font-weight: 800; font-size: 0.84rem; color: #20242C; }
.pd-settings-row select { min-height: 40px; border-radius: 9px; border: 1px solid #D9D0C5; background: #FFFFFF; padding: 0.35rem 0.5rem; font: inherit; }
.pd-settings-row .pd-inline { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }

/* =====================================================================
   Album
   ===================================================================== */
.pd-album-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.pd-album-meta { margin: 0.35rem 0 0; color: rgba(32, 36, 44, 0.62); font-size: 0.9rem; }
.pd-photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; }
.pd-tile { position: relative; border: 0; padding: 0; margin: 0; background: #F1E6DC; border-radius: 12px; overflow: hidden; cursor: pointer; aspect-ratio: 16 / 10; }
.pd-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-tile-badge { position: absolute; right: 6px; bottom: 6px; background: rgba(32, 36, 44, 0.72); color: #FFFFFF; border-radius: 999px; padding: 0.15rem 0.42rem; font-size: 0.64rem; font-weight: 800; }
.pd-tile:focus-visible { outline: 3px solid #21C4F3; outline-offset: 2px; }
@media (max-width: 900px) { .pd-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pd-viewer { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 1.2rem; background: rgba(16, 25, 39, 0.62); }
.pd-viewer-card {
  position: relative; width: min(1180px, 94vw); height: min(760px, 88vh); max-height: 88vh; overflow: hidden;
  display: grid; grid-template-columns: 61% 39%; background: #FFFFFF; border-radius: 18px;
  box-shadow: 0 24px 70px rgba(8, 17, 31, 0.34);
}
.pd-viewer-photos { display: grid; gap: 5px; background: #EFE5DC; min-height: 0; overflow: hidden; }
.pd-viewer-photos[data-count="1"] { grid-template-columns: 1fr; }
.pd-viewer-photos[data-count="2"] { grid-template-columns: 1fr 1fr; }
.pd-viewer-photos[data-count="3"] { grid-template-columns: 1.2fr 0.8fr; grid-template-rows: 1fr 1fr; }
.pd-viewer-photos[data-count="3"] .pd-photo:first-child { grid-row: 1 / 3; }
.pd-viewer-photos .pd-photo { min-height: 0; }
.pd-viewer.is-preparing .pd-viewer-card { visibility: hidden; }
.pd-viewer-card.is-single { grid-template-columns: var(--pd-photo-pct, 61%) minmax(0, 1fr); }
.pd-viewer-card.is-single .pd-viewer-photos .pd-photo { width: 100%; height: 100%; aspect-ratio: auto; }
.pd-viewer-msg {
  position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  row-gap: 0; align-content: stretch; padding: 1.4rem 9% 1.3rem;
  background: linear-gradient(145deg, #FFFAF5, #FFF0E6); min-width: 0; min-height: 0; overflow: hidden;
}
.pd-viewer-event { position: static; margin: 0; padding-bottom: 0.8rem; font-size: 0.78rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; color: #B94E31; overflow-wrap: anywhere; }
.pd-viewer-quote {
  margin: 0; align-self: center; justify-self: stretch; max-height: 100%; min-height: 0; overflow: hidden;
  padding-bottom: 3px;
  font-family: var(--font-body); font-size: 1.55rem; line-height: 1.18; font-weight: 700; color: #20242C; overflow-wrap: anywhere;
}
.pd-viewer-footer { display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; padding-top: 0.9rem; }
.pd-viewer-sender { min-width: 0; color: #B94E31; }
.pd-viewer-from { display: block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: rgba(185, 78, 49, 0.78); }
.pd-viewer-name { display: block; font-size: 1rem; line-height: 1.15; font-weight: 850; overflow-wrap: anywhere; }
.pd-viewer-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 0; color: rgba(32, 36, 44, 0.6); font-size: 0.78rem; font-weight: 700; }
.pd-viewer-foot img { width: 58px; height: auto; aspect-ratio: 1099 / 815; display: block; flex: 0 0 auto; margin-left: auto; }
.pd-viewer-close { position: absolute; top: 0.6rem; right: 0.6rem; z-index: 4; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #E9E2DA; background: #FFFFFF; color: #20242C; font-size: 1.25rem; font-weight: 900; cursor: pointer; }
.pd-viewer-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.75); background: rgba(255,255,255,0.94); color: #20242C; font-size: 1.5rem; font-weight: 900; cursor: pointer; }
.pd-viewer-prev { left: max(0.6rem, calc(50vw - 47vw - 1.6rem)); }
.pd-viewer-next { right: max(0.6rem, calc(50vw - 47vw - 1.6rem)); }
.pd-viewer-count { position: absolute; bottom: 1.1rem; left: 50%; transform: translateX(-50%); color: #FFFFFF; background: #20242C; border-radius: 999px; padding: 0.28rem 0.65rem; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); font-weight: 800; font-size: 0.85rem; }
@media (max-width: 820px) {
  .pd-viewer { padding: 0; }
  .pd-viewer-card { width: 100vw; max-height: none; height: 100dvh; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 42dvh) minmax(0, 1fr); border-radius: 0; overflow: hidden; }
  .pd-viewer-card.is-single { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--pd-photo-h, 42dvh) minmax(0, 1fr); }
  .pd-viewer-photos { min-height: 0; max-height: none; }
  .pd-viewer-msg { padding: 1rem 1.15rem 3.8rem; }
  .pd-viewer-event { padding-bottom: 0.4rem; font-size: 0.72rem; }
  .pd-viewer-quote { font-size: 1.35rem; }
  .pd-viewer-footer { padding-top: 0.6rem; }
  .pd-viewer-close { top: 0.5rem; right: 0.5rem; }
  .pd-viewer-arrow { top: auto; bottom: 0.7rem; transform: none; }
  .pd-viewer-prev { left: 0.7rem; }
  .pd-viewer-next { right: 0.7rem; }
  .pd-viewer-count { bottom: 1.1rem; }
}

/* =====================================================================
   Confirm dialog (in application; never window.confirm)
   ===================================================================== */
.pd-dialog { position: fixed; inset: 0; z-index: 130; display: grid; place-items: center; padding: 1.2rem; background: rgba(16, 25, 39, 0.5); }
.pd-dialog-box { width: min(460px, 100%); background: #FFFFFF; border-radius: 16px; padding: 1.35rem; box-shadow: 0 20px 55px rgba(16, 35, 63, 0.25); }
.pd-dialog-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 0.75rem; background: #FBE9DF; color: #B94E31; font-size: 1.15rem; font-weight: 900; }
.pd-dialog-box.danger .pd-dialog-icon { background: #FBE9E7; color: #B93F35; }
.pd-dialog-box h2 { margin: 0; font-size: 1.3rem; line-height: 1.2; color: #20242C; }
.pd-dialog-body { margin: 0.55rem 0 0; color: rgba(32, 36, 44, 0.66); line-height: 1.5; font-size: 0.9rem; }
.pd-dialog-detail { margin-top: 0.7rem; background: #F4F1EE; border-radius: 9px; padding: 0.55rem 0.65rem; font-size: 0.78rem; font-weight: 700; color: #20242C; }
.pd-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1.1rem; }
.pd-dialog-actions.three { grid-template-columns: 0.9fr 1.1fr 1.15fr; }
.pd-dialog-actions .pd-btn { min-height: 44px; font-size: 0.85rem; padding-inline: 0.5rem; }
@media (max-width: 560px) {
  .pd-dialog-actions.three { grid-template-columns: 1fr; }
  .pd-dialog-actions.three .pd-cancel { order: 3; }
}

/* =====================================================================
   Download modal and phone sheet
   ===================================================================== */
.pd-download { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 1.2rem; background: rgba(16, 25, 39, 0.55); }
.pd-download-box { width: min(520px, 100%); background: #FFFFFF; border-radius: 16px; padding: 1.4rem; box-shadow: 0 18px 54px rgba(16, 35, 63, 0.25); }
.pd-download-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #FBE9DF; color: #B94E31; font-weight: 900; margin-bottom: 0.7rem; }
.pd-download-box h2 { margin: 0; font-size: 1.35rem; color: #20242C; }
.pd-download-copy { margin: 0.55rem 0 0; color: rgba(32, 36, 44, 0.65); line-height: 1.5; font-size: 0.9rem; }
.pd-progress-copy { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.9rem; font-size: 0.82rem; font-weight: 750; color: #20242C; }
.pd-track { height: 8px; background: #EDF0F3; border-radius: 999px; overflow: hidden; margin-top: 0.35rem; }
.pd-bar { height: 100%; width: 0; background: #EF6B52; border-radius: 999px; transition: width 0.25s ease; }
.pd-folders { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: 0.9rem; }
.pd-folder { background: #F4F1EE; border-radius: 9px; padding: 0.55rem 0.6rem; font-size: 0.78rem; font-weight: 750; color: #20242C; }
.pd-folder small { display: block; color: rgba(32, 36, 44, 0.6); font-weight: 600; margin-top: 0.15rem; }
.pd-download-actions { display: grid; gap: 0.45rem; margin-top: 1rem; }
.pd-download-actions .pd-btn { width: 100%; }
.pd-download-summary { margin-top: 0.9rem; background: #F4F1EE; border-radius: 9px; padding: 0.6rem 0.7rem; font-size: 0.78rem; font-weight: 700; color: #20242C; overflow-wrap: anywhere; }
.pd-download.done .pd-download-icon { background: #E7F5EF; color: #247858; }
.pd-download.partial .pd-download-icon { background: #FFF8DA; color: #7A5B00; }
.pd-download.failed .pd-download-icon { background: #FBE9E7; color: #B93F35; }

/* Split package: one row per on-demand part. Reuses the download panel
   styling above; only the part rows and their states are new. */
.pd-parts { display: grid; gap: 0.55rem; margin-top: 0.95rem; max-height: min(52vh, 480px); overflow-y: auto; padding-right: 0.15rem; }
.pd-part { border: 1px solid #E9E2DA; border-radius: 12px; padding: 0.7rem 0.75rem; background: #FFFFFF; }
.pd-part-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.pd-part-head strong { font-size: 0.9rem; color: #20242C; }
.pd-part-state { font-size: 0.7rem; font-weight: 850; letter-spacing: 0.04em; color: rgba(32, 36, 44, 0.55); }
.pd-part[data-state="preparing"] .pd-part-state { color: #B94E31; }
.pd-part[data-state="done"] .pd-part-state { color: #247858; }
.pd-part[data-state="failed"] .pd-part-state { color: #B93F35; }
.pd-part-meta { margin-top: 0.2rem; color: rgba(32, 36, 44, 0.62); font-size: 0.78rem; font-weight: 650; }
.pd-part-progress { margin-top: 0.55rem; }
.pd-part-error { margin-top: 0.45rem; color: #B93F35; font-size: 0.78rem; font-weight: 700; }
.pd-part-download { width: 100%; margin-top: 0.6rem; min-height: 44px; font-size: 0.85rem; }
@media (max-width: 560px) {
  .pd-download { align-items: end; padding: 0; }
  .pd-download-box { border-radius: 20px 20px 0 0; padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .pd-folders { grid-template-columns: 1fr; }
}

/* Login / empty states inside the photo page */
.pd-center { background: #FFFFFF; border: 1px solid #E9E2DA; border-radius: 14px; padding: 2rem 1.2rem; text-align: center; }
.pd-center h1 { margin: 0 0 0.4rem; font-size: 1.5rem; color: #20242C; }
.pd-center p { margin: 0 0 1rem; color: rgba(32, 36, 44, 0.65); }
.pd-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
