/* ═══════════════════════════════════════
   Living Canvas v4 — Floating Bubbles Aesthetic
   ═══════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --bg-deep: #06060a;
  --bg-panel: rgba(10, 10, 15, 0.78);
  --bg-panel-hover: rgba(16, 16, 22, 0.9);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(255, 255, 255, 0.25);

  --text-primary: #e8e8ec;
  --text-secondary: rgba(232, 232, 236, 0.6);
  --text-tertiary: rgba(232, 232, 236, 0.4);
  --text-accent: #a8b4ff;

  --accent: #7c8aff;
  --accent-hover: #9ba5ff;
  --accent-glow: rgba(124, 138, 255, 0.15);

  --gold: #ffd700;
  --silver: #c0c0d0;
  --bronze: #cd7f32;

  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 100px;
  --radius-bubble: 24px;

  --blur: blur(20px);
  --blur-heavy: blur(40px);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --z-canvas: 0;
  --z-vignette: 1;
  --z-panels: 10;
  --z-topbar: 20;
  --z-modal: 100;
  --z-toast: 200;

  /* Bottom panel height hint for canvas sizing */
  --panel-height: 260px;
}

/* ─── Canvas Background ─── */
#canvas-container {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  background: var(--bg-deep);
  touch-action: none;
  overflow: hidden;
}

.canvas-img {
  position: absolute;
  opacity: 0;
  transition: opacity 1.5s var(--ease-out);
  max-width: none;
  image-rendering: auto;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Desktop: contain shows the full image without cropping */
  object-fit: contain;
  transform-origin: center center;
  will-change: transform, opacity;
}

.canvas-img.active {
  opacity: 1;
}

#canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #07070a;
  overflow: hidden;
  z-index: 3;
}

/* ─── Bold Intro ─── */
.intro-scene {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-grain,
.gen-grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  opacity: 0.035;
  pointer-events: none;
  animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-5%, -5%); }
  50% { transform: translate(3%, -8%); }
  75% { transform: translate(-7%, 2%); }
  100% { transform: translate(0, 0); }
}

.intro-content {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: introFadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes introFadeUp {
  0% { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

.intro-wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 0.88;
}

.intro-word {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  color: #fff;
  font-size: clamp(4rem, 14vw, 10rem);
}

.intro-w1 { animation: wordReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both; }
.intro-w2 { animation: wordReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both; }

@keyframes wordReveal {
  0% { opacity: 0; transform: translateY(40px); filter: blur(12px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.intro-line {
  width: 48px;
  height: 2px;
  background: var(--accent);
  margin: 24px auto 20px;
  animation: lineExpand 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
  box-shadow: 0 0 16px var(--accent), 0 0 40px rgba(124, 138, 255, 0.2);
}

@keyframes lineExpand {
  0% { width: 0; opacity: 0; }
  100% { width: 48px; opacity: 1; }
}

.intro-tagline {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: tagReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

@keyframes tagReveal {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

#canvas-placeholder.swooping-out {
  animation: swoopOut 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes swoopOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08); filter: blur(20px); }
}

#canvas-placeholder.hidden { display: none; }

/* ─── Generation Overlay ─── */
#canvas-generating {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

#canvas-generating.hidden { display: none; }

.gen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 7, 10, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gen-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: introFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gen-bar-track {
  width: 240px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.generating-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.generating-text {
  position: relative;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Vignette — fades edges, bottom stronger for panel overlay area */
.vignette-overlay {
  position: absolute;
  inset: 0;
  z-index: var(--z-vignette);
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(6, 6, 10, 0.5) 100%),
    linear-gradient(to top, rgba(6, 6, 10, 0.75) 0%, transparent 28%),
    linear-gradient(to bottom, rgba(6, 6, 10, 0.4) 0%, transparent 15%);
}

/* ════════════════════════════════════
   TOP BAR — floating bubble style
   ════════════════════════════════════ */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(to bottom, rgba(6, 6, 10, 0.6), transparent);
  pointer-events: none;
}

#top-bar > * { pointer-events: auto; }

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.dev-badge {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

.top-bar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Stats as floating bubbles */
.stats-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--bg-panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.stat-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.55rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.stat-divider { display: none; }

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Icon Buttons ─── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 180ms var(--ease-out);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-subtle);
  transform: scale(1.05);
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

/* ─── Glass Panel Shared ─── */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-subtle);
}

/* ════════════════════════════════════
   LEADERBOARD PANEL
   ════════════════════════════════════ */
#leaderboard-panel {
  position: fixed;
  top: 60px;
  right: 16px;
  bottom: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  z-index: var(--z-panels);
  border-radius: var(--radius-bubble);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: transform 400ms var(--ease-out), opacity 300ms var(--ease-out);
  overflow: hidden;
  touch-action: auto;
}

#leaderboard-panel.visible {
  transform: translateX(0);
  opacity: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}

