:root {
  --bg: #101014;
  --panel: #191922;
  --panel2: #20202b;
  --text: #eeeeff;
  --muted: #aaaabc;
  --accent: #8b5cf6;
  --accent2: #a78bfa;
  --border: #30303d;
  --input: #12121a;
  --danger: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #1b1530 0%, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--accent2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  padding: 18px 28px;
  background: rgba(25, 25, 34, 0.9);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 22px;
  font-weight: 700;
}

.logo a {
  color: var(--text);
}

nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

nav a {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel2);
  color: var(--text);
}

nav a:hover {
  background: var(--accent);
  text-decoration: none;
}

.wrapper {
  max-width: 1250px;
  margin: 0 auto;
  padding: 26px;
}

.wrapper.narrow {
  max-width: 900px;
  padding: 32px;
}

.hero {
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(32,32,43,.9));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.hero p {
  color: var(--muted);
  max-width: 720px;
  line-height: 1.55;
}

.card {
  background: rgba(25,25,34,.95);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.card.compact-card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}

.section-title,
h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

h1 {
  margin: 0 0 8px;
}

p,
li {
  color: var(--muted);
}

/* Auth pages */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page h1 {
  font-size: 28px;
}

.links {
  text-align: center;
  margin-top: 16px;
}

/* Forms */

label {
  display: block;
  margin: 16px 0 7px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

textarea.large {
  min-height: 260px;
}

input[type="file"] {
  background: var(--input);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 14px;
  color: var(--muted);
  cursor: pointer;
  margin: 8px 0 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
  line-height: 1.4;
}

.error {
  color: #ffb4b4;
  background: #351b24;
  border: 1px solid #6b2a3a;
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 16px;
}

/* Buttons */

.button,
button {
  display: inline-block;
  padding: 11px 16px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.auth-page button,
.auth-page .button {
  width: 100%;
  display: block;
  text-align: center;
  margin-top: 12px;
}

.button.secondary {
  background: var(--panel2);
}

.button.danger {
  background: var(--danger);
}

.button:hover,
button:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* Layout */

.layout {

  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 22px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Bots */

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 360px));
  gap: 20px;
}

.bot-card {
  background: rgba(25, 25, 34, 0.95);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  min-height: 170px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

.bot-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.bot-card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.bot-thumb {
  width: 100%;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--input);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.bot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bot-thumb-fallback {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  font-weight: 800;
  color: var(--muted);
}

.tags {
  margin-top: 12px;
}

.tag {
  display: inline-block;
  padding: 4px 9px;
  margin: 2px;
  background: #29293a;
  color: #cbcbed;
  border-radius: 999px;
  font-size: 12px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 24px;
  background: rgba(18,18,26,.55);
}

/* Profile */

.profile-hero {
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(32,32,43,.9));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 24px;
}

.avatar {
  width: 110px;
  height: 110px;
  border-radius: 28px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 42px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(0,0,0,.3);
}

.avatar.large-avatar {
  width: 180px;
  height: 240px;
  border-radius: 20px;
  background: var(--input);
  color: var(--muted);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.profile-info p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.stats {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.stat {
  background: rgba(18,18,26,.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--muted);
}

.stat strong {
  color: var(--text);
}

/* Bot page */

.bot-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(32,32,43,.9));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 22px;
}

.meta,
.muted {
  color: var(--muted);
}

.creator-note,
.text-block {
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

details {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent2);
}

/* Chat */

.chat {
  position: sticky;
  top: 20px;
  height: fit-content;
}

.chat-messages {
  height: 600px;
  overflow-y: auto;
  background: var(--input);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--border);
}

.message:last-child {
  border-bottom: none;
}

.message strong {
  color: var(--accent2);
}

