:root {
  --bg-a: #2a0b45;
  --bg-b: #3c0f61;
  --ink: #1b1c22;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(120, 90, 160, 0.25);
  --accent: #6d3df3;
  --accent-hover: #5a31d1;
  --accent-2: #ff7ad9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: #2a0b45;
  position: relative;
  overflow-x: hidden;
}

#root {
  position: relative;
  z-index: 2;
  min-height: clamp(34rem, 70vh, 48rem);
}

.shell {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.shell.single {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
}

.shell.single .panel {
  width: min(100%, 560px);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 16px 40px rgba(30, 10, 60, 0.18);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 2;
}

.panel-form {
  min-height: 25rem;
}

.panel-results {
  min-height: 18rem;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
}

p {
  margin-top: 0;
}

label {
  display: inline-block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}

textarea {
  resize: vertical;
}

.actions {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lora-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.lora-slot {
  display: flex;
  flex-direction: column;
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(100, 60, 200, 0.28);
}

button:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-2));
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.button-secondary {
  background: #fff;
  color: #2b2236;
  border: 1px solid rgba(90, 60, 140, 0.2);
  box-shadow: none;
}

.button-secondary:hover {
  background: #f5efff;
}

.status {
  font-size: 0.92rem;
}

.subtle {
  color: #5c5568;
}

.hidden {
  display: none;
}

.plans {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.plan-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: #fff;
  overflow: hidden;
}

.plan-card.featured {
  border-color: var(--accent);
}

.admin-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.metric-card {
  text-align: left;
}

.metric-bars {
  display: grid;
  gap: 0.5rem;
}

.metric-bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 52px;
  gap: 0.6rem;
  align-items: center;
}

.metric-bar-label,
.metric-bar-value {
  font-size: 0.82rem;
  color: #665d74;
}

.metric-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(109, 61, 243, 0.12);
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.metric-list {
  display: grid;
  gap: 0.45rem;
}

.metric-list p {
  margin: 0;
  font-size: 0.92rem;
}