.leaderboard-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0;
}

.leaderboard-section {
  padding: 0 16px;
  margin-bottom: 20px;
}

.leaderboard-section:last-child { margin-bottom: 8px; }

.leaderboard-section-title {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 4px 0 8px;
}

.leaderboard-table-wrap { overflow-x: auto; }

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.leaderboard-table th {
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: left;
  padding: 6px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.col-rank {
  width: 36px;
  text-align: center !important;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 600;
}

.rank-1 { background: rgba(255, 215, 0, 0.15); color: var(--gold); border: 1px solid rgba(255, 215, 0, 0.3); }
.rank-2 { background: rgba(192, 192, 208, 0.12); color: var(--silver); border: 1px solid rgba(192, 192, 208, 0.25); }
.rank-3 { background: rgba(205, 127, 50, 0.15); color: var(--bronze); border: 1px solid rgba(205, 127, 50, 0.3); }
.rank-default { color: var(--text-tertiary); }

.donor-name { font-weight: 500; color: var(--text-primary); }

.influence-bar-cell { display: flex; align-items: center; gap: 6px; }

.influence-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  min-width: 30px;
}

.influence-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 600ms var(--ease-out);
}

.influence-bar-text {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.leaderboard-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

/* ════════════════════════════════════
   BOTTOM PANEL — Floating Bubble Card
   ════════════════════════════════════ */
#bottom-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  z-index: var(--z-panels);
  border-radius: var(--radius-bubble);
  max-height: 34vh;
  display: flex;
  flex-direction: column;
  transition: transform 400ms var(--ease-out), opacity 300ms var(--ease-out);
  touch-action: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#bottom-panel.collapsed .panel-body {
  display: none;
}

#bottom-panel.collapsed {
  transform: translateY(calc(100% - 44px));
  border-radius: var(--radius-bubble);
}

.panel-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  color: var(--text-tertiary);
  transition: color 180ms var(--ease-out);
  flex-shrink: 0;
}

.panel-collapse-btn:hover {
  color: var(--text-primary);
}

#bottom-panel.collapsed .panel-collapse-btn svg {
  transform: rotate(180deg);
}

.panel-collapse-btn svg {
  transition: transform 300ms var(--ease-out);
}

.panel-body {
  padding: 0 16px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
}

/* ════════════════════════════════════
   ACTION AREA
   ════════════════════════════════════ */
#action-area {
  margin-bottom: 10px;
}

.action-state {
  animation: bubbleIn 400ms var(--ease-spring);
}

.action-state.hidden {
  display: none;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  transition: all 180ms var(--ease-out);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-glow), 0 2px 8px rgba(124, 138, 255, 0.2);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  transition: all 180ms var(--ease-out);
  cursor: pointer;
}

.btn-secondary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.btn-wide { width: 100%; }

/* ─── Donate Button — Compact Pill ─── */
#action-donate {
  display: flex;
  justify-content: center;
}

