/* ==========================================================================
   Humanizer page — visual refresh.
   Loaded after styles.css. Only restyles the existing markup (all ids and
   classes that main.js uses stay the same). Every selector starts with
   "#page-humanizer.page" so it beats the older "#page-humanizer .x" rules
   without !important. Palette matches the React pages (account-react/).
   ========================================================================== */

#page-humanizer.page {
  --hx-ink: #1d1d1f;
  --hx-ink-2: #424245;
  --hx-muted: #86868b;
  --hx-line: #e5e5e7;
  --hx-soft: #f5f5f7;
  --hx-card: #ffffff;
  --hx-green: #10b981;
  --hx-green-ink: #047857;
  --hx-green-soft: #d1fae5;
  --hx-red: #ef4444;
  --hx-red-ink: #b91c1c;
  --hx-red-soft: #fee2e2;
  --hx-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--hx-ink);
}

/* ---------- Page head ---------- */
#page-humanizer.page .sw-humanizer-page { max-width: 1200px; }
#page-humanizer.page .sw-breadcrumb { display: none; }
#page-humanizer.page .sw-hum-page-head { margin-bottom: 18px; }
#page-humanizer.page .sw-hum-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#page-humanizer.page .sw-hum-title-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

#page-humanizer.page .sw-hum-head-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--hx-ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

#page-humanizer.page .sw-hum-head-icon svg { width: 20px; height: 20px; stroke: currentColor; }

#page-humanizer.page .sw-hum-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

#page-humanizer.page .sw-hum-subtitle { margin: 3px 0 0; font-size: 14px; color: var(--hx-muted); }

#page-humanizer.page .sw-how-to {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--hx-ink-2);
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

#page-humanizer.page .sw-how-to:hover { background: var(--hx-soft); }

/* Word-limit strip */
#page-humanizer.page .sw-hum-limit-wrap { margin-bottom: 16px; }

#page-humanizer.page .sw-adv-limit-zone {
  padding: 12px 16px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 14px;
  box-shadow: var(--hx-shadow);
}

/* ---------- Two columns ---------- */
#page-humanizer.page .sw-hum-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

#page-humanizer.page .sw-hum-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#page-humanizer.page .sw-hum-sidebar { position: sticky; top: 20px; min-width: 0; }

/* ---------- Input card ---------- */
#page-humanizer.page .sw-card {
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 20px;
  box-shadow: var(--hx-shadow);
}

#page-humanizer.page .sw-card-input { margin: 0; overflow: visible; }
#page-humanizer.page .sw-card-input:focus-within { border-color: #c7c7cc; }

#page-humanizer.page .sw-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 14px 18px;
  background: #fafafa;
  border-bottom: 1px solid var(--hx-line);
  border-radius: 20px 20px 0 0;
}

#page-humanizer.page .sw-toolbar-left,
#page-humanizer.page .sw-model-toolbar-stack { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

#page-humanizer.page .sw-muted-label,
#page-humanizer.page .sw-model-pill-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

#page-humanizer.page .sw-level-hint { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--hx-muted); }

/* Segmented controls: level + model */
#page-humanizer.page .sw-level-pills,
#page-humanizer.page .sw-model-tab-bar {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 11px;
  box-shadow: none;
}

#page-humanizer.page .sw-level-pill {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hx-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#page-humanizer.page .sw-level-pill:hover:not(.sw-level-pill--active) { color: var(--hx-ink); background: var(--hx-soft); }
#page-humanizer.page .sw-level-pill--active { color: #fff; background: var(--hx-ink); box-shadow: none; }

#page-humanizer.page .sw-model-pill.sw-model-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--hx-ink-2);
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#page-humanizer.page .sw-model-pill.sw-model-tab:hover { background: var(--hx-soft); }

#page-humanizer.page .sw-model-pill.sw-model-tab.sw-model-tab--active,
#page-humanizer.page .sw-model-pill.sw-model-tab.selected { color: #fff; background: var(--hx-ink); }

#page-humanizer.page .sw-model-legacy { position: relative; }

#page-humanizer.page .sw-model-legacy-menu {
  padding: 4px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

#page-humanizer.page .sw-model-legacy-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--hx-ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

#page-humanizer.page .sw-model-legacy-item:hover { background: var(--hx-soft); }

/* Textarea */
#page-humanizer.page .sw-card-body-input { padding: 0; }

#page-humanizer.page .sw-textarea {
  display: block;
  width: 100%;
  min-height: 300px;
  padding: 20px 22px;
  font: inherit;
  font-size: 15px;
  line-height: 1.75;
  color: var(--hx-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  resize: vertical;
}

#page-humanizer.page .sw-textarea::placeholder { color: #a1a1a6; }

#page-humanizer.page .sw-humanizer-word-warning {
  margin: 0 18px 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

/* Footer: words + Clear | Check for AI + Humanize */
#page-humanizer.page .sw-card-footer-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 18px;
  background: #fafafa;
  border-top: 1px solid var(--hx-line);
}

#page-humanizer.page .sw-footer-left { display: inline-flex; align-items: center; gap: 10px; }
#page-humanizer.page .sw-footer-sep { display: none; }

#page-humanizer.page .sw-word-count-line {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--hx-muted);
  font-variant-numeric: tabular-nums;
}

/* Clear: soft red pill, same as the AI Detector */
#page-humanizer.page #clear-humanizer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #c0392b;
  background: #fff1f0;
  border: 1px solid #f6c9c4;
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#page-humanizer.page #clear-humanizer-btn:hover { color: #fff; background: #d93025; border-color: #d93025; }
#page-humanizer.page #clear-humanizer-btn svg { stroke: currentColor; }

#page-humanizer.page .sw-footer-actions { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }

#page-humanizer.page #btn-check-ai,
#page-humanizer.page #btn-humanize {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

#page-humanizer.page #btn-check-ai {
  color: var(--hx-ink);
  background: var(--hx-card);
  border: 1px solid #d2d2d7;
  box-shadow: none;
}

#page-humanizer.page #btn-check-ai:hover:not(:disabled) { background: var(--hx-soft); }

#page-humanizer.page #btn-humanize {
  padding: 0 24px;
  color: #fff;
  background: var(--hx-ink);
  border: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

#page-humanizer.page #btn-humanize:hover:not(:disabled) { background: #000; }
#page-humanizer.page #btn-humanize:active:not(:disabled),
#page-humanizer.page #btn-check-ai:active:not(:disabled) { transform: scale(0.98); }
#page-humanizer.page #btn-humanize:disabled,
#page-humanizer.page #btn-check-ai:disabled { opacity: 0.55; cursor: not-allowed; }

