/* ==========================================================
   bhak.lol — Higgsfield-Caliber Visual Meme Engine
   Pure Visual Immersion, Edge-to-Edge Masonry, ✨ Recreate
   ========================================================== */

:root {
  --bg-black: #000000;
  --bg-surface: #0a0b10;
  --bg-surface-elevated: #12141c;
  --bg-card: #0f1016;
  --bg-card-hover: #171924;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);

  --brand-flame: #ff4500;
  --neon-lime: #d4ff00;
  --neon-lime-hover: #e2ff33;
  --neon-lime-glow: rgba(212, 255, 0, 0.4);

  --whatsapp-green: #25d366;
  --whatsapp-glow: rgba(37, 211, 102, 0.4);

  --text-white: #ffffff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-card: 18px;
  --radius-full: 9999px;
  --radius-md: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-black);
  color: var(--text-white);
}

body.higgs-app {
  font-family: var(--font-body);
  background-color: var(--bg-black);
  color: var(--text-white);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ──── Minimalist Floating Navbar ──── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.35rem;
  color: #ffffff;
  letter-spacing: -0.04em;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-link:hover {
  transform: scale(1.04);
}

.brand-flame {
  font-size: 1.35rem;
  filter: drop-shadow(0 0 10px rgba(255, 69, 0, 0.8));
}

.brand-accent {
  color: var(--brand-flame);
}

/* ──── Category Filters (Higgsfield Style) ──── */
.category-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filters::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.filter-pill.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-white);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.icon-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.revenge-pill-btn {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.revenge-pill-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

/* ──── Edge-to-Edge Masonry Grid (Higgsfield Architecture) ──── */
.grid-container {
  max-width: 1720px;
  margin: 0 auto;
  padding: 16px 20px 80px;
}

.masonry-feed {
  columns: 4 280px;
  column-gap: 16px;
}

@media (max-width: 1200px) {
  .masonry-feed {
    columns: 3 240px;
  }
}

@media (max-width: 768px) {
  .masonry-feed {
    columns: 2 160px;
    column-gap: 10px;
  }
}

@media (max-width: 480px) {
  .masonry-feed {
    columns: 1 100%;
  }
}

/* ──── Media Card ──── */
.media-card {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius-card);
  overflow: hidden;
  position: relative;
  background: var(--bg-card);
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.media-card:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9), 0 0 20px rgba(212, 255, 0, 0.15);
}

.media-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-stage video,
.media-stage canvas,
.media-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Staggered Heights for Masonry Flow */
.media-card.aspect-tall .media-stage {
  aspect-ratio: 9 / 16;
}

.media-card.aspect-social .media-stage {
  aspect-ratio: 4 / 5;
}

.media-card.aspect-square .media-stage {
  aspect-ratio: 1 / 1;
}

.media-card.aspect-wide .media-stage {
  aspect-ratio: 16 / 10;
}

/* ──── Floating Card Overlays (Higgsfield Exact Matching) ──── */
.card-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.45) 0%,
    transparent 25%,
    transparent 65%,
    rgba(0, 0, 0, 0.75) 100%
  );
  pointer-events: none;
  z-index: 2;
}

.card-top-left-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.78rem;
  color: #ffffff;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.card-top-right-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  gap: 6px;
}

.tool-dot-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-dot-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.card-bottom-bar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.like-counter-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

/* The Signature Higgsfield ✨ Recreate Button */
.recreate-pill-btn {
  background: var(--neon-lime);
  color: #000000;
  border: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--neon-lime-glow);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.recreate-pill-btn:hover {
  background: var(--neon-lime-hover);
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(212, 255, 0, 0.6);
}

/* ──── The 1-Tap Remix Modal (Higgsfield Drawer) ──── */
.remix-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.remix-modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-card);
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
  animation: panelSlide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelSlide {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-dismiss-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  z-index: 20;
  transition: all 0.2s ease;
}

.modal-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.remix-modal-content {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  padding: 28px;
}

@media (max-width: 820px) {
  .remix-modal-content {
    grid-template-columns: 1fr;
  }
}

/* Left: Live Stage */
.remix-stage-col {
  display: flex;
  align-items: center;
  justify-content: center;
}

.remix-canvas-frame {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #000000;
  position: relative;
}

.remix-canvas-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.remix-watermark {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  pointer-events: none;
}

/* Right: Controls & Roasts */
.remix-controls-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.format-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--neon-lime);
  background: rgba(212, 255, 0, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.remix-headline {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.remix-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.control-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.face-action-row {
  display: flex;
  gap: 10px;
}

.photo-upload-trigger {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-upload-trigger:hover {
  border-color: var(--neon-lime);
  background: rgba(212, 255, 0, 0.08);
}

.upload-icon {
  font-size: 1.4rem;
}

.upload-copy {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: #ffffff;
}

.presets-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.preset-chip-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.preset-chip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.preset-chip-btn.active {
  background: rgba(212, 255, 0, 0.18);
  border-color: var(--neon-lime);
  color: #ffffff;
}

.name-input-group {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 8px;
}

.input-prefix {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.name-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
}

.shuffle-icon-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.shuffle-icon-btn:hover {
  transform: rotate(45deg);
}

.roast-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.roast-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.roast-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.roast-chip.active {
  background: rgba(212, 255, 0, 0.12);
  border-color: var(--neon-lime);
  color: #ffffff;
}

.remix-actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary-wa-btn {
  background: var(--whatsapp-green);
  color: #ffffff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px var(--whatsapp-glow);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.primary-wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.6);
}

.secondary-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sec-act-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-white);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 11px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sec-act-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tease-preview-text {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* ──── Reciprocal Revenge Modal (?v=...) ──── */
.revenge-panel {
  background: #0d090d;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-card);
  max-width: 440px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 0 0 50px rgba(239, 68, 68, 0.3);
  padding: 24px;
  text-align: center;
  animation: panelSlide 0.2s ease;
}

.revenge-alert-banner {
  background: #ef4444;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.revenge-heading {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.highlight-target {
  color: #ef4444;
  text-decoration: underline;
}

.revenge-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.revenge-preview-container {
  width: 100%;
  max-width: 290px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
}

.revenge-preview-container img,
.revenge-preview-container video {
  width: 100%;
  display: block;
}

.counter-attack-btn {
  width: 100%;
  background: linear-gradient(135deg, #ef4444 0%, #ff4500 100%);
  border: none;
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.05rem;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.6);
  animation: retaliatePulse 2s infinite;
}

@keyframes retaliatePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.counter-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ──── Toast Tray ──── */
.toast-tray {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-pill {
  background: #171924;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
  pointer-events: auto;
}
