/* Ensure last content sections have breathing room from page bottom */
.app-main > section:last-child,
#subscription-section {
  margin-bottom: 80px;
}
/* Subscription comparison table */
.subscription-compare {
  margin-top: 24px;
  margin-bottom: 8px;
  max-width: 1100px;
  padding: 0 12px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 8px; /* extra cushion below pills */
}

.compare-title {
  font-size: 16px;
  font-weight: 600;
  margin: 6px 0 10px;
}

.compare-table-wrapper {
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  overflow: auto;
  background: radial-gradient(1200px 500px at 30% -20%, rgba(127, 90, 240, 0.08), transparent 50%), rgba(20, 22, 36, 0.7);
  max-width: 100%;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.compare-table thead th {
  text-align: left;
  background: linear-gradient(180deg, rgba(127, 90, 240, 0.16), rgba(127, 90, 240, 0.08));
  color: var(--text);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.compare-table tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.compare-table tbody th,
.compare-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.compare-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.025);
}

.compare-table tbody td {
  text-align: center;
  color: var(--text-soft);
  /* pill styling */
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}

/* Make feature name column cleaner */
.compare-table tbody th {
  color: var(--text-soft);
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .compare-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
  }
  .compare-table tbody th,
  .compare-table tbody td {
    padding: 10px 8px;
  }
  .compare-table {
    font-size: 11px;
  }
}

/* Column sizing: first column wider for feature names */
.compare-table thead th:first-child,
.compare-table tbody th {
  width: 40%;
}
.compare-table thead th:nth-child(2),
.compare-table thead th:nth-child(3),
.compare-table thead th:nth-child(4),
.compare-table thead th:nth-child(5),
.compare-table tbody td {
  width: 15%;
}

/* Highlight Prime column subtly */
.compare-table tbody td:last-child,
.compare-table thead th:last-child {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.08), transparent 60%);
}

/* Softer row separators and rounded bottom corners */
.compare-table tbody tr:last-child td,
.compare-table tbody tr:last-child th {
  border-bottom: none;
}

.compare-table-wrapper::after {
  content: "";
  display: block;
  height: 10px;
}
:root {
  --bg: #050509;
  --bg-alt: #0b0c14;
  --card: #141624;
  --card-hover: #1b1d2f;
  --accent: #7f5af0;
  --accent-soft: rgba(127, 90, 240, 0.2);
  --danger: #ff6b6b;
  --text: #f5f5ff;
  --text-soft: #a4a5c0;
  --border-subtle: #26283a;
  --radius-xl: 20px;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.7);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #141624 0, #050509 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

.app-root {
  display: flex;
  flex: 1;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */

.side-nav {
  width: 230px;
  background: radial-gradient(circle at top left, #151729 0, #060711 60%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 18px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 4px;

  /* NEU, damit der Button nicht wie ein weißer Kasten aussieht */
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;

  cursor: pointer;
  width: 100%;
  text-align: left;
  color: var(--text);
}

.side-brand:focus-visible {
  outline: 2px solid rgba(127, 90, 240, 0.6);
  outline-offset: 2px;
}


.side-logo {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #ffffff, #7f5af0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #050509;
  box-shadow: 0 0 25px rgba(127, 90, 240, 0.65);
  flex-shrink: 0;
}

.side-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-brand-text .title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.side-brand-text .subtitle {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section-label {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
  margin-bottom: 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.14s ease-out, color 0.14s ease-out,
    transform 0.1s ease-out;
}

.nav-item span.icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
  opacity: 0.85;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(127, 90, 240, 0.14);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-spacer {
  flex: 1;
}

.nav-footer {
  font-size: 11px;
  color: var(--text-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 8px;
}

/* Main shell & header */

.app-main-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(145deg, rgba(20, 22, 36, 0.96), rgba(5, 5, 9, 0.98));
  min-height: 100vh; /* ensure main shell fills viewport height */
}

header.app-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: radial-gradient(circle at top left, rgba(127, 90, 240, 0.12),
      transparent 60%);
  position: relative;
  /* NEU: eigene Ebene */
  z-index: 10;
  /* NEU: über dem Main-Content, unter Overlay */
}




/* moved responsive profile styles to components.css */

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-soft);
}

/* moved badge styles to components.css */

/* Subscription status (PRO) with shimmering gold text */
/* moved sub-status + keyframes to components.css */

/* Diamonds counter */
/* moved diamonds styles to components.css */

/* moved profile styles to components.css */

/* Main */

main.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  padding-bottom: 0; /* allow chat/content to reach full height */
}