.btn-donate {
  width: auto;
  padding: 10px 22px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  box-shadow: 0 2px 12px rgba(124, 138, 255, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.btn-donate:hover {
  background: linear-gradient(135deg, var(--accent-hover), #b088ff);
  box-shadow: 0 4px 20px rgba(124, 138, 255, 0.35);
  transform: translateY(-1px);
}

.btn-submit svg { flex-shrink: 0; }

/* ─── Prompt Input ─── */
.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.prompt-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.influence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(124, 138, 255, 0.2);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.influence-icon { font-size: 0.9rem; }

.prompt-input-row {
  display: flex;
  gap: 8px;
}

.prompt-input-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 180ms var(--ease-out);
}

.prompt-input-row input::placeholder { color: var(--text-tertiary); }

.prompt-input-row input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
}

/* Prompt extras: message + hide checkbox */
.prompt-extras {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.prompt-message-input {
  flex: 1;
  min-width: 0;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.prompt-message-input::placeholder { color: var(--text-tertiary); }

.prompt-message-input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
}

.checkbox-label-sm {
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.checkbox-label-sm .checkbox-visual {
  width: 14px;
  height: 14px;
}

/* Evolving state */
.evolving-message {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--accent-glow);
  border: 1px solid rgba(124, 138, 255, 0.15);
  border-radius: var(--radius-bubble);
  margin-bottom: 12px;
}

.evolving-icon {
  position: relative;
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 2px;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.evolving-title {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.evolving-prompt {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 60px;
  overflow-y: auto;
}

/* ════════════════════════════════════
   FEED — Bubble Cards
   ════════════════════════════════════ */
#feed-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.feed-title {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  transition: all 180ms var(--ease-out);
  animation: feedBubbleIn 400ms var(--ease-spring);
  background: rgba(255, 255, 255, 0.02);
}

@keyframes feedBubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.feed-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.feed-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(124, 138, 255, 0.2), rgba(155, 107, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid rgba(124, 138, 255, 0.15);
}

.feed-content { flex: 1; min-width: 0; }

.feed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.feed-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
}

.feed-weight {
  font-size: 0.6rem;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.feed-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.feed-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-hidden-label {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 0.78rem;
}

.feed-message {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 1px;
}

.feed-message::before { content: '\201C'; opacity: 0.5; }
.feed-message::after { content: '\201D'; opacity: 0.5; }

.feed-empty {
  text-align: center;
  padding: 16px 0;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.feed-item-pending {
  border-left: 2px solid var(--warning);
  padding-left: 10px;
}

/* ════════════════════════════════════
   PENDING CHANGES — Bubble Style
   ════════════════════════════════════ */
#pending-section {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.pending-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warning);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pendingPulse 1.5s ease-in-out infinite;
}

@keyframes pendingPulse {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
  50% { opacity: 1; box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
}

.pending-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
  font-size: 0.72rem;
  font-weight: 600;
}

.pending-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  background: rgba(251, 191, 36, 0.05);
  border: 1px solid rgba(251, 191, 36, 0.1);
  font-size: 0.78rem;
  animation: pendingSlideIn 0.3s var(--ease-out) both;
}

@keyframes pendingSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pending-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  animation: pendingPulse 1.5s ease-in-out infinite;
}

.pending-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pending-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.72rem;
}

.pending-text {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-time {
  color: var(--text-tertiary);
  font-size: 0.65rem;
  flex-shrink: 0;
}

/* ════════════════════════════════════
   MODAL — Floating Bubble
   ════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 1;
  transition: opacity 300ms var(--ease-out);
  padding: 20px;
  touch-action: auto;
}

.modal-overlay.hidden { display: none; }
.modal-overlay.fade-out { opacity: 0; }

.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-bubble);
  animation: modalBubbleIn 450ms var(--ease-spring);
}

@keyframes modalBubbleIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-body {
  padding: 20px 24px 24px;
}

/* Form elements */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 180ms var(--ease-out);
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
}

