:root {
  --bg: #0f1412;
  --fg: #e8f0ea;
  --muted: #7a9084;
  --accent: #c4f56e;
  --accent-dim: rgba(196, 245, 110, 0.12);
  --border: rgba(232, 240, 234, 0.1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  /* Единая поверхность для карточек и панелей */
  --surface: linear-gradient(152deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0.02) 100%);
  --surface-glass: rgba(255, 255, 255, 0.04);
  --surface-raised: linear-gradient(152deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.025) 100%);
  --field-bg: rgba(15, 20, 18, 0.55);
  --field-bg-strong: rgba(15, 20, 18, 0.72);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  direction: ltr;
}

html,
body {
  height: 100%;
  margin: 0;
}

input,
textarea,
select {
  direction: ltr;
  /* plaintext ломал порядок ввода/каретку в части браузеров и полей */
  unicode-bidi: normal;
  text-align: left;
}

body {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  background: radial-gradient(1200px 800px at 10% -10%, #1a2a22 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #152018 0%, transparent 50%), var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.top {
  width: min(720px, 100%);
  margin-bottom: 1.5rem;
  text-align: left;
}

.top-app {
  margin-bottom: 1rem;
}

.top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.user-label {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-small {
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
}

.auth-screen {
  width: min(440px, 100%);
  margin: 12vh auto 2rem;
  padding: 0 1rem;
}

.auth-logo {
  margin-top: 0;
}

.auth-lead {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.auth-lead-sub {
  margin-top: -0.25rem;
  margin-bottom: 1rem;
  font-size: 0.78rem;
  opacity: 0.95;
}

.auth-error {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: #f0a8a8;
}

.auth-input {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.85rem;
}

.auth-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.app-workspace {
  width: 100%;
  max-width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.profile-panel {
  margin-bottom: 1.25rem;
}

.funnel-step-panel {
  margin-bottom: 0.75rem;
}

.profile-panel-lead {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.profile-summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  list-style: none;
}

.profile-summary::-webkit-details-marker {
  display: none;
}

.profile-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45em;
  transition: transform 0.15s ease;
}

.profile-panel[open] .profile-summary::before {
  transform: rotate(90deg);
}

.profile-mount {
  margin-top: 0.75rem;
}

.profile-block-title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-block-sub {
  margin: 0.65rem 0 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-artist-block {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 560px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-field-wide {
  grid-column: 1 / -1;
}

.profile-themes-title {
  border-top: none;
  padding-top: 0.5rem;
}

.profile-comp-row {
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
}

.pt-row {
  margin-bottom: 0.65rem;
  padding: 0.65rem 0.75rem;
}

.btn-margin {
  margin: 0.5rem 0 0.75rem;
}

.logo {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--fg);
}

.tag {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.artist-block {
  width: min(720px, 100%);
  margin-bottom: 1.25rem;
}

.artist-heading {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.funnel-step-lead {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.cabinet-block {
  margin-top: 1rem;
}

.quick-add {
  margin-top: 0.75rem;
}

.quick-add-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.quick-add-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.artist-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 520px) {
  .artist-row {
    grid-template-columns: 1fr;
  }
}

.artist-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.artist-card:hover {
  border-color: rgba(196, 245, 110, 0.25);
  background: var(--surface-raised);
}

.artist-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.artist-card.is-active {
  border-color: rgba(196, 245, 110, 0.45);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(196, 245, 110, 0.12);
}

.artist-name {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.artist-vibe {
  font-size: 0.78rem;
  color: var(--muted);
}

.artist-card.is-active .artist-vibe {
  color: rgba(232, 240, 234, 0.75);
}

.funnel-block {
  width: min(720px, 100%);
  margin-bottom: 1.25rem;
}

.funnel-block.is-hidden,
.is-hidden {
  display: none !important;
}

.funnel-hint {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.4em;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 520px) {
  .choice-row {
    grid-template-columns: 1fr;
  }
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.choice-card:hover {
  border-color: rgba(196, 245, 110, 0.22);
  background: var(--surface-raised);
}

.choice-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-card.is-active {
  border-color: rgba(196, 245, 110, 0.45);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(196, 245, 110, 0.12);
}

.choice-title {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.choice-line {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.choice-card.is-active .choice-line {
  color: rgba(232, 240, 234, 0.72);
}

.meaning-lead {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.meaning-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .meaning-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.meaning-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.meaning-card:hover {
  border-color: rgba(196, 245, 110, 0.2);
  background: var(--surface-raised);
}

.meaning-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.meaning-card.is-active {
  border-color: rgba(196, 245, 110, 0.42);
  background: var(--accent-dim);
}

.meaning-label {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--fg);
}

.meaning-blurb {
  font-size: 0.68rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meaning-card.is-active .meaning-blurb {
  color: rgba(122, 144, 132, 0.95);
}

.path-panel {
  width: min(720px, 100%);
  margin-bottom: 0.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.path-order-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.path-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.path-actions-top {
  margin: 0 0 0.65rem;
}

.path-intro-label {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.path-crumb {
  color: var(--fg);
  font-weight: 500;
}

.path-sep {
  color: var(--muted);
  font-size: 0.75rem;
}

.path-intro {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.section-sub {
  margin: 1.35rem 0 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.revision-hint {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.revision-comment {
  min-height: 100px;
}

.prompt-label {
  display: block;
  margin: 0.85rem 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt-label:first-of-type {
  margin-top: 0.25rem;
}

.prompt-edit {
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 180px;
  outline: none;
  caret-color: var(--accent);
}

.prompt-edit:focus {
  border-color: rgba(196, 245, 110, 0.35);
  box-shadow: 0 0 0 1px rgba(196, 245, 110, 0.08);
}

.prompt-result {
  min-height: 220px;
  background: var(--field-bg-strong);
}

.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.75rem;
  margin-bottom: 0.15rem;
}

.api-inline-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.prompt-actions .btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  border-color: rgba(196, 245, 110, 0.35);
  background: var(--accent-dim);
}

.btn:active {
  transform: translateY(1px);
}

.app-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: min(720px, 100%);
  margin-bottom: 1rem;
}

.tab-btn {
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  border-color: rgba(196, 245, 110, 0.28);
  color: var(--fg);
}

.tab-btn-active {
  border-color: rgba(196, 245, 110, 0.45);
  background: var(--accent-dim);
  color: var(--fg);
}

.app-tab-panel {
  width: 100%;
  max-width: min(720px, 100%);
}

.ref-studio-title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.ref-studio-lead {
  margin-top: 0;
}

.ref-questions-block {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
}

.ref-questions-list {
  margin: 0.35rem 0 0.75rem 1.25rem;
  padding: 0;
  color: var(--fg);
  font-size: 0.88rem;
  line-height: 1.55;
}

.ref-questions-list li {
  margin-bottom: 0.35rem;
}

.ref-studio-note {
  margin: 0.25rem 0 0.85rem;
  font-size: 0.78rem;
}

.ref-funnel-artist-row {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
}

.ref-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--fg);
}

.ref-checkbox-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.ref-funnel-artist-hint {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.ref-req-mark {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.ref-knowledge-area {
  min-height: 6rem;
}

.ref-essence-field {
  min-height: 5.5rem;
}

.ref-essence-field::placeholder {
  color: var(--muted);
  opacity: 0.92;
}

.ref-revision-comment {
  min-height: 5.5rem;
}

.ref-opt-label {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.88em;
}

.ref-studio-details {
  margin-top: 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  overflow: hidden;
}

.ref-studio-details[open] {
  padding-bottom: 0.35rem;
}

.ref-studio-details-body {
  padding: 0 1rem 0.85rem;
}

.ref-studio-details-lead {
  margin-top: 0.25rem;
}

.ref-structure-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0.4rem 0 0.65rem;
  max-width: 22rem;
}

.ref-structure-slots .ref-structure-select {
  width: 100%;
}

.ref-structure-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.85rem;
}

.ref-quick-actions {
  margin-bottom: 0.35rem;
}

.foot {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  width: min(720px, 100%);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
  opacity: 0.88;
}

.foot code {
  font-size: 0.85em;
  color: var(--accent);
  background: rgba(196, 245, 110, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.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;
}

.lyrics-breakdown {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
}

.lyrics-breakdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0.6rem 0 0.75rem;
}

.lyrics-lines-mount {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lyrics-section-h {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.25rem 0 0;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}

.lyrics-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

@media (max-width: 560px) {
  .lyrics-pair {
    grid-template-columns: 1fr;
  }
}

.lyrics-line-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  min-height: 2.75rem;
}

.lyrics-line-card.is-liked {
  border-color: rgba(196, 245, 110, 0.45);
  background: var(--accent-dim);
}

.lyrics-line-text {
  flex: 1;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

button.lyrics-like {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

button.lyrics-like:hover {
  color: var(--accent);
  border-color: rgba(196, 245, 110, 0.35);
}

button.lyrics-like.is-active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(196, 245, 110, 0.5);
}

.lyrics-spacer {
  height: 4px;
}

.ref-lyrics-breakdown .ref-line-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
}

.ref-lyrics-breakdown .ref-line-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ref-line-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ref-line-marks-label {
  font-size: 0.68rem;
  color: var(--muted);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

button.ref-mark-btn {
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1;
  min-width: 2.35rem;
  min-height: 2.35rem;
  padding: 0.2rem 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg-strong);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

button.ref-mark-btn:hover {
  border-color: rgba(196, 245, 110, 0.3);
  color: var(--fg);
}

button.ref-mark-btn.is-active {
  border-color: rgba(196, 245, 110, 0.55);
  background: var(--accent-dim);
  color: var(--accent);
}

.ref-track-output {
  margin-top: 0.5rem;
}

.ref-track-output-hint {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.78rem;
}

.ref-track-output--has-text .ref-track-output-hint {
  opacity: 0.85;
}

.ref-lyrics-main.ref-lyrics-breakdown:not(.is-hidden) {
  margin-bottom: 1rem;
  border-color: rgba(196, 245, 110, 0.22);
  box-shadow: 0 0 0 1px rgba(196, 245, 110, 0.06);
}

.ref-result-raw-details {
  margin-top: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
  overflow: hidden;
}

.ref-result-raw-details[open] {
  padding-bottom: 0.5rem;
}

.ref-result-raw-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
  user-select: none;
}

.ref-result-raw-summary::-webkit-details-marker {
  display: none;
}

.ref-result-raw-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45em;
  transition: transform 0.15s ease;
  color: var(--accent);
}

.ref-result-raw-details[open] .ref-result-raw-summary::before {
  transform: rotate(90deg);
}

.ref-result-textarea-wrap {
  margin: 0 0.75rem 0.65rem;
}

.ref-result-textarea-wrap .ref-result-textarea {
  display: block;
  margin: 0 0 0.45rem;
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
}

.ref-result-placeholder-hint {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 40rem;
}

.ref-result-placeholder-hint[hidden] {
  display: none !important;
}

/* Глобальный индикатор: запрос к API (все вкладки) */
.tw-global-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10000;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
  background: transparent;
}

.tw-global-progress.is-visible {
  opacity: 1;
}

.tw-global-progress::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--accent);
  animation: tw-global-progress-slide 1.1s ease-in-out infinite;
}

@keyframes tw-global-progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

textarea.tw-result-updated-flash {
  animation: tw-result-flash 1.2s ease-out 1;
}

@keyframes tw-result-flash {
  0%,
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
  35% {
    box-shadow: 0 0 0 2px var(--accent);
  }
}

.tw-track-title-input {
  max-width: 28rem;
  margin-bottom: 0.65rem;
}

.tw-text-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0.35rem 0 0.5rem;
}

.tw-text-stats {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.tw-versions-details {
  margin-top: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-glass);
}

.tw-versions-summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  list-style: none;
}

.tw-versions-summary::-webkit-details-marker {
  display: none;
}

.tw-versions-hint {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.8rem;
}

.tw-funnel-variants-details {
  margin-top: 0.85rem;
}

.tw-funnel-variants-mount {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tw-variant-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.45rem 0.55rem;
  background: var(--surface-glass);
}

.tw-variant-card > summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tw-variant-card > summary::-webkit-details-marker {
  display: none;
}

.tw-variant-card-body {
  margin-top: 0.4rem;
  padding: 0.45rem 0.35rem;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 20rem;
  overflow: auto;
  border-radius: 6px;
  background: var(--surface, rgba(0, 0, 0, 0.04));
}

.tw-variant-card-actions {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.tw-versions-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tw-version-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.tw-version-item:first-child {
  border-top: none;
}

.tw-version-meta {
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.tw-retry-row {
  margin-bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.tw-retry-row.is-hidden {
  display: none !important;
}

.tw-retry-hint {
  margin: 0;
  font-size: 0.78rem;
  max-width: 36rem;
}
