:root {
  --bg-primary: #08080a;
  --bg-surface: rgba(18, 18, 22, 0.75);
  --bg-surface-elevated: rgba(24, 24, 30, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);
  --text-primary: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-faint: #52525b;
  --gold-accent: #d4af6e;
  --gold-glow: #e2b774;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient glow lights */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 1;
}

.glow-1 {
  width: 600px;
  height: 600px;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(212, 175, 110, 0.12) 0%, rgba(120, 80, 220, 0.05) 60%, transparent 100%);
}

.glow-2 {
  width: 480px;
  height: 480px;
  top: 45%;
  right: -100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, transparent 70%);
}

.glow-3 {
  width: 500px;
  height: 500px;
  bottom: 0;
  left: -80px;
  background: radial-gradient(circle, rgba(212, 175, 110, 0.06) 0%, transparent 70%);
}

.noise-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 2;
}

#ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

/* Page Wrapper */
.page-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

/* Top Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  padding-bottom: 0.5rem;
}

/* Editorial Hero Card */
.editorial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 4.5rem 3.5rem;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 
    0 30px 60px -15px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.4s ease;
}

.editorial-card:hover {
  border-color: var(--border-highlight);
}

.whisper-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-accent);
  margin-bottom: 2rem;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--gold-accent);
  box-shadow: 0 0 10px var(--gold-accent);
  display: inline-block;
  animation: pulse 2.5s infinite ease-in-out;
}

.main-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.8rem, 6.5vw, 4.8rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: #fafafa;
  margin-bottom: 1.75rem;
}

.name-gradient {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(135deg, #ffffff 10%, #f6e0b5 50%, #c59b56 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.manifesto {
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 300;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 3rem;
}

/* Actions */
.action-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.toast-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.75rem;
  background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fafafa;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.4);
}

.toast-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 15px 30px -5px rgba(212, 175, 110, 0.15);
}

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

.toast-counter {
  font-size: 0.875rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.counter-num {
  color: var(--text-muted);
  font-weight: 600;
  transition: color 0.3s ease;
}

/* =========================================
   Guestbook / Messages Section
   ========================================= */
.guestbook-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.section-header {
  text-align: left;
}

.sub-label {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: var(--gold-accent);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 500;
  color: #fafafa;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* Composer */
.message-composer {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease;
}

.message-composer:focus-within {
  border-color: rgba(212, 175, 110, 0.35);
}

.message-composer textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: none;
  min-height: 80px;
}

.message-composer textarea::placeholder {
  color: var(--text-faint);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
  flex-wrap: wrap;
}

.author-wrap {
  flex: 1;
  min-width: 220px;
}

.author-wrap input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.author-wrap input:focus {
  border-color: rgba(212, 175, 110, 0.3);
}

.author-wrap input::placeholder {
  color: var(--text-faint);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: #f4f4f5;
  color: #09090b;
  border: none;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.submit-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -4px rgba(255, 255, 255, 0.25);
}

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

/* Feed Container */
.messages-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-faint);
  padding: 0 0.5rem;
}

.feed-header strong {
  color: var(--text-muted);
}

.feed-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #10b981;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite ease-in-out;
}

.messages-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.messages-feed::-webkit-scrollbar {
  width: 5px;
}
.messages-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
}

/* Individual Message Card */
.message-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.25s ease;
  animation: slideIn 0.4s ease forwards;
}

.message-card:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(255, 255, 255, 0.14);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.author-pill {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.author-prefix {
  color: var(--text-faint);
  font-weight: 400;
}

.card-time {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.card-body-text {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #e4e4e7;
  word-break: break-word;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.6rem;
}

/* Like Button */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.like-btn:hover {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
  background: rgba(244, 63, 94, 0.08);
}

.like-btn.liked {
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.12);
}

.like-icon {
  font-size: 0.9rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-btn:hover .like-icon,
.like-btn.liked .like-icon {
  transform: scale(1.2);
}

.loading-state, .empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-faint);
  font-size: 0.9rem;
}

/* Footer */
.bottom-footer {
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 1rem;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

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

@media (max-width: 640px) {
  .editorial-card {
    padding: 3rem 1.75rem;
  }
  .page-wrapper {
    padding: 2rem 1rem 4rem;
    gap: 2.5rem;
  }
  .composer-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .submit-btn {
    justify-content: center;
  }
}
