:root {
  --psyduck-yellow: #F5D442;
  --psyduck-dark: #D4A017;
  --psyduck-cream: #FFF8DC;
  --psyduck-blue: #4A90D9;
  --psyduck-red: #E74C3C;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #0f3460;
  --text-light: #eaeaea;
  --text-muted: #a0a0a0;
  --border-color: #2a2a4a;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
}

a {
  color: var(--psyduck-yellow);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: var(--psyduck-dark);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Navbar */
.navbar {
  background: var(--bg-card);
  border-bottom: 3px solid var(--psyduck-yellow);
  padding: 12px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5em;
  font-weight: bold;
  color: var(--psyduck-yellow);
}

.navbar-brand:hover {
  text-decoration: none;
  color: var(--psyduck-dark);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.navbar-links a {
  color: var(--text-light);
  font-size: 0.95em;
}

.navbar-links a:hover {
  color: var(--psyduck-yellow);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1.2em;
  color: var(--psyduck-yellow);
}

.card-narrow {
  max-width: 450px;
  margin: 40px auto;
}

.card-medium {
  max-width: 550px;
  margin: 30px auto;
}

.card-wide {
  max-width: 700px;
  margin: 20px auto;
}

.card-flush {
  padding: 0;
}

.card-centered {
  text-align: center;
}

.card-offset-top {
  margin-top: 40px;
}

.card-title-spaced {
  margin-bottom: 20px;
}

.card-title-tight {
  margin-bottom: 16px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--psyduck-yellow);
  color: #1a1a2e;
}

.btn-primary:hover {
  background: var(--psyduck-dark);
  color: white;
  text-decoration: none;
}

.btn-danger {
  background: var(--psyduck-red);
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8em;
}

.btn-full {
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.9em;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 1em;
}

.form-control:focus {
  outline: none;
  border-color: var(--psyduck-yellow);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-divider {
  border-top: 1px solid var(--border-color);
  margin: 24px 0 16px;
}

.form-section-title {
  color: var(--psyduck-yellow);
  font-size: 1.1em;
  margin-bottom: 6px;
}

.form-section-desc {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-bottom: 16px;
}

.textarea-compact {
  min-height: 60px;
}

.is-hidden {
  display: none;
}

.text-center {
  text-align: center;
}

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

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

.page-title {
  color: var(--psyduck-yellow);
  margin-bottom: 20px;
}

.auth-footer {
  margin-top: 14px;
  text-align: center;
  color: var(--text-muted);
}

.brand-logo-sm {
  width: 36px;
  height: 36px;
}

.error-logo {
  width: 80px;
  height: 80px;
}

.error-title {
  color: var(--psyduck-yellow);
  font-size: 2em;
}

.error-message {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.flex-grow {
  flex: 1;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--psyduck-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--bg-dark);
  font-size: 1em;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  font-size: 2em;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.8em;
}

.avatar-chat-header {
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.avatar-edit-preview {
  margin: 0 auto 12px;
}

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

/* Thread list */
.thread-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.thread-item:hover {
  background: rgba(245, 212, 66, 0.05);
}

.thread-item:last-child {
  border-bottom: none;
}

.thread-meta {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-top: 4px;
}

.thread-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.thread-page-title {
  color: var(--psyduck-yellow);
}

.thread-title-link {
  font-size: 1.1em;
  font-weight: 600;
}

.thread-body-actions {
  margin-top: 16px;
}

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

.content-body img {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 8px;
}

.thread-votes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.thread-score {
  color: var(--text-muted);
  font-size: 0.9em;
  font-weight: 600;
}

.section-heading {
  margin: 20px 0 12px;
  color: var(--text-muted);
}

.item-title {
  font-weight: 600;
}

/* Messages */
.message-bubble {
  max-width: 70%;
  padding: 10px 16px;
  border-radius: 18px;
  line-height: 1.5;
}

.message-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 70%;
}

.message-row-sent .message-stack {
  align-items: flex-end;
}

.message-stack .message-bubble {
  max-width: 100%;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
}

.message-row-sent {
  justify-content: flex-end;
}

.message-row-received {
  justify-content: flex-start;
}

.message-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.message-sent {
  background: var(--psyduck-yellow);
  color: var(--bg-dark);
  border-bottom-right-radius: 4px;
}

.message-received {
  background: var(--bg-input);
  color: var(--text-light);
  border-bottom-left-radius: 4px;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
}

.message-input {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

.message-input input {
  flex: 1;
}

.conversation-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.profile-card-anchor {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

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

.partner-name {
  font-weight: 600;
  color: var(--text-light);
}

.partner-joined {
  color: var(--text-muted);
  font-size: 0.8em;
  margin-top: 2px;
}

.member-badge {
  display: inline-block;
  font-size: 0.75em;
  vertical-align: middle;
  margin-left: 6px;
}

.empty-message {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.pokemon-card {
  position: absolute;
  z-index: 200;
  top: calc(100% + 2px);
  left: -8px;
  width: 320px;
  padding: 12px;
  background: linear-gradient(135deg, #ffe763 0%, #f4c322 45%, #d99518 100%);
  border: 4px solid #ffcf22;
  border-radius: 18px;
  color: #1b1c22;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.52), inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  isolation: isolate;
  opacity: 0;
  transform: translateY(-4px);
}

.pokemon-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  z-index: 0;
  border-radius: 12px;
  background:
    radial-gradient(circle at 25% 30%, rgba(255, 255, 255, 0.45), transparent 28%),
    linear-gradient(180deg, #74bee9 0%, #3994cf 55%, #1670ad 100%);
}

.pokemon-card > * {
  position: relative;
  z-index: 1;
}

.pokemon-card-show {
  animation: pokemon-card-fade-in 160ms ease-out forwards;
}

.pokemon-card-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(35, 28, 16, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  color: #2e2b29;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

.pokemon-card-close:hover {
  background: rgba(255, 255, 255, 0.9);
}

.pokemon-card-name {
  flex: 1;
  font-weight: 800;
  font-size: 1.35em;
  letter-spacing: -0.02em;
}

.pokemon-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pokemon-card-stage {
  padding: 2px 8px;
  background: linear-gradient(180deg, #f4f0e4, #c8beb0);
  border: 1px solid #80766b;
  border-radius: 999px;
  color: #2e2b29;
  font-size: 0.72em;
  font-style: italic;
  font-weight: 800;
}

.pokemon-card-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border: 5px solid #e9e3d6;
  border-radius: 4px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9), transparent 10%),
    radial-gradient(circle at 80% 30%, rgba(255, 230, 92, 0.9), transparent 12%),
    #fff7cf;
  display: block;
  box-shadow: inset 0 0 0 1px #655e57;
}

.pokemon-card-detail {
  margin: 3px 8px 16px;
  padding: 2px 8px;
  background: #e9e3d6;
  border: 1px solid #8d8478;
  color: #36322e;
  font-size: 0.68em;
  text-align: center;
}

.pokemon-card-type {
  margin: 0 8px 6px;
  padding: 3px 10px;
  font-size: 0.8em;
  font-weight: 700;
  text-align: center;
  color: #36322e;
}

.pokemon-card-ability {
  margin: 0 0 6px;
  min-height: 54px;
  padding: 0 14px;
  background: transparent;
  border-radius: 0;
  font-size: 1em;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.pokemon-card-thread {
  margin-top: 10px;
  padding: 7px 8px;
  background: #efe7da;
  border: 1px solid #8d8478;
  border-radius: 6px;
  font-size: 0.76em;
  font-weight: 700;
}

.pokemon-card-thread a {
  color: #4d2800;
  text-decoration: underline;
}

@keyframes pokemon-card-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mentions */
.mention {
  color: var(--psyduck-blue);
  font-weight: 600;
}

/* Conversation list */
.conversation-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.conversation-item:hover {
  background: rgba(245, 212, 66, 0.05);
  text-decoration: none;
}

.conversation-preview {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-top: 2px;
}

.conversation-count {
  color: var(--text-muted);
  font-size: 0.8em;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(231, 76, 60, 0.2);
  border: 1px solid var(--psyduck-red);
  color: #ff6b6b;
}

.alert-success {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid #2ecc71;
  color: #2ecc71;
}

/* Unread badge */
.badge {
  background: var(--psyduck-red);
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  font-weight: bold;
}

/* Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.profile-info h2 {
  color: var(--psyduck-yellow);
}

.profile-info p {
  color: var(--text-muted);
}

.profile-bio {
  margin-top: 8px;
  color: var(--text-light);
}

.profile-joined {
  margin-top: 4px;
  font-size: 0.85em;
}

.profile-actions {
  display: flex;
  gap: 10px;
}

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

@media (max-width: 640px) {
  .message-input {
    flex-wrap: wrap;
  }
}

/* Psyduck emoji/icon */
.psyduck-icon {
  font-size: 1.5em;
}
