/* shared.css — shared UI components across dashboard and board gallery */

/* @import MUST come before any other CSS rule per spec — otherwise the
   browser silently ignores it. Wall text fonts (curated set; must match
   FONT_REGISTRY in wall_text_utils.py and WALL_TEXT_FONTS in
   static/gallery.js). */
@import url("https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;700&family=Homemade+Apple&family=Permanent+Marker&family=Special+Elite&family=Space+Grotesk:wght@500;700;900&family=Playfair+Display:ital,wght@0,500;0,700;0,900;1,500;1,700;1,900&display=swap");

/* --- Modal backdrop (bottom sheet pattern) --- */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: flex-end;
  justify-content: center;
}

/* Centered modal card (used by the wall color picker, account modal, etc.) */
.account-modal-inner {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  position: relative;
}
@media (max-width: 600px) {
  .account-modal-inner {
    width: 95%;
    margin: 10px;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
  }
}
.upload-sheet {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.upload-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.upload-sheet-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.upload-sheet-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 8px 12px;
  margin: -8px -12px;
  z-index: 10;
  position: relative;
}
.upload-sheet-close:hover {
  color: #111;
}

/* --- Upload modal inner components --- */
.paste-area {
  width: 100%;
  min-height: 80px;
  padding: 15px;
  border: 2px dashed #007bff;
  border-radius: 8px;
  background: #f8f9fa;
  margin-bottom: 12px;
  font-size: 16px;
  resize: none;
  font-family: inherit;
  color: #999;
}
.paste-area:focus {
  outline: none;
  border-color: #0056b3;
  background: white;
  color: #333;
}
.divider {
  text-align: center;
  margin: 12px 0;
  color: #ccc;
  font-size: 13px;
}
.file-input {
  display: none;
}
.preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.preview-item {
  position: relative;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 4px;
  background: white;
  max-width: 100px;
}
.preview-item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  cursor: pointer;
}
.preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.preview-remove:hover {
  background: #c53030;
}
.submit-btn {
  width: 100%;
  padding: 14px;
  background: #111;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: none;
}
.submit-btn:hover {
  background: #333;
}
.submit-btn:disabled {
  background: #e5e5e5;
  color: #888;
  cursor: not-allowed;
}

/* --- Drop area (file upload target) --- */
.drop-area {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.drop-area:hover,
.drop-area.drag-over {
  border-color: #111;
}
.drop-area h3 {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #111;
}
.drop-area p {
  color: #999;
  font-size: 13px;
}

/* --- Add dropdown (Image / Song picker) --- */
.add-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  min-width: 140px;
  z-index: 1001;
}
.add-dropdown.open {
  display: block;
}
.add-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.add-dropdown-item:hover {
  background: #f5f5f5;
}
.add-dropdown-item:first-child {
  border-radius: 10px 10px 0 0;
}
.add-dropdown-item:last-child {
  border-radius: 0 0 10px 10px;
}

/* --- Gallery container --- */
#galleryContainer {
  position: relative;
  min-height: calc(100vh - 52px);
}
#galleryContainer img {
  transition: transform 0.15s ease;
  border-radius: 2px;
}
#galleryContainer img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* --- Gallery edit mode (delete/edit buttons) --- */
.gallery-delete-btn {
  position: absolute;
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 16px;
  line-height: 26px;
  text-align: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
}
.gallery-delete-btn:hover {
  transform: scale(1.15);
}
.gallery-edit-btn {
  position: absolute;
  background: #111;
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 13px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
}
.gallery-edit-btn:hover {
  transform: scale(1.15);
}
.gallery-size-btn {
  position: absolute;
  background: #111;
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
  font-family: inherit;
}
.gallery-size-btn:hover {
  transform: scale(1.15);
}
.size-popover {
  position: absolute;
  z-index: 20;
  background: #111;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.size-popover button {
  background: transparent;
  color: #999;
  border: none;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s;
}
.size-popover button:hover {
  background: #333;
  color: #fff;
}
.size-popover button.active {
  background: #fff;
  color: #111;
}
body.edit-mode #galleryContainer img {
  opacity: 0.8;
}

