/* IrohaVerse - lobby edition
   Dark navy/purple glassmorphism, pink/lavender/cyan accents. */

:root {
  --bg: #080816;
  --bg-2: #0d0d24;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.13);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f8f7ff;
  --muted: #b9b6d3;
  --pink: #ff8fd8;
  --lavender: #b79cff;
  --cyan: #8be9ff;
  --danger: #ff6b8a;
  --success: #7cffb2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --glow: 0 0 24px rgba(183, 156, 255, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255, 143, 216, 0.14), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(139, 233, 255, 0.12), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(183, 156, 255, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* floating background orbs */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.bg-orbs span {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5;
  animation: float 18s ease-in-out infinite;
}
.bg-orbs span:nth-child(1) { width: 340px; height: 340px; left: -60px; top: 8%;
  background: radial-gradient(circle, var(--pink), transparent 70%); }
.bg-orbs span:nth-child(2) { width: 300px; height: 300px; right: -40px; top: 30%;
  background: radial-gradient(circle, var(--cyan), transparent 70%); animation-delay: -6s; }
.bg-orbs span:nth-child(3) { width: 380px; height: 380px; left: 40%; bottom: -80px;
  background: radial-gradient(circle, var(--lavender), transparent 70%); animation-delay: -12s; }
@keyframes float { 0%,100% { transform: translateY(0) translateX(0); } 50% { transform: translateY(-30px) translateX(20px); } }

/* ---------- navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(8, 8, 22, 0.6);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.3px; }
.brand-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--lavender), var(--cyan));
  box-shadow: var(--glow);
}
.brand-text {
  background: linear-gradient(120deg, var(--pink), var(--lavender), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: 0.92rem; color: var(--muted);
  transition: 0.2s; border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); background: var(--surface-strong); border-color: var(--border); }

/* ---------- layout ---------- */
.container { width: min(920px, 92vw); margin: 28px auto 60px; }
.footer { text-align: center; color: var(--muted); padding: 30px 12px 40px; font-size: 0.85rem; }

.section-title { margin: 26px 4px 12px; font-size: 1.1rem; color: var(--muted); font-weight: 600; letter-spacing: 0.4px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 20px;
  margin-bottom: 18px;
}
.empty-card { text-align: center; padding: 48px 20px; }

/* ---------- buttons / pills / tags ---------- */
.btn {
  display: inline-block; cursor: pointer; border: none;
  padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 0.95rem;
  color: #14121f; background: linear-gradient(120deg, var(--pink), var(--lavender));
  box-shadow: var(--glow); transition: 0.2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn.small { padding: 8px 14px; font-size: 0.85rem; }
.btn.block { width: 100%; }
.btn.ghost {
  background: var(--surface-strong); color: var(--text); border: 1px solid var(--border); box-shadow: none;
}
.btn.ghost:hover { background: var(--surface); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); transform: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 0.85rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem;
  background: rgba(183, 156, 255, 0.16); color: var(--lavender); border: 1px solid rgba(183, 156, 255, 0.3);
}
.tag.staff { background: rgba(255, 143, 216, 0.16); color: var(--pink); border-color: rgba(255, 143, 216, 0.35); }
.tag.readonly, .tag.view { background: rgba(139, 233, 255, 0.14); color: var(--cyan); border-color: rgba(139, 233, 255, 0.3); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hint { font-size: 0.8rem; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); }
.back-link:hover { color: var(--text); }