.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder {
  color: var(--text-tertiary);
}

/* Checkbox */
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-visual {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms var(--ease-out);
  flex-shrink: 0;
}

.checkbox-label input:checked + .checkbox-visual {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .checkbox-visual::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* Amount presets — Floating Bubbles */
.amount-presets {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.amount-btn {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 220ms var(--ease-spring);
  cursor: pointer;
  text-align: center;
}

.amount-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.amount-btn.selected {
  background: linear-gradient(135deg, var(--accent-glow), rgba(155, 107, 255, 0.15));
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 20px rgba(124, 138, 255, 0.2);
}

.custom-amount-row {
  display: flex;
  align-items: center;
  position: relative;
}

.currency-symbol {
  position: absolute;
  left: 18px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  pointer-events: none;
}

.custom-amount-row input {
  padding-left: 32px !important;
}

/* Payment methods */
.payment-methods { display: flex; gap: 6px; }

.payment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 180ms var(--ease-out);
  cursor: pointer;
}

.payment-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.payment-btn.selected { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.donate-info { text-align: center; }

.donate-info p {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.form-error {
  margin-top: 10px;
  padding: 8px 16px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--radius-pill);
  color: var(--error);
  font-size: 0.82rem;
  text-align: center;
}

.form-error.hidden { display: none; }

/* ─── Help Modal ─── */
.help-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.help-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.help-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(124, 138, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
  flex-shrink: 0;
}

.help-step h3 {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.help-step p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-note {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.help-note p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ════════════════════════════════════
   TOAST — Floating Bubble
   ════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  max-width: 360px;
  animation: toastBubbleIn 450ms var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.toast-out {
  animation: toastOut 300ms var(--ease-out) forwards;
}

.toast-emoji { font-size: 1.2rem; flex-shrink: 0; }

@keyframes toastBubbleIn {
  from { opacity: 0; transform: translateX(40px) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ─── Image Upload ─── */
.btn-icon-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 180ms var(--ease-out);
}

.btn-icon-upload:hover {
  color: var(--text-primary);
  background: var(--bg-input-focus);
  border-color: var(--border-light);
  transform: scale(1.05);
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 14px;
  background: rgba(124, 138, 255, 0.06);
  border: 1px solid rgba(124, 138, 255, 0.15);
  border-radius: var(--radius-pill);
  animation: fadeIn 300ms var(--ease-out);
}

.image-preview.hidden { display: none; }

.image-preview-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.image-preview-name {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 180ms var(--ease-out);
}

.image-remove-btn:hover {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

/* ─── Re-prompt State ─── */
.reprompt-header { margin-bottom: 10px; }

.reprompt-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.reprompt-actions { margin-top: 10px; }

/* ─── Feed Image Icon ─── */
.feed-image-icon {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: -2px;
}

/* ─── Utility ─── */
.hidden { display: none !important; }

/* Pan hint — hidden by default, shown only via mobile media query */
.canvas-pan-hint {
  display: none;
}

/* ════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════ */
@media (max-width: 768px) {
  /* Mobile: same contain as desktop. JS transform handles zoom/pan. */
  .canvas-img {
    object-fit: contain;
  }

  #top-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    justify-content: center;
  }

  .top-bar-left {
    order: 2;
    flex: 0 0 auto;
  }

  .top-bar-center {
    order: 1;
    flex: 1 1 100%;
    display: flex;
    justify-content: center;
    position: static;
    transform: none;
  }

  .top-bar-right {
    order: 3;
    flex: 0 0 auto;
    gap: 2px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .logo {
    font-size: 0.9rem;
  }

  .stats-row {
    gap: 4px;
  }

  .stat-item {
    padding: 4px 10px;
  }

  .stat-value { font-size: 0.78rem; }
  .stat-label { font-size: 0.5rem; }

  #leaderboard-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    transform: translateX(100%);
  }

  #leaderboard-panel.visible {
    transform: translateX(0);
  }

  #bottom-panel {
    bottom: 8px;
    left: 8px;
    right: 8px;
    max-height: 42vh;
    border-radius: var(--radius-xl);
  }

  /* Donate button on mobile */
  .btn-donate {
    padding: 9px 18px;
    font-size: 0.78rem;
  }

  .btn-donate .btn-donate-long {
    display: none;
  }

  .panel-body {
    padding: 0 14px 14px;
  }

  .prompt-input-row {
    flex-direction: column;
  }

  .prompt-input-row .btn-primary {
    width: 100%;
  }

  .prompt-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-xl);
  }

  .payment-methods {
    flex-direction: column;
  }

  .amount-presets {
    flex-wrap: wrap;
    justify-content: center;
  }

  .amount-btn {
    min-width: 48px;
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  #toast-container {
    top: auto;
    bottom: 20px;
    right: 14px;
    left: 14px;
  }

  .toast {
    max-width: 100%;
  }

  .feed-list {
    max-height: 110px;
  }

  /* Pan hint overlay */
  .canvas-pan-hint {
    display: flex;
    position: fixed;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    z-index: calc(var(--z-canvas) + 1);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-family: var(--font-body);
    letter-spacing: 0.02em;
    pointer-events: none;
    opacity: 0;
    animation: panHintIn 0.6s 2s var(--ease-out) forwards;
  }

  .canvas-pan-hint.hidden { display: none; }

  .canvas-pan-hint svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    animation: panHintDrag 2s 2.4s ease-in-out 2;
  }

  @keyframes panHintIn {
    from { opacity: 0; transform: translate(-50%, 50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, 50%) scale(1); }
  }

  @keyframes panHintDrag {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(10px); }
  }
}