.plan-ribbon {
  position: absolute;
  top: 14px;
  right: -34px;
  min-width: 140px;
  padding: 0.28rem 0.75rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(35deg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.price {
  font-weight: 700;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  align-content: start;
  min-height: 12rem;
}

.home-page .panel-results {
  justify-items: center;
}

.home-page .panel-results .gallery {
  width: min(100%, 1100px);
  margin-left: auto;
  margin-right: auto;
  grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
  justify-content: center;
}

.home-page .panel-results .card {
  width: 100%;
  max-width: 420px;
}

.home-result-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.shared-shell {
  max-width: 980px;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  align-items: start;
}

.shell.library-shell {
  max-width: 1080px;
  width: min(100%, 1080px);
  grid-template-columns: 1fr !important;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

.library-panel,
.mobile-panel {
  width: 100%;
}

.library-gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.shared-composer {
  position: sticky;
  top: 104px;
}

@media (min-width: 701px) {
  .shared-composer {
    max-height: calc(100vh - 122px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.7rem;
    scrollbar-width: thin;
  }
}

.shared-feed {
  display: grid;
  gap: 1rem;
}

.feed-post {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  padding: 1rem;
  box-shadow: 0 16px 34px rgba(30, 10, 60, 0.12);
}

.feed-post-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.feed-post-author,
.comment-author {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.feed-post-title {
  font-weight: 700;
  font-size: 1.02rem;
}

.feed-post-meta,
.comment-meta,
.feed-post-prompt {
  color: #665d74;
  font-size: 0.88rem;
}

.feed-post-body {
  margin-bottom: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.feed-post-image {
  width: 100%;
  display: block;
  border-radius: 14px;
  margin-bottom: 0.8rem;
}

.comments {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(120, 90, 160, 0.18);
}

.comment-count {
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.comments-list {
  display: grid;
  gap: 0.6rem;
}

.comment-item {
  background: #f7f3ff;
  border: 1px solid rgba(120, 90, 160, 0.12);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.comment-meta {
  margin-bottom: 0.3rem;
}

.feed-avatar,
.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(120, 90, 160, 0.2);
  background: rgba(109, 61, 243, 0.12);
}

.comment-avatar {
  width: 32px;
  height: 32px;
}

.comment-body {
  margin: 0;
  white-space: pre-wrap;
}

.comment-like-btn {
  margin-top: 0;
}

.comment-actions {
  margin-top: 0.55rem;
}

.shared-page .button-secondary,
.shared-page .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.6rem 0.95rem;
  line-height: 1.15;
  font-weight: 700;
  border-radius: 14px;
}

.shared-page .actions.mobile-actions,
.shared-page .comment-actions {
  align-items: stretch;
  gap: 0.55rem;
}

.shared-page .actions.mobile-actions > .button-secondary,
.shared-page .actions.mobile-actions > .link-btn,
.shared-page .comment-actions > .button-secondary {
  flex: 1 1 140px;
}

.shared-page .reaction-btn,
.shared-page .comment-like-btn,
.shared-page .comment-delete-btn,
.shared-page .dm-friend-btn {
  min-width: 0;
}

.shared-page .comment-actions > .comment-like-btn,
.shared-page .comment-actions > .comment-delete-btn {
  flex: 0 0 auto;
}

.reaction-btn {
  gap: 0.45rem;
}

.shared-page .reaction-btn-active.reaction-btn-like,
.shared-page .comment-like-btn.reaction-btn-active {
  background: linear-gradient(135deg, #4d8dff, #2457d6);
  box-shadow: 0 10px 24px rgba(46, 99, 224, 0.34);
}

.shared-page .reaction-btn-active.reaction-btn-heart {
  background: linear-gradient(135deg, #ff7aa2, #d94f7a);
  box-shadow: 0 10px 24px rgba(217, 79, 122, 0.34);
}

.shared-page .reaction-btn-active.reaction-btn-laugh {
  background: linear-gradient(135deg, #ffcf5a, #ff9f1c);
  box-shadow: 0 10px 24px rgba(255, 165, 0, 0.34);
}

.reaction-label {
  white-space: nowrap;
}

.reaction-emoji {
  display: inline-block;
  font-size: 1.05rem;
  transform-origin: center;
}

.reaction-emoji-heart {
  animation: reactionHeartBeat 1.15s ease-in-out infinite;
}

.reaction-emoji-laugh {
  animation: reactionLaughBounce 1.25s ease-in-out infinite;
}

.reaction-btn-active .reaction-emoji-heart {
  filter: drop-shadow(0 0 8px rgba(217, 79, 122, 0.45));
}

.reaction-btn-active .reaction-emoji-like {
  filter: drop-shadow(0 0 8px rgba(70, 130, 255, 0.35));
}

.reaction-btn-active .reaction-emoji-laugh {
  filter: drop-shadow(0 0 8px rgba(255, 180, 0, 0.38));
}

@keyframes reactionHeartBeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(0.94); }
  42% { transform: scale(1.14); }
  70% { transform: scale(1); }
}

@keyframes reactionLaughBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-2px) rotate(-7deg); }
  40% { transform: translateY(1px) rotate(7deg); }
  60% { transform: translateY(-1px) rotate(-5deg); }
  80% { transform: translateY(0) rotate(4deg); }
}

.shared-page .dm-friend-btn {
  justify-content: flex-start;
  text-align: left;
}

.shared-page .comment-actions {
  flex-wrap: wrap;
}

.comment-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.card img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgba(109, 61, 243, 0.08);
}

.card .caption {
  margin: 0;
  padding: 0.65rem;
  font-size: 0.9rem;
}

.library-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.library-card-body {
  padding: 0.2rem 0.75rem 0.9rem;
}

.upscale-progress {
  position: relative;
  margin: 0 0.75rem 0.8rem;
  height: 0.85rem;
  border-radius: 999px;
  background: rgba(90, 60, 140, 0.12);
  overflow: hidden;
}

.upscale-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7a59, #6d3df3);
  transition: width 0.5s ease;
}

.upscale-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2b2236;
}

.generate-progress {
  position: relative;
  margin: 0.55rem 0 0.9rem;
  height: 0.95rem;
  border-radius: 999px;
  background: rgba(90, 60, 140, 0.12);
  overflow: hidden;
}

.generate-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9f43, #ff5d8f 45%, #6d3df3);
  transition: width 0.5s ease;
}