/* Advanced settings */
#page-humanizer.page .sw-adv-card { border-top: 1px solid var(--hx-line); border-radius: 0 0 20px 20px; background: var(--hx-card); }
#page-humanizer.page .sw-adv-head { padding: 12px 18px; }
#page-humanizer.page .sw-adv-head-title { font-size: 13px; font-weight: 600; color: var(--hx-ink-2); }

#page-humanizer.page .sw-adv-sec-lbl {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

#page-humanizer.page .humaniser-chip,
#page-humanizer.page .humaniser-seg-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--hx-ink-2);
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#page-humanizer.page .humaniser-chip:hover,
#page-humanizer.page .humaniser-seg-btn:hover { background: var(--hx-soft); }

#page-humanizer.page .humaniser-chip--selected,
#page-humanizer.page .humaniser-seg-btn--active {
  color: var(--hx-ink);
  background: var(--hx-soft);
  border-color: var(--hx-ink);
  box-shadow: inset 0 0 0 1px var(--hx-ink);
}

#page-humanizer.page .sw-adv-lang-sel {
  height: 38px;
  padding: 0 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--hx-ink);
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 10px;
}

/* ---------- Detection score (right column) ---------- */
#page-humanizer.page .sw-detection-card { overflow: hidden; }

#page-humanizer.page .sw-detection-card-head { padding: 14px 18px; border-bottom: 1px solid var(--hx-line); }

#page-humanizer.page .sw-detection-card-title {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

#page-humanizer.page .sw-score-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 18px 30px;
  text-align: center;
}

#page-humanizer.page .sw-score-empty-icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 6px;
  color: #a1a1a6;
  background: #fafafa;
  border: 2px dashed #dcdce0;
  border-radius: 50%;
}

#page-humanizer.page .sw-score-empty-title { font-size: 15px; font-weight: 600; color: var(--hx-ink); }
#page-humanizer.page .sw-score-empty-copy { max-width: 24ch; font-size: 13px; line-height: 1.5; color: var(--hx-muted); }

/* Score cards (original / humanized), colored by main.js via .green / .red */
#page-humanizer.page #humaniser-score-comparison .ds-wrap { display: flex; flex-direction: column; gap: 12px; padding: 16px; }

#page-humanizer.page #humaniser-score-comparison .ds-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--hx-line);
  border-radius: 14px;
  background: var(--hx-card);
}

#page-humanizer.page #humaniser-score-comparison .ds-card.green {
  border-color: #bbf0d6;
  background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 70%);
}

#page-humanizer.page #humaniser-score-comparison .ds-card.red {
  border-color: #fbd0d0;
  background: linear-gradient(180deg, #fef2f2 0%, #ffffff 70%);
}

#page-humanizer.page #humaniser-score-comparison .ds-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

#page-humanizer.page #humaniser-score-comparison .ds-scanned-with { margin-top: -6px; font-size: 10.5px; color: #a1a1a6; }

#page-humanizer.page #humaniser-score-comparison .ring-bg { stroke: #ececef; stroke-width: 9; }
#page-humanizer.page #humaniser-score-comparison .ring-fg { stroke-width: 9; transition: stroke-dashoffset 1s ease-out; }
#page-humanizer.page #humaniser-score-comparison .ds-card.green .ring-fg { stroke: var(--hx-green); }
#page-humanizer.page #humaniser-score-comparison .ds-card.red .ring-fg { stroke: var(--hx-red); }

#page-humanizer.page #humaniser-score-comparison .ring-num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

#page-humanizer.page #humaniser-score-comparison .ds-card.green .ring-num { color: var(--hx-green-ink); }
#page-humanizer.page #humaniser-score-comparison .ds-card.red .ring-num { color: var(--hx-red-ink); }
#page-humanizer.page #humaniser-score-comparison .ring-sub { font-size: 11.5px; color: var(--hx-muted); }

#page-humanizer.page #humaniser-score-comparison .sw-ds-hint { margin: 0; font-size: 12px; text-align: center; color: var(--hx-muted); }

#page-humanizer.page #humaniser-score-comparison .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
}

#page-humanizer.page #humaniser-score-comparison .ds-card.green .badge { color: var(--hx-green-ink); background: var(--hx-green-soft); }
#page-humanizer.page #humaniser-score-comparison .ds-card.red .badge { color: var(--hx-red-ink); background: var(--hx-red-soft); }

#page-humanizer.page #humaniser-score-comparison .footer-label {
  margin: 0 -16px -16px;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: transparent;
  border-top: 1px solid var(--hx-line);
}

#page-humanizer.page #humaniser-score-comparison .footer-label.green { color: var(--hx-green-ink); }
#page-humanizer.page #humaniser-score-comparison .footer-label.red { color: var(--hx-red-ink); }

/* ---------- Result ---------- */
#page-humanizer.page .sw-humanize-result { margin: 0; }

#page-humanizer.page .sw-humanize-loading {
  padding: 48px 24px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 20px;
  box-shadow: var(--hx-shadow);
}

#page-humanizer.page .sw-humanize-loading-title { font-size: 16px; font-weight: 600; }
#page-humanizer.page .sw-humanize-loading-copy { font-size: 13.5px; color: var(--hx-muted); }

#page-humanizer.page .sw-result-card {
  margin: 0;
  padding: 0;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 20px;
  box-shadow: var(--hx-shadow);
  overflow: hidden;
}

#page-humanizer.page .sw-result-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hx-line);
}

#page-humanizer.page .sw-result-title { margin: 0; font-size: 15px; font-weight: 600; }

/* Draft navigation stays hidden, as in the original design (one draft). */
#page-humanizer.page .sw-result-draft-nav { display: none; }

#page-humanizer.page .sw-result-title-block { flex: 1 1 auto; width: auto; min-width: 0; }
#page-humanizer.page .sw-result-title { display: inline-flex; align-items: center; gap: 8px; }

#page-humanizer.page .sw-result-toolbar { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; width: auto; margin-left: auto; }

#page-humanizer.page .sw-result-toolbar .sw-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hx-ink-2);
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 999px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#page-humanizer.page .sw-result-toolbar .sw-btn-ghost:hover { background: var(--hx-soft); color: var(--hx-ink); }

#page-humanizer.page .sw-result-toolbar .sw-deep-scan-btn[aria-pressed="true"] {
  color: #fff;
  background: var(--hx-ink);
  border-color: var(--hx-ink);
}

#page-humanizer.page .sw-original-panel {
  margin: 16px 18px 0;
  padding: 14px 16px;
  background: var(--hx-soft);
  border: 1px solid var(--hx-line);
  border-radius: 12px;
}