/* --- Image preview overlay --- */
.image-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}
.image-overlay.active {
  display: flex;
}
.image-overlay-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0));
  right: 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 32px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  z-index: 1;
}
.image-overlay-close:hover {
  color: #fff;
}
.image-overlay-img {
  max-width: min(90vw, 800px);
  max-height: 65vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}
/* Decorated preview wrapper — replaces the plain <img> when an image
 * has a decoration (gallery.js showImageOverlay). Sized inline by the
 * Decorations.wrap call, just needs the same centering + flex-safe
 * positioning as .image-overlay-img. */
.image-overlay-deco-preview {
  display: block;
  margin: 0 auto;
  max-width: min(90vw, 800px);
  max-height: 72vh;
  user-select: none;
  -webkit-user-select: none;
}
/* Wall-text lightbox content — mounted by gallery.js showTextOverlay.
   Dynamic font/color/style/weight props come in inline (so we don't have
   to mirror the FONT_REGISTRY in CSS); this block handles layout +
   readability invariants. Font size scales with viewport so very long
   texts shrink instead of overflowing. */
.text-overlay-content {
  max-width: min(90vw, 720px);
  max-height: 70vh;
  overflow: auto;
  text-align: center;
  font-size: clamp(24px, 5.5vw, 56px);
  padding: 24px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  user-select: text;
  -webkit-user-select: text;
}
.image-overlay-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.image-overlay-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90vw;
  margin-bottom: 4px;
}
.image-overlay-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}
/* Inline tag editor — injected where the action bar sits so the image
 * stays in view. Looks like a small white card pinned below the image. */
.image-overlay-tag-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(90vw, 480px);
  margin-top: 4px;
}
.image-overlay-tag-editor-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.image-overlay-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s;
}
.image-overlay-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.image-overlay-btn--primary {
  background: #fff;
  color: #111;
}
.image-overlay-btn--primary:hover {
  background: #e0e0e0;
}
.image-overlay-btn--danger {
  background: #e53e3e;
  color: #fff;
}
.image-overlay-btn--danger:hover {
  background: #c53030;
}
.image-overlay-sizes {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 4px;
}
.image-overlay-sizes button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.15s;
}
.image-overlay-sizes button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}
.image-overlay-sizes button.active {
  background: #fff;
  color: #111;
}
.image-overlay-username {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 500;
  margin-top: -12px;
}

/* --- Flippable image (back-of-photo note) ---
 * Wraps either .image-overlay-img or .image-overlay-deco-preview when the
 * image has a back_text or the viewer is the owner. Tapping the image
 * rotates the wrapper via rotateY(180deg) revealing the note on the back. */
.image-overlay-flip {
  perspective: 1600px;
  display: block;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.image-overlay-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.image-overlay-flip.flipped .image-overlay-flip-inner {
  transform: rotateY(180deg);
}
.image-overlay-flip-front,
.image-overlay-flip-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.image-overlay-flip-front {
  /* Normal flow — its child (img or decoration preview) drives the
   * wrapper's size. The back face inherits that size via inset: 0.
   * The explicit rotateY(0) lifts the face into the 3D context so
   * backface-visibility actually hides its <img> child when flipped. */
  position: relative;
  transform: rotateY(0deg);
  -webkit-transform: rotateY(0deg);
}
.image-overlay-flip-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
  background: #f4ebd6;
  color: #2a2a2a;
  border-radius: 8px;
  padding: 28px 24px;
  font-family: "Patrick Hand", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: 22px;
  line-height: 1.5;
  text-align: center;
  overflow: auto;
  user-select: text;
  -webkit-user-select: text;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-overlay-flip-back-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  max-width: 100%;
}
.image-overlay-flip-back-text--placeholder {
  color: #8a8478;
  font-style: italic;
}
.image-overlay-flip-back textarea {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  text-align: center;
  resize: none;
  outline: none;
  padding: 0;
}
/* Floating save tick on the editable back card. Sits in the bottom-right
 * corner over the textarea while editing. Disappears on save (the back
 * re-renders to a static text view). */