/* moved landing view styles to views.css */

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}
.feature-icon { font-size: 22px; margin-bottom: 6px; }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-soft); }

/* Subscription */
#subscription-section { display: none; padding: 22px; }
.subscription-header { margin-bottom: 10px; }
.subscription-header h2 { font-size: 22px; font-weight: 700; }
.subscription-header p { color: var(--text-soft); font-size: 13px; }
.subscription-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: stretch; }
.plan-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.plan-card.highlight { border-color: rgba(127,90,240,0.7); box-shadow: 0 16px 40px rgba(127,90,240,0.15); }
.plan-card.premium { border-color: rgba(255,107,107,0.6); box-shadow: 0 16px 40px rgba(255,107,107,0.12); }
.plan-badge { position: absolute; top: 10px; right: 10px; font-size: 10px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); }
.plan-price { font-size: 22px; font-weight: 800; margin: 8px 0; }
.plan-price span { font-size: 12px; font-weight: 500; color: var(--text-soft); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 6px; color: var(--text-soft); font-size: 13px; margin: 10px 0; }
.plan-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,0.5); border-color: rgba(127,90,240,0.4); }

/* New header layout */
.plan-header { display: flex; align-items: center; gap: 10px; }
.plan-icon { width: 28px; height: 28px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: radial-gradient(120% 100% at 30% 0%, rgba(127,90,240,0.5), rgba(255,107,203,0.35)); box-shadow: 0 0 16px rgba(127,90,240,0.35); }
.plan-title { display: flex; align-items: baseline; gap: 8px; }
.plan-title h3 { font-size: 18px; }
.plan-title .plan-tier { padding: 2px 8px; border-radius: 999px; font-size: 11px; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); }

.plan-card.highlight .plan-title .plan-tier { background: rgba(127,90,240,0.18); border-color: rgba(127,90,240,0.35); }
.plan-card.premium .plan-title .plan-tier { background: linear-gradient(135deg, #b8860b, #ffd700); color: #050509; border: none; }

/* Feature list icons */
.plan-features li { display: flex; align-items: center; gap: 8px; }
.plan-features .fi { display: inline-flex; width: 18px; justify-content: center; opacity: 0.85; }

/* Footer actions */
.plan-actions { margin-top: auto; }
.plan-cta { width: 100%; padding: 10px 12px; border-radius: 10px; border: none; cursor: pointer; background: linear-gradient(135deg, var(--accent), #ff6bcb); color: #050509; font-weight: 700; margin-top: auto; }
.plan-cta .icon { margin-right: 6px; }
.plan-card h3 .plan-tier { margin-left: 6px; font-size: 12px; color: var(--text-soft); }

/* Settings */
#settings-section { display: none; padding: 22px; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; }
}

/* moved character selection and filters to views.css */

.toast {
  min-width: 220px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(20,22,36,0.78);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 2px 10px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-6px) scale(0.995);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.9,.2,1);
  cursor: pointer;
  pointer-events: auto;
}

/* Toasts container: centered at top */
#toast-container {
  position: fixed;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  align-items: center;
  pointer-events: none; /* allow clicks only on individual toasts */
}
.toast-show { opacity: 1; transform: translateY(0) scale(1); }
.toast-hide { opacity: 0; transform: translateY(-6px) scale(0.995); }
.toast-warning { border-left: 4px solid #ffb86b; background: linear-gradient(90deg, rgba(255,184,107,0.06), rgba(20,22,36,0.98)); color: #fff; }
.toast-info { border-left: 4px solid var(--accent); }

/* moved tag animations to views.css */

/* screen-reader only helper */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive adjustments for small screens (toasts) */
@media (max-width: 520px) {
  #toast-container { top: 16px; }
  .toast {
    max-width: calc(100% - 32px);
    min-width: auto;
    border-radius: 16px;
    padding: 10px 12px;
  }
}

/* showing count display */
.showing-count {
  color: var(--text-soft);
  font-size: 13px;
  margin-right: 8px;
  min-width: 140px;
  text-align: left;
}

.nsfw-only-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  color: var(--text-soft);
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  font-size: 13px;
  margin-right: 6px;
}

.nsfw-only-chip.selected {
  background: linear-gradient(135deg, rgba(255,107,107,0.18), rgba(255,80,80,0.12));
  color: var(--text);
  border-color: rgba(255,107,107,0.6);
}

.clear-tags-btn {
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  margin-left: 8px;
}

.clear-tags-btn:hover { transform: translateY(-1px); }