.generate-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2b2236;
}

.library-shared-note {
  margin: 0 0 0.6rem;
  color: #6d3df3;
  font-size: 0.84rem;
  font-weight: 700;
}

.library-profile-note {
  margin: 0 0 0.6rem;
  color: #d94f7a;
  font-size: 0.84rem;
  font-weight: 700;
}

.mobile-actions {
  gap: 0.5rem;
}

.compact-actions {
  margin-top: 0.85rem;
}

.dm-notification-actions {
  margin-bottom: 0.85rem;
}

.status-error {
  color: #871d08;
}

.composer-form {
  display: grid;
  gap: 0.65rem;
}

.dm-friend-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.dm-friend-btn {
  width: 100%;
  justify-self: stretch;
}

.dm-friend-btn-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.dm-thread {
  display: grid;
  gap: 0.65rem;
}

.dm-thread-label {
  margin-bottom: 0;
}

.dm-messages {
  display: grid;
  gap: 0.55rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.dm-message {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.7rem 0.8rem;
}

.dm-message-own {
  background: rgba(109, 61, 243, 0.1);
  border-color: rgba(109, 61, 243, 0.25);
}

.dm-message-body,
.dm-message-meta {
  margin: 0;
}

.dm-message-body {
  white-space: pre-wrap;
  line-height: 1.45;
}

.dm-message-meta {
  margin-top: 0.35rem;
  color: #665d74;
  font-size: 0.82rem;
}

.dm-form {
  margin-top: 0.15rem;
}

.profile-friends-grid {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.profile-friends-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.profile-friend-row {
  display: block;
  padding: 0.2rem 0;
}

.profile-avatar-block {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(30, 10, 60, 0.12);
}

.profile-avatar-meta {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 900px) {
  .shell {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }

  .shell.library-shell {
    grid-template-columns: 1fr !important;
    max-width: 980px;
  }

  .shell.library-shell .library-panel {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }

  .panel-auth {
    grid-column: 1 / 2;
    position: sticky;
    top: 1rem;
  }

  .panel-plans,
  .panel-form,
  .panel-results {
    grid-column: 2 / 3;
  }

  .plans {
    grid-template-columns: 1fr 1fr;
  }

  .admin-analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.link-btn {
  text-decoration: none;
  display: inline-block;
  border: 1px solid rgba(90, 60, 140, 0.2);
  background: #ffffff;
  color: #2b2236;
  border-radius: 999px;
  padding: 0.52rem 0.95rem;
  text-align: center;
}

.link-btn:hover {
  background: #f5efff;
}

.card-actions {
  padding: 0 0.65rem 0.75rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.admin-comment-list {
  padding: 0 0.65rem 0.75rem;
}

.admin-prompt-group {
  margin-top: 0.75rem;
}

.admin-prompt-group summary {
  cursor: pointer;
  font-weight: 700;
}

.admin-prompt-group-body {
  padding-top: 0.35rem;
}

.admin-comment-item {
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.admin-appeal-list {
  display: grid;
  gap: 0.7rem;
}

.admin-appeal-item {
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(90, 60, 140, 0.16);
  background: #f7f3ff;
}

.admin-appeal-item p {
  margin: 0.2rem 0;
}

.admin-ban-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(135, 29, 8, 0.1);
  color: #871d08;
  font-weight: 700;
}

.admin-ban-pill-open {
  background: rgba(23, 108, 54, 0.12);
  color: #176c36;
}

.admin-shared-ban-panel {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0.65rem 0.75rem;
}

.admin-generation-ban-panel {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0.65rem 0.75rem;
}

.admin-shared-ban-state {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(23, 108, 54, 0.16);
  background: rgba(23, 108, 54, 0.05);
  margin-bottom: 0.75rem;
}

.admin-generation-ban-state {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(23, 108, 54, 0.16);
  background: rgba(23, 108, 54, 0.05);
  margin-bottom: 0.75rem;
}

.admin-shared-ban-state-active {
  border-color: rgba(135, 29, 8, 0.16);
  background: rgba(135, 29, 8, 0.06);
}

.admin-shared-ban-state p {
  margin: 0;
}

.admin-shared-ban-status {
  margin-bottom: 0.15rem;
}

.admin-shared-ban-controls-slot {
  display: block;
}

.admin-ban-controls {
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.admin-ban-reason {
  width: 100%;
}

.admin-ban-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.admin-ban-feedback {
  margin: 0;
  font-size: 0.9rem;
}

.shared-ban-page {
  min-height: 100vh;
}

.shared-ban-shell {
  max-width: 760px;
}

.shared-ban-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(55, 37, 16, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 244, 217, 0.94), rgba(255, 255, 255, 0.98)),
    radial-gradient(circle at top right, rgba(201, 69, 38, 0.18), transparent 38%);
  box-shadow: 0 24px 64px rgba(41, 24, 8, 0.18);
}

.shared-ban-bars {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(32, 20, 12, 0.76) 0 18px,
    rgba(32, 20, 12, 0.06) 18px 56px
  );
  opacity: 0.2;
  pointer-events: none;
}

.shared-ban-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
  padding: 2rem;
}

.shared-ban-kicker {
  margin: 0;
  color: #871d08;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shared-ban-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 0.95;
}

.shared-ban-meta {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.shared-ban-meta p,
.shared-ban-note {
  margin: 0;
}

.shared-ban-actions {
  display: grid;
  gap: 0.8rem;
}

.shared-ban-actions textarea {
  min-height: 150px;
}

.shared-ban-actions .button-secondary {
  justify-self: start;
}

.delete-btn {
  cursor: pointer;
}

.empty-note {
  margin: 0;
  color: #4a423d;
}

.cascade-bg {
  position: fixed;
  inset: -30vh 0 0 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.cascade-item {
  position: absolute;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transform: translate3d(-50%, 0, 0) rotate(var(--fall-rotate));
  animation: cascadeTileFall var(--fall-duration) linear infinite;
  animation-delay: var(--fall-delay);
}

.cascade-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(186, 110, 255, 0.12), rgba(42, 11, 69, 0.35)),
    radial-gradient(circle at 75% 30%, rgba(110, 80, 220, 0.12), rgba(42, 11, 69, 0.4)),
    linear-gradient(rgba(32, 6, 47, 0.45), rgba(42, 11, 69, 0.55));
}

@keyframes cascadeTileFall {
  from {
    transform: translate3d(-50%, 0, 0) rotate(var(--fall-rotate));
  }

  to {
    transform: translate3d(calc(-50% + var(--fall-drift)), 170vh, 0) rotate(calc(var(--fall-rotate) + 8deg));
  }
}

.page-title,
.site-nav,
.shell,
.nav-greeting {
  position: relative;
  z-index: 2;
}

.subtle {
  margin: 0.2rem 0 0.4rem;
  color: rgba(30, 20, 50, 0.7);
}

.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.4rem 0 0.75rem;
  width: 100%;
}