.image-overlay-flip-back-save {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #2a2a2a;
  color: #f4ebd6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition:
    background 0.15s,
    transform 0.1s;
  z-index: 3;
}
.image-overlay-flip-back-save:hover {
  background: #111;
}
.image-overlay-flip-back-save:active {
  transform: scale(0.94);
}
/* Subtle hint sitting under the image when a flippable back exists. */
.image-overlay-flip-hint {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-weight: 500;
  margin-top: -8px;
  letter-spacing: 0.02em;
  user-select: none;
  pointer-events: none;
}

/* Folded corner — the bottom-right corner of the photo is clipped away
 * (wall shows through), and the back of that same corner is shown folded
 * inward on top of the image. The cream triangle's hypotenuse lies exactly
 * along the cut, so visually it looks like the page corner pivoted across
 * the diagonal: empty space outside, paper-back sitting on the image side.
 * The drop-shadow falls into the cut to sell the lifted-paper depth. */
.has-note {
  position: relative;
  transition: transform 0.15s ease;
}
.has-note > img,
.has-note > div {
  clip-path: polygon(
    0 0,
    100% 0,
    100% calc(100% - 30px),
    calc(100% - 30px) 100%,
    0 100%
  );
}
/* Hover scale lives on the wrapper so the fold ::after scales with the
 * image — otherwise the corner detaches as the image grows under it.
 * The default `#galleryContainer img:hover` rule still fires for the
 * inner img; we cancel its transform so we don't compound 1.03 × 1.03. */
#galleryContainer .has-note:hover {
  transform: scale(1.03);
}
#galleryContainer .has-note:hover img {
  transform: none;
}
.has-note::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #c9bb9d 0%, #ece0c2 55%, #fbf3dd 100%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
  filter: drop-shadow(1.5px 1.5px 2px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  z-index: 2;
}

/* --- Mobile bottom tab bar --- */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.12);
  z-index: 9999;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (max-width: 599px) {
  .mobile-tab-bar {
    display: flex;
  }
  body.has-tab-bar {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
  }
  /* Hide tab bar when a modal is open — simpler than laying out around it */
  body.has-tab-bar .modal-backdrop.show ~ .mobile-tab-bar,
  body.has-tab-bar .mobile-tab-bar.tab-hidden {
    display: none !important;
  }
}
.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0 4px;
  text-decoration: none;
  color: #8e8e93;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab svg {
  stroke: #8e8e93;
  width: 24px;
  height: 24px;
}
.mobile-tab.active {
  color: #111;
  font-weight: 600;
}
.mobile-tab.active svg {
  stroke: #111;
}
.mobile-tab-add {
  margin-top: -14px;
}
.mobile-tab-add svg {
  background: #111;
  stroke: #fff;
  border-radius: 50%;
  padding: 7px;
  width: 40px;
  height: 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.mobile-tab-add.active svg,
.mobile-tab-add svg {
  stroke: #fff;
}
.mobile-add-menu {
  display: none;
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  border-radius: 14px;
  padding: 6px;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}
.mobile-add-menu.open {
  display: flex !important;
}
.mobile-add-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-add-menu button:active {
  background: rgba(255, 255, 255, 0.1);
}
.mobile-add-menu button svg {
  stroke: #fff;
  flex-shrink: 0;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  pointer-events: none;
  animation:
    toast-in 0.3s ease,
    toast-out 0.3s ease 2.7s forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Wall color picker swatches (shared modal) */
.wall-swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.wall-swatch.selected {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #111;
}

.upload-tags-label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}

/* --- Tag input (shared component) --- */
.tag-input {
  position: relative;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 6px 8px;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
}
.tag-input:focus-within {
  border-color: #111;
}
.tag-input-pills {
  display: contents; /* pills flow inline with the input */
}
.tag-input-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f2f2f2;
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  font-size: 13px;
  color: #111;
  font-weight: 500;
  line-height: 1.3;
}
.tag-input-pill-x {
  background: rgba(0, 0, 0, 0.08);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 14px;
  line-height: 14px;
  color: #555;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tag-input-pill-x:hover {
  background: rgba(0, 0, 0, 0.18);
  color: #000;
}
.tag-input-field {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 6px 4px;
  background: transparent;
}
.tag-input-field:disabled {
  cursor: not-allowed;
}
.tag-input-autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
}
.tag-input-ac-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
.tag-input-ac-row:hover,
.tag-input-ac-row.active {
  background: #f5f5f5;
}
.tag-input-ac-name {
  color: #111;
  font-weight: 500;
}
.tag-input-ac-uses {
  color: #999;
  font-size: 12px;
}
.tag-input-hint {
  width: 100%;
  font-size: 11px;
  color: #888;
  padding: 2px 4px 0;
  min-height: 14px;
}
.tag-input-hint--warn {
  color: #c0392b;
}