.sort { display: flex; align-items: center; gap: 8px; }
.sort-label { color: var(--text-soft); font-size: 13px; }
.sort-select { padding: 6px 8px; border-radius: 8px; background: rgba(10,10,20,0.9); color: var(--text); border: 1px solid var(--border-subtle); }

/* Section actions (Create character + NSFW toggle) */
.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.create-character-btn {
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff6bcb);
  color: #050509;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.create-character-btn:hover { transform: translateY(-2px); }

.create-character-btn .btn-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 8px;
  background: #ffffff;
  color: #050509;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  box-shadow: 0 6px 12px rgba(127,90,240,0.12);
}

/* Create button icon */
.create-character-btn .create-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  font-size: 14px;
  margin-right: 8px;
  vertical-align: middle;
}

.create-character-btn .create-text { vertical-align: middle; }

/* Character card rating stars */
.char-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.char-rating .stars { position: relative; display: inline-block; }
.char-rating .stars-outer,
.char-rating .stars-inner {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 2px;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial;
}
.char-rating .stars-outer { color: rgba(255,255,255,0.18); }
.char-rating .stars-inner {
  color: #ffd166;
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
.char-rating .rating-meta { color: var(--text-soft); font-size: 12px; }
.char-rating .rating-number { margin-right: 4px; }

/* Responsive: compact layout for small screens */
@media (max-width: 760px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-actions {
    width: 100%;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
  }

  /* Make the create button smaller on mobile */
  .create-character-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* Keep the switch and label compact */
  .nsfw-toggle { gap: 6px; }
  .nsfw-toggle .switch { width: 40px; height: 20px; }
  .nsfw-toggle .slider:before { height: 16px; width: 16px; left: 2px; top: 2px; }
  .nsfw-toggle .nsfw-checkbox:checked + .slider:before { transform: translateX(18px); }

  /* Hide the NEW badge on small screens to save space */
  .create-character-btn .btn-badge { display: none; }

  /* On very small screens stack controls vertically */
  @media (max-width: 420px) {
    .section-actions {
      flex-direction: column;
      align-items: stretch;
    }
    .create-character-btn { width: 100%; }
    .nsfw-toggle { justify-content: flex-start; }
    /* Keep icon and text visible on very small screens as requested */
    .create-character-btn .create-text { display: inline; }
    .create-character-btn .create-icon { margin-right: 6px; }
  }
}

.nsfw-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
}

/* Switch-style toggle */
.nsfw-toggle .switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.nsfw-toggle .nsfw-checkbox {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  left: 0;
  top: 0;
}

.nsfw-toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 24px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.nsfw-toggle .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 160ms ease, background 160ms ease;
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.nsfw-toggle .nsfw-checkbox:checked + .slider {
  background: linear-gradient(135deg, var(--accent), #ff6bcb);
}

.nsfw-toggle .nsfw-checkbox:checked + .slider:before {
  transform: translateX(20px);
  background: #050509;
}

.nsfw-toggle .nsfw-label {
  font-size: 13px;
  color: var(--text-soft);
}

.section-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.section-header p {
  font-size: 13px;
  color: var(--text-soft);
}

/* moved character grid and cards to views.css */

/* Extra tightening for very small screens: more compact cards/grid */
@media (max-width: 600px) {
  .character-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .char-card {
    padding: 10px 10px 12px;
    min-height: 0;
  }

  .char-image {
    height: 220px;
  }
}

.char-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(127, 90, 240, 0.18),
      transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.char-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.7);
  border-color: rgba(127, 90, 240, 0.7);
  background: var(--card-hover);
  z-index: 2;
}

.char-card:hover::before {
  opacity: 1;
}

.char-image {
  width: 100%;
  height: 250px;
  border-radius: 16px;
  background-size: cover;
  background-position: top;
  margin-bottom: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
}

.char-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.char-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 20% 0, #ffffff, #7f5af0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #050509;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(127, 90, 240, 0.7);
}

.char-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.char-name {
  font-size: 15px;
  font-weight: 600;
}

.char-tagline {
  font-size: 12px;
  color: var(--text-soft);
}

.char-body {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
  line-height: 1.4;
  flex: 1;
}

.char-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-soft);
  flex-wrap: wrap;
}

/* Buttons inside character cards */
.char-footer .play-btn,
.char-footer .delete-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, opacity 0.12s ease-out;
}