/* ---------- gradient placeholders ---------- */
.grad-1 { background: linear-gradient(135deg, #ff8fd8, #b79cff); }
.grad-2 { background: linear-gradient(135deg, #b79cff, #8be9ff); }
.grad-3 { background: linear-gradient(135deg, #ff8fd8, #ffb3c1); }
.grad-4 { background: linear-gradient(135deg, #8be9ff, #b79cff); }
.grad-5 { background: linear-gradient(135deg, #ffb3e6, #8be9ff); }
.grad-6 { background: linear-gradient(135deg, #b79cff, #ff8fd8); }

/* ---------- avatar ---------- */
.avatar {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.25); box-shadow: var(--glow);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; }
.avatar-initial { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #1a1730; z-index: 1; }

/* ---------- media ---------- */
.media-wrap {
  position: relative; width: 100%; border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 4 / 5; display: block;
}
.media-wrap.tall { aspect-ratio: 4 / 5; }
.media-img, .media-video { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 2; }
.media-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1;
  color: rgba(20, 18, 40, 0.8); font-weight: 700; letter-spacing: 0.5px; text-transform: lowercase;
}
.media-fallback .media-img, .media-fallback .media-video { display: none; }
.media-fallback .media-placeholder { z-index: 3; }

/* ---------- feed / posts ---------- */
.post-card { padding: 16px; }
.post-card.single { padding: 20px; }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-user { font-weight: 700; }
.post-user:hover { color: var(--pink); }
.post-meta { font-size: 0.78rem; color: var(--muted); }
.post-actions { display: flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; }
.post-caption { margin: 6px 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tags .tag { background: var(--surface); color: var(--cyan); border-color: var(--border); }

.feed-grid { display: grid; gap: 18px; }
.view-post { display: inline-block; margin-top: 10px; color: var(--lavender); font-weight: 600; }
.view-post:hover { color: var(--pink); }

.comment-preview { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }
.comment-preview b { color: var(--text); }

/* ---------- comments ---------- */
.comments { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.comment-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 12px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .avatar { width: 34px; height: 34px; }
.comment-user { font-weight: 700; margin-right: 6px; }
.comment-text { color: var(--muted); }
.comment-form { display: flex; gap: 8px; }
.comment-form input, .chat-input input, .auth-form input {
  flex: 1; padding: 11px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); outline: none;
}
.comment-form input:focus, .chat-input input:focus, .auth-form input:focus { border-color: var(--lavender); box-shadow: var(--glow); }

/* ---------- profile ---------- */
.profile-card { padding: 0; overflow: hidden; }
.profile-hero { height: 180px; position: relative; }
.profile-hero img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.profile-head { display: flex; gap: 18px; padding: 14px 20px 20px; align-items: flex-start; }
.profile-head .avatar { width: 104px; height: 104px; border-width: 3px; margin-top: -60px;
  box-shadow: 0 0 0 4px var(--bg-2), var(--glow); flex: 0 0 auto; }
.profile-info { padding-top: 6px; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-name-row h1 { margin: 0; font-size: 1.5rem; }
.verified { color: var(--cyan); }
.profile-handle { margin-top: 2px; }
.profile-stats { display: flex; gap: 18px; margin: 10px 0; flex-wrap: wrap; }
.profile-stats b { color: var(--text); }
.profile-bio { color: var(--muted); max-width: 60ch; }

.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-item { display: block; }
.grid-media { aspect-ratio: 1 / 1; border-radius: var(--radius-sm); }

/* ---------- friends ---------- */
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.friend-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px; }
.friend-card .avatar { width: 64px; height: 64px; }
.friend-name { font-weight: 700; }
.friend-sub { font-size: 0.8rem; color: var(--muted); }
.friend-actions { display: flex; gap: 8px; margin-top: 6px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.idle { background: var(--lavender); }

/* ---------- chats inbox ---------- */
.chat-room-list { display: grid; gap: 12px; }
.chat-room {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); transition: 0.2s;
}
.chat-room:hover { background: var(--surface-strong); transform: translateY(-1px); }
.room-avatar { width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto; box-shadow: var(--glow); }
.room-main { flex: 1; min-width: 0; }
.room-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.room-preview { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { text-align: right; font-size: 0.75rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.unread { background: var(--pink); color: #14121f; border-radius: 999px; padding: 1px 8px; font-weight: 800; font-size: 0.72rem; }

/* ---------- chat room (live) ---------- */
.chat-card { padding: 0; overflow: hidden; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--surface-strong);
}
.chat-title { display: flex; align-items: center; gap: 12px; }
.chat-title h1 { margin: 0; font-size: 1.15rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.chat-stream {
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  min-height: 320px; max-height: 60vh; overflow-y: auto;
}
.bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 16px; background: var(--surface-strong);
  border: 1px solid var(--border); animation: pop 0.25s ease;
}
.bubble .b-user { font-size: 0.75rem; color: var(--lavender); font-weight: 700; margin-bottom: 2px; }
.bubble .b-user .role { color: var(--cyan); font-weight: 600; }
.bubble .b-time { font-size: 0.68rem; color: var(--muted); margin-top: 3px; text-align: right; }
.bubble.mod { border-color: rgba(255, 143, 216, 0.35); }
.bubble.self { align-self: flex-end; background: linear-gradient(120deg, rgba(255,143,216,0.22), rgba(183,156,255,0.22)); }
.sys-line { align-self: center; font-size: 0.78rem; color: var(--muted); padding: 4px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.typing-line { align-self: flex-start; font-size: 0.78rem; color: var(--muted); font-style: italic; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chat-input { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* ---------- auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 20px 0; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.auth-card h1 { margin: 4px 0; }
.auth-form { display: grid; gap: 14px; margin-top: 16px; }
.auth-form label { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin: 12px 0; font-size: 0.9rem; }
.alert.error { background: rgba(255, 107, 138, 0.14); border: 1px solid rgba(255, 107, 138, 0.4); color: #ffd0da; }
.alert.notice { background: rgba(139, 233, 255, 0.12); border: 1px solid rgba(139, 233, 255, 0.3); color: #d6f6ff; }

/* ---------- admin ---------- */
.admin-flag { text-align: center; border-color: rgba(124, 255, 178, 0.35); }
.admin-flag-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px; font-weight: 800; letter-spacing: 0.5px;
  background: rgba(124, 255, 178, 0.16); color: var(--success); border: 1px solid rgba(124, 255, 178, 0.4);
}
.admin-flag h1 { margin: 12px 0 4px; }
.flag-box {
  margin: 18px auto; max-width: 620px; padding: 16px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35); border: 1px dashed rgba(124, 255, 178, 0.5);
}
.flag-label { display: block; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.flag { font-family: "Consolas", "Courier New", monospace; font-size: 1.15rem; color: var(--success); word-break: break-all; }
.logout-form { margin-top: 8px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.admin-card-head h3 { margin: 0; font-size: 1.02rem; }
.admin-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.admin-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 0.88rem; }
.badge { font-size: 0.72rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-strong); color: var(--muted); border: 1px solid var(--border); }
.badge.ok { color: var(--success); border-color: rgba(124, 255, 178, 0.35); }
.admin-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 40px 20px 30px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 8px 0;
  background: linear-gradient(120deg, var(--pink), var(--lavender), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 56ch; margin: 10px auto 22px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 26px; }
.feature { padding: 18px; text-align: left; }
.feature .emoji { font-size: 1.6rem; }
.feature h3 { margin: 8px 0 4px; font-size: 1.05rem; }
.feature p { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ---------- music toggle ---------- */
.music-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; cursor: pointer; border: 1px solid var(--border);
  background: rgba(8, 8, 22, 0.72); backdrop-filter: blur(10px); color: var(--text);
  box-shadow: var(--shadow); font-weight: 600; font-size: 0.88rem; transition: 0.2s;
}
.music-toggle:hover { transform: translateY(-1px); border-color: var(--lavender); }
.music-toggle.playing { color: var(--pink); border-color: rgba(255, 143, 216, 0.5); box-shadow: var(--glow); }
.music-note { animation: none; }
.music-toggle.playing .music-note { animation: bob 1s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .admin-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: repeat(3, 1fr); }
  .profile-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .profile-head .avatar { margin-top: -56px; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 7px 10px; font-size: 0.82rem; }
}
@media (max-width: 460px) {
  .brand-text { display: none; }
}