#page-humanizer.page .sw-original-heading {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

#page-humanizer.page .sw-original-body { font-size: 14px; line-height: 1.7; color: var(--hx-ink-2); max-height: 220px; overflow-y: auto; }

/* Humanized text: fixed box that scrolls inside */
#page-humanizer.page .sw-humanized-body { padding: 0; }

#page-humanizer.page .sw-humanized-text {
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px;
  font-size: 15px;
  line-height: 1.85;
  color: var(--hx-ink);
  scrollbar-width: thin;
  scrollbar-color: #d2d2d7 transparent;
}

#page-humanizer.page .sw-humanized-text::-webkit-scrollbar { width: 8px; }
#page-humanizer.page .sw-humanized-text::-webkit-scrollbar-thumb { background: #d2d2d7; border-radius: 8px; border: 2px solid #fff; }

#page-humanizer.page .sw-result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 12px 18px;
  background: #fafafa;
  border-top: 1px solid var(--hx-line);
}

#page-humanizer.page .sw-legend-main { margin: 0; font-size: 12px; color: var(--hx-muted); }
#page-humanizer.page .sw-result-footer-meta { display: inline-flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--hx-ink-2); }
#page-humanizer.page .sw-color-legend { display: inline-flex; gap: 12px; }
#page-humanizer.page .sw-color-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
#page-humanizer.page .sw-color-legend .legend-color { width: 12px; height: 12px; border-radius: 3px; }
#page-humanizer.page .sw-color-legend .ai-color { background: #ffe2e2; }
#page-humanizer.page .sw-color-legend .human-color { background: #d0fae5; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  #page-humanizer.page .sw-hum-columns { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media (max-width: 900px) {
  #page-humanizer.page .sw-hum-head-icon { display: none; }
  #page-humanizer.page .sw-hum-title { font-size: 24px; }
  #page-humanizer.page .sw-hum-title-row { display: flex; align-items: flex-start; justify-content: space-between; }
  #page-humanizer.page .sw-hum-title-left { flex: 1 1 auto; width: auto; min-width: 0; }
  #page-humanizer.page .sw-hum-subtitle { max-width: 28ch; }
  #page-humanizer.page .sw-how-to { flex-shrink: 0; height: 34px; padding: 0 12px; font-size: 12.5px; }

  #page-humanizer.page .sw-hum-columns { display: flex; flex-direction: column; gap: 16px; }
  #page-humanizer.page .sw-hum-sidebar { position: static; width: 100%; }

  #page-humanizer.page .sw-card-toolbar { flex-direction: column; align-items: stretch; padding: 12px 14px; }
  #page-humanizer.page .sw-toolbar-left,
  #page-humanizer.page .sw-model-toolbar-stack { flex-direction: column; align-items: stretch; gap: 7px; }
  /* Level: one scrollable row. Model: a 2 x 2 grid so all four fit. */
  #page-humanizer.page .sw-level-pills {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #page-humanizer.page .sw-level-pill { flex: 1 0 auto; }

  #page-humanizer.page .sw-model-tab-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    overflow: visible;
  }
  #page-humanizer.page .sw-model-legacy { display: flex; min-width: 0; width: auto; flex: none; }
  #page-humanizer.page .sw-model-legacy .sw-model-legacy-trigger { width: 100%; }
  #page-humanizer.page .sw-model-pill.sw-model-tab { width: 100%; min-width: 0; justify-content: center; padding: 0 8px; }

  #page-humanizer.page .sw-textarea { min-height: 220px; padding: 14px 16px; }
  #page-humanizer.page .sw-card-footer-input { padding: 12px 14px; }
  #page-humanizer.page .sw-footer-actions { width: 100%; margin-left: 0; }
  #page-humanizer.page #btn-check-ai,
  #page-humanizer.page #btn-humanize { flex: 1; height: 46px; }

  #page-humanizer.page .sw-result-card-head { padding: 12px 14px; }
  #page-humanizer.page .sw-humanized-text { max-height: 360px; padding: 14px 16px; }
  #page-humanizer.page .sw-result-footer { padding: 12px 14px; }
}

/* Advanced settings sit flush under the footer, on white. */
#page-humanizer.page .sw-adv-card { margin: 0; box-shadow: none; border-left: 0; border-right: 0; border-bottom: 0; }
#page-humanizer.page .sw-adv-head { background: transparent; border-bottom: 1px solid var(--hx-line); }
#page-humanizer.page .sw-adv-body { background: var(--hx-card); padding: 16px 18px 18px; border-radius: 0 0 20px 20px; }

/* ==========================================================================
   Polish pass: collapsible advanced settings, compact chips, tidier score
   card and result header.
   ========================================================================== */

/* Advanced settings: a clickable row; the body hides when collapsed
   (humanizer-ui.js toggles .is-collapsed). */
#page-humanizer.page .sw-adv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

#page-humanizer.page .sw-adv-head:hover { background: #fafafa; }
#page-humanizer.page .sw-adv-head:focus-visible { outline: 2px solid var(--hx-ink); outline-offset: -2px; }
#page-humanizer.page .sw-adv-head-start { display: inline-flex; align-items: center; gap: 8px; }
#page-humanizer.page .sw-adv-head-hint { font-size: 12.5px; color: var(--hx-muted); }

#page-humanizer.page .sw-adv-chevron {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  color: var(--hx-muted);
  border-radius: 8px;
  transition: transform 0.2s ease, background 0.15s ease;
}

#page-humanizer.page .sw-adv-head:hover .sw-adv-chevron { background: var(--hx-soft); color: var(--hx-ink); }
#page-humanizer.page .sw-adv-card:not(.is-collapsed) .sw-adv-chevron { transform: rotate(180deg); }
#page-humanizer.page .sw-adv-card.is-collapsed .sw-adv-body { display: none; }
#page-humanizer.page .sw-adv-card.is-collapsed .sw-adv-head { border-bottom: 0; border-radius: 0 0 20px 20px; }

/* Engine: same segmented look as the model picker, no nested box */
#page-humanizer.page .sw-adv-engine-block {
  padding: 0;
  margin-bottom: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#page-humanizer.page .sw-adv-eng-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 11px;
}

#page-humanizer.page .humaniser-seg-btn {
  height: 30px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

#page-humanizer.page .humaniser-seg-btn--active { color: #fff; background: var(--hx-ink); box-shadow: none; }

/* Tone / purpose: compact pills, four per row, dark when selected */
#page-humanizer.page .humaniser-field { margin: 0; }
#page-humanizer.page .sw-adv-div { height: 1px; margin: 14px 0; background: var(--hx-line); border: 0; }