.message span {
  color: var(--text);
  word-break: break-word;
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.message-time {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-form input {
  flex: 1;
}

.chat-form button {
  width: auto;
}

.message {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 14px;
  text-decoration: none;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-avatar:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.chat-message-body {
  flex: 1;
  min-width: 0;
}

.message-text {
  color: var(--text);
  word-break: break-word;
}

.login-note {
  color: var(--muted);
  margin-top: 12px;
}

/* Upload preview */

.preview-box {
  margin-top: 16px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
}

.preview-box p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.preview-box img {
  max-width: 220px;
  max-height: 320px;
  border-radius: 14px;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* Rules / policy */

.rules {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.rules strong {
  color: var(--text);
}

/* Footer */

.footer {
  margin-top: 30px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.footer a {
  margin: 0 10px;
  color: var(--muted);
}

.footer a:hover {
  color: var(--accent2);
}

/* Mobile */

@media (max-width: 850px) {
  .layout,
  .grid,
  .profile-hero,
  .bot-hero {
    grid-template-columns: 1fr;
  }

  .chat {
    position: static;
  }

  header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .avatar.large-avatar {
    width: 100%;
    height: 320px;
  }

    .bot-grid {
    grid-template-columns: 1fr;
  }

  .bot-thumb {
    height: 240px;
  }
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Ratings and comments */

.rating-form {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.heart-button {
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 11px;
  font-size: 22px;
  cursor: pointer;
}

.heart-button:hover,
.heart-button.active {
  background: #8b1e5a;
  color: #ffd1e8;
}

.comment-form textarea {
  min-height: 110px;
  margin-bottom: 10px;
}

.comments-list {
  margin-top: 20px;
}

.comment {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.comment:last-child {
  border-bottom: none;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.small-button {
  padding: 7px 10px;
  font-size: 13px;
  margin-top: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(18,18,26,.55);
}

.user-row-avatar {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 34px;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
}

.user-row-avatar:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.user-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-row-main h3 {
  margin: 0 0 6px;
}

.user-row-main p {
  margin: 8px 0 0;
}

.user-row-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.user-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 700px) {
  .user-row {
    grid-template-columns: 80px 1fr;
  }

  .user-row-avatar {
    width: 80px;
    height: 80px;
    font-size: 28px;
  }

  .user-row-actions {
    grid-column: 1 / -1;
  }
}

.profile-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-title-row h1 {
  margin: 0;
}

.profile-edit-toggle {
  margin-top: 0;
  white-space: nowrap;
}

.profile-edit-panel {
  animation: softDrop .16s ease;
}

@keyframes softDrop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rich-content {
  white-space: normal;
}

.rich-content p {
  margin: 0 0 12px;
}

.rich-content h1,
.rich-content h2,
.rich-content h3 {
  margin: 0 0 10px;
}

.rich-content ul,
.rich-content ol {
  margin-top: 8px;
  margin-bottom: 12px;
}

.rich-content blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--input);
  border-radius: 10px;
}

.profile-bio {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.profile-bio > div {
  background: rgba(5, 15, 35, 0.72) !important;
  border-radius: 14px !important;
  padding: 14px !important;
}

.profile-bio p {
  color: inherit;
}

.site-header {
  padding: 16px 28px;
  background: rgba(25, 25, 34, 0.9);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}

.nav-links,
.nav-account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav a {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel2);
  color: var(--text);
  text-decoration: none;
  transition: 0.15s ease;
}

.top-nav a:hover {
  background: var(--accent);
  text-decoration: none;
}

.nav-avatar-link {
  padding: 0 !important;
  background: transparent !important;
  border-radius: 999px;
}

.nav-avatar-link:hover {
  background: transparent !important;
  transform: translateY(-1px);
}

.nav-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}

.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 800px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .top-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links,
  .nav-account {
    flex-wrap: wrap;
  }
}

.nav-account .logout-link {
  background: transparent;
  border: 1px solid var(--border);
}

.creator-note-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: transparent;
}

.extra-greetings-list {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.extra-greeting-box {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.extra-greeting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.greeting-list {
  display: grid;
  gap: 12px;
}

.greeting-card {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.greeting-card summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 8px;
}

.tag-input-box {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #29293a;
  color: #cbcbed;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px 5px 10px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.tag-chip button {
  all: unset;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.35);
  color: #eeeeff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.tag-chip button:hover {
  background: var(--accent);
  color: white;
}

.tag-input-box input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px;
  margin: 0;
  outline: none;
}

.button.export-button {
  background: #2563eb;
  color: white;
}

.button.export-button:hover {
  filter: brightness(1.1);
}

.bot-search-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1fr) auto;
  gap: 10px;
  align-items: start;
}

@media (max-width: 850px) {
  .bot-search-form {
    grid-template-columns: 1fr;
  }
}

.bot-tag-search-box {
  position: relative;
  min-height: 58px;
}

.bot-tag-search-box input {
  min-height: 38px;
}

.logo a {
  display: flex;
  align-items: center;
}

.logo img {
  height: 44px;
  width: auto;
  display: block;
}

.profile-bot-card {
  display: flex;
  flex-direction: column;
}

.bot-thumb-link {
  position: relative;
  display: block;
  text-decoration: none;
  overflow: hidden;
}

.bot-thumb-link:hover {
  text-decoration: none;
}

.bot-thumb-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,.82), transparent);
  pointer-events: none;
}

.bot-thumb-tags {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 2;
}

.overlay-tag {
  background: rgba(18,18,26,.88);
  color: #eeeeff;
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(4px);
  margin: 0;
}

.profile-bot-card h3 {
  margin-top: 12px;
  margin-bottom: 0;
}

.profile-bot-card .actions {
  margin-top: 12px;
}

.profile-bots-section {
  min-height: 420px;
}