.prompt-suggestions.hidden {
  display: none;
}

.prompt-suggestions-header {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.prompt-suggestions-header span {
  flex: 1 1 auto;
}

.prompt-suggestions-toggle {
  display: none;
  flex: 0 0 auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.suggestion-chip {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.top-bar {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1.1rem 0.45rem;
  background: rgba(20, 6, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  min-height: 74px;
}

.top-bar .page-title {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  grid-column: 2;
  line-height: 1.2;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  color: #f8f2ff;
  text-align: center;
}

.top-bar .site-nav {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.top-bar .site-nav::-webkit-scrollbar {
  display: none;
}

.top-bar .site-nav a,
.top-bar .site-nav .nav-greeting {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.top-bar .site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
}

.nav-auth-link {
  min-width: 86px;
  text-align: center;
}

.admin-console-header-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.nav-greeting {
  display: inline-block;
  min-width: 0;
  max-width: min(40vw, 280px);
  color: #f8f2ff;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 140ms ease;
}

.nav-greeting-visible {
  opacity: 1;
}

.nav-link-hidden {
  visibility: hidden;
  pointer-events: none;
}

body > .top-bar {
  margin-left: auto;
  margin-right: auto;
}

.corner-logo {
  position: static;
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 12px;
}

@media (max-width: 700px) {
  .cascade-bg {
    display: none;
  }

  .cascade-overlay {
    background:
      radial-gradient(circle at 20% 20%, rgba(186, 110, 255, 0.08), rgba(42, 11, 69, 0.2)),
      linear-gradient(rgba(32, 6, 47, 0.34), rgba(42, 11, 69, 0.42));
  }

  .shell {
    margin: 1rem auto;
    padding: 0 0.75rem 1rem;
    gap: 0.85rem;
  }

  .panel {
    padding: 0.95rem;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(30, 10, 60, 0.14);
    backdrop-filter: none;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  textarea {
    min-height: 142px;
  }

  .lora-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions > * {
    width: 100%;
  }

  .actions > .status {
    min-width: 0;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .home-page .panel-results .gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .home-page .panel-results .card {
    flex: 0 0 auto;
    width: 230px;
    max-width: 230px;
  }

  .home-result-image {
    width: 230px;
    height: 230px;
    max-width: 230px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .shared-shell {
    grid-template-columns: 1fr;
  }

  .shell.library-shell {
    grid-template-columns: 1fr;
  }

  .admin-analytics-grid {
    grid-template-columns: 1fr;
  }

  .library-gallery {
    grid-template-columns: 1fr;
  }

  .shared-composer {
    position: static;
  }

  .panel-header-row,
  .feed-post-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .library-card-body {
    padding: 0.15rem 0.7rem 0.8rem;
  }

  .feed-post {
    padding: 0.85rem;
    border-radius: 16px;
  }

  .feed-post-image,
  .card img {
    border-radius: 12px;
  }

  .comment-item {
    padding: 0.65rem 0.7rem;
  }

  .shared-page .actions,
  .shared-page .comment-actions {
    flex-direction: row;
    align-items: center;
  }

  .shared-page .actions > * {
    width: auto;
  }

  .shared-page .actions.mobile-actions {
    gap: 0.45rem;
  }

  .shared-page .actions.mobile-actions > span {
    flex: 1 1 100%;
    min-width: 0;
  }

  .shared-page .actions.mobile-actions > .button-secondary,
  .shared-page .actions.mobile-actions > .link-btn,
  .shared-page .comment-actions > .button-secondary {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }

  .shared-page .comment-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .shared-page .comment-form textarea {
    min-height: 88px;
  }

  .shared-page .comment-form .button-secondary {
    width: auto;
    min-width: 104px;
    justify-self: end;
  }

  .shared-page .dm-form {
    grid-template-columns: 1fr;
  }

  .shared-page .dm-form .button-secondary {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .top-bar .site-nav {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-bar .site-nav::-webkit-scrollbar {
    display: none;
  }

  .top-bar .site-nav a,
  .top-bar .site-nav .nav-greeting {
    width: auto;
    max-width: none;
    min-width: 96px;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-greeting {
    display: none;
  }

  .top-bar {
    padding: 0.45rem 0.75rem 0.35rem;
    min-height: 0;
    backdrop-filter: none;
  }

  .top-bar .page-title {
    font-size: 1.05rem;
    text-align: center;
  }

  .prompt-suggestions {
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.3rem 0 0.65rem;
  }

  .prompt-suggestions-header {
    align-items: flex-start;
    gap: 0.45rem;
  }

  .prompt-suggestions-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .suggestion-chip {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    padding: 0.55rem 0.8rem;
    font-size: 0.92rem;
    line-height: 1.3;
  }

  .shell.single {
    padding: 1.6rem 0.75rem;
    min-height: calc(100vh - 110px);
  }

  .library-shell,
  .shared-shell {
    margin-top: 0.75rem;
    padding-bottom: 1.1rem;
  }

  .shell.single .panel {
    width: 100%;
  }

  .corner-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .cascade-item:nth-child(n + 13) {
    display: none;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 0.42rem 0.6rem 0.3rem;
  }

  .top-bar .page-title {
    font-size: 1rem;
  }

  .top-bar .site-nav {
    gap: 0.35rem;
  }

  .link-btn,
  button,
  .button-secondary {
    min-height: 40px;
    padding: 0.58rem 0.85rem;
  }

  .shared-page .button-secondary,
  .shared-page .link-btn {
    min-height: 36px;
    padding: 0.48rem 0.72rem;
    border-radius: 12px;
    font-size: 0.92rem;
  }

  .shared-page .actions.mobile-actions {
    gap: 0.4rem;
  }

  .shared-page .actions.mobile-actions > .button-secondary,
  .shared-page .actions.mobile-actions > .link-btn,
  .shared-page .comment-actions > .button-secondary {
    flex: 1 1 calc(50% - 0.2rem);
  }

  .shared-page .reaction-label {
    font-size: 0.86rem;
  }

  .shared-page .feed-post-meta,
  .shared-page .comment-meta,
  .shared-page .feed-post-prompt {
    font-size: 0.8rem;
  }

  .shared-page .comment-form {
    grid-template-columns: 1fr;
  }

  .shared-page .comment-form .button-secondary {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .shared-ban-content {
    padding: 1.25rem;
  }

  .shared-ban-actions .button-secondary {
    width: 100%;
    justify-self: stretch;
  }

  .corner-logo {
    width: 36px;
    height: 36px;
  }

  .panel {
    padding: 0.85rem;
  }

  .shell {
    padding: 0 0.6rem 0.9rem;
  }

  .card-actions.mobile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .card-actions.mobile-actions > * {
    width: 100%;
  }

  .admin-ban-controls {
    grid-template-columns: 1fr;
  }

  .admin-ban-actions {
    flex-direction: column;
  }

  .card-actions.mobile-actions > :first-child:last-child,
  .card-actions.mobile-actions > :nth-child(3):last-child {
    grid-column: 1 / -1;
  }

  .status,
  .subtle,
  .card .caption {
    font-size: 0.88rem;
  }
}

@media (min-width: 900px) {
  .shell.shell-no-sidebar {
    grid-template-columns: 1fr;
    max-width: 1100px;
  }

  .shell.shell-no-sidebar .panel-auth,
  .shell.shell-no-sidebar .panel-form,
  .shell.shell-no-sidebar .panel-results,
  .shell.shell-no-sidebar .panel-plans {
    grid-column: auto;
    position: static;
    top: auto;
  }
}

.shell.shell-no-sidebar,
.shell.shell-no-sidebar .panel-form,
.shell.shell-no-sidebar .panel-results {
  grid-template-columns: 1fr !important;
  grid-column: auto !important;
  position: static !important;
}

.content-shell {
  max-width: 960px;
  margin-top: 0;
  content-visibility: auto;
  contain-intrinsic-size: 1px 780px;
}

.content-single {
  max-width: 860px;
}

.content-panel {
  text-align: left;
}

.panel-results,
.content-panel {
  content-visibility: auto;
  contain-intrinsic-size: 1px 560px;
}

.prompt-example {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.96rem;
  line-height: 1.5;
}

.admin-page .shell.shell-no-sidebar {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 700px) {
  .admin-page .shell.shell-no-sidebar {
    width: 100%;
    max-width: 720px;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    justify-items: center;
  }

  .admin-page .shell.shell-no-sidebar .panel {
    width: 100%;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }

  .admin-console-header-actions {
    justify-content: center;
  }
}

.profile-page .button-secondary,
.profile-page .link-btn,
.profile-page #updateUsernameBtn,
.profile-page #manageBillingBtn,
.profile-page #logoutBtn {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(100, 60, 200, 0.28);
}

.profile-page .button-secondary:hover,
.profile-page .link-btn:hover,
.profile-page #updateUsernameBtn:hover,
.profile-page #manageBillingBtn:hover,
.profile-page #logoutBtn:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-2));
}



.home-page .button-secondary,
.home-page .link-btn,
.plans-page .button-secondary,
.plans-page .link-btn,
.library-page .button-secondary,
.library-page .link-btn,
.shared-page .button-secondary,
.shared-page .link-btn {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(100, 60, 200, 0.28);
}

.home-page .button-secondary:hover,
.home-page .link-btn:hover,
.plans-page .button-secondary:hover,
.plans-page .link-btn:hover,
.library-page .button-secondary:hover,
.library-page .link-btn:hover,
.shared-page .button-secondary:hover,
.shared-page .link-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-2));
}

@media (max-width: 899px) {
  .home-page .suggestion-chip {
    border-radius: 12px;
  }
}