#page-humanizer.page .humaniser-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

#page-humanizer.page .humaniser-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 999px;
  box-shadow: none;
}

#page-humanizer.page .humaniser-chip-emoji { font-size: 13px; line-height: 1; }
#page-humanizer.page .humaniser-chip-chk { display: none; }

#page-humanizer.page .humaniser-chip.humaniser-chip--selected {
  color: #fff;
  background: var(--hx-ink);
  border-color: var(--hx-ink);
  box-shadow: none;
}

#page-humanizer.page .sw-adv-lang-wrap { margin-top: 8px; max-width: 280px; }
#page-humanizer.page .sw-adv-lang-sel { width: 100%; }

/* Score card: tighter, no duplicate "Looks Human" footer */
#page-humanizer.page #humaniser-score-comparison .ds-card { gap: 8px; padding: 18px 16px 16px; }
#page-humanizer.page #humaniser-score-comparison .ring-wrap { width: 120px; height: 120px; margin: 6px 0 4px; filter: none; }
#page-humanizer.page #humaniser-score-comparison .sw-ds-hint:empty { display: none; }
#page-humanizer.page #humaniser-score-comparison .footer-label { display: none; }
#page-humanizer.page #humaniser-score-comparison .ds-wrap { padding: 14px; }

/* Result header: normal height */
#page-humanizer.page .sw-result-card-head { min-height: 0; padding: 12px 18px; }
#page-humanizer.page .sw-result-title-block,
#page-humanizer.page .sw-result-toolbar { margin-top: 0; margin-bottom: 0; padding: 0; }
#page-humanizer.page .sw-result-title { font-size: 15px; line-height: 1.3; }
#page-humanizer.page .sw-result-title svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  #page-humanizer.page .sw-adv-head-hint { display: none; }
  #page-humanizer.page .humaniser-chip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #page-humanizer.page .sw-adv-lang-wrap { max-width: none; }
  /* Three equal buttons on one line */
  #page-humanizer.page .sw-result-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    margin-left: 0;
  }
  #page-humanizer.page .sw-result-toolbar .sw-btn-ghost { justify-content: center; padding: 0 6px; font-size: 12px; white-space: nowrap; }
}

/* ==========================================================================
   Extras added by humanizer-ui.js: paste button, model hint, feature cards.
   Plus a calmer "Humanizing…" loading state.
   ========================================================================== */

#page-humanizer.page .hx-input-wrap { position: relative; }

#page-humanizer.page .hx-paste {
  position: absolute;
  top: 16px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hx-ink-2);
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#page-humanizer.page .hx-paste:hover { color: var(--hx-ink); background: var(--hx-soft); }
#page-humanizer.page .hx-paste.is-hidden { display: none; }

#page-humanizer.page .hx-model-hint {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--hx-muted);
}

#page-humanizer.page .hx-model-hint:empty { display: none; }

/* Feature cards */
#page-humanizer.page .hx-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#page-humanizer.page .hx-features.is-hidden { display: none; }

#page-humanizer.page .hx-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--hx-card);
  border: 1px solid var(--hx-line);
  border-radius: 16px;
  box-shadow: var(--hx-shadow);
}

#page-humanizer.page .hx-feature-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--hx-ink);
  border-radius: 10px;
}

#page-humanizer.page .hx-feature strong { display: block; font-size: 14px; font-weight: 600; }
#page-humanizer.page .hx-feature div > span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--hx-muted); }

/* Calmer loading state (same feel as the AI Detector's scanning card) */
#page-humanizer.page .sw-humanize-loading {
  min-height: 0;
  padding: 52px 24px;
  border-color: var(--hx-line);
  border-radius: 20px;
  box-shadow: var(--hx-shadow);
}

#page-humanizer.page .sw-humanize-loading-mark { width: 76px; height: 76px; margin-bottom: 14px; }
#page-humanizer.page .sw-humanize-loading-mark::before,
#page-humanizer.page .sw-humanize-loading-mark::after { display: none; }

#page-humanizer.page .sw-humanize-loading-ring { animation: none; box-shadow: none; }
#page-humanizer.page .sw-humanize-loading-ring--outer { background: var(--hx-soft); border: 1px solid var(--hx-line); }

#page-humanizer.page .sw-humanize-loading-ring--inner {
  inset: 14px;
  background: transparent;
  border: 3px solid #e5e5e7;
  border-top-color: var(--hx-ink);
  box-shadow: none;
  animation: hx-spin 0.9s linear infinite;
}

#page-humanizer.page .sw-humanize-loading-brain { display: none; }
#page-humanizer.page .sw-humanize-loading-title { margin: 0; font-size: 16px; font-weight: 600; }
#page-humanizer.page .sw-humanize-loading-copy { margin: 4px 0 0; }

@keyframes hx-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  #page-humanizer.page .hx-features { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #page-humanizer.page .hx-paste { top: auto; bottom: 14px; right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #page-humanizer.page .sw-humanize-loading-ring--inner { animation: none; }
}

/* Advanced settings are SuperSonic-only. On Ghost models (.is-ghost, set by
   humanizer-ui.js) the head and settings hide; only the Ghost 4.6 word-limit
   warning can still show (.has-hint). */
#page-humanizer.page .sw-adv-card.is-ghost .sw-adv-head,
#page-humanizer.page .sw-adv-card.is-ghost #humanizer-advanced-root { display: none; }
#page-humanizer.page .sw-adv-card.is-ghost .sw-adv-body { display: block; }
#page-humanizer.page .sw-adv-card.is-ghost:not(.has-hint) { display: none; }

/* With nothing under the footer, it becomes the rounded bottom of the card. */
#page-humanizer.page .sw-card-input:has(.sw-adv-card.is-ghost:not(.has-hint)) .sw-card-footer-input {
  border-radius: 0 0 20px 20px;
}

/* ==========================================================================
   Typography like the reference: no title icon, "How to use" right next to
   the title, sentence-case labels, slightly larger readable text.
   ========================================================================== */
#page-humanizer.page .sw-hum-head-icon { display: none; }

#page-humanizer.page .sw-hum-title-row { justify-content: flex-start; }
#page-humanizer.page .sw-hum-title-left { display: block; flex: none; }
#page-humanizer.page .sw-hum-title-left > div { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; }
#page-humanizer.page .sw-hum-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
#page-humanizer.page .sw-hum-subtitle { flex-basis: 100%; margin-top: 8px; font-size: 16px; color: #6e6e73; }

/* "How to use" sits beside the title (it is placed right after the h1). */
#page-humanizer.page .sw-hum-title-left .sw-how-to {
  justify-self: start;
  width: auto;
  height: 36px;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--hx-ink);
  border-radius: 8px;
}