@media (max-width: 400px) {
  .stats-row { gap: 3px; }
  .stat-item { padding: 3px 8px; }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .logo {
    font-size: 0.82rem;
  }
}

/* Desktop-specific: constrain bottom panel width for large screens */
@media (min-width: 769px) {
  #bottom-panel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(680px, calc(100vw - 48px));
  }

  #bottom-panel.collapsed {
    transform: translateX(-50%) translateY(calc(100% - 44px));
  }
}

/* ─── Number input spinners — hide ─── */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ═══════════════════════════════════════
   STRIPE PAYMENT ELEMENT
   ═══════════════════════════════════════ */

#stripe-payment-element {
  margin: 12px 0;
  min-height: 100px;
}

#stripe-payment-message {
  font-size: 0.82rem;
  color: var(--error);
  text-align: center;
  margin-top: 8px;
}

#stripe-payment-message:empty {
  display: none;
}

/* Donate modal two-step flow */
.donate-step {
  transition: opacity 0.3s ease;
}

.donate-step.hidden {
  display: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  cursor: pointer;
  margin-bottom: 12px;
  transition: color 180ms var(--ease-out);
  background: none;
  border: none;
  padding: 0;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-primary);
}

/* Donate step 2 summary */
.donate-step-summary {
  margin-bottom: 12px;
  padding: 10px 16px;
  background: rgba(124, 138, 255, 0.06);
  border: 1px solid rgba(124, 138, 255, 0.15);
  border-radius: var(--radius-pill);
  text-align: center;
}

.donate-step-summary-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.donate-summary-name {
  font-weight: 600;
  color: var(--text-primary);
}

.donate-summary-amount {
  font-weight: 700;
  color: var(--accent);
}

/* ═══════════════════════════════════════
   HISTORY PANEL (left side)
   ═══════════════════════════════════════ */

#history-panel {
  position: fixed;
  top: 60px;
  left: 16px;
  bottom: 16px;
  width: 400px;
  max-width: calc(100vw - 32px);
  z-index: var(--z-panels);
  border-radius: var(--radius-bubble);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  transition: transform 400ms var(--ease-out), opacity 300ms var(--ease-out);
  overflow: hidden;
  touch-action: auto;
}

