:root {
  --bg: #0b1020;
  --card: #101a33;
  --card2: #0f1830;
  --text: #e7ecff;
  --muted: #94a3c7;
  --line: rgba(255, 255, 255, .08);
  --btn: #2a5cff;
  --danger: #ff3b3b;
  --shadow: 0 12px 30px rgba(0, 0, 0, .35);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(42, 92, 255, .35), transparent 60%),
              radial-gradient(900px 500px at 80% 0%, rgba(0, 255, 170, .18), transparent 60%),
              var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;
  scroll-behavior: smooth;
}

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

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
}

.small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(11, 16, 32, .6);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  transition: var(--transition);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 1.2em;
  transition: var(--transition);
}

.brand:hover {
  opacity: .8;
}

.nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 10px;
  border-radius: 999px;
  transition: var(--transition);
  position: relative;
}

.nav a:hover {
  background: rgba(255, 255, 255, .06);
  transform: translateY(-1px);
}

/* Cards */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 12px 0;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
}

.card__title {
  font-weight: 800;
  margin-bottom: 10px;
  font-size: 1.3em;
}

/* Buttons */
.btn {
  background: var(--btn);
  border: 0;
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition);
  font-size: 14px;
}

.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 92, 255, .3);
}

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

.btn--ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .15);
}

.btn--danger {
  background: var(--danger);
}

.btn--danger:hover {
  box-shadow: 0 4px 12px rgba(255, 59, 59, .3);
}

.btn--primary {
  background: linear-gradient(135deg, #2a5cff, #00ffaa);
  color: #0b1020;
  font-weight: 900;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0, 255, 170, .25);
}

.btn--primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(0, 255, 170, .35);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Forms */
.auth {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
  color: var(--text);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

input:focus, textarea:focus {
  border-color: rgba(42, 92, 255, .5);
  background: rgba(0, 0, 0, .35);
  box-shadow: 0 0 0 3px rgba(42, 92, 255, .1);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  cursor: pointer;
  margin-right: 10px;
  transition: var(--transition);
}

input[type="file"]::-webkit-file-upload-button:hover {
  background: rgba(255, 255, 255, .1);
}

label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: -5px;
}

/* Flash messages */
.flashbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  animation: slideDown .3s ease-out;
}

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

.flash {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  animation: fadeIn .3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.flash--err {
  border-color: rgba(255, 59, 59, .5);
  background: rgba(255, 59, 59, .1);
}

.flash--ok {
  border-color: rgba(0, 255, 170, .35);
  background: rgba(0, 255, 170, .1);
}

/* Posts */
.post {
  overflow: hidden;
  animation: fadeInUp .4s ease-out;
}

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

.post__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.userpill {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.userpill:hover {
  opacity: .8;
}

.userpill__name {
  font-weight: 800;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .08);
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
  transition: var(--transition);
}

.avatar:hover {
  border-color: rgba(255, 255, 255, .2);
  transform: scale(1.05);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar__ph {
  font-weight: 900;
  font-size: 14px;
}

.avatar--big {
  width: 96px;
  height: 96px;
  border-radius: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge svg {
  width: 18px;
  height: 18px;
  fill: #2a5cff;
  transition: var(--transition);
}

.badge__check {
  fill: #00ffaa;
}

.badge--verified {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  vertical-align: middle;
}

.badge--verified svg {
  width: 16px;
  height: 16px;
}

.post__body {
  margin-top: 10px;
}

.post__text {
  white-space: pre-wrap;
  line-height: 1.6;
  word-wrap: break-word;
}

.post__imgwrap {
  display: block;
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  transition: var(--transition);
}

.post__imgwrap:hover {
  border-color: rgba(255, 255, 255, .15);
  transform: scale(1.01);
}

.post__imgwrap img {
  width: 100%;
  display: block;
  transition: var(--transition);
}

.post__imgwrap:hover img {
  transform: scale(1.02);
}

.post__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

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

.reactbtn {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: var(--transition);
  font-size: 14px;
}

.reactbtn:hover {
  background: rgba(255, 255, 255, .1);
  transform: translateY(-2px);
}

.reactbtn.active {
  border-color: rgba(42, 92, 255, .8);
  box-shadow: 0 0 0 2px rgba(42, 92, 255, .18) inset;
  background: rgba(42, 92, 255, .15);
}

.cnt {
  font-family: var(--mono);
  opacity: .9;
  font-size: 13px;
}

.hidden {
  display: none;
}

/* Comments */
.comments {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  animation: slideDown .3s ease-out;
}

.comment {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, .16);
  margin: 8px 0;
  transition: var(--transition);
}

.comment:hover {
  background: rgba(0, 0, 0, .22);
  border-color: rgba(255, 255, 255, .12);
}

.comment__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.comment__text {
  white-space: pre-wrap;
  margin-top: 6px;
  line-height: 1.5;
  word-wrap: break-word;
}

.reply {
  margin-left: 18px;
  border-left: 2px solid rgba(42, 92, 255, .25);
  padding-left: 12px;
}

.commentform {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* Lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listItem {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: var(--transition);
}

.listItem:hover {
  background: rgba(255, 255, 255, .06);
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, .12);
}

.listItem--row {
  align-items: flex-start;
}

/* Profile */
.profileGrid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

@media (max-width: 820px) {
  .profileGrid {
    grid-template-columns: 1fr;
  }
}

.profileLeft {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.profileRight {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profileActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profileAction {
  margin-top: 18px;
  display: flex;
  justify-content: flex-start;
}

/* Chat */
.chatbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
  scroll-behavior: smooth;
}

.chatbox::-webkit-scrollbar {
  width: 8px;
}

.chatbox::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, .2);
  border-radius: 4px;
}

.chatbox::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 4px;
}

.chatbox::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .2);
}

.msg {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  animation: fadeInUp .3s ease-out;
  word-wrap: break-word;
}

.msg--me {
  margin-left: auto;
  background: rgba(42, 92, 255, .10);
  border-color: rgba(42, 92, 255, .25);
}

.msg__meta {
  font-size: 11px;
  margin-bottom: 4px;
  opacity: .7;
}

.msg__text {
  line-height: 1.5;
}

.chatinput {
  flex: 1;
}

/* Grid */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 980px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.footer {
  padding-bottom: 24px;
  text-align: center;
  opacity: .6;
}

/* Dot indicator */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ff3b3b;
  margin-left: 6px;
  box-shadow: 0 0 0 2px rgba(255, 59, 59, .18);
  vertical-align: middle;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

/* Post form */
.postform {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Loading state */
.loading {
  opacity: .6;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
  .wrap {
    padding: 10px;
  }
  
  .card {
    padding: 12px;
  }
  
  .nav {
    gap: 8px;
  }
  
  .nav a {
    padding: 6px 8px;
    font-size: 14px;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .msg {
    max-width: 90%;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid rgba(42, 92, 255, .6);
  outline-offset: 2px;
}
