:root {
  --dark-bg: #0b0b10;
  --dark-panel: #14141d;
  --dark-panel-2: #1b1b28;
  --dark-border: #2a2a3d;
  --accent: #8b5cf6;
  --accent-2: #c084fc;
  --blood: #ef4444;
  --text-dark-primary: #e7e3f5;
  --text-dark-muted: #8b87a0;
  --light-bg: #ffffff;
  --light-panel: #f6f5fa;
  --light-border: #e5e3ef;
  --text-light-primary: #201d2e;
  --text-light-muted: #6f6b84;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--dark-bg);
  color: var(--text-dark-primary);
  min-height: 100vh;
}

.hidden { display: none !important; }

.brand {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-dark-primary);
}
.brand span { color: var(--accent-2); }
.brand-sm { font-size: 1.15rem; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 8px; cursor: pointer;
  font: 600 0.9rem 'Inter', sans-serif;
  padding: 0.6rem 1.1rem;
  transition: filter 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6d28d9); color: #fff; }
.btn-light { background: #e9e7f2; color: var(--text-light-primary); }
.btn-danger { background: transparent; color: var(--blood); border: 1px solid var(--blood); }
.btn-ghost-light { background: transparent; color: var(--text-light-muted); border: 1px solid var(--light-border); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 0.9rem; }
.field label {
  display: block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.3rem; color: inherit; opacity: 0.7;
}
input, textarea {
  width: 100%; padding: 0.6rem 0.8rem;
  border-radius: 8px; border: 1px solid var(--dark-border);
  background: var(--dark-panel-2); color: var(--text-dark-primary);
  font: 400 0.95rem 'Inter', sans-serif;
  outline: none; resize: vertical;
}
input:focus, textarea:focus { border-color: var(--accent); }

.error { color: var(--blood); font-size: 0.85rem; margin-bottom: 0.8rem; }
.hint { font-size: 0.78rem; color: var(--text-dark-muted); margin: 0.4rem 0; }
.muted { color: var(--text-light-muted); font-size: 0.85rem; }
.muted-dark { color: var(--text-dark-muted); font-size: 0.9rem; padding: 0.6rem 0; }
.desc { font-size: 0.9rem; margin: 0.5rem 0; white-space: pre-wrap; }
.row { display: flex; gap: 0.5rem; align-items: center; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(139, 92, 246, 0.15), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(192, 132, 252, 0.08), transparent 50%),
    var(--dark-bg);
  padding: 1rem;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--dark-panel);
  border: 1px solid var(--dark-border);
  border-radius: 16px; padding: 2.2rem;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  text-align: center;
}
.auth-card .brand { font-size: 1.7rem; }
.tagline { color: var(--text-dark-muted); font-size: 0.95rem; margin: 0.7rem 0 1.6rem; line-height: 1.45; }
.tagline em {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-2);
}
.auth-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.4rem; }
.auth-tab {
  flex: 1; padding: 0.55rem; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid var(--dark-border);
  color: var(--text-dark-muted); font: 600 0.85rem 'Inter', sans-serif;
}
.auth-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#auth-form { text-align: left; }

.google-signin { margin-top: 1.2rem; }
.google-signin .divider {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--text-dark-muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.google-signin .divider::before,
.google-signin .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--dark-border);
}
.google-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  padding: 0.65rem 1rem; border-radius: 999px; cursor: pointer;
  background: #fff; color: #1f1f1f; border: none;
  font: 600 0.9rem 'Inter', sans-serif;
  transition: filter 0.15s;
}
.google-btn:hover { filter: brightness(0.93); }
.google-btn:disabled { opacity: 0.6; cursor: wait; }

.invite-offer { margin-top: 0.5rem; }
.invite-result {
  margin-top: 0.6rem; padding: 0.7rem; border-radius: 10px;
  background: var(--light-panel); border: 1px solid var(--light-border);
  font-size: 0.8rem; color: var(--text-light-muted);
}
.invite-result .row { margin-top: 0.5rem; }
.invite-result input { font-size: 0.75rem; padding: 0.4rem 0.6rem; }