#history-panel.visible {
  transform: translateX(0);
  opacity: 1;
}

.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  overscroll-behavior: contain;
}

.history-empty {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  padding: 40px 20px;
}

/* ── Timeline ── */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.history-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(124, 138, 255, 0.25);
}

.history-thumb-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-thumb-wrap {
  flex: 1;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
}

.history-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-thumb-label {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.history-thumb-arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  display: flex;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
}

.history-name {
  font-weight: 600;
  color: var(--text-primary);
}

.history-weight {
  color: var(--accent);
  font-weight: 600;
}

.history-time {
  color: var(--text-tertiary);
  margin-left: auto;
}

.history-prompt {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-msg {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-style: italic;
}


/* ═══════════════════════════════════════
   FEED BEFORE/AFTER BUTTON
   ═══════════════════════════════════════ */

.feed-item-has-ba {
  cursor: pointer;
}

.feed-item-has-ba:hover {
  background: rgba(255,255,255,0.04);
}

.feed-ba-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--accent);
  background: rgba(124, 138, 255, 0.08);
  border: 1px solid rgba(124, 138, 255, 0.2);
  border-radius: 100px;
  cursor: pointer;
  transition: background 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.feed-ba-btn:hover {
  background: rgba(124, 138, 255, 0.15);
  border-color: rgba(124, 138, 255, 0.35);
}

.feed-ba-btn svg {
  stroke: var(--accent);
}


/* ═══════════════════════════════════════
   BEFORE / AFTER LIGHTBOX
   ═══════════════════════════════════════ */

.ba-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
  pointer-events: none;
}

.ba-lightbox:not(.hidden) {
  pointer-events: auto;
}

.ba-lightbox.ba-lightbox-visible {
  opacity: 1;
}

.ba-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ba-lightbox-content {
  position: relative;
  width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ba-lightbox-close-btn {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: background 180ms;
}

.ba-lightbox-close-btn:hover {
  background: rgba(255,255,255,0.2);
}

.ba-lightbox-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.ba-lightbox-name {
  font-weight: 600;
  color: white;
}

.ba-lightbox-weight {
  color: var(--accent);
  font-weight: 600;
}

.ba-lightbox-time {
  color: rgba(255,255,255,0.5);
  margin-left: auto;
}

.ba-lightbox-prompt {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.7);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Slider Container ── */
.ba-slider-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.ba-slider-after {
  position: absolute;
  inset: 0;
}

.ba-slider-before {
  position: absolute;
  inset: 0;
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

.ba-slider-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Labels */
.ba-label {
  position: absolute;
  top: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 5;
}

.ba-label-before {
  left: 12px;
}

.ba-label-after {
  right: 12px;
}

/* Handle / Divider line */
.ba-slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  z-index: 3;
  pointer-events: none;
}

.ba-slider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: white;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

.ba-slider-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  color: #333;
}

.ba-slider-grip svg {
  width: 14px;
  height: 14px;
}

/* Hidden range input overlaying the container for drag interaction */
.ba-slider-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}


/* ═══════════════════════════════════════
   MOBILE — History & Lightbox
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  #history-panel {
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    transform: translateX(-100%);
  }

  #history-panel.visible {
    transform: translateX(0);
  }

  .ba-lightbox-content {
    width: 96vw;
    max-height: 92vh;
    overflow-y: auto;
  }

  .ba-slider-container {
    /* Prevent the slider from overflowing on short mobile screens */
    max-height: 55vh;
    aspect-ratio: auto;
  }

  .ba-slider-img {
    max-height: 55vh;
    object-fit: contain;
  }

  .ba-lightbox-close-btn {
    top: -36px;
  }

  .ba-lightbox-meta {
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ba-slider-grip {
    width: 34px;
    height: 34px;
  }

  .ba-slider-grip svg {
    width: 12px;
    height: 12px;
  }
}

