/* ═══════════════════════════════════════════════════════════════════════
   DREAM PORTAL — Psychedelic-Studio Quality Stylesheet
   Dark-mode-first · Mesh Gradients · Glassmorphism · Portal Transitions
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ───────────────────────────────────────── */
:root {
  --bg-deep: #07060e;
  --bg-surface: rgba(15, 12, 30, 0.85);
  --bg-glass: rgba(25, 20, 50, 0.55);
  --bg-glass-hover: rgba(35, 28, 65, 0.7);
  --border-glass: rgba(140, 100, 255, 0.18);
  --border-glow: rgba(140, 100, 255, 0.35);
  --text-primary: #f0ecff;
  --text-secondary: #a89cc8;
  --text-muted: #6b5f8a;
  --accent-violet: #8b5cf6;
  --accent-indigo: #6366f1;
  --accent-fuchsia: #d946ef;
  --accent-cyan: #22d3ee;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --gradient-portal: linear-gradient(135deg, var(--accent-violet), var(--accent-fuchsia), var(--accent-cyan));
  --gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(217, 70, 239, 0.1), rgba(34, 211, 238, 0.08));
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15), 0 0 80px rgba(217, 70, 239, 0.08);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Reset & Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Animated Mesh Gradient Background ───────────────────────────── */
#mesh-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(139, 92, 246, 0.20) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(217, 70, 239, 0.15) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 90%, rgba(34, 211, 238, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 70% 20%, rgba(244, 63, 94, 0.10) 0%, transparent 50%);
  animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% {
    background:
      radial-gradient(ellipse 80% 60% at 20% 30%, rgba(139, 92, 246, 0.20) 0%, transparent 60%),
      radial-gradient(ellipse 60% 80% at 80% 70%, rgba(217, 70, 239, 0.15) 0%, transparent 55%),
      radial-gradient(ellipse 70% 50% at 50% 90%, rgba(34, 211, 238, 0.12) 0%, transparent 50%),
      radial-gradient(ellipse 50% 40% at 70% 20%, rgba(244, 63, 94, 0.10) 0%, transparent 50%);
  }
  33% {
    background:
      radial-gradient(ellipse 70% 70% at 60% 20%, rgba(139, 92, 246, 0.18) 0%, transparent 55%),
      radial-gradient(ellipse 80% 60% at 30% 80%, rgba(217, 70, 239, 0.20) 0%, transparent 60%),
      radial-gradient(ellipse 50% 70% at 80% 50%, rgba(34, 211, 238, 0.15) 0%, transparent 50%),
      radial-gradient(ellipse 60% 50% at 10% 60%, rgba(244, 63, 94, 0.12) 0%, transparent 50%);
  }
  66% {
    background:
      radial-gradient(ellipse 60% 80% at 80% 50%, rgba(139, 92, 246, 0.22) 0%, transparent 60%),
      radial-gradient(ellipse 70% 50% at 20% 40%, rgba(217, 70, 239, 0.12) 0%, transparent 50%),
      radial-gradient(ellipse 80% 60% at 50% 10%, rgba(34, 211, 238, 0.18) 0%, transparent 55%),
      radial-gradient(ellipse 50% 70% at 40% 90%, rgba(244, 63, 94, 0.15) 0%, transparent 50%);
  }
  100% {
    background:
      radial-gradient(ellipse 75% 65% at 40% 60%, rgba(139, 92, 246, 0.20) 0%, transparent 58%),
      radial-gradient(ellipse 65% 75% at 70% 30%, rgba(217, 70, 239, 0.17) 0%, transparent 55%),
      radial-gradient(ellipse 55% 55% at 30% 70%, rgba(34, 211, 238, 0.14) 0%, transparent 52%),
      radial-gradient(ellipse 70% 45% at 80% 80%, rgba(244, 63, 94, 0.11) 0%, transparent 50%);
  }
}

/* Noise texture overlay */
#mesh-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
}

/* ─── Floating Particles ──────────────────────────────────────────── */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ─── Layout ──────────────────────────────────────────────────────── */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Header ──────────────────────────────────────────────────────── */
.header {
  padding: 32px 0 24px;
  text-align: center;
  position: relative;
}

.header__logo {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  background: var(--gradient-portal);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
  position: relative;
}

.header__logo::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--gradient-portal);
  border-radius: 2px;
  opacity: 0.5;
}

.header__tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 12px;
  letter-spacing: 0.04em;
}

/* ─── Navigation Tabs ─────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 32px;
  flex-wrap: wrap;
}

.nav-tab {
  padding: 10px 28px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  outline: none;
  user-select: none;
}

.nav-tab:hover {
  border-color: var(--border-glow);
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.nav-tab--active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(217, 70, 239, 0.15));
  border-color: var(--accent-violet);
  color: var(--text-primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

/* ─── Glass Card ──────────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--shadow-card);
  padding: 32px;
  transition: all var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* ─── View Panels ─────────────────────────────────────────────────── */
