:root {
  --accent: #3224FF;
  --bg: #EFEFEF;
  --text: #0B0B0B;
  --muted: #6D6D75;
  --line: #D8D8DE;
  --card: #FFFFFF;
  --soft: #F7F7F8;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 16px 42px rgba(11, 11, 11, 0.08);
  --shadow-soft: 0 8px 24px rgba(11, 11, 11, 0.06);
  --sidebar: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; }
.container {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 74px;
  background: rgba(239, 239, 239, 0.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  height: 74px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.logo-mark {
  width: 42px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.08em;
}
.logo-word { font-size: 21px; }
.logo-word span { font-weight: 500; }
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: max-content;
}
.nav a {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  opacity: 0.86;
  padding: 10px 0;
  position: relative;
}
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
}
.search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
}
.search-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 14px 0 42px;
  background: rgba(255,255,255,0.8);
  outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(50,36,255,0.08); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.8);
  display: grid;
  place-items: center;
  font-size: 18px;
  position: relative;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  right: 9px;
  top: 8px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #111;
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
}
.avatar.lg { width: 132px; height: 132px; font-size: 42px; }
.avatar.md { width: 48px; height: 48px; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.btn {
  border: 1px solid var(--line);
  min-height: 42px;
  padding: 0 18px;
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.btn.danger { border-color: rgba(220, 38, 38, .3); color: #B91C1C; }

.page { padding: 36px 0 72px; }
.hero {
  text-align: center;
  padding: 28px 0 34px;
}
.eyebrow { color: var(--accent); font-weight: 900; letter-spacing: .02em; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(38px, 6vw, 62px); line-height: .98; letter-spacing: -0.055em; margin-bottom: 14px; }
h2 { font-size: clamp(28px, 3.5vw, 44px); line-height: 1; letter-spacing: -0.045em; margin-bottom: 12px; }
h3 { font-size: 22px; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 10px; }
.lead { max-width: 680px; margin: 0 auto 20px; color: #23232A; line-height: 1.45; font-size: 17px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 34px 0 18px; }
.section-title h2, .section-title h3 { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips.center { justify-content: center; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #202028;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.subtle { background: #E7E7EA; }

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.card.pad { padding: 20px; }
.card.big-pad { padding: 28px; border-radius: var(--radius-lg); }
.card.clean { box-shadow: none; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.prompt-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.prompt-cover {
  aspect-ratio: 1.65 / 1;
  background: #111;
  overflow: hidden;
}
.prompt-cover img { width: 100%; height: 100%; object-fit: cover; }
.prompt-card-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.prompt-title { font-size: 18px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.08; }
.prompt-meta, .row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.start { align-items: flex-start; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  background: #E9E9ED;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #282832;
  white-space: nowrap;
}
.badge.accent { background: rgba(50,36,255,0.1); color: var(--accent); }
.badge.good { background: #E7F7EE; color: #127341; }
.badge.warn { background: #FFF5D9; color: #8A6500; }
.badge.bad { background: #FFE7E7; color: #9A1B1B; }
.stat { font-weight: 800; }
.stars { color: #D7A900; letter-spacing: -0.07em; }
.card-actions { margin-top: auto; display: flex; gap: 8px; }

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 26px;
  align-items: start;
}
.filter-card { position: sticky; top: 96px; padding: 18px; }
.filter-group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.filter-group:last-child { border-bottom: 0; }
.filter-title { font-weight: 900; margin-bottom: 10px; display: flex; justify-content: space-between; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 650; font-size: 14px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.thread-row {
  display: grid;
  grid-template-columns: 70px 1fr 120px 56px;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.thread-row:last-child { border-bottom: 0; }
.vote-box { display: grid; place-items: center; color: var(--accent); font-weight: 900; }
.thread-title { font-size: 20px; font-weight: 900; letter-spacing: -0.035em; }
.thread-excerpt { color: #373742; margin: 5px 0 10px; line-height: 1.35; }
.side-card { padding: 18px; }
.side-card + .side-card { margin-top: 18px; }

.creator-card { padding: 18px; }
.creator-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.creator-stats div { border-top: 1px solid var(--line); padding-top: 10px; }
.creator-stats strong { display: block; font-size: 19px; }
.preview-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preview-strip img { height: 70px; width: 100%; object-fit: cover; border-radius: 12px; }

.account-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(239,239,239,0.92);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.sidebar .logo { margin-bottom: 12px; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav a, .sidebar-nav button {
  min-height: 46px;
  border-radius: 13px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #252530;
  background: transparent;
  border: 0;
  text-align: left;
}
.sidebar-nav a.active, .sidebar-nav button.active { background: rgba(50,36,255,0.1); color: var(--accent); }
.sidebar-footer { margin-top: auto; }
.account-main { padding: 34px 34px 72px; }
.account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 18px; }
.stat-card .num { font-size: 30px; line-height: 1; letter-spacing: -0.05em; font-weight: 900; margin: 12px 0 4px; }

.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; gap: 7px; }
.form-row label { font-weight: 850; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  padding: 12px 14px;
  outline: none;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.codearea { min-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(50,36,255,0.08); }

.editor-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.editor-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.table-card { overflow: hidden; }
.table-row {
  display: grid;
  grid-template-columns: 80px 1.6fr 130px 130px 110px 120px 70px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.table-row.header { font-weight: 900; color: var(--muted); font-size: 13px; background: var(--soft); }
.table-row:last-child { border-bottom: 0; }
.table-row img { width: 70px; height: 48px; object-fit: cover; border-radius: 12px; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 540px;
  gap: 60px;
  align-items: center;
  width: min(1220px, calc(100% - 56px));
  margin: 0 auto;
  padding: 70px 0;
}
.floating-cards { position: relative; min-height: 280px; margin-top: 30px; }
.float-card {
  position: absolute;
  width: 190px;
  padding: 12px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transform: rotate(var(--r));
}
.float-card img { border-radius: 12px; height: 82px; width: 100%; object-fit: cover; margin-bottom: 8px; }
.auth-card { padding: 32px; border-radius: var(--radius-lg); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 22px; }
.auth-tabs button { height: 46px; border: 0; background: transparent; border-bottom: 2px solid var(--line); font-weight: 900; color: var(--muted); }
.auth-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.profile-hero {
  display: grid;
  grid-template-columns: 150px 1fr 220px;
  gap: 24px;
  align-items: center;
}
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin: 24px 0; overflow-x: auto; }
.tabs a, .tabs button {
  border: 0;
  background: transparent;
  padding: 0 0 12px;
  font-weight: 900;
  white-space: nowrap;
  color: #2C2C35;
}
.tabs a.active, .tabs button.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

.notification-row {
  display: grid;
  grid-template-columns: 10px 46px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.notification-row:last-child { border-bottom: 0; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.unread-dot.read { background: #BFC0C7; }

.upload-box {
  border: 1.5px dashed #BFC0C7;
  border-radius: var(--radius);
  background: var(--soft);
  min-height: 118px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 18px;
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.mobile-nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mobile-nav a { display: grid; place-items: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--muted); }
.mobile-nav a.active { color: var(--accent); }
.mobile-nav .circle { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; }
.mobile-nav a.active .circle { background: rgba(50,36,255,0.1); }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111;
  color: #fff;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  font-weight: 800;
}

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

@media (max-width: 1120px) {
  .nav { display: none; }
  .grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .filter-card { position: static; }
  .editor-layout, .editor-grid { grid-template-columns: 1fr; }
  .profile-hero { grid-template-columns: 110px 1fr; }
  .profile-hero .profile-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .topbar { height: 66px; }
  .topbar-inner { width: calc(100% - 26px); height: 66px; gap: 10px; }
  .logo-word { display: none; }
  .top-actions .btn { display: none; }
  .container { width: calc(100% - 28px); }
  .page { padding-bottom: 92px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; }
  .hero { text-align: left; padding-top: 18px; }
  .lead { margin-left: 0; }
  .mobile-nav { display: block; }
  .account-shell { display: block; }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto; z-index: 50; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .sidebar .logo, .sidebar-footer, .sidebar-profile { display: none; }
  .sidebar-nav { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .sidebar-nav a, .sidebar-nav button { min-height: 48px; font-size: 11px; padding: 0 4px; justify-content: center; flex-direction: column; gap: 2px; }
  .sidebar-nav a:nth-child(n+6), .sidebar-nav button:nth-child(n+6) { display: none; }
  .account-main { padding: 22px 14px 98px; }
  .account-top { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-page { grid-template-columns: 1fr; width: calc(100% - 28px); padding: 30px 0 92px; }
  .floating-cards { display: none; }
  .thread-row { grid-template-columns: 46px 1fr; }
  .thread-row > :nth-child(3), .thread-row > :nth-child(4) { display: none; }
  .table-row { grid-template-columns: 64px 1fr 60px; }
  .table-row .hide-mobile, .table-row.header { display: none; }
  .check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  h1 { font-size: 42px; }
  h2 { font-size: 32px; }
  .profile-hero { grid-template-columns: 1fr; text-align: left; }
  .avatar.lg { width: 110px; height: 110px; }
  .profile-hero .profile-actions { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* Updated unified zarixDesign header */
.logo {
  gap: 0;
  min-width: auto;
}
.logo-img {
  width: 112px;
  height: auto;
  display: block;
}
.sidebar .logo-img {
  width: 126px;
}
.logo-mark,
.logo-word {
  display: none !important;
}
.nav-dropdown {
  position: relative;
  padding: 10px 0;
}
.nav-drop-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 850;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  opacity: .9;
}
.nav-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  background: transparent;
  border-radius: 999px;
}
.nav-dropdown.active::after {
  background: var(--accent);
}
.nav-drop-menu {
  position: absolute;
  left: -14px;
  top: calc(100% + 10px);
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.98);
  transform-origin: top left;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.nav-dropdown:hover .nav-drop-menu,
.nav-dropdown:focus-within .nav-drop-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.nav-drop-menu a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  font-weight: 850;
}
.nav-drop-menu a:hover {
  background: rgba(50,36,255,.09);
  color: var(--accent);
}
.nav-drop-menu a::after {
  display: none !important;
}
.lang-toggle {
  width: 50px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  color: var(--text);
  font-weight: 900;
  letter-spacing: .02em;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.lang-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(50,36,255,.4);
  box-shadow: var(--shadow-soft);
}
.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  background: rgba(255,255,255,.75);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11,11,11,.36);
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modalFade .16s ease both;
}
.modal-card {
  width: min(620px, 100%);
  animation: modalIn .18s ease both;
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card,
.btn,
.input,
.textarea,
.select,
.icon-btn,
.search-input,
.upload-box,
.prompt-cover,
.float-card,
.auth-card {
  border-radius: var(--radius);
}
.btn.small,
.badge {
  border-radius: 999px;
}
.prompt-card,
.side-card,
.filter-card,
.stat-card,
.creator-card {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.prompt-card:hover,
.creator-card:hover,
.card.hoverable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(50,36,255,.18);
}
@media (max-width: 820px) {
  .logo-img { width: 96px; }
  .lang-toggle { width: 44px; }
  .user-pill .small-text { display: none; }
}

/* Interaction polish update */
html[data-theme="dark"] {
  --bg: #111113;
  --text: #F3F3F5;
  --muted: #A8A8B1;
  --line: #2A2A31;
  --card: #18181C;
  --soft: #202027;
  --shadow: 0 16px 42px rgba(0,0,0,.32);
  --shadow-soft: 0 8px 24px rgba(0,0,0,.22);
}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar {
  background: rgba(17,17,19,.9);
}
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .input,
html[data-theme="dark"] .textarea,
html[data-theme="dark"] .select,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .lang-toggle,
html[data-theme="dark"] .nav-drop-menu,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .btn:not(.primary) {
  background: rgba(255,255,255,.06);
  color: var(--text);
}
html[data-theme="dark"] .lead,
html[data-theme="dark"] .thread-excerpt,
html[data-theme="dark"] .chip {
  color: var(--text);
}
html[data-theme="dark"] .badge { background: #25252D; color: #F3F3F5; }
html[data-theme="dark"] .badge.accent { background: rgba(50,36,255,.22); color: #AFAAFF; }

.page-view {
  opacity: 0;
  transform: translateY(7px);
  transition: opacity .18s ease, transform .18s ease;
}
.page-view.page-ready {
  opacity: 1;
  transform: translateY(0);
}

.logo,
.nav a,
.nav-drop-btn,
.nav-drop-menu a,
.sidebar-nav a,
.sidebar-nav button,
.chip,
.badge,
.icon-btn,
.lang-toggle,
.user-pill,
.prompt-cover,
.thread-row,
.notification-row,
.table-row,
.preview-strip img,
.mobile-nav a,
.creator-card,
.card,
.btn {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}
.logo:hover,
.nav a:hover,
.nav-drop-btn:hover,
.nav-drop-menu a:hover,
.sidebar-nav a:hover,
.sidebar-nav button:hover,
.chip:hover,
.icon-btn:hover,
.lang-toggle:hover,
.user-pill:hover,
.mobile-nav a:hover {
  transform: translateY(-1px) scale(1.015);
}
.btn:hover,
.prompt-card:hover,
.creator-card:hover,
.model-card:hover,
.collection-card:hover,
.thread-row:hover,
.notification-row:hover,
.table-row:not(.header):hover,
.side-card:hover,
.stat-card:hover {
  transform: translateY(-2px) scale(1.006);
  box-shadow: var(--shadow);
  border-color: rgba(50,36,255,.22);
}
.btn:active,
.nav a:active,
.nav-drop-btn:active,
.chip:active,
.icon-btn:active,
.lang-toggle:active,
.user-pill:active {
  transform: translateY(0) scale(.98);
}
.nav-drop-btn { min-height: 32px; }
.nav-drop-btn::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .0;
  transform: scale(.6);
  transition: opacity .16s ease, transform .16s ease;
}
.nav-dropdown:hover .nav-drop-btn::after,
.nav-dropdown.active .nav-drop-btn::after {
  opacity: 1;
  transform: scale(1);
}
.nav-drop-menu { display: grid; gap: 4px; }
.filter-title { justify-content: flex-start; }
.model-card {
  min-height: 290px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.model-card .muted {
  min-height: 66px;
  line-height: 1.32;
}
.model-card .btn {
  margin-top: auto !important;
  min-height: 44px;
  white-space: nowrap;
}
.vote-box small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}
@media (prefers-reduced-motion: reduce) {
  *, .page-view { transition: none !important; animation: none !important; transform: none !important; }
}

/* v3 fixes: avatars, menus, dropdowns, editor preview */
.avatar {
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  line-height: 1;
}
img.avatar {
  width: 34px;
  height: 34px;
}
img.avatar.md { width: 48px; height: 48px; }
img.avatar.sm { width: 28px; height: 28px; }
img.avatar.lg { width: 132px; height: 132px; }
.top-creators-card { padding: 20px; }
.top-creators-list { display: grid; gap: 14px; }
.top-creator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.top-creator-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.top-creator-info {
  min-width: 0;
  display: grid;
  line-height: 1.16;
}
.top-creator-info strong {
  white-space: normal;
  word-break: break-word;
  line-height: 1.12;
}
.top-creator-row .follow-btn {
  flex: 0 0 auto;
  min-width: 112px;
  padding-inline: 12px;
}
.side-card .row.between { gap: 14px; }

.models-grid { align-items: stretch; }
.model-card {
  padding: 18px !important;
  min-height: 254px;
  gap: 12px;
}
.model-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.model-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 16px;
}
.model-badge {
  max-width: 124px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-card h3 {
  margin: 4px 0 0;
  font-size: 21px;
}
.model-desc {
  min-height: 58px !important;
  margin: 0;
  line-height: 1.26 !important;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.model-count { margin-top: auto; }
.model-view-btn {
  margin-top: 0 !important;
  min-height: 38px !important;
  border-radius: 13px;
}

.social-btn {
  position: relative;
  gap: 10px;
}
.social-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.variable-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 42px;
  gap: 8px;
  align-items: center;
}
.var-remove {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: #B91C1C;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.var-remove:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: var(--shadow-soft);
  border-color: rgba(185,28,28,.28);
  background: #FFF1F1;
}
.preview-only .btn,
.preview-only .card-actions { display: none; }

.action-menu-wrap {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}
.prompt-menu-btn {
  letter-spacing: .08em;
  min-width: 48px;
}
.action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 176px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.action-menu-wrap.open .action-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.action-menu a,
.action-menu button {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  font-weight: 850;
  text-align: left;
}
.action-menu a:hover,
.action-menu button:hover {
  background: rgba(50,36,255,.09);
  color: var(--accent);
}
.action-menu .delete-prompt-btn:hover {
  background: #FFF1F1;
  color: #B91C1C;
}

.native-select-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
}
.nice-select {
  position: relative;
  width: 100%;
}
.nice-select-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.88);
  color: var(--text);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 750;
  text-align: left;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.nice-select-btn i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .55;
  flex: 0 0 auto;
  transition: transform .16s ease, opacity .16s ease;
}
.nice-select:hover .nice-select-btn,
.nice-select.open .nice-select-btn {
  border-color: rgba(50,36,255,.38);
  box-shadow: 0 0 0 4px rgba(50,36,255,.07);
}
.nice-select.open .nice-select-btn i {
  transform: scale(1.35);
  opacity: 1;
}
.nice-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  max-height: 280px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.985);
  transform-origin: top center;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.nice-select.open .nice-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.nice-select-menu button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  padding: 0 11px;
  font-weight: 800;
  text-align: left;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nice-select-menu button:hover,
.nice-select-menu button.active {
  background: rgba(50,36,255,.09);
  color: var(--accent);
}
.nice-select-menu button:active { transform: scale(.985); }

span.badge,
span.chip {
  cursor: default !important;
}
span.badge:hover,
span.chip:hover {
  transform: none !important;
  box-shadow: none !important;
}
a.badge,
button.badge,
a.chip,
button.chip {
  cursor: pointer;
}

html[data-theme="dark"] .var-remove,
html[data-theme="dark"] .action-menu,
html[data-theme="dark"] .nice-select-btn,
html[data-theme="dark"] .nice-select-menu {
  background: rgba(24,24,28,.96);
  color: var(--text);
}
html[data-theme="dark"] .var-remove:hover { background: rgba(185,28,28,.14); }

@media (max-width: 900px) {
  .variable-row { grid-template-columns: 1fr; }
  .var-remove { width: 100%; }
  .top-creator-row { grid-template-columns: 1fr; }
  .top-creator-row .follow-btn { width: 100%; }
}

.codebox {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.telegram-login-box {
  min-height: 52px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--soft);
  border: 1px solid var(--line);
}