.char-footer .play-btn {
  background: linear-gradient(135deg, var(--accent), #ff6bcb);
  color: #050509;
  box-shadow: 0 6px 18px rgba(127,90,240,0.22);
}

.char-footer .play-btn:hover { transform: translateY(-2px); }

.char-footer .delete-btn {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid rgba(255,255,255,0.06);
}

.char-footer .delete-btn:hover {
  background: rgba(255,107,107,0.06);
  color: var(--danger);
  transform: translateY(-2px);
}

/* Owner outline and edit button */
.char-card.owner {
  box-shadow: 0 20px 50px rgba(127,90,240,0.18);
  border: 1px solid rgba(127,90,240,0.9);
}

.char-footer .edit-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid rgba(127,90,240,0.16);
  background: rgba(127,90,240,0.06);
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, opacity 0.12s ease-out;
}

.char-footer .edit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(127,90,240,0.12);
}

.char-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.char-pill.accent {
  border-color: rgba(127, 90, 240, 0.6);
  color: var(--accent);
  background: rgba(127, 90, 240, 0.12);
}

.char-pill.nsfw {
  border-color: rgba(255, 107, 107, 0.7);
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.12);
}

/* moved chat view styles to views.css */

/* Auth overlay */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  backdrop-filter: blur(18px);
}

.auth-modal {
  width: 100%;
  max-width: 420px;
  background: #0b0c16;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.9);
  padding: 18px 18px 16px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  position: relative;
}

.auth-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-soft);
}

.auth-close {
  position: absolute;
  right: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 5, 12, 0.9);
  color: var(--text-soft);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(14, 15, 30, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.auth-tab {
  flex: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.14s ease-out, color 0.14s ease-out,
    box-shadow 0.14s ease-out;
}

.auth-tab.active {
  background: radial-gradient(circle at 20% 0, #ffffff, #7f5af0);
  color: #050509;
  box-shadow: 0 0 16px rgba(127, 90, 240, 0.75);
  font-weight: 500;
}

.auth-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.auth-form label {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form input {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(10, 10, 20, 0.95);
  color: var(--text);
  padding: 7px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.14s ease-out, box-shadow 0.14s ease-out,
    background 0.14s ease-out;
}

.auth-form input:focus {
  border-color: rgba(127, 90, 240, 0.9);
  background: rgba(13, 13, 28, 1);
  box-shadow: 0 0 0 1px rgba(127, 90, 240, 0.5);
}

/* Register checkboxes: override pill input styling */
.auth-form label.register-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  margin-top: 2px;
  color: var(--text-soft);
  line-height: 1.35;
}

.auth-form label.register-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(10, 10, 20, 0.95);
  box-shadow: none;
  outline: none;
  flex-shrink: 0;

  /* Custom checkbox */
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: transform 0.1s ease-out, border-color 0.14s ease-out, box-shadow 0.14s ease-out, background 0.14s ease-out;
}

.auth-form label.register-checkbox input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transition: transform 0.12s ease-out;
  background: var(--bg);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 84% 8%, 38% 72%);
}

.auth-form label.register-checkbox input[type="checkbox"]:checked {
  border-color: rgba(127, 90, 240, 0.9);
  background: radial-gradient(circle at 20% 0, #ffffff, #7f5af0);
}

.auth-form label.register-checkbox input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.auth-form label.register-checkbox input[type="checkbox"]:hover {
  transform: translateY(-1px);
}

.auth-form label.register-checkbox input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 2px rgba(127, 90, 240, 0.45);
}

.auth-submit {
  margin-top: 6px;
  border-radius: 999px;
  border: none;
  padding: 8px 12px;
  background: radial-gradient(circle at 20% 0, #ffffff, #7f5af0);
  color: #050509;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(127, 90, 240, 0.8);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(127, 90, 240, 0.95);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
  font-size: 11px;
  color: var(--text-soft);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-google {
  margin-top: 2px;
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(9, 10, 22, 0.96);
  color: var(--text);
  font-size: 13px;
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.auth-google:disabled:hover {
  transform: none;
}

.auth-google-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.auth-google-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.35;
}

.auth-google-hint:empty {
  display: none;
}

.auth-google-hint.is-warning {
  color: var(--color-danger);
}

/* Register checkbox error highlight (red pulse) */
.auth-form label.register-checkbox.is-error {
  color: var(--color-danger);
}

.auth-form label.register-checkbox.is-error input[type="checkbox"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 45%, transparent);
  animation: registerCheckboxPulse 850ms ease-out;
}

@keyframes registerCheckboxPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-danger) 60%, transparent); }
  45% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger) 50%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-danger) 0%, transparent); }
}

.hidden {
  display: none !important;
}

/* Responsive */