.view-panel {
  display: none;
  opacity: 0;
  transform: translateY(12px);
}

.view-panel--active {
  display: block;
  animation: fadeSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Submit Form ─────────────────────────────────────────────────── */
.form-section {
  margin-bottom: 28px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  background: rgba(10, 8, 20, 0.6);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-smooth);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15), 0 0 20px rgba(139, 92, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.7;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a89cc8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-select option {
  background: #1a1530;
  color: var(--text-primary);
}

/* ─── Slider Component ────────────────────────────────────────────── */
.slider-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.slider-item {
  padding: 16px;
  background: rgba(10, 8, 20, 0.4);
  border: 1px solid rgba(140, 100, 255, 0.08);
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
}

.slider-item:hover {
  border-color: rgba(140, 100, 255, 0.2);
  background: rgba(10, 8, 20, 0.5);
}

.slider-info {
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: help;
  opacity: 0.6;
  transition: opacity 0.2s;
  margin-left: 4px;
}

.slider-item:hover .slider-info {
  opacity: 1;
  color: var(--accent-violet);
}

.slider-tooltip {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-bottom: 0;
}

.slider-item:hover .slider-tooltip {
  max-height: 80px;
  opacity: 1;
  margin-bottom: 10px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.slider-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.slider-value-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-violet);
  min-width: 24px;
  text-align: right;
}

.slider-unit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-violet);
  background: rgba(140, 100, 255, 0.12);
  border: 1px solid rgba(140, 100, 255, 0.25);
  border-radius: 6px;
  padding: 2px 4px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.slider-unit:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 2px rgba(140, 100, 255, 0.2);
}

.slider-unit option {
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 4px 8px;
}

.slider-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(140, 100, 255, 0.1);
  cursor: pointer;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-portal);
  transition: width 0.15s ease;
  pointer-events: none;
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: transparent;
  outline: none;
  margin: 0;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-violet);
  border: 3px solid var(--bg-deep);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.7);
}

.slider-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-violet);
  border: 3px solid var(--bg-deep);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
  cursor: pointer;
}

.slider-wrapper {
  position: relative;
}

.slider-wrapper .slider-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ─── Tags ────────────────────────────────────────────────────────── */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  user-select: none;
  outline: none;
}

.tag-chip:hover {
  border-color: var(--accent-violet);
  color: var(--text-secondary);
}

.tag-chip--selected {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(217, 70, 239, 0.2));
  border-color: var(--accent-violet);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.tag-chip--disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── Submit Button ───────────────────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--gradient-portal);
  color: white;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
  outline: none;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-submit:hover::before {
  opacity: 1;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4), 0 0 60px rgba(217, 70, 239, 0.15);
}

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

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── Dream Feed / Gallery ────────────────────────────────────────── */
.feed-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  align-items: center;
}

.feed-controls .form-select,
.feed-controls .form-input {
  width: auto;
  min-width: 150px;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-violet);
  font-size: 0.78rem;
  font-weight: 600;
}

.filter-badge__remove {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.filter-badge__remove:hover {
  opacity: 1;
}

/* ─── Dream Cards Grid ────────────────────────────────────────────── */
.dreams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.dream-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.dream-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-portal);
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.dream-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.dream-card:hover::before {
  opacity: 1;
}

.dream-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.dream-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}