/* ---------- App layout ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 2fr;
  min-height: 100vh;
}

/* ---------- Left: My World (white) ---------- */
.my-world {
  background: var(--light-bg);
  color: var(--text-light-primary);
  padding: 1.6rem;
  border-right: 1px solid var(--light-border);
  overflow-y: auto; max-height: 100vh;
  position: sticky; top: 0;
}
.my-world input, .my-world textarea {
  background: var(--light-panel); border-color: var(--light-border);
  color: var(--text-light-primary);
}
.my-world .hint { color: var(--text-light-muted); }
.my-world-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.2rem;
}
.my-world-header h2 { font-family: 'Cinzel', serif; font-size: 1.3rem; }

.profile-card {
  background: var(--light-panel);
  border: 1px solid var(--light-border);
  border-radius: 14px; padding: 1.2rem;
  text-align: center;
}
.avatar {
  border-radius: 50%; object-fit: cover;
  background: #d8d5e6;
  border: 2px solid var(--accent);
}
.avatar-lg { width: 84px; height: 84px; }
.avatar-sm { width: 42px; height: 42px; }
.avatar-wrap { position: relative; display: inline-block; }
.avatar-upload {
  position: absolute; right: -4px; bottom: -4px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; cursor: pointer;
  border: 2px solid var(--light-bg);
}
.profile-info h3 { margin-top: 0.6rem; font-size: 1.1rem; }
.profile-info .btn { margin-top: 0.5rem; }
.profile-stats {
  display: flex; gap: 0.6rem; margin-top: 1rem;
}
.stat {
  flex: 1; background: #fff; border: 1px solid var(--light-border);
  border-radius: 10px; padding: 0.6rem 0.4rem;
}
.stat b { display: block; font-size: 1.25rem; color: var(--accent); }
.stat span { font-size: 0.68rem; color: var(--text-light-muted); }

.edit-profile {
  margin-top: 1rem; background: var(--light-panel);
  border: 1px solid var(--light-border); border-radius: 14px; padding: 1rem;
}

.add-member { margin-top: 1.4rem; }
.add-member h4, .members h4 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light-muted); margin-bottom: 0.6rem;
}
.add-member .row input { flex: 1; }

.members { margin-top: 1.4rem; }
.member-list { list-style: none; }
.member-list li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.6rem; border-radius: 10px; cursor: pointer;
  transition: background 0.15s;
}
.member-list li:hover { background: var(--light-panel); }
.member-list .m-name { font-weight: 600; font-size: 0.92rem; }
.member-list .m-email { font-size: 0.75rem; color: var(--text-light-muted); }

/* ---------- Right: dark side ---------- */
.dark-side {
  padding: 1.6rem 2.2rem 3rem;
  background:
    radial-gradient(ellipse at 90% 0%, rgba(139, 92, 246, 0.08), transparent 45%),
    var(--dark-bg);
  overflow-y: auto; max-height: 100vh;
}
.dark-header {
  display: flex; justify-content: center;
  padding-bottom: 1.2rem; border-bottom: 1px solid var(--dark-border);
  margin-bottom: 1.4rem;
}

.section-title { margin-bottom: 0.9rem; }
.section-title h2 {
  font-family: 'Cinzel', serif; font-size: 1.15rem; color: var(--accent-2);
  letter-spacing: 0.06em;
}
.section-sub { font-size: 0.78rem; color: var(--text-dark-muted); margin-top: 0.15rem; }
.wall-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.btn-wall-filter {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--dark-border);
  color: var(--text-dark-muted);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font: 600 0.78rem 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.15s;
}
.btn-wall-filter:hover { border-color: var(--accent); color: var(--text-dark-primary); }
.btn-wall-filter.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent);
  color: var(--accent-2);
}