/* Labels: normal case, same size as the controls */
#page-humanizer.page .sw-muted-label,
#page-humanizer.page .sw-model-pill-label {
  min-width: 52px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: #6e6e73;
}

#page-humanizer.page .sw-level-hint { flex-basis: auto; font-size: 15px; color: #6e6e73; }
#page-humanizer.page .hx-model-hint { font-size: 14px; color: #6e6e73; }
#page-humanizer.page .sw-card-toolbar { padding: 20px 28px; gap: 16px; }
#page-humanizer.page .sw-toolbar-left,
#page-humanizer.page .sw-model-toolbar-stack { gap: 14px; }

/* Segmented controls: soft grey track, white selected pill (like the photo) */
#page-humanizer.page .sw-level-pills,
#page-humanizer.page .sw-model-tab-bar { padding: 4px; background: #f0f0f2; border-color: transparent; border-radius: 12px; }

#page-humanizer.page .sw-level-pill { min-width: 36px; height: 34px; font-size: 16px; font-weight: 500; color: #6e6e73; }
#page-humanizer.page .sw-level-pill:hover:not(.sw-level-pill--active) { background: rgba(255, 255, 255, 0.6); }
#page-humanizer.page .sw-level-pill--active { color: #fff; background: var(--hx-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }

#page-humanizer.page .sw-model-pill.sw-model-tab { height: 38px; padding: 0 16px; font-size: 16px; font-weight: 500; color: #8e8e93; }
#page-humanizer.page .sw-model-pill.sw-model-tab:hover { background: rgba(255, 255, 255, 0.6); color: var(--hx-ink); }
/* The selected model stays dark: an older !important rule in styles.css sets it. */

/* Text box + footer text */
#page-humanizer.page .sw-textarea { padding: 24px 28px; font-size: 16px; }
#page-humanizer.page .sw-textarea::placeholder { color: #6e6e73; }
#page-humanizer.page .sw-card-footer-input { padding: 16px 28px; }
#page-humanizer.page .sw-word-count-line { font-size: 15px; color: #6e6e73; }

@media (max-width: 900px) {
  #page-humanizer.page .sw-hum-title { font-size: 26px; }
  #page-humanizer.page .sw-hum-subtitle { font-size: 14.5px; }
  #page-humanizer.page .sw-hum-title-left .sw-how-to { height: 32px; font-size: 13.5px; }
  #page-humanizer.page .sw-card-toolbar { padding: 14px 16px; }
  #page-humanizer.page .sw-muted-label,
  #page-humanizer.page .sw-model-pill-label { font-size: 14px; }
  #page-humanizer.page .sw-level-pill { flex: 1 1 0; min-width: 0; padding: 0; height: 32px; font-size: 14.5px; }
  #page-humanizer.page .sw-model-pill.sw-model-tab { height: 36px; font-size: 14px; }
  #page-humanizer.page .sw-textarea { padding: 16px; font-size: 15px; }
  #page-humanizer.page .sw-card-footer-input { padding: 12px 14px; }
  #page-humanizer.page .sw-word-count-line { font-size: 13.5px; }
}