/* --- Follow pill (gallery header + list rows) ---
 * Two visual states: not-following (filled black pill) and following
 * (outlined). Dark wall walls get a light variant via .follow-pill--dark
 * so the pill stays legible on slate/charcoal backgrounds — same idea as
 * iOS FollowButton's `isDark`. */
.follow-pill {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.05s;
}
.follow-pill:hover {
  background: #000;
}
.follow-pill:active {
  transform: scale(0.96);
}
.follow-pill:disabled {
  opacity: 0.6;
  cursor: default;
}
.follow-pill.following {
  background: transparent;
  color: #111;
  border-color: rgba(0, 0, 0, 0.25);
}
.follow-pill.following:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.45);
}
.follow-pill--compact {
  font-size: 12px;
  padding: 5px 12px;
}
.follow-pill--dark {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.follow-pill--dark:hover {
  background: #f0f0f0;
}
.follow-pill--dark.following {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
.follow-pill--dark.following:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.8);
}

/* "Follows you" — tiny chip next to a username on a wall the viewer is
 * being followed by. Hidden by default; gallery.html flips display when
 * the profile fetch reports is_followed_by. */
.followsyou-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: #555;
  line-height: 1;
  vertical-align: middle;
}
body[data-wall-theme="dark"] .followsyou-badge {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
}

/* --- User row (followers / following / search results) --- */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.user-row:hover {
  background: #f7f7f7;
}
.user-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #ececec;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.user-row-avatar--empty::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c8c8c8;
}
.user-row-username {
  font-family:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  color: #111;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-row-trailing {
  flex-shrink: 0;
}

/* --- Following rail (horizontal avatar chips) ---
 * Used inside the Circles modal above the circles list. Mirrors iOS
 * FollowingRail. */
.following-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}
.following-rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: #666;
}
.following-rail-seeall {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #111;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
}
.following-rail-seeall:hover {
  background: rgba(0, 0, 0, 0.05);
}
.following-rail-scroller {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 6px;
  scrollbar-width: none;
}
.following-rail-scroller::-webkit-scrollbar {
  display: none;
}
.following-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  width: 64px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.following-chip-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: #ececec;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
}
.following-chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.following-chip-name {
  font-family:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
  color: #111;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.following-rail-empty {
  font-size: 12px;
  color: #999;
}

/* --- Network sub-view (segmented + search + list) ---
 * Lives inside the Circles modal; revealed when the user taps "See all"
 * on the Following rail. Hidden by default. */
.network-subview {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.network-subview.open {
  display: flex;
}
.network-subview-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: #111;
  cursor: pointer;
  padding: 4px 6px;
  margin: 0 0 4px -6px;
  align-self: flex-start;
  border-radius: 6px;
}
.network-subview-back:hover {
  background: rgba(0, 0, 0, 0.05);
}
.network-segmented {
  display: flex;
  background: #f1f1f1;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.network-segmented button {
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.network-segmented button.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.network-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 8px 12px;
}
.network-search svg {
  flex-shrink: 0;
  color: #999;
}
.network-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  padding: 2px 0;
}
.network-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.network-empty {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 28px 8px;
}
.network-loading {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  padding: 12px 0;
}

