:root {
  --bg: #0b0d14;
  --bg-elev: #121622;
  --bg-card: rgba(20, 25, 38, 0.85);
  --bg-card-hover: rgba(25, 31, 48, 0.96);
  --bg-input: rgba(11, 14, 22, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --text-muted: #949db5;
  --text-dim: #677089;
  --accent: #5865f2;
  --accent-hover: #6c77f6;
  --accent-soft: rgba(88, 101, 242, 0.16);
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 45% at 20% -5%, rgba(88, 101, 242, 0.18), transparent 65%),
    radial-gradient(50% 40% at 85% 5%, rgba(139, 92, 246, 0.12), transparent 65%);
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden {
  display: none !important;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 13, 20, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.brand-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #a5b4fc;
  background: var(--accent-soft);
  border: 1px solid rgba(88, 101, 242, 0.32);
  padding: 3px 8px;
  border-radius: 999px;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
}

.user-pill img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.user-pill-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-pill-name {
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
}

.skeleton-btn {
  width: 165px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-discord {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.32);
}

.btn-discord:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* Main / Hero */
.main {
  padding-top: 34px;
  padding-bottom: 64px;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-sub strong {
  color: var(--text);
  font-weight: 600;
}

.progress-card {
  min-width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.84rem;
}

.progress-label {
  color: var(--text-muted);
}

.progress-value {
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: #a5b4fc;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  transition: width 0.35s ease;
}

/* Alert Banner */
.alert-banner {
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.alert-banner.warn {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.alert-banner.error {
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.search-wrap {
  position: relative;
  flex: 1 1 280px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  border-color: rgba(88, 101, 242, 0.65);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.filter-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.filter-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-tab.active {
  background: var(--accent);
  color: #fff;
}

.results-meta {
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
}

/* Members Grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.member-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.member-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.member-card.has-review {
  border-color: rgba(16, 185, 129, 0.34);
}

.member-card.is-self {
  border-color: rgba(88, 101, 242, 0.42);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #1b2030;
  border: 2px solid rgba(255, 255, 255, 0.08);
  display: block;
}

.member-card.has-review .avatar {
  border-color: var(--green);
}

.member-card.is-self .avatar {
  border-color: var(--accent);
}

.order-badge {
  position: absolute;
  bottom: -3px;
  right: -4px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  background: #0e121c;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 1px 5px;
  border-radius: 6px;
}

.member-meta {
  flex: 1;
  min-width: 0;
}

.member-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.member-nick {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.member-username {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.member-id-btn {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.member-id-btn:hover {
  color: var(--text-muted);
  border-color: var(--border-strong);
}

/* Note area */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-textarea {
  width: 100%;
  min-height: 78px;
  max-height: 240px;
  resize: vertical;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.note-textarea:focus {
  border-color: rgba(88, 101, 242, 0.65);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.note-textarea::placeholder {
  color: var(--text-dim);
}

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

.char-count {
  font-size: 0.74rem;
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
}

.char-count.warn {
  color: var(--amber);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Saved review preview (only visible to author) */
.saved-box {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #6ee7b7;
}

.saved-badge.edited {
  color: #fcd34d;
}

.saved-time {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.saved-text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

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

.saved-privacy {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Locked / CTA states */
.locked-box {
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.self-box {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(88, 101, 242, 0.3);
  background: var(--accent-soft);
  padding: 11px 12px;
  font-size: 0.83rem;
  color: #c7d2fe;
  font-weight: 500;
}

/* Empty & Footer */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  background: #171c2b;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.87rem;
  font-weight: 500;
  animation: toastIn 0.2s ease;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.55);
}

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

@media (max-width: 640px) {
  .members-grid {
    grid-template-columns: 1fr;
  }
  .topbar-inner {
    min-height: 60px;
  }
  .user-pill-sub {
    display: none;
  }
  .results-meta {
    margin-left: 0;
    width: 100%;
  }
}