.dark-divide {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #6a6a74, var(--dark-border), #6a6a74, transparent);
  margin: 0.2rem 0 1.6rem;
}

/* My Darkness */
.my-darkness {
  background: #2c2c32;
  border: 3px solid #5a5a64;
  border-radius: 4px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.4rem;
}
.darkness-list { display: flex; flex-direction: column; gap: 0.55rem; max-height: 220px; overflow-y: auto; }
.darkness-item {
  background: var(--dark-panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
}
.darkness-item time { display: block; font-size: 0.7rem; color: var(--text-dark-muted); margin-top: 0.3rem; }

/* Compose */
.compose { margin-bottom: 1.8rem; }
.compose form { display: flex; gap: 0.7rem; align-items: flex-end; }
.compose textarea { flex: 1; }

/* Wall */
.post {
  background: var(--dark-panel);
  border: 1px solid var(--dark-border);
  border-radius: 14px; padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
}
.post-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
.ghost-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--dark-panel-2);
  border: 1px dashed var(--dark-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.post-author { font-weight: 600; font-size: 0.9rem; color: var(--accent-2); }
.post-author.is-me { color: var(--text-dark-muted); font-style: italic; }
.post-time { font-size: 0.72rem; color: var(--text-dark-muted); }
.post-content { font-size: 1rem; line-height: 1.5; white-space: pre-wrap; margin-bottom: 0.8rem; }

.post-actions { display: flex; gap: 0.5rem; border-top: 1px solid var(--dark-border); padding-top: 0.7rem; }
.react-btn {
  background: transparent; border: 1px solid var(--dark-border);
  color: var(--text-dark-muted); border-radius: 8px;
  padding: 0.35rem 0.8rem; cursor: pointer; font: 600 0.85rem 'Inter', sans-serif;
  transition: all 0.15s;
}
.react-btn:hover { border-color: var(--accent); color: var(--text-dark-primary); }
.react-btn.active-like { background: rgba(139,92,246,0.2); border-color: var(--accent); color: var(--accent-2); }
.react-btn.active-dislike { background: rgba(239,68,68,0.15); border-color: var(--blood); color: var(--blood); }

.comments { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.comment {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: var(--dark-panel-2); border-radius: 10px; padding: 0.55rem 0.8rem;
}
.comment .ghost-avatar { width: 28px; height: 28px; font-size: 0.85rem; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-author { font-size: 0.78rem; font-weight: 600; color: var(--accent-2); }
.comment-author.is-me { color: var(--text-dark-muted); font-style: italic; }
.comment-text { font-size: 0.88rem; }
.comment-form { display: flex; gap: 0.5rem; margin-top: 0.7rem; }
.comment-form input { flex: 1; padding: 0.45rem 0.7rem; font-size: 0.88rem; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 5, 10, 0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  width: 100%; max-width: 440px;
  background: var(--light-bg); color: var(--text-light-primary);
  border-radius: 16px; padding: 1.8rem; position: relative;
  max-height: 90vh; overflow-y: auto;
}
.modal input, .modal textarea {
  background: var(--light-panel); border-color: var(--light-border);
  color: var(--text-light-primary);
}
.modal .hint { color: var(--text-light-muted); }
.modal-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  background: none; border: none; font-size: 1rem; cursor: pointer;
  color: var(--text-light-muted);
}
.modal-profile { text-align: center; margin-bottom: 1.2rem; }
.modal-profile h3 { margin-top: 0.6rem; }
.modal-comment {
  border-top: 1px solid var(--light-border); padding-top: 1rem;
}
.modal-comment h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.modal-comment textarea { margin: 0.5rem 0; }
.modal-actions { margin-top: 1.2rem; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .my-world { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--light-border); }
  .dark-side { max-height: none; padding: 1.4rem 1.2rem; }
}