/* Tablets/small desktop: tighten paddings, keep layout mostly desktop-like */
@media (max-width: 900px) {
  header.app-header {
    padding: 10px 10px;
  }

  #character-selection {
    padding: 18px 14px 14px;
  }

  .character-grid {
    margin-top: 8px;
  }

  .chat-body {
    padding-inline: 12px;
  }

  .brand-text .subtitle {
    display: none;
  }

  .auth-modal {
    margin-inline: 14px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .chat-info-panel {
    width: 100%;
  }
}

/* Phones and small tablets: hamburger + slide-in nav, stacked filters */
@media (max-width: 720px) {
  .app-main-shell {
    width: 100%;
  }

  /* When chat is open on mobile, hide the big app header
     so only the chat header (with back button) is visible */
  body.chat-open header.app-header {
    display: none;
  }

  /* Lock page scrolling entirely while chat is open so iOS doesn't
     push the whole document; we will show a fixed chat overlay instead. */
  html.chat-open,
  body.chat-open {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* Character selection: let the whole page scroll, avoid inner scroll areas */
  #character-selection {
    height: auto;
  }

  .character-grid {
    overflow-y: visible;
  }

  /* Chat view on mobile: fixed full-screen overlay (header, messages, input)
     that sits above the app and does its own internal scrolling. */
  body.chat-open #chat-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    z-index: 90;
  }

  .chat-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Show mobile info toggle in header */
  .chat-info-toggle {
    display: inline-flex;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .brand {
    gap: 8px;
  }

  /* Character info as slide-up sheet, hidden by default */
  .chat-info-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 60vh;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    background: rgba(10, 10, 20, 0.98);
    backdrop-filter: blur(18px);
    transform: translateY(100%);
    transition: transform 0.18s ease-out;
    z-index: 80;
  }

  #chat-screen.info-open .chat-info-panel {
    transform: translateY(0);
  }

  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-width: 280px;
    width: 0;
    overflow: hidden;
    transition: width 0.18s ease-out, box-shadow 0.18s ease-out;
    z-index: 60;
    padding-left: 0;
    padding-right: 0;
    pointer-events: none;
  }

  .side-nav.is-open {
    width: 78%;
    max-width: 280px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    padding-left: 14px;
    padding-right: 14px;
    pointer-events: auto;
    overflow-y: auto;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 50;
    display: none;
  }

  .mobile-nav-backdrop.show {
    display: block;
  }

  /* Stack filters and make tag chips horizontally scrollable */
  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filters-row .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filters-row .chips .tag-chip,
  .filters-row .chips .nsfw-only-chip,
  .filters-row .chips .clear-tags-btn {
    white-space: nowrap;
  }

  .sort {
    width: 100%;
    justify-content: space-between;
  }

  .sort-label {
    display: none;
  }

  .showing-count {
    font-size: 12px;
    min-width: 0;
    margin-right: 0;
  }

  .sort-select {
    min-width: 130px;
  }

  /* Chat input: bigger tap targets */
  .chat-input-bar {
    padding: 6px 10px 6px;
    /* Add safe-area inset on iOS */
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .chat-input {
    font-size: 16px;
  }

  .chat-send-btn {
    width: 38px;
    height: 38px;
  }

  /* Chat messages: scroll inside the chat overlay on mobile,
     flexing between chat header and input */
  .chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 12px;
  }

  /* Ensure all form controls use 16px to prevent iOS zoom */
  input,
  textarea,
  select {
    font-size: 16px;
  }

  /* Hide secondary header badges on very small screens */
  .header-actions {
    display: none;
  }

  /* moved conv play button responsive styles to views.css */

/* Conversation List */
/* moved conversation list styles to views.css */

/* ============================================================
   FIX: Auth Overlay must be clickable and above all UI layers
   ============================================================ */

.auth-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;

    /* MUST be highest layer */
    z-index: 99999 !important;

    background: rgba(5, 5, 12, 0.85) !important;
    backdrop-filter: blur(18px) !important;
    pointer-events: all !important;
}

.auth-modal {
    position: relative !important;
    z-index: 100000 !important;
    pointer-events: all !important;
}

/* Prevent the page behind from blocking clicks (keep main shell/header below overlays) */
.app-main-shell,
header.app-header {
  position: relative !important;
  z-index: 1 !important;
}

/* FINAL OVERRIDE FOR AUTH OVERLAY – FIX CLICK BLOCKING */
#auth-overlay,
.auth-overlay {
    position: fixed !important;
    inset: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;

    z-index: 999999 !important;

    background: rgba(10, 10, 20, 0.8) !important;
    backdrop-filter: blur(18px) !important;

    pointer-events: auto !important;
}

.auth-modal {
    position: relative !important;
    z-index: 1000000 !important;
    pointer-events: auto !important;
}

/* Debug visibility overrides removed after verification */