/* --- Discoverable toggle (account modal) --- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d8d8d8;
  border-radius: 999px;
  transition: background 0.15s;
}
.toggle-switch-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}
.toggle-switch input:checked + .toggle-switch-slider {
  background: #111;
}
.toggle-switch input:checked + .toggle-switch-slider::before {
  transform: translateX(18px);
}
.toggle-switch input:disabled + .toggle-switch-slider {
  opacity: 0.5;
  cursor: default;
}

/* --- Explore search affordance (icon → expanding bar) --- */
.explore-search-toggle {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: background 0.15s;
}
.explore-search-toggle:hover {
  background: #fff;
}
.explore-search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  padding: 8px 14px;
  width: 320px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.explore-search-bar.open {
  display: flex;
}
.explore-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  min-width: 0;
}
.explore-search-bar button {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 2px;
  display: flex;
  align-items: center;
}
.explore-search-bar button:hover {
  color: #111;
}
/* Results render as a floating dropdown anchored to the search bar
 * instead of replacing the page content — the explore grid stays where
 * it is behind the panel. Positioned with fixed so it stays glued
 * under the (also fixed) header on scroll. */
.explore-search-results {
  display: none;
  flex-direction: column;
  gap: 2px;
  position: fixed;
  top: 64px;
  right: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
  padding: 6px;
  z-index: 1001;
}
.explore-search-results.open {
  display: flex;
}
.explore-search-results .user-row {
  padding: 8px 10px;
}
.explore-search-results .user-row:hover {
  background: #f4f4f4;
}
.explore-search-empty {
  text-align: center;
  font-size: 13px;
  color: #999;
  padding: 28px 8px;
}
/* Soft backdrop dims the grid behind the dropdown so the panel feels
 * focused without hiding context completely. Click anywhere outside
 * the dropdown to dismiss. */
.explore-search-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 1000;
}
.explore-search-scrim.open {
  display: block;
}
@media (max-width: 600px) {
  .explore-search-bar {
    width: 100%;
  }
  .explore-search-bar.open ~ .explore-search-toggle,
  .explore-header.searching .explore-logo,
  .explore-header.searching .explore-back {
    display: none;
  }
  .explore-search-results {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

/* The .wall-text-tile class is set by gallery.js when it builds the text
   tile element. The dynamic style props (font-family, font-size, color,
   font-style) are inline so the picker preview can be cheap. This block
   just covers the layout invariants every text tile needs. */
.wall-text-tile {
  pointer-events: auto;
  /* Padding is set inline by gallery.js (WALL_TEXT_PAD_X / Y constants)
     so the bbox math and the rendered padding stay in lockstep. Setting
     it here too would either double up or fight the inline value. */
  box-sizing: border-box;
  /* Don't render text on top of the focus ring of an underlying focused
     element (e.g. a music tile with keyboard focus). */
  isolation: isolate;
}

/* Wall text editor textarea — doubles as the live preview. The dashed
   border tells the user "this is editable"; on focus the dashes fade so
   the user sees the actual tile result without chrome in the way. */
.wall-text-input::placeholder {
  /* Placeholder inherits font + colour from inline styles; tone down
     opacity so the user can tell it's a placeholder vs real content. */
  opacity: 0.35;
}
.wall-text-input:focus {
  border-style: solid;
  border-color: #bbb;
}

/* Auto-balance toggle row. Sits below the Bold/Italic/Size row in the
   text editor modal. Layout: icon + label/subtitle on the left, iOS-
   style switch on the right. The whole row is clickable. */
.wall-text-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #ececec;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.wall-text-toggle-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #444;
}
.wall-text-toggle-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  line-height: 1.2;
}
.wall-text-toggle-sub {
  font-size: 12px;
  color: #888;
  line-height: 1.3;
  margin-top: 2px;
}

/* iOS-style switch. The native checkbox is hidden but stays as the
   focusable/clickable input — accessibility is preserved. The .track
   element is what the user sees; ::after is the moving knob. */
.wall-text-toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.wall-text-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.wall-text-toggle-switch .track {
  position: absolute;
  inset: 0;
  background: #d1d1d6;
  border-radius: 999px;
  transition: background 0.18s;
}
.wall-text-toggle-switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.18s,
    background 0.18s;
}
.wall-text-toggle-switch input:checked + .track {
  background: #111;
}
.wall-text-toggle-switch input:checked + .track::after {
  transform: translateX(18px);
}