/* ---------- Desktop topbar: breadcrumb ---------- */
@media (min-width: 901px) {
  .sw-desktop-topbar .sw-topbar-left { gap: 10px; }

  .sw-topbar-trail { display: flex; align-items: center; gap: 4px; }

  .sw-desktop-topbar .sw-topbar-crumb.nav-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 10px;
    color: #6e6e73;
    font-size: 16px;
    font-weight: 400;
    border-radius: 9px;
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .sw-desktop-topbar .sw-topbar-crumb.nav-item svg { color: #8e8e93; transition: color 0.15s ease; }
  .sw-desktop-topbar .sw-topbar-crumb.nav-item:hover { color: #111; background: #f4f4f6; }
  .sw-desktop-topbar .sw-topbar-crumb.nav-item:hover svg { color: #111; }

  .sw-desktop-topbar .sw-topbar-chevron { color: #c2c2c7; flex-shrink: 0; }

  .sw-desktop-topbar .sw-topbar-current {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    color: #111;
    font-size: 16px;
    font-weight: 600;
    border-radius: 9px;
    background: #f4f4f6;
  }

}

/* ---------- Topbar on every page + account menu ---------- */
@media (min-width: 901px) {
  .main-content > .sw-desktop-topbar,
  .main-content:has(#page-humanizer.active) > .sw-desktop-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 76px;
    padding: 0 32px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    color: #111;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid #ececef;
    font-family: "Geist", sans-serif;
  }

  /* Only Dashboard: no chevron / current page pill. */
  .sw-topbar-trail.is-root .sw-topbar-chevron,
  .sw-topbar-trail.is-root .sw-topbar-current { display: none; }
  .sw-desktop-topbar .sw-topbar-trail.is-root .sw-topbar-crumb.nav-item { color: #111; font-weight: 600; background: #f4f4f6; }
  .sw-desktop-topbar .sw-topbar-trail.is-root .sw-topbar-crumb.nav-item svg { color: #111; }

  /* Account trigger */
  .sw-desktop-topbar .sw-topbar-account {
    gap: 4px;
    padding: 5px;
    border: 1px solid transparent;
    border-radius: 14px;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .sw-desktop-topbar .sw-account-menu-trigger { inset: 0 52px 0 0; border-radius: 13px; }
  .sw-desktop-topbar .sw-topbar-account:has(.sw-account-menu-trigger:hover),
  .sw-desktop-topbar .sw-topbar-account:has(.sw-account-menu.is-open) {
    background: #f6f6f8;
    border-color: #ececef;
    border-radius: 14px;
  }
  .sw-desktop-topbar .sw-topbar-avatar {
    width: 40px;
    height: 40px;
    color: #fff;
    border: 0;
    background: linear-gradient(145deg, #3a3a3c 0%, #111 100%);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e4e4e7;
    font-size: 15px;
    font-weight: 600;
  }
  .sw-desktop-topbar .sw-topbar-user-copy { min-width: 0; max-width: 240px; padding: 0 6px 0 10px; }
  .sw-desktop-topbar .sw-topbar-user-copy strong { font-size: 15px; font-weight: 600; color: #111; }
  .sw-desktop-topbar .sw-topbar-user-copy small {
    overflow: hidden;
    color: #6e6e73;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sw-desktop-topbar .sw-topbar-switch { width: 16px; margin-right: 6px; color: #8e8e93; }

  .sw-desktop-topbar .sw-theme-button {
    position: relative;
    z-index: 3;
    width: 38px;
    height: 38px;
    margin-left: 8px;
    color: #3a3a3c;
    border-radius: 10px;
  }
  .sw-desktop-topbar .sw-theme-button::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 9px;
    bottom: 9px;
    width: 1px;
    background: #e4e4e7;
  }

  /* Dropdown */
  .sw-account-menu {
    top: 70px;
    right: 32px;
    width: 300px;
    padding: 6px;
    border: 1px solid #e7e7ea;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -8px rgba(0, 0, 0, 0.16);
    transform-origin: top right;
    cursor: default;
  }
  .sw-account-menu.is-open { animation: sw-menu-in 0.16s ease-out; }
  .sw-account-menu.is-open.from-sidebar { width: 300px; transform-origin: bottom left; }
  @keyframes sw-menu-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: none; }
  }

  .sw-account-menu-profile {
    gap: 12px;
    margin-bottom: 6px;
    padding: 14px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f7f7f9 0%, #f1f1f4 100%);
  }
  .sw-account-menu-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    color: #fff;
    border: 0;
    background: linear-gradient(145deg, #3a3a3c 0%, #111 100%);
    box-shadow: 0 0 0 2px #fff;
    font-size: 16px;
    font-weight: 600;
  }
  .sw-account-menu-copy strong { font-size: 16px; font-weight: 600; color: #111; }
  .sw-account-menu-copy small { font-size: 13px; color: #6e6e73; }
  .sw-account-menu-copy > span,
  #sw-account-menu-plan.is-premium-plan {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-top: 7px;
    padding: 3px 9px;
    color: #3a3a3c;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
  }
  #sw-account-menu-plan.is-premium-plan { color: #fff; border-color: #111; background: #111; }
  #sw-account-menu-plan.is-premium-plan::before {
    content: "";
    width: 11px;
    height: 11px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .sw-account-menu-nav { display: flex; flex-direction: column; gap: 2px; }
  .sw-account-menu .sw-account-menu-item,
  .sw-account-menu .sw-account-menu-item.nav-item {
    min-height: 42px;
    padding: 0 10px;
    gap: 11px;
    color: #1d1d1f;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 14.5px;
    font-weight: 500;
    transition: background 0.12s ease, color 0.12s ease;
  }
  .sw-account-menu .sw-account-menu-item svg {
    width: 30px;
    height: 30px;
    padding: 7px;
    flex: 0 0 30px;
    color: #3a3a3c;
    border-radius: 8px;
    background: #f4f4f6;
    transition: background 0.12s ease, color 0.12s ease;
  }
  .sw-account-menu .sw-account-menu-item:hover,
  .sw-account-menu .sw-account-menu-item.nav-item:hover,
  .sw-account-menu .sw-account-menu-item.nav-item.active { color: #111; background: #f6f6f8; }
  .sw-account-menu .sw-account-menu-item:hover svg,
  .sw-account-menu .sw-account-menu-item.nav-item.active svg { color: #fff; background: #111; }

  .sw-account-menu .sw-account-menu-logout {
    position: relative;
    margin-top: 6px;
    color: #c0362c;
  }
  .sw-account-menu .sw-account-menu-logout::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: -4px;
    height: 1px;
    background: #ececef;
  }
  .sw-account-menu .sw-account-menu-logout svg { color: #c0362c; background: #fdecea; }
  .sw-account-menu .sw-account-menu-logout:hover { color: #a12a21; background: #fdf3f2; }
  .sw-account-menu .sw-account-menu-logout:hover svg { color: #fff; background: #d93a2f; }
}

/* ---------- Sidebar (desktop + phone drawer) ---------- */
.app-container > aside.sidebar {
  background: #fafafa;
  border-right: 1px solid #ececef;
  font-family: "Geist", sans-serif;
}
@media (min-width: 901px) {
  .app-container > aside.sidebar { width: 280px; }
}

/* Logo */
.app-container > aside.sidebar .sidebar-header { min-height: 76px; padding: 18px 18px 6px; border-bottom: 0; }
.app-container > aside.sidebar .sb-logo { gap: 11px; }
.app-container > aside.sidebar .sb-logo-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(145deg, #3a3a3c 0%, #111 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.app-container > aside.sidebar .sb-logo-icon svg { width: 19px; height: 19px; }
.app-container > aside.sidebar .sb-logo-text h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.03em; color: #111; }

/* Section labels */
.app-container > aside.sidebar .nav-section { padding: 6px 12px 0; }
.app-container > aside.sidebar .nav-label {
  padding: 18px 10px 8px;
  color: #8e8e93;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Links */
.app-container > aside.sidebar .nav-item {
  position: relative;
  min-height: 42px;
  margin: 0 0 2px;
  padding: 5px 8px;
  gap: 11px;
  color: #3a3a3c;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-container > aside.sidebar .nav-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: #6e6e73 !important;
  border-radius: 8px;
  background: transparent !important;
  transform: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-container > aside.sidebar .nav-icon svg { width: 18px; height: 18px; }

.app-container > aside.sidebar .nav-item:hover { color: #111; background: #f0f0f2; }
.app-container > aside.sidebar .nav-item:hover .nav-icon { color: #111 !important; }

.app-container > aside.sidebar .nav-item.active,
.app-container > aside.sidebar .nav-item.active:hover {
  color: #111;
  font-weight: 600;
  border-color: #e7e7ea;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px -6px rgba(0, 0, 0, 0.12);
}
.app-container > aside.sidebar .nav-item.active .nav-icon,
.app-container > aside.sidebar .nav-item.active:hover .nav-icon {
  color: #fff !important;
  background: #111 !important;
}

.app-container > aside.sidebar .nav-item:focus-visible { outline: 2px solid #111; outline-offset: 1px; }

/* Support link sits apart, above the profile. */
.app-container > aside.sidebar .sidebar-footer {
  margin: 14px 12px 0;
  padding: 12px 0 0;
  border-top: 1px solid #ececef;
}

/* Profile card */
.app-container > aside.sidebar .user-profile {
  margin: auto 12px 12px;
  min-height: 0;
  padding: 10px 10px 10px 12px;
  gap: 11px;
  border: 1px solid #e7e7ea;
  border-top: 1px solid #e7e7ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.app-container > aside.sidebar .user-profile:hover { background: #f6f6f8; border-color: #e0e0e4; }
.app-container > aside.sidebar .user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 0;
  background: linear-gradient(145deg, #3a3a3c 0%, #111 100%);
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e4e4e7;
}
.app-container > aside.sidebar .user-avatar-letter { color: #fff; font-size: 15px; font-weight: 600; }
.app-container > aside.sidebar .user-info { min-width: 0; }
.app-container > aside.sidebar .user-name {
  overflow: hidden;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-container > aside.sidebar .user-plan { margin-top: 3px; font-size: 12px; }
.app-container > aside.sidebar #sidebar-plan-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 2px 8px;
  color: #3a3a3c;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  font-size: 11.5px;
  font-weight: 600;
}
.app-container > aside.sidebar #sidebar-plan-status.is-premium-plan { color: #fff; border-color: #111; background: #111; }
.app-container > aside.sidebar #sidebar-plan-status.is-premium-plan::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.app-container > aside.sidebar .sb-account-chevron { width: 26px; height: 30px; color: #8e8e93; border-radius: 8px; }
.app-container > aside.sidebar .user-profile:hover .sb-account-chevron { color: #111; }

/* Desktop: the account menu opened from the sidebar sits above the profile card. */
@media (min-width: 901px) {
  .sw-account-menu.is-open.from-sidebar { left: 12px; bottom: 80px; width: 256px; }
}

/* Hover must not wash out the selected engine / tone / purpose button:
   the plain :hover rule above outranks the selected rule, which left white
   text on a light background. Selected stays dark; others get dark text. */
#page-humanizer.page .humaniser-seg-btn:not(.humaniser-seg-btn--active):hover,
#page-humanizer.page .humaniser-chip:not(.humaniser-chip--selected):hover {
  color: var(--hx-ink);
  background: var(--hx-soft);
}
#page-humanizer.page .humaniser-seg-btn.humaniser-seg-btn--active,
#page-humanizer.page .humaniser-seg-btn.humaniser-seg-btn--active:hover,
#page-humanizer.page .humaniser-chip.humaniser-chip--selected,
#page-humanizer.page .humaniser-chip.humaniser-chip--selected:hover {
  color: #fff;
  background: var(--hx-ink);
  border-color: var(--hx-ink);
}
#page-humanizer.page .humaniser-seg-btn--active .humaniser-seg-icon { color: #fff; opacity: 1; }

/* ---------- Page header: never wider than the screen ---------- */
/* The title block was flex: none, so it sized to its full one-line width
   (565px) and pushed the subtitle off small screens. */
#page-humanizer.page .sw-hum-title-row { min-width: 0; }
#page-humanizer.page .sw-hum-title-left { flex: 1 1 auto; width: 100%; min-width: 0; }
#page-humanizer.page .sw-hum-subtitle { max-width: none; overflow-wrap: anywhere; }
#page-humanizer.page .sw-humanized-text { overflow-wrap: anywhere; }
#page-humanizer.page #humanizer-input { max-width: 100%; }

/* ---------- Phone: sidebar drawer + account menu ---------- */
@media (max-width: 900px) {
  /* The top bar already shows the logo; don't repeat it in the drawer. */
  .app-container > aside.sidebar .sidebar-header { display: none; }
  .app-container > aside.sidebar .nav-section:first-of-type .nav-label { padding-top: 14px; }
  .app-container > aside.sidebar { border-right: 1px solid #ececef; box-shadow: 12px 0 32px rgba(0, 0, 0, 0.12); }

  .sw-account-menu {
    left: 12px;
    right: auto;
    top: auto;
    bottom: 88px;
    width: min(300px, calc(88vw - 24px));
    padding: 6px;
    border: 1px solid #e7e7ea;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px -8px rgba(0, 0, 0, 0.2);
  }
  .sw-account-menu.is-open { animation: sw-menu-up 0.16s ease-out; }
  @keyframes sw-menu-up {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }

  .sw-account-menu-profile {
    gap: 11px;
    margin-bottom: 6px;
    padding: 12px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f7f7f9 0%, #f1f1f4 100%);
  }
  .sw-account-menu-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    color: #fff;
    border: 0;
    background: linear-gradient(145deg, #3a3a3c 0%, #111 100%);
    box-shadow: 0 0 0 2px #fff;
    font-size: 15px;
    font-weight: 600;
  }
  .sw-account-menu-copy strong { font-size: 15px; font-weight: 600; color: #111; }
  .sw-account-menu-copy small { font-size: 12.5px; color: #6e6e73; }
  .sw-account-menu-copy > span,
  #sw-account-menu-plan.is-premium-plan {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-top: 6px;
    padding: 2px 9px;
    color: #3a3a3c;
    border: 1px solid #e4e4e7;
    border-radius: 999px;
    background: #fff;
    font-size: 11.5px;
    font-weight: 600;
  }
  #sw-account-menu-plan.is-premium-plan { color: #fff; border-color: #111; background: #111; }
  #sw-account-menu-plan.is-premium-plan::before {
    content: "";
    width: 10px;
    height: 10px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .sw-account-menu-nav { display: flex; flex-direction: column; gap: 2px; }
  .sw-account-menu .sw-account-menu-item,
  .sw-account-menu .sw-account-menu-item.nav-item,
  .sw-account-menu .sw-account-menu-item.nav-item.active {
    min-height: 44px;
    padding: 0 10px;
    gap: 11px;
    color: #1d1d1f;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    font-size: 15px;
    font-weight: 500;
  }
  .sw-account-menu .sw-account-menu-item svg {
    width: 30px;
    height: 30px;
    padding: 7px;
    flex: 0 0 30px;
    color: #3a3a3c;
    border-radius: 8px;
    background: #f4f4f6;
  }
  .sw-account-menu .sw-account-menu-item:active { background: #f6f6f8; }

  .sw-account-menu .sw-account-menu-logout { position: relative; margin-top: 6px; color: #c0362c; }
  .sw-account-menu .sw-account-menu-logout::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: -4px;
    height: 1px;
    background: #ececef;
  }
  .sw-account-menu .sw-account-menu-logout svg { color: #c0362c; background: #fdecea; }
}

/* Announcement bar (phones): one line with "…" instead of wrapping into
   three lines that the bar's fixed height cuts off. */
.sw-announcement .sw-announcement-inner { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.sw-announcement .sw-ann-badge { flex-shrink: 0; white-space: nowrap; }
.sw-announcement .sw-announcement-text {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* The page is a full-height flex column, so the bar (overflow: hidden) was
   being squeezed and its top cut off. Keep its natural height. */
.sw-announcement,
.mobile-navbar { flex-shrink: 0; }

/* ---------- Sidebar v2: calmer links, dark pill for the open page ---------- */
.app-container > aside.sidebar .nav-section { padding: 4px 12px 0; }
.app-container > aside.sidebar .nav-label { padding: 20px 12px 8px; font-size: 11px; color: #9a9aa0; }

.app-container > aside.sidebar .nav-item {
  min-height: 42px;
  margin: 0 0 2px;
  padding: 0 12px;
  gap: 12px;
  color: #4a4a4f;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.app-container > aside.sidebar .nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 0;
  color: #8a8a90 !important;
}
.app-container > aside.sidebar .nav-icon svg { width: 19px; height: 19px; stroke-width: 1.9; }

.app-container > aside.sidebar .nav-item:hover { color: #111; background: #efeff2; }
.app-container > aside.sidebar .nav-item:hover .nav-icon { color: #111 !important; }

.app-container > aside.sidebar .nav-item.active,
.app-container > aside.sidebar .nav-item.active:hover {
  color: #fff;
  font-weight: 600;
  border: 0;
  background: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16), 0 6px 16px -8px rgba(0, 0, 0, 0.45);
}
.app-container > aside.sidebar .nav-item.active .nav-icon,
.app-container > aside.sidebar .nav-item.active:hover .nav-icon {
  color: #fff !important;
  background: transparent !important;
}

/* Support gets a "Help" heading like the other groups, not a divider. */
.app-container > aside.sidebar .sidebar-footer { margin: 0; padding: 4px 12px 0; border-top: 0; }

.app-container > aside.sidebar .user-profile { margin: auto 12px 12px; background: #fff; }

/* Phones: model options stacked one per row (not a 2x2 grid). */
@media (max-width: 900px) {
  #page-humanizer.page .sw-model-tab-bar { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  #page-humanizer.page .sw-model-pill.sw-model-tab { height: 42px; }
}

/* ---------- Humanize loader (same as stealthwriter.ai) ----------
   A soft ping wave behind a tinted circle, a pulsing brain icon, the two
   lines of copy and three bouncing dots. */
#page-humanizer.page .sw-humanize-loading {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
  padding: 80px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--hx-line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#page-humanizer.page .sw-humanize-loading-mark {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0;
  display: grid;
  place-items: center;
}
#page-humanizer.page .sw-humanize-loading-mark::before,
#page-humanizer.page .sw-humanize-loading-mark::after { display: none; }

#page-humanizer.page .sw-humanize-loading-ring {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
}
#page-humanizer.page .sw-humanize-loading-ring--outer {
  background: rgba(23, 23, 23, 0.2);
  animation: hx-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
#page-humanizer.page .sw-humanize-loading-ring--inner {
  inset: 0;
  background: rgba(23, 23, 23, 0.1);
  animation: none;
}

#page-humanizer.page .sw-humanize-loading-brain {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  color: #0a0a0a;
  filter: none;
  animation: hx-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#page-humanizer.page .sw-humanize-loading-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; color: #0a0a0a; }
#page-humanizer.page .sw-humanize-loading-copy { margin: -14px 0 0; font-size: 14px; line-height: 20px; color: #737373; }

#page-humanizer.page .sw-humanize-loading-dots { display: flex; gap: 6px; margin: 0; }
#page-humanizer.page .sw-humanize-loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.6);
  animation: hx-bounce 1s infinite;
}
#page-humanizer.page .sw-humanize-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
#page-humanizer.page .sw-humanize-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes hx-ping { 75%, 100% { transform: scale(2); opacity: 0; } }
@keyframes hx-pulse { 50% { opacity: 0.5; } }
@keyframes hx-bounce {
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: none; animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* ---------- Detection Score: scanning state + reveal ----------
   While the result is being scanned the card shows a spinner and
   "Scanning text…" (humanizer-ui.js adds .is-scanning); the score then
   fades in and the ring fills (main.js animates the ring and number). */
#page-humanizer.page #humaniser-score-comparison[aria-hidden="false"] { animation: hx-fade-in 0.3s ease-out; }
@keyframes hx-fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #page-humanizer.page .sw-humanize-loading-ring--outer,
  #page-humanizer.page .sw-humanize-loading-brain,
  #page-humanizer.page .sw-humanize-loading-dots span { animation: none; }
}

/* ---------- Detection Score: scanning progress ----------
   Shown while the result (or "Check for AI") is being scanned; built and
   driven by humanizer-ui.js. */
#page-humanizer.page .sw-score-empty.is-scanning { display: none !important; }

#page-humanizer.page .hx-scan {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 20px 22px;
  text-align: center;
  animation: hx-fade-in 0.25s ease-out;
}
#page-humanizer.page .hx-scan.is-active { display: flex; }

#page-humanizer.page .hx-scan-mark {
  position: relative;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
}
#page-humanizer.page .hx-scan-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(17, 17, 17, 0) 0deg, rgba(17, 17, 17, 0.85) 300deg, rgba(17, 17, 17, 0) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: hx-spin 1.1s linear infinite;
}
#page-humanizer.page .hx-scan-mark > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: #111;
  border-radius: 50%;
  background: #f4f4f6;
}
#page-humanizer.page .hx-scan-mark svg { animation: hx-pulse 1.6s ease-in-out infinite; }

#page-humanizer.page .hx-scan-title { margin: 0; font-size: 14.5px; font-weight: 600; color: #111; }
#page-humanizer.page .hx-scan-step { margin: -10px 0 0; min-height: 18px; font-size: 12.5px; color: #8e8e93; }

#page-humanizer.page .hx-scan-progress { width: 100%; }
#page-humanizer.page .hx-scan-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: #8e8e93;
}
#page-humanizer.page .hx-scan-row strong { color: #111; font-weight: 600; font-variant-numeric: tabular-nums; }
#page-humanizer.page .hx-scan-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f0f2;
}
#page-humanizer.page .hx-scan-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #3a3a3c, #111);
  transition: width 0.35s ease-out;
}
#page-humanizer.page .hx-scan-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: hx-shine 1.3s ease-in-out infinite;
}
@keyframes hx-shine { to { transform: translateX(100%); } }

#page-humanizer.page .hx-scan-steps { display: flex; justify-content: center; gap: 6px; }
#page-humanizer.page .hx-scan-steps i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e2e2e6;
  transition: background 0.2s ease, width 0.2s ease;
}
#page-humanizer.page .hx-scan-steps i.is-done { background: #8e8e93; }
#page-humanizer.page .hx-scan-steps i.is-now { width: 16px; border-radius: 999px; background: #111; }

@media (prefers-reduced-motion: reduce) {
  #page-humanizer.page .hx-scan-mark::before,
  #page-humanizer.page .hx-scan-mark svg,
  #page-humanizer.page .hx-scan-fill::after { animation: none; }
}
#page-humanizer.page .sw-detection-card:has(.hx-scan.is-active) #humaniser-score-comparison { display: none !important; }
#page-humanizer.page .hx-scan-fill { transition: width 0.12s linear; }