.dream-card__dreamer {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.1);
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dream-card__excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dream-card__metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.metric-pill--vividness   { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.metric-pill--lucidity    { background: rgba(34, 211, 238, 0.12); color: #67e8f9; }
.metric-pill--intensity   { background: rgba(244, 63, 94, 0.12); color: #fb7185; }
.metric-pill--fear        { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.metric-pill--meaningful { background: rgba(74, 222, 128, 0.12); color: #86efac; }

.dream-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dream-card__tag {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 100px;
  background: rgba(140, 100, 255, 0.08);
  border: 1px solid rgba(140, 100, 255, 0.15);
  color: var(--text-muted);
}

.dream-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dream-card__footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dream-card__tense {
  text-transform: capitalize;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-indigo);
  font-size: 0.78rem;
}

/* ─── Dream Detail Modal / Portal View ────────────────────────────── */
.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-overlay--active {
  opacity: 1;
  visibility: visible;
}

.portal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 6, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.portal-content {
  position: relative;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 80px rgba(139, 92, 246, 0.2), 0 0 160px rgba(217, 70, 239, 0.1);
  padding: 40px;
  transform: scale(0.8) rotateX(10deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.portal-overlay--active .portal-content {
  transform: scale(1) rotateX(0deg);
}

/* Scrollbar styling for portal */
.portal-content::-webkit-scrollbar {
  width: 6px;
}
.portal-content::-webkit-scrollbar-track {
  background: transparent;
}
.portal-content::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

.portal-share {
  position: absolute;
  top: 20px;
  right: 68px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  z-index: 10;
}

.portal-share:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.1);
}

.portal-share.copied {
  border-color: #86efac;
  color: #86efac;
  background: rgba(134, 239, 172, 0.1);
}

.portal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  z-index: 10;
}

.portal-close:hover {
  border-color: var(--accent-rose);
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

.portal-dreamer {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.1);
  padding: 6px 16px;
  border-radius: 100px;
  display: inline-block;
  margin-bottom: 16px;
}

.portal-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.portal-tense {
  font-size: 0.85rem;
  color: var(--accent-indigo);
  text-transform: capitalize;
  margin-bottom: 24px;
}

.portal-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 32px;
  white-space: pre-wrap;
}

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.portal-metric {
  padding: 14px;
  background: rgba(10, 8, 20, 0.5);
  border: 1px solid rgba(140, 100, 255, 0.1);
  border-radius: var(--radius-md);
  text-align: center;
}

.portal-metric__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.portal-metric__value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--gradient-portal);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portal-metric__bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(140, 100, 255, 0.1);
  margin-top: 8px;
  overflow: hidden;
}

.portal-metric__bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient-portal);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.portal-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
}

.portal-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

/* ─── Like Button ───────────────────────────────────────────────── */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  line-height: 1;
}

.like-btn:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}

.like-btn--liked {
  color: var(--accent-rose);
}

.like-btn--liked:hover {
  background: rgba(244, 63, 94, 0.15);
}

.like-btn--pop {
  animation: likePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes likePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.like-btn__count {
  min-width: 12px;
  text-align: center;
}

.like-btn--portal {
  font-size: 0.9rem;
  padding: 6px 10px;
  gap: 6px;
}

/* ─── Comments Section ────────────────────────────────────────────── */
.portal-comments {
  margin-top: 28px;
  border-top: 1px solid var(--border-glass);
  padding-top: 20px;
}

.portal-comments__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.portal-comments__list {
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-comments__list::-webkit-scrollbar {
  width: 4px;
}
.portal-comments__list::-webkit-scrollbar-track {
  background: transparent;
}
.portal-comments__list::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.25);
  border-radius: 2px;
}

.portal-comments__empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 12px 0;
}

.portal-comment {
  background: rgba(10, 8, 20, 0.4);
  border: 1px solid rgba(140, 100, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.portal-comment__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.portal-comment__author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.portal-comment__time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.portal-comment__text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.portal-comments__form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.portal-comments__input {
  flex: 1;
  background: rgba(10, 8, 20, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  transition: border-color var(--transition-smooth);
}

.portal-comments__input:focus {
  outline: none;
  border-color: var(--accent-violet);
}

.portal-comments__input::placeholder {
  color: var(--text-muted);
}

.portal-comments__submit {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-violet);
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-violet);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
  white-space: nowrap;
}

.portal-comments__submit:hover {
  background: rgba(139, 92, 246, 0.3);
  color: var(--text-primary);
}

.portal-comments__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-bottom: 60px;
}

.pagination__btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.pagination__btn:hover:not(:disabled) {
  border-color: var(--accent-violet);
  color: var(--text-primary);
}

.pagination__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination__info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state__icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state__text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── Loading Spinner ─────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(139, 92, 246, 0.15);
  border-top-color: var(--accent-violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Toast Notifications ─────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 22px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast--success {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.3);
  color: #86efac;
}

.toast--error {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.toast--info {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  color: #a78bfa;
}

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

.toast--exit {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to { transform: translateX(100px); opacity: 0; }
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-container { padding: 0 16px; }
  .glass-card { padding: 20px; }
  .portal-content { padding: 24px; }
  .dreams-grid { grid-template-columns: 1fr; }
  .slider-group { grid-template-columns: 1fr; }
  .feed-controls { flex-direction: column; }
  .feed-controls .form-select,
  .feed-controls .form-input { width: 100%; }
}

@media (max-width: 480px) {
  .nav-tabs { gap: 6px; }
  .nav-tab { padding: 8px 18px; font-size: 0.82rem; }
  .header { padding: 24px 0 16px; }
}

/* ─── Utility ─────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-gradient {
  background: var(--gradient-portal);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mb-0 { margin-bottom: 0; }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 24px; }
/* ─── Footer ──────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  padding: 1.5rem;
  border-top: 1px solid var(--border-glass);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition-smooth);
}

.footer a:hover {
  color: var(--accent-violet);
  text-decoration: underline;
}