:root {
  --bg: #070b13;
  --surface: #0d1422;
  --card: #111827;
  --card-2: #151f31;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --text: #f3f4f6;
  --muted: #8b95a7;
  --border: #233044;
  --input: #070b18;
  --danger: #fb7185;
  --ok: #34d399;
  --shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, .14), transparent 30rem),
    linear-gradient(180deg, #080d18 0%, var(--bg) 42rem);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 700px) 320px;
  gap: 28px;
  max-width: 1360px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 20px;
}

.left-rail, .right-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 34px 6px;
}

.brand::before {
  content: "";
  width: 14px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(56, 189, 248, .55);
}

nav { display: grid; gap: 10px; }
nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  color: var(--text);
  font-weight: 800;
  transition: background .18s ease, transform .18s ease, color .18s ease;
}
nav a:hover {
  background: rgba(56, 189, 248, .12);
  color: var(--text);
  transform: translateX(3px);
}
.primary-link { background: rgba(56, 189, 248, .16); color: var(--accent); }

.content {
  min-height: 100vh;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: rgba(7, 11, 19, .62);
}

.page-title {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(7, 11, 19, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 24px 28px;
}
.page-title h1 { margin: 0 0 16px; font-size: 30px; line-height: 1; }
.page-title p { margin: 0; color: var(--muted); }

.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tabs a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  background: rgba(17, 24, 39, .55);
}
.tabs .active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #00111d;
  border-color: transparent;
}

.composer, .auth-card, .guest-panel, .settings-form, .profile-head, .side-panel.wide {
  background: linear-gradient(180deg, rgba(21, 31, 49, .94), rgba(13, 20, 34, .94));
  border: 1px solid var(--border);
  border-radius: 24px;
  margin: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.composer-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
}

input, textarea, select {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(56, 189, 248, .7);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, .1);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.composer textarea {
  border: 0;
  background: transparent;
  font-size: 22px;
  padding-top: 8px;
}

.composer-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tool-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  background: rgba(7, 11, 24, .72);
  cursor: pointer;
  overflow: hidden;
}
.tool-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.counter { color: var(--muted); font-weight: 800; min-width: 36px; text-align: center; }

.btn, button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 24, 39, .8);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  min-height: 42px;
  padding: 0 18px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.btn:hover, button:hover { transform: translateY(-1px); border-color: var(--accent); }
.primary, .btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #00111d;
  border-color: transparent;
}
.danger { color: var(--danger); border-color: rgba(251, 113, 133, .45); }

.feed { display: grid; }
.vibe-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 20, 34, .62);
  padding: 24px 28px;
  transition: background .18s ease;
}
.vibe-card:hover { background: rgba(17, 24, 39, .88); }
.avatar, .profile-avatar, .mini-user img, .user-row img, .notice img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(56, 189, 248, .85);
  background: var(--card);
}
.profile-avatar { width: 112px; height: 112px; }
.vibe-main p { margin: 8px 0 14px; line-height: 1.55; overflow-wrap: anywhere; font-size: 18px; }
.vibe-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 15px;
}
.vibe-meta .display { color: var(--text); font-weight: 900; }
.badge {
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}
.vibe-media {
  width: 100%;
  max-height: 560px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 22px;
  cursor: zoom-in;
}
.url-preview {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin: 10px 0 14px;
  background: var(--input);
}
.url-preview span { color: var(--muted); overflow-wrap: anywhere; }

.vibe-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.vibe-actions button, .vibe-actions a {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  padding: 0 8px;
}
.vibe-actions button:hover, .vibe-actions a:hover, .vibe-actions .active {
  background: rgba(56, 189, 248, .1);
  color: var(--accent);
}

.inline-reply {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(7, 11, 24, .68);
}
.inline-reply textarea { min-height: 90px; }
.reply-tools { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin-top: 10px; }
.login-reply { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 800; }

.right-rail .search-mini input { margin-bottom: 20px; min-height: 54px; }
.side-panel {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(17, 24, 39, .72);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.side-panel h3 { margin: 0 0 14px; font-size: 22px; }
.side-panel a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; color: var(--text); }
.mini-user, .user-row { display: flex !important; justify-content: flex-start !important; align-items: center; gap: 12px; }
.mini-user small, .user-row small, .notice small { display: block; color: var(--muted); }

.auth-card { max-width: 520px; margin: 46px auto; }
.auth-card h1 { margin-top: 0; font-size: 34px; }
.auth-card form, .settings-form { display: grid; gap: 14px; }
.avatar-picker {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(56, 189, 248, .45);
  border-radius: 20px;
  padding: 16px;
  color: var(--muted);
  font-weight: 800;
  background: rgba(56, 189, 248, .06);
}

.flash {
  margin: 20px 24px 0;
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 14px 16px;
  font-weight: 800;
  background: rgba(17, 24, 39, .88);
}
.flash.ok { border-color: rgba(52, 211, 153, .45); color: var(--ok); }
.flash.error { border-color: rgba(251, 113, 133, .45); color: var(--danger); }

.profile-head {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 20px;
  align-items: start;
}
.profile-head h1 { margin: 0 0 6px; font-size: 32px; }
.notice, .message-row, .admin-row, .user-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 24px; }
.admin-grid article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
}
.admin-grid strong { display: block; font-size: 30px; color: var(--accent); }
.admin-row form { display: flex; gap: 8px; align-items: center; }
.pill:not(:empty) {
  background: var(--danger);
  color: white;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(2, 6, 23, .92);
  display: grid;
  place-items: center;
  padding: 30px;
}
.media-modal img { max-width: min(100%, 1000px); max-height: 86vh; border-radius: 22px; }
.media-modal button { position: fixed; top: 20px; right: 20px; font-size: 28px; width: 48px; }
[hidden] { display: none !important; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .right-rail { display: none; }
}
@media (max-width: 760px) {
  .app-shell { display: block; padding: 0; }
  .left-rail {
    position: sticky;
    z-index: 10;
    height: auto;
    background: rgba(7, 11, 19, .96);
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
  }
  .brand { margin: 0 0 10px; font-size: 26px; }
  nav { display: flex; overflow-x: auto; gap: 6px; }
  nav a { white-space: nowrap; min-height: 40px; padding: 0 12px; }
  .content { border: 0; }
  .page-title { padding: 20px 18px; }
  .composer, .auth-card, .guest-panel, .settings-form, .profile-head { margin: 16px; border-radius: 20px; }
  .composer-row { grid-template-columns: 44px 1fr; }
  .composer-tools { flex-wrap: wrap; justify-content: flex-start; }
  .vibe-card { grid-template-columns: 44px 1fr; padding: 18px; }
  .avatar { width: 44px; height: 44px; }
  .vibe-actions { grid-template-columns: repeat(2, 1fr); }
  .profile-head { grid-template-columns: 78px 1fr; }
  .profile-avatar { width: 78px; height: 78px; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
}
